Skip to content

Commit 4028ae4

Browse files
committed
added openMap pane
1 parent 618b816 commit 4028ae4

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import edofro.tutorialomatic.ToM_ui as tomui
2+
import edofro.tutorialomatic.ToM as tom
3+
4+
//opens tutorial map
5+
def sep = File.separator
6+
def userDir = c.userDirectory.path
7+
def mapFileName = "Tutorial Sample.mm"
8+
def pathName = userDir + sep + "doc" + sep + "Tutorial-o-Matic" + sep + mapFileName
9+
def tutMap = tom.getMapFromPath(pathName, false) //usar mapa indicado (pero oculto)
10+
11+
tom.showTutorials( tutMap )
12+
13+
return 'tutorial started'

Tutorial-o-Matic/src/main/groovy/ToM.groovy

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ToM{
3030
groovy : 'ToM_groovy' ,
3131
copyPaste : 'ToM_copy' ,
3232
select : 'ToM_select' ,
33+
openMap : 'ToM_openMap' ,
3334
]
3435

3536
static final exeHowIcons = ['emoji-1F507', 'emoji-2328', 'emoji-1F5B1']
@@ -103,6 +104,9 @@ class ToM{
103104
case styles.select:
104105
addSelectPane(myPanel, tutNode)
105106
break
107+
case styles.openMap:
108+
addOpenMapPane(myPanel, tutNode)
109+
break
106110
default:
107111
ui.informationMessage('node style not defined')
108112
break
@@ -388,6 +392,25 @@ class ToM{
388392
myP.add(buttonPanel, tomui.GBC)
389393
}
390394

395+
def static addOpenMapPane(myP, tutNode){
396+
def sep = File.separator
397+
def nodoMapa = tutNode.children.find{it.text.endsWith('.mm')}
398+
def mapFileName = nodoMapa?.text
399+
def Dir = tutNode.map.file.parent
400+
def pathName = Dir + sep + mapFileName
401+
def enabled = !disableBttn(tutNode)
402+
def msgHtml = tomui.getHtmlFromNote(nodoMapa)?:"Click to open '${mapFileName}'"
403+
def bttnText = "Open map '${mapFileName}'"
404+
def bttnToolTip = "Click to open '${mapFileName}'"
405+
def bttnAction = { e ->
406+
def bttn = e.source
407+
bttn.setEnabled(enabled)
408+
def mapa = getMapFromPath(pathName, true) //usar mapa indicado (pero oculto)
409+
}
410+
def buttonPanel = tomui.getButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false)
411+
myP.add(buttonPanel, tomui.GBC)
412+
}
413+
391414
// end:
392415

393416
// region: Getting map

0 commit comments

Comments
 (0)