-
Notifications
You must be signed in to change notification settings - Fork 0
/
m_toolset.py
58 lines (44 loc) · 1.21 KB
/
m_toolset.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from ij.plugin.tool import MacroToolRunner
from ij.plugin import MacroInstaller
from ij.gui import GenericDialog
class MyActionToolOptions(MacroToolRunner):
minSize = 6
name = "my options Action Tool"
icon = "C000T4b12o"
def getToolName(self):
return self.name
def getToolIcon(self):
return self.icon
def runMacroTool(self, name):
self.showOptionsDialog()
def showOptionsDialog(self):
gd = GenericDialog("my cool tool options")
gd.addNumericField("min. size: ", self.minSize)
gd.showDialog()
if gd.wasCanceled():
return None
self.minSize = gd.getNextNumber()
def myAction():
print("myAction exceuted")
class MyActionTool(MacroToolRunner):
minSize = 6
name = "my cool Action Tool"
icon = "C000T4b12a"
def getToolName(self):
return self.name
def getToolIcon(self):
return self.icon
def runMacroTool(self, name):
myAction()
def showOptionsDialog(self):
gd = GenericDialog("my cool tool options")
gd.addNumericField("min. size: ", self.minSize)
gd.showDialog()
if gd.wasCanceled():
return None
self.minSize = gd.getNextNumber()
macroInstaller = MacroInstaller()
options = MyActionToolOptions(macroInstaller)
options.run("")
tool = MyActionTool(macroInstaller)
tool.run("")