[GRASS-SVN] r36443 - grass/branches/releasebranch_6_4/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Mar 21 02:50:56 EDT 2009


Author: cmbarton
Date: 2009-03-21 02:50:54 -0400 (Sat, 21 Mar 2009)
New Revision: 36443

Modified:
   grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
Log:
Fix record editing dialog for Mac

Modified: grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py	2009-03-21 06:06:21 UTC (rev 36442)
+++ grass/branches/releasebranch_6_4/gui/wxpython/gui_modules/dbm.py	2009-03-21 06:50:54 UTC (rev 36443)
@@ -249,6 +249,7 @@
             
             for value in record.split('|'):
                 if self.columns[columns[j]]['ctype'] != type(''):
+                    # encode numeric values
                     try:
                         ### casting disabled (2009/03)
                         ### self.itemDataMap[i].append(self.columns[columns[j]]['ctype'](value))
@@ -1246,7 +1247,6 @@
                         else:
                             value = values[i]
                         values[i] = list.columns[columnName[i]]['ctype'] (value)
-
                     except:
                         raise ValueError(_("Value '%(value)s' needs to be entered as %(type)s.") % 
                                          {'value' : str(values[i]),
@@ -1381,6 +1381,8 @@
 
             list.Update(self.mapDBInfo)
                         
+            list.Update(self.mapDBInfo)
+                
     def OnDataReload(self, event):
         """Reload list of records"""
         self.OnApplySqlStatement(None)
@@ -3453,9 +3455,13 @@
         """
         wx.Dialog.__init__(self, parent, id, title, style=style)
 
+        self.CenterOnParent()
+        
         self.keyId = keyEditable[0]
         
         self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
+        
+        box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY, label='')
 
         self.dataPanel = scrolled.ScrolledPanel(parent=self.panel, id=wx.ID_ANY,
                                             style=wx.TAB_TRAVERSAL)
@@ -3473,13 +3479,15 @@
         #
         self.widgets = []
         id = 0
-        self.box = False
+        self.usebox = False
         self.cat = None
         for column, value in data:
             if keyEditable[0] == id:
                 self.cat = int(value)
                 if keyEditable[1] == False:
-                    self.box = True
+                    self.usebox = True
+                    box.SetLabel =" %s %d " % (_("Category"), self.cat)
+                    self.boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
                     id += 1
                     continue
                 else:
@@ -3510,11 +3518,6 @@
         """Do layout"""
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        if self.box:
-            box = wx.StaticBox(parent=self.panel, id=wx.ID_ANY,
-                               label=" %s %d " % (_("Category"), self.cat))
-            boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-
         # data area
         dataSizer = wx.FlexGridSizer (cols=2, hgap=3, vgap=3)
         dataSizer.AddGrowableCol(1)
@@ -3532,8 +3535,8 @@
         self.dataPanel.SetSizer(dataSizer)
         dataSizer.Fit(self.dataPanel)
 
-        if self.box:
-            boxSizer.Add(item=self.dataPanel, proportion=1,
+        if self.usebox:
+            self.boxSizer.Add(item=self.dataPanel, proportion=1,
                          flag=wx.EXPAND | wx.ALL, border=5)
             
         # buttons
@@ -3542,17 +3545,21 @@
         btnSizer.AddButton(self.btnSubmit)
         btnSizer.Realize()
 
-        if not self.box:
+        if not self.usebox:
             sizer.Add(item=self.dataPanel, proportion=1,
                       flag=wx.EXPAND | wx.ALL, border=5)
         else:
-            sizer.Add(item=boxSizer, proportion=1,
+            sizer.Add(item=self.boxSizer, proportion=1,
                       flag=wx.EXPAND | wx.ALL, border=5)
             
 
         sizer.Add(item=btnSizer, proportion=0,
                  flag=wx.EXPAND | wx.ALL, border=5)
 
+        framewidth = self.GetSize()[0]
+        self.SetMinSize((framewidth,150))
+        self.SetMaxSize((framewidth,300))
+
         #sizer.SetSizeHints(self.panel)
         self.panel.SetAutoLayout(True)
         self.panel.SetSizer(sizer)
@@ -3560,18 +3567,18 @@
 
         self.Layout()
 
-        # set window frame size (min & max)
-        minFrameHeight = 150
-        maxFrameHeight = 2 * minFrameHeight
-        if self.GetSize()[1] > minFrameHeight:
-            self.SetMinSize((self.GetSize()[0], minFrameHeight))
-        else:
-            self.SetMinSize(self.GetSize())
+#        # set window frame size (min & max)
+#        minFrameHeight = 150
+#        maxFrameHeight = 2 * minFrameHeight
+#        if self.GetSize()[1] > minFrameHeight:
+#            self.SetMinSize((self.GetSize()[0], minFrameHeight))
+#        else:
+#            self.SetMinSize(self.GetSize())
 
-        if self.GetSize()[1] > maxFrameHeight:
-            self.SetSize((self.GetSize()[0], maxFrameHeight))
-        else:
-            self.SetSize(self.panel.GetSize())
+#        if self.GetSize()[1] > maxFrameHeight:
+#            self.SetSize((self.GetSize()[0], maxFrameHeight))
+#        else:
+#            self.SetSize(self.panel.GetSize())
             
     def GetValues(self, columns=None):
         """Return list of values (casted to string).
@@ -3586,7 +3593,7 @@
                 valueList.append(value)
 
         # add key value
-        if self.box:
+        if self.usebox:
             valueList.insert(self.keyId, str(self.cat))
                              
         return valueList



More information about the grass-commit mailing list