[GRASS-SVN] r53985 - in grass/trunk/gui/wxpython: core gcp gmodeler gui_core iclass lmgr mapdisp mapswipe nviz vdigit

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Nov 23 06:21:17 PST 2012


Author: annakrat
Date: 2012-11-23 06:21:17 -0800 (Fri, 23 Nov 2012)
New Revision: 53985

Added:
   grass/trunk/gui/wxpython/core/giface.py
   grass/trunk/gui/wxpython/lmgr/giface.py
Modified:
   grass/trunk/gui/wxpython/gcp/manager.py
   grass/trunk/gui/wxpython/gcp/mapdisplay.py
   grass/trunk/gui/wxpython/gmodeler/frame.py
   grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py
   grass/trunk/gui/wxpython/gmodeler/preferences.py
   grass/trunk/gui/wxpython/gui_core/dialogs.py
   grass/trunk/gui/wxpython/gui_core/mapdisp.py
   grass/trunk/gui/wxpython/gui_core/mapwindow.py
   grass/trunk/gui/wxpython/gui_core/preferences.py
   grass/trunk/gui/wxpython/iclass/digit.py
   grass/trunk/gui/wxpython/iclass/frame.py
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
   grass/trunk/gui/wxpython/mapdisp/frame.py
   grass/trunk/gui/wxpython/mapdisp/mapwindow.py
   grass/trunk/gui/wxpython/mapswipe/frame.py
   grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py
   grass/trunk/gui/wxpython/mapswipe/mapwindow.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
   grass/trunk/gui/wxpython/vdigit/mapwindow.py
Log:
wxGUI: unified grass interface (to be continued) (co-author: wenzeslaus)

Added: grass/trunk/gui/wxpython/core/giface.py
===================================================================
--- grass/trunk/gui/wxpython/core/giface.py	                        (rev 0)
+++ grass/trunk/gui/wxpython/core/giface.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -0,0 +1,61 @@
+"""!
+ at package core.giface
+
+ at brief GRASS interface for standalone application (without layer manager)
+
+Classes:
+ - giface::StandaloneGrassInterface
+
+(C) 2012 by the GRASS Development Team
+
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
+ at author Anna Kratochvilova <kratochanna gmail.com>
+ at author Vaclav Petras <wenzeslaus gmail.com>
+"""
+from core.gcmd import RunCommand
+from core.utils import CmdToTuple
+
+import grass.script as grass
+
+class StandaloneGrassInterface():
+    def RunCmd(self, command,
+               onDone = None, onPrepare = None, userData = None, **kwargs):
+        if onPrepare:
+            onPrepare(userData)
+
+        cmdTuple = CmdToTuple(command)
+        returncode = RunCommand(cmdTuple[0], **cmdTuple[1])
+
+        if onDone:
+            onDone(cmd = command, returncode = returncode)
+
+    def Help(self, entry):
+        RunCommand('g.manual', quiet = True, entry = entry)
+
+    def WriteLog(self, text, wrap = None,
+                 switchPage = False, priority = 1):
+        grass.message(text)
+
+    def WriteCmdLog(self, line, pid = None, switchPage = True):
+        grass.message(text)
+
+    def WriteWarning(self, line):
+        grass.warning(line)
+
+    def WriteError(self, line):
+        grass.error(line)
+
+    def GetLayerTree(self):
+        return None
+
+    def GetMapDisplay(self):
+        """!Get current map display.
+        """
+        return None
+
+    def GetAllMapDisplays(self):
+        """!Get list of all map displays.
+        """
+        return []
\ No newline at end of file


Property changes on: grass/trunk/gui/wxpython/core/giface.py
___________________________________________________________________
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native

Modified: grass/trunk/gui/wxpython/gcp/manager.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/manager.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gcp/manager.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -84,8 +84,9 @@
     Start wizard here and finish wizard here
     """
 
-    def __init__(self, parent):
+    def __init__(self, parent, giface):
         self.parent = parent # GMFrame
+        self._giface = giface
 
         #
         # get environmental variables
@@ -222,9 +223,10 @@
             #
             # start GCP Manager
             #
-            self.gcpmgr = GCP(self.parent, grwiz=self, size=globalvar.MAP_WINDOW_SIZE,
-                                               toolbars=["gcpdisp"],
-                                               Map=self.SrcMap, lmgr=self.parent)
+            self.gcpmgr = GCP(self.parent, giface = self._giface, 
+                              grwiz=self, size=globalvar.MAP_WINDOW_SIZE,
+                              toolbars=["gcpdisp"],
+                              Map=self.SrcMap, lmgr=self.parent)
 
             # load GCPs
             self.gcpmgr.InitMapDisplay()
@@ -778,11 +780,12 @@
     Manages ground control points for georectifying. Calculates RMS statistics.
     Calls i.rectify or v.rectify to georectify map.
     """
-    def __init__(self, parent, grwiz = None, id = wx.ID_ANY,
+    def __init__(self, parent, giface, grwiz = None, id = wx.ID_ANY,
                  title = _("Manage Ground Control Points"),
                  size = (700, 300), toolbars = ["gcpdisp"], Map = None, lmgr = None):
 
         self.grwiz = grwiz # GR Wizard
+        self._giface = giface
 
         if tgt_map['raster'] == '' and tgt_map['vector'] == '':
             self.show_target = False
@@ -790,7 +793,7 @@
             self.show_target = True
         
         #wx.Frame.__init__(self, parent, id, title, size = size, name = "GCPFrame")
-        MapFrame.__init__(self, parent = parent, title = title, size = size,
+        MapFrame.__init__(self, parent = parent, giface = self._giface, title = title, size = size,
                             Map = Map, toolbars = toolbars, lmgr = lmgr, name = 'GCPMapWindow')
 
         #
@@ -1235,7 +1238,7 @@
         # if event != None save also to backup file
         if event:
             shutil.copy(self.file['points'], self.file['points_bak'])
-            self.parent.goutput.WriteLog(_('POINTS file saved for group <%s>') % self.xygroup)
+            self._giface.WriteLog(_('POINTS file saved for group <%s>') % self.xygroup)
             #self.SetStatusText(_('POINTS file saved'))
 
     def ReadGCPs(self):
@@ -1421,8 +1424,7 @@
             # georectify each vector in VREF using v.rectify
             for vect in vectlist:
                 self.outname = str(vect.split('@')[0]) + self.extension
-                print self.outname
-                self.parent.goutput.WriteLog(text = _('Transforming <%s>...') % vect,
+                self._giface.WriteLog(text = _('Transforming <%s>...') % vect,
                                              switchPage = True)
                 ret = msg = ''
                 
@@ -1459,14 +1461,15 @@
             self.VectGRList.append(self.outname)
             print '*****vector list = ' + str(self.VectGRList)
         else:
-            self.parent.goutput.WriteError(_('Georectification of vector map <%s> failed') %
-                                                   self.outname)
+            self._giface.WriteError(_('Georectification of vector map <%s> failed') %
+                                      self.outname)
 
          
     def OnSettings(self, event):
         """!GCP Manager settings"""
-        dlg = GrSettingsDialog(parent=self, id=wx.ID_ANY, title=_('GCP Manager settings'))
-        
+        dlg = GrSettingsDialog(parent=self, giface=self._giface,
+                               id=wx.ID_ANY, title=_('GCP Manager settings'))
+
         if dlg.ShowModal() == wx.ID_OK:
             pass
         
@@ -1745,9 +1748,7 @@
 
     def OnHelp(self, event):
         """!Show GCP Manager manual page"""
-        cmdlist = ['g.manual', 'entry=wxGUI.GCP_Manager']
-        self.parent.goutput.RunCmd(cmdlist, compReg=False,
-                                       switchPage=False)
+        self._giface.Help(entry = 'wxGUI.GCP_Manager')
 
     def OnUpdateActive(self, event):
 
@@ -2341,7 +2342,7 @@
         return valuelist
 
 class GrSettingsDialog(wx.Dialog):
-    def __init__(self, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
+    def __init__(self, parent, id, giface, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
                  style=wx.DEFAULT_DIALOG_STYLE):
         wx.Dialog.__init__(self, parent, id, title, pos, size, style)
         """
@@ -2826,7 +2827,7 @@
         UserSettings.ReadSettingsFile(settings=fileSettings)
         fileSettings['gcpman'] = UserSettings.Get(group='gcpman')
         file = UserSettings.SaveToFile(fileSettings)
-        self.parent.parent.goutput.WriteLog(_('GCP Manager settings saved to file \'%s\'.') % file)
+        self._giface.WriteLog(_('GCP Manager settings saved to file \'%s\'.') % file)
         #self.Close()
 
     def OnApply(self, event):

Modified: grass/trunk/gui/wxpython/gcp/mapdisplay.py
===================================================================
--- grass/trunk/gui/wxpython/gcp/mapdisplay.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gcp/mapdisplay.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -42,7 +42,7 @@
     """!Main frame for map display window. Drawing takes place in
     child double buffered drawing window.
     """
-    def __init__(self, parent=None, title=_("GRASS GIS Manage Ground Control Points"),
+    def __init__(self, parent, giface, title=_("GRASS GIS Manage Ground Control Points"),
                  toolbars=["gcpdisp"], tree=None, notebook=None, lmgr=None,
                  page=None, Map=None, auimgr=None, name = 'GCPMapWindow', **kwargs):
         """!Main map display window with toolbars, statusbar and
@@ -58,13 +58,14 @@
         @param kwargs wx.Frame attribures
         """
         
-        SingleMapFrame.__init__(self, parent = parent, title = title,
+        SingleMapFrame.__init__(self, parent = parent, giface = giface, title = title,
                               Map = Map, auimgr = auimgr, name = name, **kwargs)
         
         self._layerManager = lmgr   # Layer Manager object
         self.tree       = tree      # Layer Manager layer tree object
         self.page       = page      # Notebook page holding the layer tree
         self.layerbook  = notebook  # Layer Manager layer tree notebook
+        self._giface = giface
         #
         # Add toolbars
         #
@@ -113,11 +114,11 @@
         # Init map display (buffered DC & set default cursor)
         #
         self.grwiz.SwitchEnv('source')
-        self.SrcMapWindow = BufferedWindow(self, id=wx.ID_ANY,
+        self.SrcMapWindow = BufferedWindow(parent=self, giface=self._giface, id=wx.ID_ANY,
                                           Map=self.SrcMap, frame = self, tree=self.tree, lmgr=self._layerManager)
 
         self.grwiz.SwitchEnv('target')
-        self.TgtMapWindow = BufferedWindow(self, id=wx.ID_ANY,
+        self.TgtMapWindow = BufferedWindow(parent=self, giface=self._giface, id=wx.ID_ANY,
                                           Map=self.TgtMap, frame = self, tree=self.tree, lmgr=self._layerManager)
         self.MapWindow = self.SrcMapWindow
         self.Map = self.SrcMap

Modified: grass/trunk/gui/wxpython/gmodeler/frame.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/frame.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gmodeler/frame.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -56,7 +56,7 @@
 from grass.script import core as grass
 
 class ModelFrame(wx.Frame):
-    def __init__(self, parent, id = wx.ID_ANY,
+    def __init__(self, parent, giface, id = wx.ID_ANY,
                  title = _("GRASS GIS Graphical Modeler"), **kwargs):
         """!Graphical modeler main window
         
@@ -67,6 +67,7 @@
         @param kwargs wx.Frames' arguments
         """
         self.parent = parent
+        self._giface = giface
         self.searchDialog = None # module search dialog
         self.baseTitle = title
         self.modelFile = None    # loaded model
@@ -275,7 +276,7 @@
         
     def OnPreferences(self, event):
         """!Open preferences dialog"""
-        dlg = PreferencesDialog(parent = self)
+        dlg = PreferencesDialog(parent = self, giface = self._giface)
         dlg.CenterOnParent()
         
         dlg.ShowModal()
@@ -283,15 +284,8 @@
         
     def OnHelp(self, event):
         """!Show help"""
-        if self.parent and self.parent.GetName() == 'LayerManager':
-            log = self.parent.GetLogWindow()
-            log.RunCmd(['g.manual',
-                        'entry=wxGUI.Modeler'])
-        else:
-            RunCommand('g.manual',
-                       quiet = True,
-                       entry = 'wxGUI.Modeler')
-        
+        self._giface.Help(entry = 'wxGUI.Modeler')
+
     def OnModelProperties(self, event):
         """!Model properties dialog"""
         dlg = PropertiesDialog(parent = self)
@@ -715,11 +709,6 @@
             self.SetFocus()
             self.Raise()
 
-    def OnHelp(self, event):
-        """!Display manual page"""
-        grass.run_command('g.manual',
-                          entry = 'wxGUI.Modeler')
-
     def OnAbout(self, event):
         """!Display About window"""
         info = wx.AboutDialogInfo()

Modified: grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gmodeler/g.gui.gmodeler.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -41,6 +41,7 @@
 
 sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
+from core.giface import StandaloneGrassInterface
 from gmodeler.frame import ModelFrame
 
 def main():
@@ -49,7 +50,7 @@
     
     app = wx.PySimpleApp()
     wx.InitAllImageHandlers()
-    frame = ModelFrame(parent = None)
+    frame = ModelFrame(parent = None, giface = StandaloneGrassInterface())
     if options['file']:
         frame.LoadModelFile(options['file'])
     frame.Show()

Modified: grass/trunk/gui/wxpython/gmodeler/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gmodeler/preferences.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gmodeler/preferences.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -24,10 +24,10 @@
 
 class PreferencesDialog(PreferencesBaseDialog):
     """!User preferences dialog"""
-    def __init__(self, parent, settings = UserSettings,
+    def __init__(self, parent, giface, settings = UserSettings,
                  title = _("Modeler settings")):
         
-        PreferencesBaseDialog.__init__(self, parent = parent, title = title,
+        PreferencesBaseDialog.__init__(self, parent = parent, giface = giface, title = title,
                                        settings = settings)
         
         # create notebook pages

Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -1787,13 +1787,14 @@
         pass
 
 class GdalImportDialog(ImportDialog):
-    def __init__(self, parent, ogr = False, link = False):
+    def __init__(self, parent, giface, ogr = False, link = False):
         """!Dialog for bulk import of various raster/vector data
 
         @param parent parent window
         @param ogr True for OGR (vector) otherwise GDAL (raster)
         @param link True for linking data otherwise importing data
         """
+        self._giface = giface
         self.link = link
         self.ogr  = ogr
         
@@ -1899,8 +1900,7 @@
                 cmd.append('--overwrite')
             
             # run in Layer Manager
-            self.parent.goutput.RunCmd(cmd, switchPage = True,
-                                       onDone = self.AddLayers)
+            self._giface.RunCmd(cmd, switchPage = True, onDone = self.AddLayers)
         
         if popOGR:
             os.environ.pop('GRASS_VECTOR_OGR')
@@ -2023,10 +2023,10 @@
         
 class DxfImportDialog(ImportDialog):
     """!Dialog for bulk import of DXF layers""" 
-    def __init__(self, parent):
+    def __init__(self, parent, giface):
         ImportDialog.__init__(self, parent, itype = 'dxf',
                               title = _("Import DXF layers"))
-        
+        self._giface = giface
         self.dsnInput = filebrowse.FileBrowseButton(parent = self.panel, id = wx.ID_ANY, 
                                                     size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
                                                     dialogTitle = _('Choose DXF file to import'),
@@ -2069,8 +2069,7 @@
                 cmd.append('--overwrite')
             
             # run in Layer Manager
-            self.parent.goutput.RunCmd(cmd, switchPage = True,
-                                       onDone = self.AddLayers)
+            self._giface.RunCmd(cmd, switchPage = True, onDone = self.AddLayers)
         
         self.OnCancel()
 

Modified: grass/trunk/gui/wxpython/gui_core/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapdisp.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gui_core/mapdisp.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -381,7 +381,7 @@
     @note To access maps use getters only
     (when using class or when writing class itself).
     """
-    def __init__(self, parent = None, id = wx.ID_ANY, title = None,
+    def __init__(self, parent = None, giface = None, id = wx.ID_ANY, title = None,
                  style = wx.DEFAULT_FRAME_STYLE,
                  Map = None,
                  auimgr = None, name = None, **kwargs):

Modified: grass/trunk/gui/wxpython/gui_core/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapwindow.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gui_core/mapwindow.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -36,13 +36,14 @@
      - Pixel2Cell
      - Cell2Pixel (if it is possible)
     """
-    def __init__(self, parent, Map, frame,
+    def __init__(self, parent, giface, Map, frame,
                  id = wx.ID_ANY, tree = None, lmgr = None, **kwargs):
         self.parent = parent # MapFrame
         self.Map    = Map
         self.frame = frame
         self.tree   = tree
         self.lmgr   = lmgr
+        self._giface = giface
         
         # mouse attributes -- position on the screen, begin and end of
         # dragging, and type of drawing

Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -55,13 +55,14 @@
 
 class PreferencesBaseDialog(wx.Dialog):
     """!Base preferences dialog"""
-    def __init__(self, parent, settings, title = _("User settings"),
+    def __init__(self, parent, giface, settings, title = _("User settings"),
                  size = (500, 475),
                  style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER):
         self.parent = parent # ModelerFrame
         self.title  = title
         self.size   = size
         self.settings = settings
+        self._giface = giface
         
         wx.Dialog.__init__(self, parent = parent, id = wx.ID_ANY, title = title,
                            style = style)
@@ -148,7 +149,7 @@
         Posts event EVT_SETTINGS_CHANGED.
         """
         if self._updateSettings():
-            self.parent.goutput.WriteLog(_('Settings applied to current session but not saved'))
+            self._giface.WriteLog(_('Settings applied to current session but not saved'))
             event = wxSettingsChanged()
             wx.PostEvent(self, event)
             self.Close()
@@ -175,7 +176,7 @@
                 self.settings.Set(group = 'language', key = 'locale', subkey = 'lc_all', value = 'C')
                 lang = 'C'
             self.settings.SaveToFile()
-            self.parent.goutput.WriteLog(_('Settings saved to file \'%s\'.') % self.settings.filePath)
+            self._giface.WriteLog(_('Settings saved to file \'%s\'.') % self.settings.filePath)
             if lang:
                 StoreEnvVariable(key = 'LANG', value = lang)
             else:
@@ -243,8 +244,7 @@
             size = self.parent.GetSize()
             dim = '%d,%d,%d,%d' % (pos[0], pos[1], size[0], size[1])
             # opened displays
-            for page in range(0, self.parent.GetLayerNotebook().GetPageCount()):
-                mapdisp = self.parent.GetLayerNotebook().GetPage(page).maptree.GetMapDisplay()
+            for mapdisp in self._giface.GetAllMapDisplays():
                 pos  = mapdisp.GetPosition()
                 size = mapdisp.GetSize()
 
@@ -258,10 +258,9 @@
 
 class PreferencesDialog(PreferencesBaseDialog):
     """!User preferences dialog"""
-    def __init__(self, parent, title = _("GUI Settings"),
+    def __init__(self, parent, giface, title = _("GUI Settings"),
                  settings = UserSettings):
-        
-        PreferencesBaseDialog.__init__(self, parent = parent, title = title,
+        PreferencesBaseDialog.__init__(self, parent = parent, giface = giface, title = title,
                                        settings = settings)
         
         # create notebook pages

Modified: grass/trunk/gui/wxpython/iclass/digit.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/digit.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/iclass/digit.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -28,7 +28,7 @@
 
 class IClassVDigitWindow(VDigitWindow):
     """! Class similar to VDigitWindow but specialized for wxIClass."""
-    def __init__(self, parent, map, frame):
+    def __init__(self, parent, giface, map, frame):
         """!
         
         @a parent should has toolbar providing current class (category).
@@ -36,7 +36,7 @@
         @param parent gui parent
         @param map map renderer instance
         """
-        VDigitWindow.__init__(self, parent = parent, Map = map, frame = frame)
+        VDigitWindow.__init__(self, parent = parent, giface = giface, Map = map, frame = frame)
         
     def _onLeftDown(self, event):
         action = self.toolbar.GetAction()

Modified: grass/trunk/gui/wxpython/iclass/frame.py
===================================================================
--- grass/trunk/gui/wxpython/iclass/frame.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/iclass/frame.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -69,7 +69,7 @@
     
     It is wxGUI counterpart of old i.class module.
     """
-    def __init__(self, parent = None, title = _("Supervised Classification Tool"),
+    def __init__(self, parent = None, giface = None, title = _("Supervised Classification Tool"),
                  toolbars = ["iClassMisc", "iClassMap", "vdigit", "iClass"],
                  size = (875, 600), name = 'IClassWindow', **kwargs):
         """!
@@ -82,9 +82,11 @@
                                 name = name,
                                 firstMap = Map(), secondMap = Map(),
                                 **kwargs)
-        
-        self.firstMapWindow = IClassVDigitWindow(self, map = self.firstMap, frame = self)
-        self.secondMapWindow = BufferedWindow(self, Map = self.secondMap, frame = self)
+        self._giface = giface
+        self.firstMapWindow = IClassVDigitWindow(parent = self, giface = self._giface,
+                                                 map = self.firstMap, frame = self)
+        self.secondMapWindow = BufferedWindow(parent = self, giface = self._giface,
+                                              Map = self.secondMap, frame = self)
         self.MapWindow = self.firstMapWindow # current by default
         
         self._bindWindowsActivation()
@@ -188,8 +190,7 @@
             
     def OnHelp(self, event):
         """!Show help page"""
-        grass.run_command('g.manual',
-                          entry = 'wxGUI.IClass')
+        self._giface.Help(entry = 'wxGUI.IClass')
         
     def CreateTempVector(self):
         """!Create temporary vector map for training areas"""

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -66,6 +66,7 @@
 from lmgr.toolbars         import LMWorkspaceToolbar, LMDataToolbar, LMToolsToolbar
 from lmgr.toolbars         import LMMiscToolbar, LMVectorToolbar, LMNvizToolbar
 from lmgr.pyshell          import PyShellWindow
+from lmgr.giface           import LayerManagerGrassInterface
 from gui_core.forms        import GUI
 from gcp.manager           import GCPWizard
 from nviz.main             import haveNviz
@@ -91,6 +92,8 @@
 
         self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
 
+        self._giface = LayerManagerGrassInterface(self)
+
         self._auimgr = wx.aui.AuiManager(self)
 
         # initialize variables
@@ -390,11 +393,11 @@
     def OnGCPManager(self, event):
         """!Launch georectifier module
         """
-        GCPWizard(self)
+        GCPWizard(self, self._giface)
 
     def OnGModeler(self, event):
         """!Launch Graphical Modeler"""
-        win = ModelFrame(parent = self)
+        win = ModelFrame(parent = self, giface = self._giface)
         win.CentreOnScreen()
         
         win.Show()
@@ -577,11 +580,11 @@
             return
         
         if layertype == 'barscale':
-            self.GetLayerTree().GetMapDisplay().OnAddBarscale(None)
+            self.GetMapDisplay().OnAddBarscale(None)
         elif layertype == 'rastleg':
-            self.GetLayerTree().GetMapDisplay().OnAddLegend(None)
+            self.GetMapDisplay().OnAddLegend(None)
         elif layertype == 'redraw':
-            self.GetLayerTree().GetMapDisplay().OnRender(None)
+            self.GetMapDisplay().OnRender(None)
         else:
             # add layer into layer tree
             lname, found = GetLayerNameFromCmd(command, fullyQualified = True,
@@ -625,9 +628,7 @@
                 mlist.append(self.notebookLayers.GetPage(idx).maptree.GetMapDisplay())
             
             return mlist
-        
-        return None
-    
+
     def GetLogWindow(self):
         """!Get widget for command output"""
         return self.goutput
@@ -1282,10 +1283,7 @@
         """!Close all open map display windows
         """
         displays = list()
-        for page in range(0, self.notebookLayers.GetPageCount()):
-            displays.append(self.notebookLayers.GetPage(page).maptree.GetMapDisplay())
-        
-        for display in displays:
+        for display in self.GetMapDisplay(onlyCurrent = False):
             display.OnCloseWindow(event)
         
     def OnRenameDisplay(self, event):
@@ -1340,7 +1338,7 @@
         """!General GUI preferences/settings
         """
         if not self.dialogs['preferences']:
-            dlg = PreferencesDialog(parent = self)
+            dlg = PreferencesDialog(parent = self, giface = self._giface)
             self.dialogs['preferences'] = dlg
             self.dialogs['preferences'].CenterOnScreen()
             
@@ -1436,31 +1434,31 @@
     
     def OnImportDxfFile(self, event, cmd = None):
         """!Convert multiple DXF layers to GRASS vector map layers"""
-        dlg = DxfImportDialog(parent = self)
+        dlg = DxfImportDialog(parent = self, giface = self._giface)
         dlg.CentreOnScreen()
         dlg.Show()
 
     def OnImportGdalLayers(self, event, cmd = None):
         """!Convert multiple GDAL layers to GRASS raster map layers"""
-        dlg = GdalImportDialog(parent = self)
+        dlg = GdalImportDialog(parent = self, giface = self._giface)
         dlg.CentreOnScreen()
         dlg.Show()
 
     def OnLinkGdalLayers(self, event, cmd = None):
         """!Link multiple GDAL layers to GRASS raster map layers"""
-        dlg = GdalImportDialog(parent = self, link = True)
+        dlg = GdalImportDialog(parent = self, giface = self._giface, link = True)
         dlg.CentreOnScreen()
         dlg.Show()
         
     def OnImportOgrLayers(self, event, cmd = None):
         """!Convert multiple OGR layers to GRASS vector map layers"""
-        dlg = GdalImportDialog(parent = self, ogr = True)
+        dlg = GdalImportDialog(parent = self, giface = self._giface, ogr = True)
         dlg.CentreOnScreen()
         dlg.Show()
         
     def OnLinkOgrLayers(self, event, cmd = None):
         """!Links multiple OGR layers to GRASS vector map layers"""
-        dlg = GdalImportDialog(parent = self, ogr = True, link = True)
+        dlg = GdalImportDialog(parent = self, giface = self._giface, ogr = True, link = True)
         dlg.CentreOnScreen()
         dlg.Show()
         
@@ -1569,7 +1567,8 @@
         self.currentPage = self.notebookLayers.GetCurrentPage()
         
         # create layer tree (tree control for managing GIS layers)  and put on new notebook page
-        self.currentPage.maptree = LayerTree(self.currentPage, id = wx.ID_ANY, pos = wx.DefaultPosition,
+        self.currentPage.maptree = LayerTree(self.currentPage, giface = self._giface,
+                                             id = wx.ID_ANY, pos = wx.DefaultPosition,
                                              size = wx.DefaultSize, style = wx.TR_HAS_BUTTONS |
                                              wx.TR_LINES_AT_ROOT| wx.TR_HIDE_ROOT |
                                              wx.TR_DEFAULT_STYLE| wx.NO_BORDER | wx.FULL_REPAINT_ON_RESIZE,
@@ -1678,7 +1677,7 @@
         if not self.currentPage:
             self.AddMaps([mapName], grassType, check = True)
         else:
-            display = self.GetLayerTree().GetMapDisplay()
+            display = self.GetMapDisplay()
             mapLayers = map(lambda x: x.GetName(),
                             display.GetMap().GetListOfLayers(l_type = ltype))
             if mapName in mapLayers:
@@ -1784,12 +1783,12 @@
     def OnAddRasterArrow(self, event):
         """!Add flow arrows raster map to the current layer tree"""
         self.notebook.SetSelectionByName('layers')
-        tree = self.GetLayerTree()
-        resolution = tree.GetMapDisplay().GetProperty('resolution')
+        mapdisplay = self.GetMapDisplay()
+        resolution = mapdisplay.GetProperty('resolution')
         if not resolution:
             dlg = self.MsgDisplayResolution()
             if dlg.ShowModal() == wx.ID_YES:
-                tree.GetMapDisplay().SetProperty('resolution', True)
+                mapdisplay.SetProperty('resolution', True)
             dlg.Destroy()
 
         self.GetLayerTree().AddLayer('rastarrow')
@@ -1797,14 +1796,14 @@
     def OnAddRasterNum(self, event):
         """!Add cell number raster map to the current layer tree"""
         self.notebook.SetSelectionByName('layers')
-        tree = self.GetLayerTree()
-        resolution = tree.GetMapDisplay().GetProperty('resolution')
+        mapdisplay = self.GetMapDisplay()
+        resolution = mapdisplay.GetProperty('resolution')
         if not resolution:
             limitText = _("Note that cell values can only be displayed for "
                           "regions of less than 10,000 cells.")
             dlg = self.MsgDisplayResolution(limitText)
             if dlg.ShowModal() == wx.ID_YES:
-                tree.GetMapDisplay().SetProperty('resolution', True)
+                mapdisplay.SetProperty('resolution', True)
             dlg.Destroy()
 
         # region = tree.GetMap().GetCurrentRegion()

Added: grass/trunk/gui/wxpython/lmgr/giface.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/giface.py	                        (rev 0)
+++ grass/trunk/gui/wxpython/lmgr/giface.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -0,0 +1,58 @@
+"""!
+ at package lmgr.giface
+
+ at brief Layer Manager GRASS interface
+
+Classes:
+ - giface::LayerManagerGrassInterface
+
+(C) 2012 by the GRASS Development Team
+
+This program is free software under the GNU General Public License
+(>=v2). Read the file COPYING that comes with GRASS for details.
+
+ at author Anna Kratochvilova <kratochanna gmail.com>
+ at author Vaclav Petras <wenzeslaus gmail.com>
+"""
+class LayerManagerGrassInterface:
+    def __init__(self, lmgr):
+        self.lmgr = lmgr
+
+    def RunCmd(self, *args, **kwargs):
+        self.lmgr.goutput.RunCmd(*args, **kwargs)
+
+    def Help(self, entry):
+        cmdlist = ['g.manual', 'entry=%s' % entry]
+        self.RunCmd(cmdlist, compReg = False, switchPage = False)
+
+    def WriteLog(self, text, wrap = None,
+                 switchPage = False, priority = 1):
+        self.lmgr.goutput.WriteLog(text = text, wrap = wrap, switchPage = switchPage,
+                                   priority = priority)
+
+    def WriteCmdLog(self, line, pid = None, switchPage = True):
+        self.lmgr.goutput.WriteCmdLog(line = line, pid = pid, switchPage = switchPage)
+
+    def WriteWarning(self, line):
+        self.lmgr.goutput.WriteWarning(line = line)
+
+    def WriteError(self, line):
+        self.lmgr.goutput.WriteError(line = line)
+
+    def GetLayerTree(self):
+        return self.lmgr.GetLayerTree()
+
+    def GetMapDisplay(self):
+        """!Get current map display.
+
+        @return MapFrame instance
+        @return None no mapdisplay open
+        """
+        return self.lmgr.GetMapDisplay(onlyCurrent = True)
+
+    def GetAllMapDisplays(self):
+        """!Get list of all map displays.
+
+        @return list of MapFrame instances
+        """
+        return self.lmgr.GetMapDisplay(onlyCurrent = False)
\ No newline at end of file


Property changes on: grass/trunk/gui/wxpython/lmgr/giface.py
___________________________________________________________________
Added: svn:mime-type
   + text/x-python
Added: svn:eol-style
   + native

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -98,7 +98,7 @@
 class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
     """!Creates layer tree structure
     """
-    def __init__(self, parent,
+    def __init__(self, parent, giface,
                  id = wx.ID_ANY, style = wx.SUNKEN_BORDER,
                  ctstyle = CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT |
                  CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT |
@@ -115,6 +115,8 @@
         del kwargs['notebook']
         showMapDisplay = kwargs['showMapDisplay']
         del kwargs['showMapDisplay']
+
+        self._giface = giface
         self.treepg = parent                 # notebook page holding layer tree
         self.Map = Map()                     # instance of render.Map to be associated with display
         self.root = None                     # ID of layer tree root node
@@ -149,7 +151,7 @@
         
         # init associated map display
         pos = wx.Point((self.displayIndex + 1) * 25, (self.displayIndex + 1) * 25)
-        self.mapdisplay = MapFrame(self, id = wx.ID_ANY, pos = pos,
+        self.mapdisplay = MapFrame(self, giface = self._giface, id = wx.ID_ANY, pos = pos,
                                    size = globalvar.MAP_WINDOW_SIZE,
                                    style = wx.DEFAULT_FRAME_STYLE,
                                    tree = self, notebook = self.notebook,
@@ -488,14 +490,14 @@
 
         self.PopupMenu(self.popupMenu)
         self.popupMenu.Destroy()
-        
+
     def OnTopology(self, event):
         """!Rebuild topology of selected vector map"""
         mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
         cmd = ['v.build',
                'map=%s' % mapLayer.GetName()]
-        self.lmgr.goutput.RunCmd(cmd, switchPage = True)
-        
+        self._giface.RunCmd(cmd, switchPage = True)
+
     def OnSqlQuery(self, event):
         """!Show SQL query window for PostGIS layers
         """
@@ -517,7 +519,7 @@
         cmd.append('map=%s' % mapLayer.GetName())
 
         # print output to command log area
-        self.lmgr.goutput.RunCmd(cmd, switchPage = True)
+        self._giface.RunCmd(cmd, switchPage = True)
 
     def OnSetCompRegFromRaster(self, event):
         """!Set computational region from selected raster map (ignore NULLs)"""
@@ -528,8 +530,8 @@
                'zoom=%s' % mapLayer.GetName()]
         
         # print output to command log area
-        self.lmgr.goutput.RunCmd(cmd)
-         
+        self._giface.RunCmd(cmd)
+
     def OnSetCompRegFromMap(self, event):
         """!Set computational region from selected raster/vector map
         """
@@ -561,8 +563,8 @@
         # print output to command log area
         if len(cmd) > 1:
             cmd.append('-p')
-            self.lmgr.goutput.RunCmd(cmd, compReg = False)
-        
+            self._giface.RunCmd(cmd, compReg = False)
+
     def OnProfile(self, event):
         """!Plot profile of given raster map layer"""
         mapLayer = self.GetPyData(self.layer_selected)[0]['maplayer']
@@ -621,8 +623,8 @@
     def OnUnivariateStats(self, event):
         """!Univariate raster statistics"""
         name = self.GetPyData(self.layer_selected)[0]['maplayer'].GetName()
-        self.lmgr.goutput.RunCmd(['r.univar', 'map=%s' % name], switchPage = True)
-        
+        self._giface.RunCmd(['r.univar', 'map=%s' % name], switchPage = True)
+
     def OnStartEditing(self, event):
         """!Start editing vector map layer requested by the user
         """

Modified: grass/trunk/gui/wxpython/mapdisp/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/frame.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/mapdisp/frame.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -62,7 +62,7 @@
     """!Main frame for map display window. Drawing takes place in
     child double buffered drawing window.
     """
-    def __init__(self, parent = None, title = _("GRASS GIS - Map display"),
+    def __init__(self, parent, giface, title = _("GRASS GIS - Map display"),
                  toolbars = ["map"], tree = None, notebook = None, lmgr = None,
                  page = None, Map = None, auimgr = None, name = 'MapWindow', **kwargs):
         """!Main map display window with toolbars, statusbar and
@@ -81,6 +81,7 @@
         SingleMapFrame.__init__(self, parent = parent, title = title,
                               Map = Map, auimgr = auimgr, name = name, **kwargs)
         
+        self._giface = giface
         self._layerManager = lmgr   # Layer Manager object
         self.tree       = tree      # Layer Manager layer tree object
         self.page       = page      # Notebook page holding the layer tree
@@ -128,7 +129,7 @@
         #
         # Init map display (buffered DC & set default cursor)
         #
-        self.MapWindow2D = BufferedWindow(self, id = wx.ID_ANY,
+        self.MapWindow2D = BufferedWindow(self, giface = self._giface, id = wx.ID_ANY,
                                           Map = self.Map, frame = self, tree = self.tree, lmgr = self._layerManager)
         # default is 2D display mode
         self.MapWindow = self.MapWindow2D
@@ -208,7 +209,8 @@
         
         if not self.MapWindowVDigit:
             from vdigit.mapwindow import VDigitWindow
-            self.MapWindowVDigit = VDigitWindow(self, id = wx.ID_ANY, frame = self,
+            self.MapWindowVDigit = VDigitWindow(parent = self, giface = self._giface,
+                                                id = wx.ID_ANY, frame = self,
                                                 Map = self.Map, tree = self.tree,
                                                 lmgr = self._layerManager)
             self.MapWindowVDigit.Show()
@@ -278,13 +280,13 @@
         # erase map window
         self.MapWindow.EraseMap()
         
-        self._layerManager.goutput.WriteCmdLog(_("Starting 3D view mode..."),
-                                               switchPage = False)
+        self._giface.WriteCmdLog(_("Starting 3D view mode..."),
+                                 switchPage = False)
         self.SetStatusText(_("Please wait, loading data..."), 0)
         
         # create GL window
         if not self.MapWindow3D:
-            self.MapWindow3D = GLWindow(self, id = wx.ID_ANY, frame = self,
+            self.MapWindow3D = GLWindow(self, giface = self._giface, id = wx.ID_ANY, frame = self,
                                         Map = self.Map, tree = self.tree, lmgr = self._layerManager)
             self.MapWindow = self.MapWindow3D
             self.MapWindow.SetCursor(self.cursors["default"])
@@ -341,8 +343,8 @@
                                                        key = 'statusbarMode',
                                                        subkey = 'selection'))
         self.SetStatusText(_("Please wait, unloading data..."), 0)
-        self._layerManager.goutput.WriteCmdLog(_("Switching back to 2D view mode..."),
-                                               switchPage = False)
+        self._giface.WriteCmdLog(_("Switching back to 2D view mode..."),
+                                  switchPage = False)
         if self.MapWindow3D:
             self.MapWindow3D.OnClose(event = None)
         # switch from MapWindowGL to MapWindow
@@ -731,12 +733,12 @@
                 lmap = digitToolbar.GetLayer().GetName()
                 for name in vect:
                     if lmap == name:
-                        self._layerManager.goutput.WriteWarning(_("Vector map <%s> "
+                        self._giface.WriteWarning(_("Vector map <%s> "
                                                                   "opened for editing - skipped.") % map)
                         vect.remove(name)
             
             if len(vect) < 1:
-                self._layerManager.goutput.WriteCmdLog(_("Nothing to query."))
+                self._giface.WriteCmdLog(_("Nothing to query."))
                 return
             
             vcmd.append('-a')
@@ -750,12 +752,11 @@
         # parse query command(s)
 
         if rast and not self.IsPaneShown('3d'):
-            self._layerManager.goutput.RunCmd(rcmd,
-                                              compReg = False,
-                                              onDone  =  self._QueryMapDone)
+            self._giface.RunCmd(rcmd,
+                                compReg = False,
+                                onDone  =  self._QueryMapDone)
         if vect:
-            self._layerManager.goutput.RunCmd(vcmd,
-                                              onDone = self._QueryMapDone)
+            self._giface.RunCmd(vcmd, onDone = self._QueryMapDone)
         
     def _QueryMapDone(self, cmd, returncode):
         """!Restore settings after querying (restore GRASS_REGION)
@@ -805,7 +806,7 @@
                 self.dialogs['attributes'].UpdateDialog(query = ((east, north), qdist),
                                                         action = mode)
         if not self.dialogs['attributes'].IsFound():
-            self._layerManager.goutput.WriteLog(_('Nothing found.'))
+            self._giface.WriteLog(_('Nothing found.'))
         
         cats = self.dialogs['attributes'].GetCats()
         
@@ -936,16 +937,16 @@
         
         # initiating output
         style = self._layerManager.goutput.cmdOutput.StyleWarning
-        self._layerManager.goutput.WriteLog(_('Click and drag with left mouse button '
+        self._giface.WriteLog(_('Click and drag with left mouse button '
                                               'to measure.%s'
                                               'Double click with left button to clear.') % \
                                                 (os.linesep), style)
         if self.Map.projinfo['proj'] != 'xy':
             units = self.Map.projinfo['units']
-            self._layerManager.goutput.WriteCmdLog(_('Measuring distance') + ' ('
-                                                   + units + '):')
+            self._giface.WriteCmdLog(_('Measuring distance') + ' ('
+                                      + units + '):')
         else:
-            self._layerManager.goutput.WriteCmdLog(_('Measuring distance:'))
+            self._giface.WriteCmdLog(_('Measuring distance:'))
         
         if self.Map.projinfo['proj'] == 'll':
             try:
@@ -955,7 +956,7 @@
 
                 gislib.G_begin_distance_calculations()
             except ImportError, e:
-                self._layerManager.goutput.WriteWarning(_('Geodesic distance is not yet '
+                self._giface.WriteWarning(_('Geodesic distance is not yet '
                                                           'supported by this tool.\n'
                                                           'Reason: %s' % e))
         
@@ -993,7 +994,7 @@
                    _('total distance'), strtotdist, tdunits,
                    '-' * 60)
         
-        self._layerManager.goutput.WriteLog(mstring)
+        self._giface.WriteLog(mstring)
         
         return dist
 

Modified: grass/trunk/gui/wxpython/mapdisp/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapdisp/mapwindow.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/mapdisp/mapwindow.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -51,10 +51,10 @@
     can also save the drawing to file by calling the
     SaveToFile() method.
     """
-    def __init__(self, parent, Map, frame,
+    def __init__(self, parent, giface, Map, frame,
                  id = wx.ID_ANY, tree = None, lmgr = None,
                  style = wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs):
-        MapWindow.__init__(self, parent = parent, id = id, Map = Map,
+        MapWindow.__init__(self, parent = parent, giface = giface, id = id, Map = Map,
                            frame = frame, tree = tree, lmgr = lmgr, **kwargs)
         wx.Window.__init__(self, parent = parent, id = id, style = style, **kwargs)
         

Modified: grass/trunk/gui/wxpython/mapswipe/frame.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/frame.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/mapswipe/frame.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -35,7 +35,8 @@
 
 
 class SwipeMapFrame(DoubleMapFrame):
-    def __init__(self, parent  = None, title = _("GRASS GIS Map Swipe"), name = "swipe", **kwargs):
+    def __init__(self, parent  = None, giface = None, 
+                 title = _("GRASS GIS Map Swipe"), name = "swipe", **kwargs):
         DoubleMapFrame.__init__(self, parent = parent, title = title, name = name,
                                 firstMap = Map(), secondMap = Map(), **kwargs)
         Debug.msg (1, "SwipeMapFrame.__init__()")
@@ -50,7 +51,7 @@
             self.AddToolbar(toolbars.pop(0))
         for toolb in toolbars:
             self.AddToolbar(toolb)
-
+        self._giface = giface
         #
         # create widgets
         #
@@ -59,8 +60,10 @@
         self.sliderH = wx.Slider(self, id = wx.ID_ANY, style = wx.SL_HORIZONTAL)
         self.sliderV = wx.Slider(self, id = wx.ID_ANY, style = wx.SL_VERTICAL)
         
-        self.firstMapWindow = SwipeBufferedWindow(parent = self.splitter, Map = self.firstMap, frame = self)
-        self.secondMapWindow = SwipeBufferedWindow(parent = self.splitter, Map = self.secondMap, frame = self)
+        self.firstMapWindow = SwipeBufferedWindow(parent = self.splitter, giface = self._giface,
+                                                  Map = self.firstMap, frame = self)
+        self.secondMapWindow = SwipeBufferedWindow(parent = self.splitter, giface = self._giface,
+                                                   Map = self.secondMap, frame = self)
         self.MapWindow = self.firstMapWindow # current by default
         self.firstMap.region = self.secondMap.region
         self.firstMapWindow.zoomhistory = self.secondMapWindow.zoomhistory
@@ -459,9 +462,7 @@
         return True
 
     def OnHelp(self, event):
-        RunCommand('g.manual',
-                   quiet = True,
-                   entry = 'wxGUI.MapSwipe')
+        self._giface.Help(entry = 'wxGUI.MapSwipe')
 
     def OnCloseWindow(self, event):
         self.GetFirstMap().Clean()

Modified: grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/mapswipe/g.gui.mapswipe.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -45,7 +45,8 @@
 if __name__ == '__main__':
     sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
 
-from core.settings  import UserSettings
+from core.settings import UserSettings
+from core.giface import StandaloneGrassInterface
 from mapswipe.frame import SwipeMapFrame
 
 
@@ -72,7 +73,7 @@
     app = wx.PySimpleApp()
     wx.InitAllImageHandlers()
 
-    frame = SwipeMapFrame()
+    frame = SwipeMapFrame(parent = None, giface = StandaloneGrassInterface())
     
     if first:
         frame.SetFirstRaster(first)

Modified: grass/trunk/gui/wxpython/mapswipe/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/mapswipe/mapwindow.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/mapswipe/mapwindow.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -35,9 +35,10 @@
     Enables to draw the image translated.
     Special mouse events with changed coordinates are used.
     """
-    def __init__(self, parent, Map, frame,
+    def __init__(self, parent, giface, Map, frame,
                  tree = None, lmgr = None, **kwargs):
-        BufferedWindow.__init__(self, parent = parent, Map = Map, frame = frame, tree = tree, lmgr = lmgr, **kwargs)
+        BufferedWindow.__init__(self, parent = parent, giface = giface,
+                                Map = Map, frame = frame, tree = tree, lmgr = lmgr, **kwargs)
         Debug.msg(2, "SwipeBufferedWindow.__init__()")
 
         self.specialSize = super(SwipeBufferedWindow, self).GetClientSize()

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -67,12 +67,12 @@
 
 class GLWindow(MapWindow, glcanvas.GLCanvas):
     """!OpenGL canvas for Map Display Window"""
-    def __init__(self, parent, id = wx.ID_ANY, frame = None,
+    def __init__(self, parent, giface, id = wx.ID_ANY, frame = None,
                  Map = None, tree = None, lmgr = None):
         self.parent = parent # MapFrame
         
         glcanvas.GLCanvas.__init__(self, parent, id)
-        MapWindow.__init__(self, parent = parent, id = id, frame = frame,
+        MapWindow.__init__(self, parent = parent, giface = giface, id = id, frame = frame,
                            Map = Map, tree = tree, lmgr = lmgr)
         self.Hide()
         

Modified: grass/trunk/gui/wxpython/vdigit/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/vdigit/mapwindow.py	2012-11-23 13:53:03 UTC (rev 53984)
+++ grass/trunk/gui/wxpython/vdigit/mapwindow.py	2012-11-23 14:21:17 UTC (rev 53985)
@@ -28,10 +28,10 @@
 class VDigitWindow(BufferedWindow):
     """!A Buffered window extended for vector digitizer.
     """
-    def __init__(self, parent, Map, frame,
+    def __init__(self, parent, giface, Map, frame,
                  id = wx.ID_ANY, tree = None, lmgr = None,
                  style = wx.NO_FULL_REPAINT_ON_RESIZE, **kwargs):
-        BufferedWindow.__init__(self, parent = parent, id = id, Map = Map,
+        BufferedWindow.__init__(self, parent = parent, giface = giface, id = id, Map = Map,
                                 frame = frame, tree = tree, lmgr = lmgr, style = style, **kwargs)
         
         self.pdcVector = wx.PseudoDC()



More information about the grass-commit mailing list