[GRASS-SVN] r44664 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 22 08:32:12 EST 2010


Author: martinl
Date: 2010-12-22 05:32:12 -0800 (Wed, 22 Dec 2010)
New Revision: 44664

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
Log:
backport r44662 &  r44663 from trunk


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2010-12-22 13:30:11 UTC (rev 44663)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gdialogs.py	2010-12-22 13:32:12 UTC (rev 44664)
@@ -1502,7 +1502,7 @@
     return filetype, ltype
 
 class StaticWrapText(wx.StaticText):
-    """! A Static Text field that wraps its text to fit its width,
+    """!A Static Text field that wraps its text to fit its width,
     enlarging its height if necessary.
     """
     def __init__(self, parent, id = wx.ID_ANY, label = '', *args, **kwds):
@@ -1522,7 +1522,7 @@
     def OnResize(self, event):
         if not getattr(self, "resizing", False):
             self.resizing = True
-            newSize = wx.Size(self.parent.GetSize().width,
+            newSize = wx.Size(self.parent.GetSize().width - 50,
                               self.GetSize().height)
             if self.wrappedSize != newSize:
                 wx.StaticText.SetLabel(self, self.originalLabel)

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-12-22 13:30:11 UTC (rev 44663)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/menuform.py	2010-12-22 13:32:12 UTC (rev 44664)
@@ -31,8 +31,8 @@
  Or you set an alias or wrap the call up in a nice shell script, GUI
  environment ... please contribute your idea.
 
-Copyright (C) 2000-2010 by the GRASS Development Team
-This program is free software under the GPL (>=v2) Read the file
+Copyright(C) 2000-2010 by the GRASS Development Team
+This program is free software under the GPL(>=v2) Read the file
 COPYING coming with GRASS for details.
 
 @author Jan-Oliver Wagner <jan at intevation.de>
@@ -691,21 +691,21 @@
                                     bitmap = wx.Bitmap(name = os.path.join(imagepath,
                                                                        'grass_form.png'),
                                                      type = wx.BITMAP_TYPE_PNG))
-        topsizer.Add (item = self.logo, proportion = 0, border = 3,
-                      flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL)
+        topsizer.Add(item = self.logo, proportion = 0, border = 3,
+                     flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL)
         
         # add module description
-        if self.task.label !=  '':
+        if self.task.label:
             module_desc = self.task.label + ' ' + self.task.description
         else:
             module_desc = self.task.description
         self.description = gdialogs.StaticWrapText(parent = self.panel,
                                                    label = module_desc)
-        topsizer.Add (item = self.description, proportion = 1, border = 5,
-                      flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
-                      
-        guisizer.Add (item = topsizer, proportion = 0, flag = wx.EXPAND)
+        topsizer.Add(item = self.description, proportion = 1, border = 5,
+                     flag = wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
         
+        guisizer.Add(item = topsizer, proportion = 0, flag = wx.EXPAND)
+        
         self.panel.SetSizerAndFit(guisizer)
         self.Layout()
         
@@ -714,7 +714,7 @@
                                       mainFrame = self)
         self.goutput = self.notebookpanel.goutput
         self.notebookpanel.OnUpdateValues = self.updateValuesHook
-        guisizer.Add (item = self.notebookpanel, proportion = 1, flag = wx.EXPAND)
+        guisizer.Add(item = self.notebookpanel, proportion = 1, flag = wx.EXPAND)
         
         # status bar
         status_text = _("Enter parameters for '") + self.task.name + "'"
@@ -753,7 +753,7 @@
             self.btn_run.SetToolTipString(_("Run the command (Ctrl+R)"))
             self.btn_run.SetDefault()
             # copy
-            self.btn_clipboard = wx.Button(parent = self.panel, id = wx.ID_COPY)
+            self.btn_clipboard = wx.Button(parent = self.panel, id = wx.ID_COPY, label = _("C&opy"))
             self.btn_clipboard.SetToolTipString(_("Copy the current command string to the clipboard (Ctrl+C)"))
             
             btnsizer.Add(item = self.btn_run, proportion = 0,
@@ -805,11 +805,6 @@
         self.Bind(wx.EVT_CLOSE,  self.OnCancel)
         self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
         
-        # constrained_size = self.notebookpanel.GetSize()
-        # 80 takes the tabbar into account
-        ### self.notebookpanel.SetSize((constrained_size[0] + 25, constrained_size[1])) 
-        ### self.notebookpanel.Layout()
-        
         # do layout
         # called automatically by SetSizer()
         self.panel.SetAutoLayout(True) 
@@ -817,9 +812,8 @@
         
         sizeFrame = self.GetBestSize()
         self.SetMinSize(sizeFrame)
-        self.SetSize((sizeFrame[0], sizeFrame[1] +
-                      self.notebookpanel.constrained_size[1] -
-                      self.notebookpanel.panelMinHeight))
+        self.SetSize(wx.Size(sizeFrame[0], sizeFrame[1] + 0.33 * max(self.notebookpanel.panelMinHeight,
+                                                                     self.notebookpanel.constrained_size[1])))
         
         # thread to update dialog
         # create queues
@@ -831,8 +825,8 @@
         
         # keep initial window size limited for small screens
         width, height = self.GetSizeTuple()
-        self.SetSize(wx.Size(min(width, 640),
-                             min(height, 480)))
+        self.SetSize(wx.Size(min(width, 650),
+                             min(height, 500)))
         
         # fix goutput's pane size
         if self.goutput:
@@ -1103,7 +1097,7 @@
             # if label is given: description -> tooltip
             if f.get('label','') !=  '':
                 title = text_beautify(f['label'])
-                tooltip = text_beautify (f['description'], width = -1)
+                tooltip = text_beautify(f['description'], width = -1)
             else:
                 title = text_beautify(f['description'])
                 tooltip = None
@@ -1164,7 +1158,7 @@
             # otherwise description -> lavel
             if p.get('label','') !=  '':
                 title = text_beautify(p['label'])
-                tooltip = text_beautify (p['description'], width = -1)
+                tooltip = text_beautify(p['description'], width = -1)
             else:
                 title = text_beautify(p['description'])
                 tooltip = None
@@ -1181,7 +1175,7 @@
                     p.get('multiple', False) and \
                     p.get('gisprompt',False) ==  False and \
                     p.get('type', '') ==  'string':
-                title_txt = wx.StaticBox (parent = which_panel, id = wx.ID_ANY)
+                title_txt = wx.StaticBox(parent = which_panel, id = wx.ID_ANY)
             else:
                 title_sizer = wx.BoxSizer(wx.HORIZONTAL)
                 title_txt = wx.StaticText(parent = which_panel)
@@ -1213,10 +1207,10 @@
                         p.get('gisprompt',False) ==  False and \
                         p.get('type', '') ==  'string':
                     title_txt.SetLabel(" %s: (%s, %s) " % (title, p['name'], p['type']))
-                    if len(valuelist) > 6:
-                        hSizer = wx.StaticBoxSizer (box = title_txt, orient = wx.VERTICAL)
+                    if valuelist_desc:
+                        hSizer = wx.StaticBoxSizer(box = title_txt, orient = wx.VERTICAL)
                     else:
-                        hSizer = wx.StaticBoxSizer (box = title_txt, orient = wx.HORIZONTAL)
+                        hSizer = wx.StaticBoxSizer(box = title_txt, orient = wx.HORIZONTAL)
                     isEnabled = {}
                     # copy default values
                     if p['value'] ==  '':
@@ -1243,15 +1237,14 @@
                         hSizer.Add(item = chkbox, proportion = 0,
                                     flag = wx.ADJUST_MINSIZE | wx.ALL, border = 1)
                         chkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckBoxMulti)
-
                         idx +=  1
                         
                     which_sizer.Add(item = hSizer, proportion = 0,
-                                     flag = wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, border = 5)
+                                    flag = wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, border = 5)
                 elif p.get('gisprompt', False) ==  False:
                     if len(valuelist) ==  1: # -> textctrl
                         title_txt.SetLabel("%s (%s %s):" % (title, _('valid range'),
-                                                          str(valuelist[0])))
+                                                            str(valuelist[0])))
                         
                         if p.get('type', '') ==  'integer' and \
                                 not p.get('multiple', False):
@@ -1701,13 +1694,13 @@
 	#
 	# determine panel size
 	#
-        maxsizes = (0,0)
+        maxsizes = (0, 0)
         for section in sections:
             tab[section].SetSizer(tabsizer[section])
             tabsizer[section].Fit(tab[section])
             tab[section].Layout()
             minsecsizes = tabsizer[section].GetSize()
-            maxsizes = map(lambda x: max(maxsizes[x], minsecsizes[x]), (0,1))
+            maxsizes = map(lambda x: max(maxsizes[x], minsecsizes[x]), (0, 1))
 
         # TODO: be less arbitrary with these 600
         self.panelMinHeight = 100



More information about the grass-commit mailing list