@@ -268,23 +268,29 @@ class ToM{
268268 }
269269
270270 def static addGroovyPane (myP , nodoT ){
271- def enabled = ! disableBttn(nodoT)
271+ def parentEnabled = ! disableBttn(nodoT)
272+ def parentReadOnly = isReadOnly(nodoT)
272273 nodoT. children. findAll{n -> WSE . isGroovyNode(n)}. each{nodo ->
274+ def enabled = parentEnabled && ! disableBttn(nodo)
275+ def readOnly = parentReadOnly || isReadOnly(nodo)
273276 def script = WSE . scriptFromNode(nodo)
274277 if (script){
275278 def scrText = script + " \n c.statusInfo = '---- ready ----'" . toString()
276279 def msgHtml = getGroovyHtml(nodo, script)
277- def bttnText = ' Execute'
278- def bttnToolTip = " Click to execute script on selected nodes"
279- def bttnAction = { e ->
280- def bttn = e. source
281- bttn. setEnabled(enabled)
282- c. script(scrText, " groovy" ). executeOn(c. selected)
283- }
284-
285- def buttonPanel = tomui. createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false )
286- buttonPanel. metaClass. pending = false
287- myP. add(buttonPanel, tomui. GBC )
280+ if (readOnly){
281+ myP. add(tomui. createInstructionsPane(msgHtml), tomui. GBC )
282+ } else {
283+ def bttnText = enabled ? ' Execute' : ' Execute 1 time'
284+ def bttnToolTip = " Click to execute script on selected nodes"
285+ def bttnAction = { e ->
286+ def bttn = e. source
287+ bttn. setEnabled(enabled)
288+ c. script(scrText, " groovy" ). executeOn(c. selected)
289+ }
290+ def buttonPanel = tomui. createButtonPanel(msgHtml,bttnText,bttnToolTip, bttnAction, false )
291+ buttonPanel. metaClass. pending = false
292+ myP. add(buttonPanel, tomui. GBC )
293+ }
288294 } else {
289295 def textoHtml = ' <html><body><p>No script encountered in tutorial node</p></body></html>'
290296 myP. add(tomui. createInstructionsPane(textoHtml), tomui. GBC )
@@ -293,7 +299,7 @@ class ToM{
293299 }
294300
295301 def static getGroovyHtml (nodo , script ){
296- def showScript = nodo. icons. icons. contains(' emoji-1F50D' )
302+ def showScript = nodo. icons. icons. contains(' emoji-1F50D' ) || nodo . icons . icons . contains( ' emoji-1F453 ' )
297303 uiMsg(" showScript ${ showScript} " )
298304 def html = showScript? tomui. getHtmlFromGroovyNode(nodo, script) : nodo. text
299305 uiMsg(" html ${ html} " )
@@ -336,6 +342,11 @@ class ToM{
336342 def iconos = nodo. icons. icons
337343 return iconos. contains(' emoji-1F56F' )
338344 }
345+
346+ def static isReadOnly (nodo ){
347+ def iconos = nodo. icons. icons
348+ return iconos. contains(' emoji-1F453' )
349+ }
339350
340351 def static addPastePane (myP , nodoSource ){
341352 def enabled = ! disableBttn(nodoSource)
0 commit comments