[GRASS-SVN] r65990 - in grass-addons/grass7/gui/wxpython/wx.metadata: g.gui.metadata mdlib

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 21 05:34:58 PDT 2015


Author: krejcmat
Date: 2015-08-21 05:34:57 -0700 (Fri, 21 Aug 2015)
New Revision: 65990

Modified:
   grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py
   grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py
Log:
wx.metadata addons: fix tree browser issue: ValueError: invalid null reference in method

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py	2015-08-21 09:52:51 UTC (rev 65989)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/g.gui.metadata/g.gui.metadata.py	2015-08-21 12:34:57 UTC (rev 65990)
@@ -85,7 +85,7 @@
         self.batch = False
         self.mdCreator = None
         self.editStatus = None
-        self.onInitEditor()
+        self.initEditor()
 
         dispatcher.connect(self.initNewMD, signal='NEW_MD.create', sender=dispatcher.Any)
         dispatcher.connect(self.onEditingMode, signal='EDITING_MODE.update', sender=dispatcher.Any)
@@ -292,7 +292,7 @@
             if not ok:
                 return False
         else:
-            self.onInitEditor()
+            self.initEditor()
 
         self.bttCreateTemplate.Disable()
         self.bttEdit.Disable()
@@ -312,7 +312,7 @@
         return True
 
     def onNewSession(self, evt):
-        self.onInitEditor()
+        self.initEditor()
         self.setTemplateEditorPath(value=False, template=False)
         # check current editing mode(grass or external xml editor)
         if self.rbGrass is False:
@@ -634,7 +634,7 @@
                     return
 
             self.xmlPath = self.mdCreator.saveXML(self.mdDestination, self.nameTMPteplate, self)
-            self.onInitEditor()
+            self.initEditor()
         # if editing multiple maps or just one but with loading own custom profile
         if self.profileChoice == 'Load custom' and self.numOfMap != 0:
             # load profile. IF - just one map, ELSE - multiple editing
@@ -661,7 +661,7 @@
                         self.initMultipleEditor()
                     else:
                         self.ListOfMapTypeDict.pop()
-                        self.onInitEditor()
+                        self.initEditor()
                 else:  # do nothing
                     return False
             else:
@@ -720,9 +720,9 @@
                 self.hideMultipleEdit()
             self.second = False
             self.secondAfterChoice = True
-            self.onInitEditor()
+            self.initEditor()
 
-    def onInitEditor(self, ):
+    def initEditor(self, ):
         '''Initialize editor
         @var first: True= First initialize main frame
         @var firstAfterChoice: True=Init editor editor after set configuration and click onEdit in toolbar
@@ -903,11 +903,12 @@
                 varmapset = self.getItemByName(mapset, varloc)
 
             # add type node if not exists
-            if self.itemExists(ltype, varmapset) is False:
-                vartype = self.AppendItem(varmapset, ltype)
+            if varmapset is not None:
+                if self.itemExists(ltype, varmapset) is False:
+                    vartype = self.AppendItem(varmapset, ltype)
 
-            if vartype is not None:
-                self.AppendItem(vartype, mlayer)
+                if vartype is not None:
+                    self.AppendItem(vartype, mlayer)
 
     def initTemporalTree(self, location, mapset):
         varloc = self.AppendItem(self.rootTmp, 'Temporal maps')
@@ -931,22 +932,25 @@
         vartype=None
         env = grass.gisenv()
         mapset = env['MAPSET']
+        try:
+            for ml in allDatasets:
+                # add mapset
+                if ml[1] == mapset:#chck current mapset
+                    it = self.itemExists(ml[1], varloc)
+                    if it is False:
+                        varmapset = it
+                    else:
+                        varmapset = self.getItemByName(ml[1], varloc)
+                    # add type node if not exists
+                    if varmapset is not None:
+                        if self.itemExists(ml[2], varmapset) is False:
+                            vartype = self.AppendItem(varmapset, ml[2])
 
-        for ml in allDatasets:
-            # add mapset
-            if ml[1] == mapset:#chck current mapset
-                it = self.itemExists(ml[1], varloc)
-                if  it is False:
-                    varmapset = it
-                else:
-                    varmapset = self.getItemByName(ml[1], varloc)
-                # add type node if not exists
-                if varmapset is not None:
-                    if self.itemExists(ml[2], varmapset) is False:
-                        vartype = self.AppendItem(varmapset, ml[2])
+                    if vartype is not None:
+                        self.AppendItem(vartype, ml[0])
 
-                if vartype is not None:
-                    self.AppendItem(vartype, ml[0])
+        except Exception, e:
+            GError('Initialize of temporal tree catalogue error: < %s >'%e)
 
         self.Bind(wx.EVT_TREE_SEL_CHANGED, self.onChanged)
         self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.onChanged)
@@ -986,7 +990,6 @@
         mapType = self.GetItemText(parentItem)
         if self.GetChildrenCount(item) == 0 and self.isMapExist(name,mapType):  # is selected map
             #check temporal selection
-
             for i in self.GetSelections():
                 MapTypeDict = {}
                 maps.append(self.GetItemText(i))
@@ -1032,8 +1035,6 @@
 #===============================================================================
 # NOTEBOOK ON THE RIGHT SIDE-xml browser+validator
 #===============================================================================
-
-
 class NotebookRight(wx.Notebook):
     '''Include pages with xml tree browser and validator of metadata
     '''

Modified: grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py
===================================================================
--- grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py	2015-08-21 09:52:51 UTC (rev 65989)
+++ grass-addons/grass7/gui/wxpython/wx.metadata/mdlib/cswlib.py	2015-08-21 12:34:57 UTC (rev 65990)
@@ -125,13 +125,14 @@
 
         self.addKeywordCtr = wx.Button(self.pnlLeft, -1, '+', size=(self.h, self.h))
         self.addKeywordCtr.Bind(wx.EVT_BUTTON, self.addKeyWidget)
-        self.findBtt = wx.Button(self.pnlLeft, size=(sizeConst, self.h), label='Find')
+        self.findBtt = wx.Button(self.pnlLeft, size=(sizeConst, self.h), label='Search')
         self.findBtt.SetBackgroundColour((255, 127, 80))
         qtyp=['All','Collection','Dataset','Event','Image','InteractiveResource',
             'MovingImage','PhysicalObject','Service','Software','Sound','StillImage','Text']
 
         self.qtypeCb = wx.ComboBox(self.pnlLeft, id=-1, pos=wx.DefaultPosition,choices=qtyp)
         self.qtypeCb.SetValue("All")
+        self.qtypeCb.Disable()
         # -----Results---
         self.resultList = AutoWidthListCtrl(self.pnlLeft)
         self.resultList.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.setTooltip)
@@ -233,7 +234,10 @@
             return
         constString = 'self.constraints=' + self.constString
         try:
-            exec (constString)
+            exec(constString)
+            if type(self.constraints != type(list())):
+                GMessage('Constraints syntax error')
+                return
         except:
             GMessage('Constraints syntax error')
             return



More information about the grass-commit mailing list