瀏覽代碼

wxGUI/gmodeler: fix loading models

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49431 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 年之前
父節點
當前提交
9ddda2c55b
共有 3 個文件被更改,包括 14 次插入6 次删除
  1. 2 1
      gui/wxpython/gmodeler/dialogs.py
  2. 11 5
      gui/wxpython/gmodeler/model.py
  3. 1 0
      gui/wxpython/gmodeler/model_file.py

+ 2 - 1
gui/wxpython/gmodeler/dialogs.py

@@ -31,6 +31,7 @@ from core.gcmd            import GError, EncodeString
 from gui_core.dialogs     import ElementDialog, MapLayersDialog
 from gui_core.ghelp       import SearchModuleWindow
 from gui_core.prompt      import GPromptSTC
+from gui_core.forms       import CmdPanel
 
 from grass.script import task as gtask
 
@@ -430,7 +431,7 @@ class ModelParamDialog(wx.Dialog):
         task.flags  = params['flags']
         task.params = params['params']
         
-        panel = menuform.cmdPanel(parent = self, id = wx.ID_ANY, task = task)
+        panel = CmdPanel(parent = self, id = wx.ID_ANY, task = task)
         self.tasks.append(task)
         
         return panel

+ 11 - 5
gui/wxpython/gmodeler/model.py

@@ -25,6 +25,7 @@ import os
 import getpass
 import copy
 import re
+import mimetypes
 try:
     import xml.etree.ElementTree as etree
 except ImportError:
@@ -33,9 +34,13 @@ except ImportError:
 import wx
 from wx.lib import ogl
 
-from core.globalvar   import ETCWXDIR
-from core.gcmd        import GMessage, GException, GError, RunCommand
-from gmodeler.dialogs import ModelParamDialog
+from core.globalvar      import ETCWXDIR
+from core.gcmd           import GMessage, GException, GError, RunCommand
+from gmodeler.dialogs    import ModelParamDialog
+from gmodeler.model_file import ProcessModelFile
+from core.utils          import CmdToTuple
+from core.settings       import UserSettings
+from gui_core.forms      import GUI
 
 from grass.script import core as grass
 from grass.script import task as gtask
@@ -358,7 +363,7 @@ class Model(object):
         for action in self.GetItems(objType = ModelAction):
             cmd = action.GetLog(string = False)
             
-            task = menuform.GUI(show = None).ParseCommand(cmd = cmd)
+            task = GUI(show = None).ParseCommand(cmd = cmd)
             errList += map(lambda x: cmd[0] + ': ' + x, task.get_cmd_error())
             
             # check also variables
@@ -581,9 +586,10 @@ class Model(object):
                 condVar, condText = map(lambda x: x.strip(), re.split('\s*in\s*', cond))
                 pattern = re.compile('%' + condVar)
                 ### for vars()[condVar] in eval(condText): ?
+                vlist = list()
                 if condText[0] == '`' and condText[-1] == '`':
                     # run command
-                    cmd, dcmd = utils.CmdToTuple(condText[1:-1].split(' '))
+                    cmd, dcmd = CmdToTuple(condText[1:-1].split(' '))
                     ret = RunCommand(cmd,
                                      read = True,
                                      **dcmd)

+ 1 - 0
gui/wxpython/gmodeler/model_file.py

@@ -20,6 +20,7 @@ import os
 import time
 import re
 
+from core           import utils
 from gui_core.forms import GUI
 from core.gcmd      import GWarning, EncodeString