[GRASS-SVN] r67644 - in grass/trunk/gui/wxpython: core modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Jan 23 11:26:53 PST 2016


Author: annakrat
Date: 2016-01-23 11:26:53 -0800 (Sat, 23 Jan 2016)
New Revision: 67644

Modified:
   grass/trunk/gui/wxpython/core/gconsole.py
   grass/trunk/gui/wxpython/modules/import_export.py
Log:
wxGUI: fix adding layers to tree in import dialog (#2860)

Modified: grass/trunk/gui/wxpython/core/gconsole.py
===================================================================
--- grass/trunk/gui/wxpython/core/gconsole.py	2016-01-23 18:10:26 UTC (rev 67643)
+++ grass/trunk/gui/wxpython/core/gconsole.py	2016-01-23 19:26:53 UTC (rev 67644)
@@ -116,7 +116,7 @@
         os.environ['GRASS_MESSAGE_FORMAT'] = 'gui'
         while True:
             requestId, args, kwds = self.requestQ.get()
-            for key in ('callable', 'onDone', 'onPrepare', 'userData', 'notification'):
+            for key in ('callable', 'onDone', 'onPrepare', 'userData', 'addLayer', 'notification'):
                 if key in kwds:
                     vars()[key] = kwds[key]
                     del kwds[key]
@@ -202,6 +202,7 @@
                                   pid=requestId,
                                   onDone=vars()['onDone'],
                                   userData=vars()['userData'],
+                                  addLayer=vars()['addLayer'],
                                   notification=vars()['notification'])
 
                 # send event
@@ -424,7 +425,8 @@
         self.writeError.emit(text=text)
 
     def RunCmd(self, command, compReg=True, skipInterface=False,
-               onDone=None, onPrepare=None, userData=None, notification=Notification.MAKE_VISIBLE):
+               onDone=None, onPrepare=None, userData=None, addLayer=None,
+               notification=Notification.MAKE_VISIBLE):
         """Run command typed into console command prompt (GPrompt).
 
         .. todo::
@@ -445,6 +447,7 @@
                                    given
         :param onDone: function to be called when command is finished
         :param onPrepare: function to be called before command is launched
+        :param addLayer: to be passed in the mapCreated signal
         :param userData: data defined for the command
         """
         if len(command) == 0:
@@ -531,7 +534,7 @@
                                       stdout=self.cmdStdOut,
                                       stderr=self.cmdStdErr,
                                       onDone=onDone, onPrepare=onPrepare,
-                                      userData=userData,
+                                      userData=userData, addLayer=addLayer,
                                       env=os.environ.copy(),
                                       notification=notification)
                 self.cmdOutputTimer.Start(50)
@@ -583,7 +586,7 @@
                                       stdout=self.cmdStdOut,
                                       stderr=self.cmdStdErr,
                                       onDone=onDone, onPrepare=onPrepare,
-                                      userData=userData,
+                                      userData=userData, addLayer=addLayer,
                                       notification=notification)
             self.cmdOutputTimer.Start(50)
 
@@ -689,7 +692,7 @@
                         if '@' not in lname:
                             lname += '@' + grass.gisenv()['MAPSET']
                         if grass.find_file(lname, element=p.get('element'))['fullname']:
-                            self.mapCreated.emit(name=lname, ltype=prompt)
+                            self.mapCreated.emit(name=lname, ltype=prompt, add=event.addLayer)
         if name == 'r.mask':
             self.updateMap.emit()
         

Modified: grass/trunk/gui/wxpython/modules/import_export.py
===================================================================
--- grass/trunk/gui/wxpython/modules/import_export.py	2016-01-23 18:10:26 UTC (rev 67643)
+++ grass/trunk/gui/wxpython/modules/import_export.py	2016-01-23 19:26:53 UTC (rev 67644)
@@ -411,7 +411,7 @@
                 cmd.append('--overwrite')
             
             # run in Layer Manager
-            self._giface.RunCmd(cmd, onDone = self.OnCmdDone, userData = userData)
+            self._giface.RunCmd(cmd, onDone=self.OnCmdDone, userData=userData, addLayer=False)
 
     def OnCmdDone(self, event):
         """Load layers and close if required"""



More information about the grass-commit mailing list