瀏覽代碼

wxGUI/modeler: fix oncancel bug

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@41836 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 15 年之前
父節點
當前提交
ebb502512f
共有 2 個文件被更改,包括 14 次插入20 次删除
  1. 14 18
      gui/wxpython/gui_modules/gmodeler.py
  2. 0 2
      gui/wxpython/gui_modules/menuform.py

+ 14 - 18
gui/wxpython/gui_modules/gmodeler.py

@@ -389,6 +389,8 @@ class ModelFrame(wx.Frame):
         # executable file
         # executable file
         os.chmod(filename, stat.S_IRWXU | stat.S_IWUSR)
         os.chmod(filename, stat.S_IRWXU | stat.S_IWUSR)
         
         
+        self.SetStatusText(_("Model exported to <%s>") % filename)
+
     def _writePython(self, fd):
     def _writePython(self, fd):
         """!Write model to file"""
         """!Write model to file"""
         fd.write(
         fd.write(
@@ -558,7 +560,8 @@ if __name__ == "__main__":
         
         
     def GetOptData(self, dcmd, layer, params, propwin):
     def GetOptData(self, dcmd, layer, params, propwin):
         """!Process action data"""
         """!Process action data"""
-        layer.SetProperties(dcmd, params, propwin)
+        if dcmd:
+            layer.SetProperties(dcmd, params, propwin)
         
         
         if params: # add data items
         if params: # add data items
             width, height = self.canvas.GetSize()
             width, height = self.canvas.GetSize()
@@ -1032,23 +1035,16 @@ class ModelEvtHandler(ogl.ShapeEvtHandler):
         """!Show properties dialog"""
         """!Show properties dialog"""
         self.frame.ModelChanged()
         self.frame.ModelChanged()
         shape = self.GetShape()
         shape = self.GetShape()
-        win = shape.GetPropDialog()
-        if not win:
-            if isinstance(shape, ModelAction):
-                module = menuform.GUI().ParseCommand(shape.cmd,
-                                                     completed = (self.frame.GetOptData, shape, None),
-                                                     parentframe = self.frame, show = True)
-            elif isinstance(shape, ModelData):
-                dlg = ModelDataDialog(parent = self.frame, shape = shape)
-                shape.SetPropDialog(dlg)
-                dlg.CentreOnParent()
-                dlg.Show()
-            
-        elif win and not win.IsShown():
-            win.Show()
-        
-        if win:
-            win.Raise()
+        # win = shape.GetPropDialog()
+        if isinstance(shape, ModelAction):
+            module = menuform.GUI().ParseCommand(shape.GetLog(string = False),
+                                                 completed = (self.frame.GetOptData, shape, shape.GetParams()),
+                                                 parentframe = self.frame, show = True)
+        elif isinstance(shape, ModelData):
+            dlg = ModelDataDialog(parent = self.frame, shape = shape)
+            shape.SetPropDialog(dlg)
+            dlg.CentreOnParent()
+            dlg.Show()
         
         
     def OnBeginDragLeft(self, x, y, keys = 0, attachment = 0):
     def OnBeginDragLeft(self, x, y, keys = 0, attachment = 0):
         """!Drag shape"""
         """!Drag shape"""

+ 0 - 2
gui/wxpython/gui_modules/menuform.py

@@ -1014,8 +1014,6 @@ class mainFrame(wx.Frame):
             elif len(self.parent.GetPyData(self.layer)[0]['cmd']) < 1:
             elif len(self.parent.GetPyData(self.layer)[0]['cmd']) < 1:
                 self.parent.Delete(self.layer)
                 self.parent.Delete(self.layer)
                 self.Destroy()
                 self.Destroy()
-        elif self.parent and self.parent.GetName() == 'Modeler':
-            self.Destroy()
         else:
         else:
             # cancel for non-display commands
             # cancel for non-display commands
             self.Destroy()
             self.Destroy()