Skip to content

Commit

Permalink
Use a single command to open tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
tferr committed Nov 24, 2016
1 parent aec7a3f commit 79069d0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 34 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import os, java.io.File
from ij import IJ
# @Context context
# @String(label="Tutorial", choices={"Python", "BeanShell"}) choice


import os, java.io.File, bar.Utils
from bar import Utils
from org.scijava import Context
from org.scijava.ui.swing.script import TextEditor

# Specify the directory containing the files to be opened
dir = Utils.getSnippetsDir() + "Tutorials" + os.sep

# Specify the extension of the files to be opened
ext = ".bsh"
ext = ".py" if choice == "Python" else ".bsh"

# If directory exists, create a new Script Editor window
# and open each filtered file on a dedicated tab
if Utils.fileExists(dir):
context = IJ.runPlugIn("org.scijava.Context", "")
editor = TextEditor(context)
for (root, dirnames, filenames) in os.walk(dir):
for filename in filenames:
Expand All @@ -24,4 +25,4 @@
# Select first tab, rename editor's window and display it
editor.switchTo(0)
editor.setVisible(True)
editor.setTitle("BAR Tutorial Files" + ext)
editor.setTitle("BAR Tutorial Files" + choice)
27 changes: 0 additions & 27 deletions Snippets/Tutorials/Open_Python_Tutorials.py

This file was deleted.

2 changes: 1 addition & 1 deletion Snippets/Tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ at the [2015 ImageJ User & Developer Conference](http://imagej.net/Conference_20
They can be accessed from ImageJ using `BAR> Snippets> Tutorials`

##See also
Resources listed in [Snippets](https://github.com/tferr/Scripts/tree/master/Snippets#useful-resources)
Resources listed in [Snippets]


| [Home] | [Analysis] | [Data Analysis] | [Annotation] | [Segmentation] | [Tools] | [Plugins][Java Classes] | [lib] | [Snippets] | [IJ] |
Expand Down

0 comments on commit 79069d0

Please sign in to comment.