[GRASS-SVN] r40813 - grass-addons/gui/wxpython/data_catalog

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 4 01:10:35 EST 2010


Author: rashadkm
Date: 2010-02-04 01:10:35 -0500 (Thu, 04 Feb 2010)
New Revision: 40813

Modified:
   grass-addons/gui/wxpython/data_catalog/catalog.py
   grass-addons/gui/wxpython/data_catalog/mapframe.py
Log:
fixed problems using grass 6.5

Modified: grass-addons/gui/wxpython/data_catalog/catalog.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/catalog.py	2010-02-04 05:57:22 UTC (rev 40812)
+++ grass-addons/gui/wxpython/data_catalog/catalog.py	2010-02-04 06:10:35 UTC (rev 40813)
@@ -306,7 +306,11 @@
                 subMenu = self.__createMenu(eachItem[1])
                 menu.AppendMenu(wx.ID_ANY, label, subMenu)
             else:
-                self.__createMenuItem(menu, *eachItem)
+                version = os.getenv("GRASS_VERSION")
+                if version == "6.4.0svn":
+                    self.__createMenuItem(menu, *eachItem)
+                else:
+                    self.__createMenuItem2(menu, *eachItem)
         self.Bind(wx.EVT_MENU_HIGHLIGHT_ALL, self.OnMenuHighlight)
         return menu
 
@@ -335,6 +339,33 @@
 
         self.Bind(wx.EVT_MENU, rhandler, menuItem)
 
+    def __createMenuItem2(self, menu, label, help, handler, gcmd, keywords, shortcut = '', kind = wx.ITEM_NORMAL):
+        """!Creates menu items"""
+
+        if not label:
+            menu.AppendSeparator()
+            return
+
+        if len(gcmd) > 0:
+            helpString = gcmd + ' -- ' + help
+        else:
+            helpString = help
+        
+        if shortcut:
+            label += '\t' + shortcut
+        
+        menuItem = menu.Append(wx.ID_ANY, label, helpString, kind)
+
+        self.menucmd[menuItem.GetId()] = gcmd
+
+        if len(gcmd) > 0 and \
+                gcmd.split()[0] not in globalvar.grassCmd['all']:
+            menuItem.Enable (False)
+
+        rhandler = eval(handler)
+
+        self.Bind(wx.EVT_MENU, rhandler, menuItem)
+
     def OnXTerm(self):
         print "asdf"
 

Modified: grass-addons/gui/wxpython/data_catalog/mapframe.py
===================================================================
--- grass-addons/gui/wxpython/data_catalog/mapframe.py	2010-02-04 05:57:22 UTC (rev 40812)
+++ grass-addons/gui/wxpython/data_catalog/mapframe.py	2010-02-04 06:10:35 UTC (rev 40813)
@@ -54,7 +54,12 @@
 
 import render
 import toolbars
-import track
+
+
+version = os.getenv("GRASS_VERSION")
+if version == "6.4.0svn":
+    import track
+
 import menuform
 import gselect
 import disp_print
@@ -809,7 +814,6 @@
             self.DrawLines(self.pdcTmp)
 
 
-
         if self.gframe.georectifying:
             # -> georectifier (redraw GCPs)
             if self.parent.toolbars['georect']:



More information about the grass-commit mailing list