Преглед изворни кода

wxGUI/modeler: fix contextual menu for ModelComment object - set comments

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@58568 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa пре 11 година
родитељ
комит
ffbaff5681
2 измењених фајлова са 10 додато и 0 уклоњено
  1. 3 0
      gui/wxpython/gmodeler/frame.py
  2. 7 0
      gui/wxpython/gmodeler/model.py

+ 3 - 0
gui/wxpython/gmodeler/frame.py

@@ -1262,9 +1262,12 @@ class ModelEvtHandler(ogl.ShapeEvtHandler):
             else:
             else:
                 popupMenu.Append(self.popupID['enable'], text=_('Enable'))
                 popupMenu.Append(self.popupID['enable'], text=_('Enable'))
                 self.frame.Bind(wx.EVT_MENU, self.OnEnable, id = self.popupID['enable'])
                 self.frame.Bind(wx.EVT_MENU, self.OnEnable, id = self.popupID['enable'])
+        if isinstance(shape, ModelAction) or isinstance(shape, ModelComment):
             popupMenu.AppendSeparator()
             popupMenu.AppendSeparator()
+        if isinstance(shape, ModelAction):
             popupMenu.Append(self.popupID['label'], text=_('Set label'))
             popupMenu.Append(self.popupID['label'], text=_('Set label'))
             self.frame.Bind(wx.EVT_MENU, self.OnSetLabel, id = self.popupID['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'))
             popupMenu.Append(self.popupID['comment'], text=_('Set comment'))
             self.frame.Bind(wx.EVT_MENU, self.OnSetComment, id = self.popupID['comment'])
             self.frame.Bind(wx.EVT_MENU, self.OnSetComment, id = self.popupID['comment'])
 
 

+ 7 - 0
gui/wxpython/gmodeler/model.py

@@ -1666,6 +1666,13 @@ class ModelComment(ModelObject, ogl.RectangleShape):
         self.ClearText()
         self.ClearText()
         self.AddText('(%d) %s' % (idx, label))
         self.AddText('(%d) %s' % (idx, label))
 
 
+    def GetComment(self):
+        return self.GetLabel()
+
+    def SetComment(self, comment):
+        self.SetLabel(comment)
+        self.GetCanvas().Refresh()
+
 class ProcessModelFile:
 class ProcessModelFile:
     """!Process GRASS model file (gxm)"""
     """!Process GRASS model file (gxm)"""
     def __init__(self, tree):
     def __init__(self, tree):