[GRASS-SVN] r58568 - grass/trunk/gui/wxpython/gmodeler

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Dec 31 08:07:37 PST 2013


Author: martinl
Date: 2013-12-31 08:07:37 -0800 (Tue, 31 Dec 2013)
New Revision: 58568

Modified:
   grass/trunk/gui/wxpython/gmodeler/frame.py
   grass/trunk/gui/wxpython/gmodeler/model.py
Log:
wxGUI/modeler: fix contextual menu for ModelComment object - set comments

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2013-12-31 15:44:29 UTC (rev 58567)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2013-12-31 16:07:37 UTC (rev 58568)
@@ -1262,9 +1262,12 @@
             else:
                 popupMenu.Append(self.popupID['enable'], text=_('Enable'))
                 self.frame.Bind(wx.EVT_MENU, self.OnEnable, id = self.popupID['enable'])
+        if isinstance(shape, ModelAction) or isinstance(shape, ModelComment):
             popupMenu.AppendSeparator()
+        if isinstance(shape, ModelAction):
             popupMenu.Append(self.popupID['label'], text=_('Set label'))
             self.frame.Bind(wx.EVT_MENU, self.OnSetLabel, id = self.popupID['label'])
+        if isinstance(shape, ModelAction) or isinstance(shape, ModelComment):
             popupMenu.Append(self.popupID['comment'], text=_('Set comment'))
             self.frame.Bind(wx.EVT_MENU, self.OnSetComment, id = self.popupID['comment'])
 

Modified: grass/trunk/gui/wxpython/gmodeler/model.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/model.py	2013-12-31 15:44:29 UTC (rev 58567)
+++ grass/trunk/gui/wxpython/gmodeler/model.py	2013-12-31 16:07:37 UTC (rev 58568)
@@ -1666,6 +1666,13 @@
         self.ClearText()
         self.AddText('(%d) %s' % (idx, label))
 
+    def GetComment(self):
+        return self.GetLabel()
+
+    def SetComment(self, comment):
+        self.SetLabel(comment)
+        self.GetCanvas().Refresh()
+
 class ProcessModelFile:
     """!Process GRASS model file (gxm)"""
     def __init__(self, tree):



More information about the grass-commit mailing list