[GRASS-SVN] r44660 - grass/trunk/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Dec 22 06:03:59 EST 2010


Author: martinl
Date: 2010-12-22 03:03:58 -0800 (Wed, 22 Dec 2010)
New Revision: 44660

Modified:
   grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: update menuform to follow wxGUI coding style


Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-12-22 10:44:27 UTC (rev 44659)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2010-12-22 11:03:58 UTC (rev 44660)
@@ -1,4 +1,4 @@
-#! /usr/bin/python
+#!/usr/bin/env python
 """
 @brief Construct simple wxPython GUI from a GRASS command interface
 description.
@@ -61,7 +61,7 @@
 
 ### i18N
 import gettext
-gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
 
 import globalvar
 if not os.getenv("GRASS_WXBUNDLED"):
@@ -90,12 +90,12 @@
 gisbase = os.getenv("GISBASE")
 if gisbase is None:
     print >>sys.stderr, "We don't seem to be properly installed, or we are being run outside GRASS. Expect glitches."
-    gisbase = os.path.join(os.path.dirname( sys.argv[0] ), os.path.pardir)
+    gisbase = os.path.join(os.path.dirname(sys.argv[0]), os.path.pardir)
     wxbase = gisbase
 else:
     wxbase = os.path.join(globalvar.ETCWXDIR)
 
-sys.path.append( wxbase)
+sys.path.append(wxbase)
 imagepath = os.path.join(wxbase, "images")
 sys.path.append(imagepath)
 
@@ -137,7 +137,7 @@
 
 def color_resolve(color):
     if len(color)>0 and color[0] in "0123456789":
-        rgb = tuple(map(int, color.split( ':' )))
+        rgb = tuple(map(int, color.split(':')))
         label = color
     else:
         # Convert color names to RGB
@@ -149,16 +149,16 @@
             label = _('Select Color')
     return (rgb, label)
 
-def text_beautify( someString , width=70):
+def text_beautify(someString , width = 70):
     """!Make really long texts shorter, clean up whitespace and remove
     trailing punctuation.
     """
     if width > 0:
-        return escape_ampersand( string.strip(
-                os.linesep.join( textwrap.wrap( utils.normalize_whitespace(someString), width ) ),
-                ".,;:" ) )
+        return escape_ampersand(string.strip(
+                os.linesep.join(textwrap.wrap(utils.normalize_whitespace(someString), width)),
+                ".,;:"))
     else:
-        return escape_ampersand( string.strip(utils.normalize_whitespace(someString ), ".,;:" ))
+        return escape_ampersand(string.strip(utils.normalize_whitespace(someString), ".,;:"))
     
 def escape_ampersand(text):
     """!Escapes ampersands with additional ampersand for GUI"""
@@ -192,7 +192,7 @@
             if self.eventId is None:
                 return
         
-        p = self.task.get_param(self.eventId, element='wxId', raiseError=False)
+        p = self.task.get_param(self.eventId, element = 'wxId', raiseError = False)
         if not p or \
                 not p.has_key('wxId-bind'):
             return
@@ -203,10 +203,10 @@
             return
         
         # check for map/input parameter
-        pMap = self.task.get_param('map', raiseError=False)
+        pMap = self.task.get_param('map', raiseError = False)
         
         if not pMap:
-            pMap = self.task.get_param('input', raiseError=False)
+            pMap = self.task.get_param('input', raiseError = False)
 
         if pMap:
             map = pMap.get('value', '')
@@ -260,14 +260,14 @@
             
             if name == 'TableSelect' or \
                     (name == 'ColumnSelect' and not map):
-                pDriver = self.task.get_param('dbdriver', element='prompt', raiseError=False)
+                pDriver = self.task.get_param('dbdriver', element = 'prompt', raiseError = False)
                 if pDriver:
                     driver = pDriver.get('value', '')
-                pDb = self.task.get_param('dbname', element='prompt', raiseError=False)
+                pDb = self.task.get_param('dbname', element = 'prompt', raiseError = False)
                 if pDb:
                     db = pDb.get('value', '')
                 if name == 'ColumnSelect':
-                    pTable = self.task.get_param('dbtable', element='element', raiseError=False)
+                    pTable = self.task.get_param('dbtable', element = 'element', raiseError = False)
                     if pTable:
                         table = pTable.get('value', '')
                 
@@ -310,26 +310,26 @@
                         self.data[win.InsertTableColumns] = { 'table'  : pTable.get('value') }
             
             elif name == 'SubGroupSelect':
-                pGroup = self.task.get_param('group', element='element', raiseError=False)
+                pGroup = self.task.get_param('group', element = 'element', raiseError = False)
                 if pGroup:
                     self.data[win.Insert] = { 'group' : pGroup.get('value', '')}
             
             elif name == 'LocationSelect':
-                pDbase = self.task.get_param('dbase', element='element', raiseError=False)
+                pDbase = self.task.get_param('dbase', element = 'element', raiseError = False)
                 if pDbase:
                     self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', '')}
 
             elif name == 'MapsetSelect':
-                pDbase = self.task.get_param('dbase', element='element', raiseError=False)
-                pLocation = self.task.get_param('location', element='element', raiseError=False)
+                pDbase = self.task.get_param('dbase', element = 'element', raiseError = False)
+                pLocation = self.task.get_param('location', element = 'element', raiseError = False)
                 if pDbase and pLocation:
                     self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
                                                    'location' : pLocation.get('value', '')}
 
-            elif name == 'ProjSelect':
-                pDbase = self.task.get_param('dbase', element='element', raiseError=False)
-                pLocation = self.task.get_param('location', element='element', raiseError=False)
-                pMapset = self.task.get_param('mapset', element='element', raiseError=False)
+            elif name ==  'ProjSelect':
+                pDbase = self.task.get_param('dbase', element = 'element', raiseError = False)
+                pLocation = self.task.get_param('location', element = 'element', raiseError = False)
+                pMapset = self.task.get_param('mapset', element = 'element', raiseError = False)
                 if pDbase and pLocation and pMapset:
                     self.data[win.UpdateItems] = { 'dbase' : pDbase.get('value', ''),
                                                    'location' : pLocation.get('value', ''),
@@ -353,7 +353,7 @@
         self.start()
         
     def Update(self, callable, *args, **kwds):
-        UpdateQThread.requestId += 1
+        UpdateQThread.requestId +=  1
         
         self.request = None
         self.requestQ.put((UpdateQThread.requestId, callable, args, kwds))
@@ -421,7 +421,7 @@
         
         return flags
     
-    def get_param(self, value, element='name', raiseError=True):
+    def get_param(self, value, element = 'name', raiseError = True):
         """!Find and return a param by name."""
         try:
             for p in self.params:
@@ -431,11 +431,11 @@
                 if type(val) in (types.ListType, types.TupleType):
                     if value in val:
                         return p
-                elif type(val) == types.StringType:
-                    if p[element][:len(value)] == value:
+                elif type(val) ==  types.StringType:
+                    if p[element][:len(value)] ==  value:
                         return p
                 else:
-                    if p[element] == value:
+                    if p[element] ==  value:
                         return p
         except KeyError:
             pass
@@ -462,7 +462,7 @@
         Find and return a flag by name.
         """
         for f in self.flags:
-            if f['name'] == aFlag:
+            if f['name'] ==  aFlag:
                 return f
         raise ValueError, _("Flag not found: %s") % aFlag
 
@@ -503,7 +503,7 @@
         """!Produce an array of command name and arguments for feeding
         into some execve-like command processor.
 
-        If ignoreErrors==True then it will return whatever has been
+        If ignoreErrors =  = True then it will return whatever has been
         built so far, even though it would not be a correct command
         for GRASS.
         """
@@ -512,18 +512,18 @@
         for flag in self.flags:
             if flag['value']:
                 if len(flag['name']) > 1: # e.g. overwrite
-                    cmd += [ '--' + flag['name'] ]
+                    cmd +=  [ '--' + flag['name'] ]
                 else:
-                    cmd += [ '-' + flag['name'] ]
+                    cmd +=  [ '-' + flag['name'] ]
         for p in self.params:
-            if p.get('value','') == '' and p.get('required', False):
-                if p.get('default', '') != '':
-                    cmd += [ '%s=%s' % ( p['name'], p['default'] ) ]
+            if p.get('value','') ==  '' and p.get('required', False):
+                if p.get('default', '') !=  '':
+                    cmd +=  [ '%s=%s' % (p['name'], p['default']) ]
                 elif ignoreErrors is False:
-                    cmd += [ '%s=%s' % ( p['name'], _('<required>') ) ]
-            elif p.get('value','') != '' and p['value'] != p.get('default','') :
+                    cmd +=  [ '%s=%s' % (p['name'], _('<required>')) ]
+            elif p.get('value','') !=  '' and p['value'] !=  p.get('default','') :
                 # Output only values that have been set, and different from defaults
-                cmd += [ '%s=%s' % ( p['name'], p['value'] ) ]
+                cmd +=  [ '%s=%s' % (p['name'], p['value']) ]
         
         errList = self.getCmdError()
         if ignoreErrors is False and errList:
@@ -536,7 +536,7 @@
 
         @param opts list of flags and parameters"""
         for opt in opts:
-            if opt[0] == '-': # flag
+            if opt[0] ==  '-': # flag
                 self.set_flag(opt.lstrip('-'), True)
             else: # parameter
                 key, value = opt.split('=', 1)
@@ -618,16 +618,16 @@
                 for ki in node_key_desc.findall('item'):
                     key_desc.append(ki.text)
             
-            if p.get('multiple', 'no') == 'yes':
+            if p.get('multiple', 'no') ==  'yes':
                 multiple = True
             else:
                 multiple = False
-            if p.get('required', 'no') == 'yes':
+            if p.get('required', 'no') ==  'yes':
                 required = True
             else:
                 required = False
             
-            self.task.params.append( {
+            self.task.params.append({
                 "name"           : p.get('name'),
                 "type"           : p.get('type'),
                 "required"       : required,
@@ -644,7 +644,7 @@
                 "values"         : values,
                 "values_desc"    : values_desc,
                 "value"          : '',
-                "key_desc"       : key_desc } )
+                "key_desc"       : key_desc })
             
     def __processFlags(self):
         """!Process flags"""
@@ -654,13 +654,13 @@
             else:
                 suppress_required = False
             
-            self.task.flags.append( {
+            self.task.flags.append({
                     "name"              : p.get('name'),
                     "label"             : self._getNodeText(p, 'label'),
                     "description"       : self._getNodeText(p, 'description'),
                     "guisection"        : self._getNodeText(p, 'guisection'),
                     "suppress_required" : suppress_required,
-                    "value"             : False } )
+                    "value"             : False })
             
     def _getNodeText(self, node, tag, default = ''):
         """!Get node text"""
@@ -695,7 +695,7 @@
         self.layer    = layer
         self.task     = task_description
         self.parent   = parent            # LayerTree | Modeler | None | ...
-        if parent and parent.GetName() == 'Modeler':
+        if parent and parent.GetName() ==  'Modeler':
             self.modeler = self.parent
         else:
             self.modeler = None
@@ -706,18 +706,18 @@
         else:
             title = self.task.name
         try:
-            if self.task.keywords != ['']:
-                title +=  " [" + ', '.join( self.task.keywords ) + "]"
+            if self.task.keywords !=  ['']:
+                title +=   " [" + ', '.join(self.task.keywords) + "]"
         except ValueError:
             pass
         
-        wx.Frame.__init__(self, parent=parent, id=ID, title=title,
-                          pos=wx.DefaultPosition, style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL,
+        wx.Frame.__init__(self, parent = parent, id = ID, title = title,
+                          pos = wx.DefaultPosition, style = wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL,
                           name = "MainFrame")
         
         self.locale = wx.Locale(language = wx.LANGUAGE_DEFAULT)
         
-        self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
+        self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
         
         # statusbar
         self.CreateStatusBar()
@@ -737,24 +737,24 @@
         topsizer = wx.BoxSizer(wx.HORIZONTAL)
         
         # GRASS logo
-        self.logo = wx.StaticBitmap(parent=self.panel,
-                                    bitmap=wx.Bitmap(name=os.path.join(imagepath,
+        self.logo = wx.StaticBitmap(parent = self.panel,
+                                    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)
+                                                     type = wx.BITMAP_TYPE_PNG))
+        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)
+        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)
+        guisizer.Add (item = topsizer, proportion = 0, flag = wx.EXPAND)
         
         self.panel.SetSizerAndFit(guisizer)
         self.Layout()
@@ -764,7 +764,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 + "'"
@@ -772,92 +772,92 @@
             self.task.getCmd()
             self.updateValuesHook()
         except ValueError:
-            self.SetStatusText( status_text )
+            self.SetStatusText(status_text)
         
         # buttons
-        btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
+        btnsizer = wx.BoxSizer(orient = wx.HORIZONTAL)
         # cancel
-        self.btn_cancel = wx.Button(parent=self.panel, id=wx.ID_CLOSE)
+        self.btn_cancel = wx.Button(parent = self.panel, id = wx.ID_CLOSE)
         self.btn_cancel.SetToolTipString(_("Close this window without executing the command (Ctrl+Q)"))
-        btnsizer.Add(item=self.btn_cancel, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=10)
+        btnsizer.Add(item = self.btn_cancel, proportion = 0, flag = wx.ALL | wx.ALIGN_CENTER, border = 10)
         self.btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
         if not hasattr(self.notebookpanel, "manual_tab_id"):
             self.btn_help.Hide()
         if self.get_dcmd is not None: # A callback has been set up
-            btn_apply = wx.Button(parent=self.panel, id=wx.ID_APPLY)
-            btn_ok = wx.Button(parent=self.panel, id=wx.ID_OK)
+            btn_apply = wx.Button(parent = self.panel, id = wx.ID_APPLY)
+            btn_ok = wx.Button(parent = self.panel, id = wx.ID_OK)
             btn_ok.SetDefault()
             
-            btnsizer.Add(item=btn_apply, proportion=0,
-                         flag=wx.ALL | wx.ALIGN_CENTER,
-                         border=10)
-            btnsizer.Add(item=btn_ok, proportion=0,
-                         flag=wx.ALL | wx.ALIGN_CENTER,
-                         border=10)
+            btnsizer.Add(item = btn_apply, proportion = 0,
+                         flag = wx.ALL | wx.ALIGN_CENTER,
+                         border = 10)
+            btnsizer.Add(item = btn_ok, proportion = 0,
+                         flag = wx.ALL | wx.ALIGN_CENTER,
+                         border = 10)
             
             btn_apply.Bind(wx.EVT_BUTTON, self.OnApply)
             btn_ok.Bind(wx.EVT_BUTTON, self.OnOK)
         else: # We're standalone
             # run
-            self.btn_run = wx.Button(parent=self.panel, id=wx.ID_OK, label= _("&Run"))
+            self.btn_run = wx.Button(parent = self.panel, id = wx.ID_OK, label =  _("&Run"))
             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)
             self.btn_clipboard.SetToolTipString(_("Copy the current command string to the clipboard (Ctrl+C)"))
             
-            btnsizer.Add(item=self.btn_run, proportion=0,
-                         flag=wx.ALL | wx.ALIGN_CENTER,
-                         border=10)
+            btnsizer.Add(item = self.btn_run, proportion = 0,
+                         flag = wx.ALL | wx.ALIGN_CENTER,
+                         border = 10)
             
-            btnsizer.Add(item=self.btn_clipboard, proportion=0,
-                         flag=wx.ALL | wx.ALIGN_CENTER,
-                         border=10)
+            btnsizer.Add(item = self.btn_clipboard, proportion = 0,
+                         flag = wx.ALL | wx.ALIGN_CENTER,
+                         border = 10)
             
             self.btn_run.Bind(wx.EVT_BUTTON, self.OnRun)
             self.btn_clipboard.Bind(wx.EVT_BUTTON, self.OnCopy)
         # help
-        self.btn_help = wx.Button(parent=self.panel, id=wx.ID_HELP)
+        self.btn_help = wx.Button(parent = self.panel, id = wx.ID_HELP)
         self.btn_help.SetToolTipString(_("Show manual page of the command (Ctrl+H)"))
         self.btn_help.Bind(wx.EVT_BUTTON, self.OnHelp)
         
         # add help button
-        btnsizer.Add(item=self.btn_help, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=10)
+        btnsizer.Add(item = self.btn_help, proportion = 0, flag = wx.ALL | wx.ALIGN_CENTER, border = 10)
         
-        guisizer.Add(item=btnsizer, proportion=0, flag=wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT,
+        guisizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_CENTER | wx.LEFT | wx.RIGHT,
                      border = 30)
         
         if self.parent and not self.modeler:
             addLayer = False
             for p in self.task.params:
-                if p.get('age', 'old') == 'new' and \
+                if p.get('age', 'old') ==  'new' and \
                    p.get('prompt', '') in ('raster', 'vector', '3d-raster'):
                     addLayer = True
             
             if addLayer:
                 # add newly created map into layer tree
-                self.addbox = wx.CheckBox(parent=self.panel,
-                                          label=_('Add created map(s) into layer tree'), style = wx.NO_BORDER)
-                self.addbox.SetValue(UserSettings.Get(group='cmd', key='addNewLayer', subkey='enabled'))
-                guisizer.Add(item=self.addbox, proportion=0,
-                             flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
-                             border=5)
+                self.addbox = wx.CheckBox(parent = self.panel,
+                                          label = _('Add created map(s) into layer tree'), style = wx.NO_BORDER)
+                self.addbox.SetValue(UserSettings.Get(group = 'cmd', key = 'addNewLayer', subkey = 'enabled'))
+                guisizer.Add(item = self.addbox, proportion = 0,
+                             flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
+                             border = 5)
         
         if self.get_dcmd is None:
             # close dialog when command is terminated
-            self.closebox = wx.CheckBox(parent=self.panel,
-                                        label=_('Close dialog on finish'), style = wx.NO_BORDER)
-            self.closebox.SetValue(UserSettings.Get(group='cmd', key='closeDlg', subkey='enabled'))
-            guisizer.Add(item=self.closebox, proportion=0,
-                         flag=wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
-                         border=5)
+            self.closebox = wx.CheckBox(parent = self.panel,
+                                        label = _('Close dialog on finish'), style = wx.NO_BORDER)
+            self.closebox.SetValue(UserSettings.Get(group = 'cmd', key = 'closeDlg', subkey = 'enabled'))
+            guisizer.Add(item = self.closebox, proportion = 0,
+                         flag = wx.EXPAND | wx.LEFT | wx.RIGHT | wx.BOTTOM,
+                         border = 5)
         
         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.SetSize((constrained_size[0] + 25, constrained_size[1])) 
         ### self.notebookpanel.Layout()
         
         # do layout
@@ -906,15 +906,15 @@
             event.Skip()
             return
         
-        if kc == 'Q':
+        if kc ==  'Q':
             self.OnCancel(None)
-        elif kc == 'S':
+        elif kc ==  'S':
             self.OnAbort(None)
-        elif kc == 'H':
+        elif kc ==  'H':
             self.OnHelp(None)
-        elif kc == 'R':
+        elif kc ==  'R':
             self.OnRun(None)
-        elif kc == 'C':
+        elif kc ==  'C':
             self.OnCopy(None)
         
         event.Skip()
@@ -925,12 +925,12 @@
 
         @param returncode command's return code (0 for success)
         """
-        if not self.parent or returncode != 0:
+        if not self.parent or returncode !=  0:
             return
         if self.parent.GetName() not in ('LayerTree', 'LayerManager'):
             return
         
-        if self.parent.GetName() == 'LayerTree':
+        if self.parent.GetName() ==  'LayerTree':
             display = self.parent.GetMapDisplay()
         else: # Layer Manager
             display = self.parent.GetLayerTree().GetMapDisplay()
@@ -983,10 +983,10 @@
         if not cmd or len(cmd) < 1:
             return
         
-        if self.standalone or cmd[0][0:2] != "d.":
+        if self.standalone or cmd[0][0:2] !=  "d.":
             # Send any non-display command to parent window (probably wxgui.py)
             # put to parents switch to 'Command output'
-            if self.notebookpanel.notebook.GetSelection() != self.notebookpanel.goutputId:
+            if self.notebookpanel.notebook.GetSelection() !=  self.notebookpanel.goutputId:
                 self.notebookpanel.notebook.SetSelection(self.notebookpanel.goutputId)
             
             try:
@@ -1009,20 +1009,20 @@
         
     def OnAbort(self, event):
         """!Abort running command"""
-        event = goutput.wxCmdAbort(aborted=True)
+        event = goutput.wxCmdAbort(aborted = True)
         wx.PostEvent(self.goutput, event)
 
     def OnCopy(self, event):
         """!Copy the command"""
         cmddata = wx.TextDataObject()
         # list -> string
-        cmdstring = ' '.join(self.createCmd(ignoreErrors=True))
+        cmdstring = ' '.join(self.createCmd(ignoreErrors = True))
         cmddata.SetText(cmdstring)
         if wx.TheClipboard.Open():
 #            wx.TheClipboard.UsePrimarySelection(True)
             wx.TheClipboard.SetData(cmddata)
             wx.TheClipboard.Close()
-            self.SetStatusText( _("'%s' copied to clipboard") % \
+            self.SetStatusText(_("'%s' copied to clipboard") % \
                                     (cmdstring))
 
     def OnCancel(self, event):
@@ -1036,7 +1036,7 @@
             # display decorations and 
             # pressing OK or cancel after setting layer properties
             if self.task.name in ['d.barscale','d.legend','d.histogram'] \
-                or len(self.parent.GetPyData(self.layer)[0]['cmd']) >= 1:
+                or len(self.parent.GetPyData(self.layer)[0]['cmd']) >=  1:
                 self.Hide()
             # canceled layer with nothing set
             elif len(self.parent.GetPyData(self.layer)[0]['cmd']) < 1:
@@ -1057,7 +1057,7 @@
         
     def createCmd(self, ignoreErrors = False):
         """!Create command string (python list)"""
-        return self.notebookpanel.createCmd(ignoreErrors=ignoreErrors)
+        return self.notebookpanel.createCmd(ignoreErrors = ignoreErrors)
 
 class cmdPanel(wx.Panel):
     """!A panel containing a notebook dividing in tabs the different
@@ -1075,60 +1075,60 @@
         # Determine tab layout
         sections = []
         is_section = {}
-        not_hidden = [ p for p in self.task.params + self.task.flags if not p.get( 'hidden','no' ) == 'yes' ]
+        not_hidden = [ p for p in self.task.params + self.task.flags if not p.get('hidden','no') ==  'yes' ]
 
         self.label_id = [] # wrap titles on resize
 
         self.Bind(wx.EVT_SIZE, self.OnSize)
         
         for task in not_hidden:
-            if task.get( 'required', False):
+            if task.get('required', False):
                 # All required go into Main, even if they had defined another guisection
-                task['guisection'] = _( 'Required' )
-            if task.get( 'guisection','' ) == '':
+                task['guisection'] = _('Required')
+            if task.get('guisection','') ==  '':
                 # Undefined guisections end up into Options
-                task['guisection'] = _( 'Optional' )
+                task['guisection'] = _('Optional')
             if not is_section.has_key(task['guisection']):
                 # We do it like this to keep the original order, except for Main which goes first
                 is_section[task['guisection']] = 1
-                sections.append( task['guisection'] )
+                sections.append(task['guisection'])
             else:
-                is_section[ task['guisection'] ] += 1
+                is_section[ task['guisection'] ] +=  1
         del is_section
 
         # 'Required' tab goes first, 'Optional' as the last one
-        for (newidx,content) in [ (0,_( 'Required' )), (len(sections)-1,_('Optional')) ]:
+        for (newidx,content) in [ (0,_('Required')), (len(sections)-1,_('Optional')) ]:
             if content in sections:
-                idx = sections.index( content )
+                idx = sections.index(content)
                 sections[idx:idx+1] = []
                 sections[newidx:newidx] =  [content]
 
-        panelsizer = wx.BoxSizer(orient=wx.VERTICAL)
+        panelsizer = wx.BoxSizer(orient = wx.VERTICAL)
 
         # Build notebook
         nbStyle = globalvar.FNPageStyle
         if globalvar.hasAgw:
-            self.notebook = FN.FlatNotebook( self, id = wx.ID_ANY, agwStyle = nbStyle)
+            self.notebook = FN.FlatNotebook(self, id = wx.ID_ANY, agwStyle = nbStyle)
         else:
-            self.notebook = FN.FlatNotebook( self, id = wx.ID_ANY, style = nbStyle)
+            self.notebook = FN.FlatNotebook(self, id = wx.ID_ANY, style = nbStyle)
         self.notebook.SetTabAreaColour(globalvar.FNPageColor)
         self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange)
 
         tab = {}
         tabsizer = {}
         for section in sections:
-            tab[section] = scrolled.ScrolledPanel(parent=self.notebook)
+            tab[section] = scrolled.ScrolledPanel(parent = self.notebook)
             tab[section].SetScrollRate(10, 10)
-            tabsizer[section] = wx.BoxSizer(orient=wx.VERTICAL)
-            self.notebook.AddPage( tab[section], text=section )
+            tabsizer[section] = wx.BoxSizer(orient = wx.VERTICAL)
+            self.notebook.AddPage(tab[section], text = section)
 
         # are we running from command line?
         ### add 'command output' tab regardless standalone dialog
-        if self.parent.GetName() == "MainFrame" and self.parent.get_dcmd is None:
-            self.goutput = goutput.GMConsole(parent=self, margin=False,
-                                             pageid=self.notebook.GetPageCount())
+        if self.parent.GetName() ==  "MainFrame" and self.parent.get_dcmd is None:
+            self.goutput = goutput.GMConsole(parent = self, margin = False,
+                                             pageid = self.notebook.GetPageCount())
             self.goutputId = self.notebook.GetPageCount()
-            self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output") )
+            self.outpage = self.notebook.AddPage(self.goutput, text = _("Command output"))
         else:
             self.goutput = None
             self.goutputId = -1
@@ -1137,46 +1137,46 @@
         if not self.manual_tab.IsFile():
             self.manual_tab.Hide()
         else:
-            self.notebook.AddPage(self.manual_tab, text=_("Manual"))
+            self.notebook.AddPage(self.manual_tab, text = _("Manual"))
             self.manual_tab_id = self.notebook.GetPageCount() - 1
         
         self.notebook.SetSelection(0)
 
-        panelsizer.Add(item=self.notebook, proportion=1, flag=wx.EXPAND )
+        panelsizer.Add(item = self.notebook, proportion = 1, flag = wx.EXPAND)
 
         #
         # flags
         #
         text_style = wx.FONTWEIGHT_NORMAL
-        visible_flags = [ f for f in self.task.flags if not f.get( 'hidden', 'no' ) == 'yes' ]
+        visible_flags = [ f for f in self.task.flags if not f.get('hidden', 'no') ==  'yes' ]
         for f in visible_flags:
             which_sizer = tabsizer[ f['guisection'] ]
             which_panel = tab[ f['guisection'] ]
             # if label is given: description -> tooltip
-            if f.get('label','') != '':
-                title = text_beautify( f['label'])
-                tooltip = text_beautify ( f['description'], width=-1)
+            if f.get('label','') !=  '':
+                title = text_beautify(f['label'])
+                tooltip = text_beautify (f['description'], width = -1)
             else:
-                title = text_beautify( f['description'] )
+                title = text_beautify(f['description'])
                 tooltip = None
             title_sizer = wx.BoxSizer(wx.HORIZONTAL)
-            rtitle_txt = wx.StaticText(parent=which_panel,
+            rtitle_txt = wx.StaticText(parent = which_panel,
                                        label = '(' + f['name'] + ')')
-            chk = wx.CheckBox(parent=which_panel, label = title, style = wx.NO_BORDER)
+            chk = wx.CheckBox(parent = which_panel, label = title, style = wx.NO_BORDER)
             self.label_id.append(chk.GetId())
             if tooltip:
                 chk.SetToolTipString(tooltip)
             chk.SetValue(f.get('value', False))
-            title_sizer.Add(item=chk, proportion=1,
-                            flag=wx.EXPAND)
-            title_sizer.Add(item=rtitle_txt, proportion=0,
-                            flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
-            which_sizer.Add(item=title_sizer, proportion=0,
-                            flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=5)
+            title_sizer.Add(item = chk, proportion = 1,
+                            flag = wx.EXPAND)
+            title_sizer.Add(item = rtitle_txt, proportion = 0,
+                            flag = wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
+            which_sizer.Add(item = title_sizer, proportion = 0,
+                            flag = wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border = 5)
             f['wxId'] = [ chk.GetId(), ]
             chk.Bind(wx.EVT_CHECKBOX, self.OnSetValue)
             
-            if self.parent.GetName() == 'MainFrame' and self.parent.modeler:
+            if self.parent.GetName() ==  'MainFrame' and self.parent.modeler:
                 parChk = wx.CheckBox(parent = which_panel, id = wx.ID_ANY,
                                      label = _("Parameterized in model"))
                 parChk.SetName('ModelParam')
@@ -1191,18 +1191,18 @@
             
             if f['name'] in ('verbose', 'quiet'):
                 chk.Bind(wx.EVT_CHECKBOX, self.OnVerbosity)
-                vq = UserSettings.Get(group='cmd', key='verbosity', subkey='selection')
-                if f['name'] == vq:
+                vq = UserSettings.Get(group = 'cmd', key = 'verbosity', subkey = 'selection')
+                if f['name'] ==  vq:
                     chk.SetValue(True)
                     f['value'] = True
-            elif f['name'] == 'overwrite' and not f.has_key('value'):
-                chk.SetValue(UserSettings.Get(group='cmd', key='overwrite', subkey='enabled'))
-                f['value'] = UserSettings.Get(group='cmd', key='overwrite', subkey='enabled')
+            elif f['name'] ==  'overwrite' and not f.has_key('value'):
+                chk.SetValue(UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled'))
+                f['value'] = UserSettings.Get(group = 'cmd', key = 'overwrite', subkey = 'enabled')
                 
         #
         # parameters
         #
-        visible_params = [ p for p in self.task.params if not p.get( 'hidden', 'no' ) == 'yes' ]
+        visible_params = [ p for p in self.task.params if not p.get('hidden', 'no') ==  'yes' ]
         
         try:
             first_param = visible_params[0]
@@ -1214,11 +1214,11 @@
             which_panel = tab[ p['guisection'] ]
             # if label is given -> label and description -> tooltip
             # otherwise description -> lavel
-            if p.get('label','') != '':
-                title = text_beautify( p['label'] )
-                tooltip = text_beautify ( p['description'], width = -1)
+            if p.get('label','') !=  '':
+                title = text_beautify(p['label'])
+                tooltip = text_beautify (p['description'], width = -1)
             else:
-                title = text_beautify( p['description'] )
+                title = text_beautify(p['description'])
                 tooltip = None
             txt = None
 
@@ -1229,49 +1229,49 @@
                 text_style = wx.FONTWEIGHT_BOLD
 
             # title sizer (description, name, type)
-            if (len(p.get('values', []) ) > 0) and \
+            if (len(p.get('values', [])) > 0) and \
                     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)
+                    p.get('gisprompt',False) ==  False and \
+                    p.get('type', '') ==  'string':
+                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)
+                title_txt = wx.StaticText(parent = which_panel)
                 if p['key_desc']:
                     ltype = ','.join(p['key_desc'])
                 else:
                     ltype = p['type']
-                rtitle_txt = wx.StaticText(parent=which_panel,
+                rtitle_txt = wx.StaticText(parent = which_panel,
                                            label = '(' + p['name'] + '=' + ltype + ')')
-                title_sizer.Add(item=title_txt, proportion=1,
-                                flag=wx.LEFT | wx.TOP | wx.EXPAND, border=5)
-                title_sizer.Add(item=rtitle_txt, proportion=0,
-                                flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.TOP, border=5)
-                which_sizer.Add(item=title_sizer, proportion=0,
-                                flag=wx.EXPAND)
+                title_sizer.Add(item = title_txt, proportion = 1,
+                                flag = wx.LEFT | wx.TOP | wx.EXPAND, border = 5)
+                title_sizer.Add(item = rtitle_txt, proportion = 0,
+                                flag = wx.ALIGN_RIGHT | wx.RIGHT | wx.TOP, border = 5)
+                which_sizer.Add(item = title_sizer, proportion = 0,
+                                flag = wx.EXPAND)
             self.label_id.append(title_txt.GetId())
 
             # title expansion
-            if p.get('multiple', False) and len( p.get('values','') ) == 0:
+            if p.get('multiple', False) and len(p.get('values','')) ==  0:
                 title = _("[multiple]") + " " + title
-                if p.get('value','') ==  '' :
+                if p.get('value','') ==   '' :
                     p['value'] = p.get('default','')
 
-            if ( len(p.get('values', []) ) > 0):
+            if (len(p.get('values', [])) > 0):
                 valuelist      = map(str, p.get('values',[]))
                 valuelist_desc = map(unicode, p.get('values_desc',[]))
 
                 if p.get('multiple', False) and \
-                        p.get('gisprompt',False) == False and \
-                        p.get('type', '') == 'string':
+                        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 )
+                        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'] == '':
+                    if p['value'] ==  '':
                         p['value'] = p.get('default', '')
                         
                     for defval in p.get('value', '').split(','):
@@ -1286,25 +1286,25 @@
                         except IndexError:
                             label = val
                         
-                        chkbox = wx.CheckBox( parent=which_panel,
-                                              label = text_beautify(label))
-                        p[ 'wxId' ].append( chkbox.GetId() )
+                        chkbox = wx.CheckBox(parent = which_panel,
+                                             label = text_beautify(label))
+                        p[ 'wxId' ].append(chkbox.GetId())
                         if isEnabled.has_key(val):
-                            chkbox.SetValue( True )
-                        hSizer.Add( item=chkbox, proportion=0,
-                                    flag=wx.ADJUST_MINSIZE | wx.ALL, border=1 )
+                            chkbox.SetValue(True)
+                        hSizer.Add(item = chkbox, proportion = 0,
+                                    flag = wx.ADJUST_MINSIZE | wx.ALL, border = 1)
                         chkbox.Bind(wx.EVT_CHECKBOX, self.OnCheckBoxMulti)
 
-                        idx += 1
+                        idx +=  1
                         
-                    which_sizer.Add( item=hSizer, proportion=0,
-                                     flag=wx.EXPAND | wx.TOP | wx.RIGHT | wx.LEFT, border=5 )
-                elif p.get('gisprompt', False) == False:
-                    if len(valuelist) == 1: # -> textctrl
+                    which_sizer.Add(item = hSizer, proportion = 0,
+                                     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])))
                         
-                        if p.get('type', '') == 'integer' and \
+                        if p.get('type', '') ==  'integer' and \
                                 not p.get('multiple', False):
 
                             # for multiple integers use textctrl instead of spinsctrl
@@ -1313,25 +1313,25 @@
                             except ValueError:
                                 minValue = -1e6
                                 maxValue = 1e6
-                            txt2 = wx.SpinCtrl(parent=which_panel, id=wx.ID_ANY, size=globalvar.DIALOG_SPIN_SIZE,
-                                               min=minValue, max=maxValue)
+                            txt2 = wx.SpinCtrl(parent = which_panel, id = wx.ID_ANY, size = globalvar.DIALOG_SPIN_SIZE,
+                                               min = minValue, max = maxValue)
                             txt2.SetName("SpinCtrl")
                             style = wx.BOTTOM | wx.LEFT
                         else:
-                            txt2 = wx.TextCtrl(parent=which_panel, value = p.get('default',''))
+                            txt2 = wx.TextCtrl(parent = which_panel, value = p.get('default',''))
                             txt2.SetName("TextCtrl")
                             style = wx.EXPAND | wx.BOTTOM | wx.LEFT
                         
                         value = self._GetValue(p)
                         # parameter previously set
                         if value:
-                            if txt2.GetName() == "SpinCtrl":
+                            if txt2.GetName() ==  "SpinCtrl":
                                 txt2.SetValue(int(value))
                             else:
                                 txt2.SetValue(value)
                         
-                        which_sizer.Add(item=txt2, proportion=0,
-                                        flag=style, border=5)
+                        which_sizer.Add(item = txt2, proportion = 0,
+                                        flag = style, border = 5)
 
                         p['wxId'] = [ txt2.GetId(), ]
                         txt2.Bind(wx.EVT_TEXT, self.OnSetValue)
@@ -1352,15 +1352,15 @@
             
             # text entry
             if (p.get('type','string') in ('string','integer','float')
-                and len(p.get('values',[])) == 0
-                and p.get('gisprompt',False) == False
-                and p.get('prompt','') != 'color'):
+                and len(p.get('values',[])) ==  0
+                and p.get('gisprompt',False) ==  False
+                and p.get('prompt','') !=  'color'):
 
-                title_txt.SetLabel(title + ':' )
+                title_txt.SetLabel(title + ':')
                 if p.get('multiple', False) or \
-                        p.get('type', 'string') == 'string' or \
+                        p.get('type', 'string') ==  'string' or \
                         len(p.get('key_desc', [])) > 1:
-                    txt3 = wx.TextCtrl(parent=which_panel, value = p.get('default',''))
+                    txt3 = wx.TextCtrl(parent = which_panel, value = p.get('default',''))
                     
                     value = self._GetValue(p)
                     if value:
@@ -1372,10 +1372,10 @@
                 else:
                     minValue = -1e9
                     maxValue = 1e9
-                    if p.get('type', '') == 'integer':
-                        txt3 = wx.SpinCtrl(parent=which_panel, value=p.get('default',''),
-                                           size=globalvar.DIALOG_SPIN_SIZE,
-                                           min=minValue, max=maxValue)
+                    if p.get('type', '') ==  'integer':
+                        txt3 = wx.SpinCtrl(parent = which_panel, value = p.get('default',''),
+                                           size = globalvar.DIALOG_SPIN_SIZE,
+                                           min = minValue, max = maxValue)
                         style = wx.BOTTOM | wx.LEFT | wx.RIGHT
                         
                         value = self._GetValue(p)
@@ -1384,7 +1384,7 @@
                         
                         txt3.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
                     else:
-                        txt3 = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
+                        txt3 = wx.TextCtrl(parent = which_panel, value = p.get('default',''),
                                            validator = FloatValidator())
                         style = wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT
                         
@@ -1394,14 +1394,14 @@
                     
                 txt3.Bind(wx.EVT_TEXT, self.OnSetValue)
                 
-                which_sizer.Add(item=txt3, proportion=0,
-                                flag=style, border=5)
+                which_sizer.Add(item = txt3, proportion = 0,
+                                flag = style, border = 5)
                 p['wxId'] = [ txt3.GetId(), ]
 
             #
             # element selection tree combobox (maps, icons, regions, etc.)
             #
-            if p.get('gisprompt', False) == True:
+            if p.get('gisprompt', False) ==  True:
                 title_txt.SetLabel(title + ':')
                 # GIS element entry
                 if p.get('prompt','') not in ('color',
@@ -1416,45 +1416,45 @@
                                               'location',
                                               'mapset',
                                               'dbase') and \
-                       p.get('element', '') != 'file':
+                       p.get('element', '') !=  'file':
                     multiple = p.get('multiple', False)
-                    if p.get('age', '') == 'new':
+                    if p.get('age', '') ==  'new':
                         mapsets = [grass.gisenv()['MAPSET'],]
                     else:
                         mapsets = None
                     if self.task.name in ('r.proj', 'v.proj') \
-                            and p.get('name', '') == 'input':
-                        if self.task.name == 'r.proj':
+                            and p.get('name', '') ==  'input':
+                        if self.task.name ==  'r.proj':
                             isRaster = True
                         else:
                             isRaster = False
-                        selection = gselect.ProjSelect(parent=which_panel,
+                        selection = gselect.ProjSelect(parent = which_panel,
                                                        isRaster = isRaster)
                         p['wxId'] = [ selection.GetId(), ]
                         selection.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                         formatSelector = False
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                     else:
-                        selection = gselect.Select(parent=which_panel, id=wx.ID_ANY,
-                                                   size=globalvar.DIALOG_GSELECT_SIZE,
-                                                   type=p.get('element', ''),
-                                                   multiple=multiple, mapsets=mapsets)
+                        selection = gselect.Select(parent = which_panel, id = wx.ID_ANY,
+                                                   size = globalvar.DIALOG_GSELECT_SIZE,
+                                                   type = p.get('element', ''),
+                                                   multiple = multiple, mapsets = mapsets)
                         formatSelector = True
                         # A select.Select is a combobox with two children: a textctl and a popupwindow;
                         # we target the textctl here
                         p['wxId'] = [selection.GetChildren()[0].GetId(), ]
                         selection.GetChildren()[0].Bind(wx.EVT_TEXT, self.OnSetValue)
                         
-                    if p.get('prompt', '') == 'vector':
+                    if p.get('prompt', '') ==  'vector':
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                         
-                        if formatSelector and p.get('age', '') == 'old':
+                        if formatSelector and p.get('age', '') ==  'old':
                             # OGR supported (read-only)
                             self.hsizer = wx.BoxSizer(wx.HORIZONTAL)
                             
-                            self.hsizer.Add(item=selection,
-                                            flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_TOP,
-                                            border=5)
+                            self.hsizer.Add(item = selection,
+                                            flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_TOP,
+                                            border = 5)
                             
                             # format (native / ogr)
                             rbox = wx.RadioBox(parent = which_panel, id = wx.ID_ANY,
@@ -1466,10 +1466,10 @@
                             rbox.SetName('VectorFormat')
                             rbox.Bind(wx.EVT_RADIOBOX, self.OnVectorFormat)
                             
-                            self.hsizer.Add(item=rbox,
-                                            flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT |
+                            self.hsizer.Add(item = rbox,
+                                            flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT |
                                             wx.RIGHT | wx.ALIGN_TOP,
-                                            border=5)
+                                            border = 5)
                             
                             ogrSelection = gselect.GdalSelect(parent = self, panel = which_panel, ogr = True,
                                                               default = 'dir',
@@ -1487,20 +1487,20 @@
                             for win in ogrSelection.GetDsnWin():
                                 p['wxId'].append(win.GetId())
                         else:
-                            which_sizer.Add(item=selection, proportion=0,
-                                            flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
-                                            border=5)
-                    elif p.get('prompt', '') == 'group':
+                            which_sizer.Add(item = selection, proportion = 0,
+                                            flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
+                                            border = 5)
+                    elif p.get('prompt', '') ==  'group':
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
-                        which_sizer.Add(item=selection, proportion=0,
-                                        flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
-                                        border=5)
+                        which_sizer.Add(item = selection, proportion = 0,
+                                        flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
+                                        border = 5)
                     else:
-                        which_sizer.Add(item=selection, proportion=0,
-                                        flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
-                                        border=5)
+                        which_sizer.Add(item = selection, proportion = 0,
+                                        flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_CENTER_VERTICAL,
+                                        border = 5)
                 # subgroup
-                elif p.get('prompt', '') == 'subgroup':
+                elif p.get('prompt', '') ==  'subgroup':
                     selection = gselect.SubGroupSelect(parent = which_panel)
                     p['wxId'] = [ selection.GetId() ]
                     selection.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
@@ -1518,9 +1518,9 @@
                                              'location',
                                              'mapset',
                                              'dbase'):
-                    if p.get('multiple', 'no') == 'yes':
-                        win = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
-                                          size=globalvar.DIALOG_TEXTCTRL_SIZE)
+                    if p.get('multiple', 'no') ==  'yes':
+                        win = wx.TextCtrl(parent = which_panel, value = p.get('default',''),
+                                          size = globalvar.DIALOG_TEXTCTRL_SIZE)
                         win.Bind(wx.EVT_TEXT, self.OnSetValue)
                     else:
                         value = p.get('value', '')
@@ -1529,23 +1529,23 @@
                         
                         if p.get('prompt', '') in ('layer',
                                                    'layer_all'):
-                            if p.get('prompt', '') == 'layer_all':
+                            if p.get('prompt', '') ==  'layer_all':
                                 all = True
                             else:
                                 all = False
                             win = wx.BoxSizer(wx.HORIZONTAL)
-                            if p.get('age', 'old') == 'old':
-                                win1 = gselect.LayerSelect(parent=which_panel,
-                                                          all=all,
-                                                          default=p['default'])
+                            if p.get('age', 'old') ==  'old':
+                                win1 = gselect.LayerSelect(parent = which_panel,
+                                                          all = all,
+                                                          default = p['default'])
                                 win1.Bind(wx.EVT_CHOICE, self.OnUpdateSelection)
                                 win1.Bind(wx.EVT_CHOICE, self.OnSetValue)
                             else:
-                                win1 = wx.SpinCtrl(parent=which_panel, id=wx.ID_ANY,
-                                                  min=1, max=100, initial=int(p['default']))
+                                win1 = wx.SpinCtrl(parent = which_panel, id = wx.ID_ANY,
+                                                  min = 1, max = 100, initial = int(p['default']))
                                 win1.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
                             win2 = gselect.LayerNameSelect(parent = which_panel)
-                            if p.get('value','') != '':
+                            if p.get('value','') !=  '':
                                 win2.SetItems([p['value']])
                                 win2.SetSelection(0)
                             
@@ -1556,48 +1556,48 @@
                                     flag = wx.LEFT | wx.ALIGN_CENTER_VERTICAL,
                                     border = 5)
 
-                        elif p.get('prompt', '') == 'dbdriver':
+                        elif p.get('prompt', '') ==  'dbdriver':
                             win = gselect.DriverSelect(parent = which_panel,
                                                        choices = p.get('values', []),
                                                        value = value)
                             win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
                             win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
-                        elif p.get('prompt', '') == 'dbname':
+                        elif p.get('prompt', '') ==  'dbname':
                             win = gselect.DatabaseSelect(parent = which_panel,
                                                          value = value)
                             win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                             win.Bind(wx.EVT_TEXT, self.OnSetValue)
-                        elif p.get('prompt', '') == 'dbtable':
-                            if p.get('age', 'old') == 'old':
-                                win = gselect.TableSelect(parent=which_panel)
+                        elif p.get('prompt', '') ==  'dbtable':
+                            if p.get('age', 'old') ==  'old':
+                                win = gselect.TableSelect(parent = which_panel)
                                 win.Bind(wx.EVT_COMBOBOX, self.OnUpdateSelection)
                                 win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             else:
-                                win = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
-                                                  size=globalvar.DIALOG_TEXTCTRL_SIZE)
+                                win = wx.TextCtrl(parent = which_panel, value = p.get('default',''),
+                                                  size = globalvar.DIALOG_TEXTCTRL_SIZE)
                                 win.Bind(wx.EVT_TEXT, self.OnSetValue)
-                        elif p.get('prompt', '') == 'dbcolumn':
+                        elif p.get('prompt', '') ==  'dbcolumn':
                             win = gselect.ColumnSelect(parent = which_panel,
                                                        value = value,
                                                        param = p)
                             win.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
                             win.Bind(wx.EVT_TEXT,     self.OnSetValue)
 
-                        elif p.get('prompt', '') == 'location':
+                        elif p.get('prompt', '') ==  'location':
                             win = gselect.LocationSelect(parent = which_panel,
                                                          value = value)
                             win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
                             win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue)
                         
-                        elif p.get('prompt', '') == 'mapset':
+                        elif p.get('prompt', '') ==  'mapset':
                             win = gselect.MapsetSelect(parent = which_panel,
                                                        value = value)
                             win.Bind(wx.EVT_COMBOBOX,     self.OnUpdateSelection)
                             win.Bind(wx.EVT_COMBOBOX,     self.OnSetValue)
                             
-                        elif p.get('prompt', '') == 'dbase':
+                        elif p.get('prompt', '') ==  'dbase':
                             win = gselect.DbaseSelect(parent = which_panel,
-                                                      changeCallback=self.OnSetValue)
+                                                      changeCallback = self.OnSetValue)
                             win.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                             p['wxId'] = [ win.GetChildren()[1].GetId() ]
                             
@@ -1607,64 +1607,64 @@
                         except AttributeError:
                             pass
                     
-                    which_sizer.Add(item=win, proportion=0,
-                                    flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border=5)
+                    which_sizer.Add(item = win, proportion = 0,
+                                    flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border = 5)
                 # color entry
                 elif p.get('prompt', '') in ('color',
                                              'color_none'):
                     default_color = (200,200,200)
                     label_color = _("Select Color")
-                    if p.get('default','') != '':
-                        default_color, label_color = color_resolve( p['default'] )
-                    if p.get('value','') != '': # parameter previously set
-                        default_color, label_color = color_resolve( p['value'] )
-                    if p.get('prompt', '') == 'color_none':
-                        this_sizer = wx.BoxSizer(orient=wx.HORIZONTAL )
+                    if p.get('default','') !=  '':
+                        default_color, label_color = color_resolve(p['default'])
+                    if p.get('value','') !=  '': # parameter previously set
+                        default_color, label_color = color_resolve(p['value'])
+                    if p.get('prompt', '') ==  'color_none':
+                        this_sizer = wx.BoxSizer(orient = wx.HORIZONTAL)
                     else:
                         this_sizer = which_sizer
-                    btn_colour = csel.ColourSelect(parent=which_panel, id=wx.ID_ANY,
-                                                   label=label_color, colour=default_color,
-                                                   pos=wx.DefaultPosition, size=(150,-1) )
-                    this_sizer.Add(item=btn_colour, proportion=0,
-                                   flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border=5)
+                    btn_colour = csel.ColourSelect(parent = which_panel, id = wx.ID_ANY,
+                                                   label = label_color, colour = default_color,
+                                                   pos = wx.DefaultPosition, size = (150,-1))
+                    this_sizer.Add(item = btn_colour, proportion = 0,
+                                   flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT, border = 5)
                     # For color selectors, this is a two-member array, holding the IDs of
                     # the selector proper and either a "transparent" button or None
                     p['wxId'] = [btn_colour.GetId(),]
-                    btn_colour.Bind(csel.EVT_COLOURSELECT,  self.OnColorChange )
-                    if p.get('prompt', '') == 'color_none':
-                        none_check = wx.CheckBox(which_panel, wx.ID_ANY, _("Transparent") )
-                        if p.get('value','') != '' and p.get('value',[''])[0] == "none":
+                    btn_colour.Bind(csel.EVT_COLOURSELECT,  self.OnColorChange)
+                    if p.get('prompt', '') ==  'color_none':
+                        none_check = wx.CheckBox(which_panel, wx.ID_ANY, _("Transparent"))
+                        if p.get('value','') !=  '' and p.get('value',[''])[0] ==  "none":
                             none_check.SetValue(True)
                         else:
                             none_check.SetValue(False)
-                        this_sizer.Add(item=none_check, proportion=0,
-                                       flag=wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT | wx.TOP, border=5)
-                        which_sizer.Add( this_sizer )
+                        this_sizer.Add(item = none_check, proportion = 0,
+                                       flag = wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT | wx.TOP, border = 5)
+                        which_sizer.Add(this_sizer)
                         none_check.Bind(wx.EVT_CHECKBOX, self.OnColorChange)
-                        p['wxId'].append( none_check.GetId() )
+                        p['wxId'].append(none_check.GetId())
                     else:
                         p['wxId'].append(None)
                 # file selector
-                elif p.get('prompt','') != 'color' and p.get('element', '') == 'file':
-                    fbb = filebrowse.FileBrowseButton(parent=which_panel, id=wx.ID_ANY, fileMask = '*',
-                                                      size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
-                                                      dialogTitle=_('Choose %s') % \
+                elif p.get('prompt','') !=  'color' and p.get('element', '') ==  'file':
+                    fbb = filebrowse.FileBrowseButton(parent = which_panel, id = wx.ID_ANY, fileMask = '*',
+                                                      size = globalvar.DIALOG_GSELECT_SIZE, labelText = '',
+                                                      dialogTitle = _('Choose %s') % \
                                                           p.get('description',_('File')),
-                                                      buttonText=_('Browse'),
-                                                      startDirectory=os.getcwd(), fileMode=0,
-                                                      changeCallback=self.OnSetValue)
+                                                      buttonText = _('Browse'),
+                                                      startDirectory = os.getcwd(), fileMode = 0,
+                                                      changeCallback = self.OnSetValue)
                     value = self._GetValue(p)
                     if value:
                         fbb.SetValue(value) # parameter previously set
-                    which_sizer.Add(item=fbb, proportion=0,
-                                    flag=wx.EXPAND | wx.RIGHT, border=5)
+                    which_sizer.Add(item = fbb, proportion = 0,
+                                    flag = wx.EXPAND | wx.RIGHT, border = 5)
                     
                     # A file browse button is a combobox with two children:
                     # a textctl and a button;
                     # we have to target the button here
                     p['wxId'] = [ fbb.GetChildren()[1].GetId() ]
-                    if p.get('age', 'new') == 'old' and \
-                            UserSettings.Get(group='cmd', key='interactiveInput', subkey='enabled'):
+                    if p.get('age', 'new') ==  'old' and \
+                            UserSettings.Get(group = 'cmd', key = 'interactiveInput', subkey = 'enabled'):
                         # widget for interactive input
                         ifbb = wx.TextCtrl(parent = which_panel, id = wx.ID_ANY,
                                            style = wx.TE_MULTILINE,
@@ -1677,13 +1677,13 @@
                         ifbb.Bind(wx.EVT_TEXT, self.OnFileText)
                         which_sizer.Add(item = wx.StaticText(parent = which_panel, id = wx.ID_ANY,
                                                              label = _('or enter values interactively')),
-                                        proportion=0,
-                                        flag=wx.EXPAND | wx.RIGHT | wx.LEFT | wx.BOTTOM, border=5)
-                        which_sizer.Add(item=ifbb, proportion=1,
-                                        flag=wx.EXPAND | wx.RIGHT | wx.LEFT, border=5)
+                                        proportion = 0,
+                                        flag = wx.EXPAND | wx.RIGHT | wx.LEFT | wx.BOTTOM, border = 5)
+                        which_sizer.Add(item = ifbb, proportion = 1,
+                                        flag = wx.EXPAND | wx.RIGHT | wx.LEFT, border = 5)
                         p['wxId'].append(ifbb.GetId())
             
-            if self.parent.GetName() == 'MainFrame' and self.parent.modeler:
+            if self.parent.GetName() ==  'MainFrame' and self.parent.modeler:
                 parChk = wx.CheckBox(parent = which_panel, id = wx.ID_ANY,
                                      label = _("Parameterized in model"))
                 parChk.SetName('ModelParam')
@@ -1700,17 +1700,17 @@
                 # create tooltip if given
                 if len(p['values_desc']) > 0:
                     if tooltip:
-                        tooltip += 2 * os.linesep
+                        tooltip +=  2 * os.linesep
                     else:
                         tooltip = ''
-                    if len(p['values']) == len(p['values_desc']):
+                    if len(p['values']) ==  len(p['values_desc']):
                         for i in range(len(p['values'])):
-                            tooltip += p['values'][i] + ': ' + p['values_desc'][i] + os.linesep
+                            tooltip +=  p['values'][i] + ': ' + p['values_desc'][i] + os.linesep
                     tooltip.strip(os.linesep)
                 if tooltip:
                     title_txt.SetToolTipString(tooltip)
 
-            if p == first_param:
+            if p ==  first_param:
                 if p.has_key('wxId') and len(p['wxId']) > 0:
                     self.FindWindowById(p['wxId'][0]).SetFocus()
         
@@ -1729,7 +1729,7 @@
         pLocation = None
         pMapset = None
         for p in self.task.params:
-            if p.get('gisprompt', False) == False:
+            if p.get('gisprompt', False) ==  False:
                 continue
             
             guidep = p.get('guidependency', '')
@@ -1742,7 +1742,7 @@
                     if id:
                         if not p.has_key('wxId-bind'):
                             p['wxId-bind'] = list()
-                        p['wxId-bind'] += pOpt['wxId']
+                        p['wxId-bind'] +=  pOpt['wxId']
                 continue
             
             prompt = p.get('element', '')
@@ -1750,40 +1750,40 @@
                 name = p.get('name', '')
                 if name in ('map', 'input'):
                     pMap = p
-            elif prompt == 'layer':
+            elif prompt ==  'layer':
                 pLayer.append(p)
-            elif prompt == 'dbcolumn':
+            elif prompt ==  'dbcolumn':
                 pColumn.append(p)
-            elif prompt == 'dbdriver':
+            elif prompt ==  'dbdriver':
                 pDriver = p
-            elif prompt == 'dbname':
+            elif prompt ==  'dbname':
                 pDatabase = p
-            elif prompt == 'dbtable':
+            elif prompt ==  'dbtable':
                 pTable = p
-            elif prompt == 'group':
+            elif prompt ==  'group':
                 pGroup = p
-            elif prompt == 'subgroup':
+            elif prompt ==  'subgroup':
                 pSubGroup = p
-            elif prompt == 'dbase':
+            elif prompt ==  'dbase':
                 pDbase = p
-            elif prompt == 'location':
+            elif prompt ==  'location':
                 pLocation = p
-            elif prompt == 'mapset':
+            elif prompt ==  'mapset':
                 pMapset = p
         
         # collect ids
         pColumnIds = []
         for p in pColumn:
-            pColumnIds += p['wxId']
+            pColumnIds +=  p['wxId']
         pLayerIds = []
         for p in pLayer:
-            pLayerIds += p['wxId']
+            pLayerIds +=  p['wxId']
         
         # set wxId-bindings
         if pMap:
             pMap['wxId-bind'] = copy.copy(pColumnIds)
             if pLayer:
-                pMap['wxId-bind'] += pLayerIds
+                pMap['wxId-bind'] +=  pLayerIds
         if pLayer:
             for p in pLayer:
                 p['wxId-bind'] = copy.copy(pColumnIds)
@@ -1807,7 +1807,7 @@
             pLocation['wxId-bind'] = pMapset['wxId']
         
         if pLocation and pMapset and pMap:
-            pLocation['wxId-bind'] += pMap['wxId']
+            pLocation['wxId-bind'] +=  pMap['wxId']
             pMapset['wxId-bind'] = pMap['wxId']
         
 	#
@@ -1815,22 +1815,22 @@
 	#
         maxsizes = (0,0)
         for section in sections:
-            tab[section].SetSizer( tabsizer[section] )
-            tabsizer[section].Fit( tab[section] )
+            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
         self.constrained_size = (min(600, maxsizes[0]) + 25, min(400, maxsizes[1]) + 25)
         for section in sections:
-            tab[section].SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
+            tab[section].SetMinSize((self.constrained_size[0], self.panelMinHeight))
         
         if self.manual_tab.IsLoaded():
-            self.manual_tab.SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
+            self.manual_tab.SetMinSize((self.constrained_size[0], self.panelMinHeight))
         
-        self.SetSizer( panelsizer )
+        self.SetSizer(panelsizer)
         panelsizer.Fit(self.notebook)
         
         self.Bind(EVT_DIALOG_UPDATE, self.OnUpdateDialog)
@@ -1840,7 +1840,7 @@
 
         @param p parameter directory
         """
-        if p.get('value', '') != '':
+        if p.get('value', '') !=  '':
             return p['value']
         return p.get('default', '')
         
@@ -1854,7 +1854,7 @@
         if text:
             filename = win.GetValue()
             if not filename:
-                # outFile = tempfile.NamedTemporaryFile(mode='w+b')
+                # outFile = tempfile.NamedTemporaryFile(mode = 'w+b')
                 filename = grass.tempfile()
                 win.SetValue(filename)
                 
@@ -1878,45 +1878,45 @@
         winNative = None
         winOgr = None
         for id in p['wxId']:
-            if id == idEvent:
+            if id ==  idEvent:
                 continue
             name = self.FindWindowById(id).GetName()
-            if name == 'Select':
+            if name ==  'Select':
                 winNative = self.FindWindowById(id + 1)  # fix the mystery (also in nviz_tools.py)
-            elif name == 'OgrSelect':
+            elif name ==  'OgrSelect':
                 winOgr = self.FindWindowById(id)
         
         # enable / disable widgets & update values
         rbox = self.FindWindowByName('VectorFormat')
         self.hsizer.Remove(rbox)
-        if sel == 0:   # -> native
+        if sel ==  0:   # -> native
             winOgr.Hide()
             self.hsizer.Remove(winOgr)
             
-            self.hsizer.Add(item=winNative,
-                            flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_TOP,
-                            border=5)
+            self.hsizer.Add(item = winNative,
+                            flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_TOP,
+                            border = 5)
             winNative.Show()
             p['value'] = winNative.GetValue()
         
-        elif sel == 1: # -> OGR
+        elif sel ==  1: # -> OGR
             sizer = wx.BoxSizer(wx.VERTICAL)
             
             winNative.Hide()
             self.hsizer.Remove(winNative)
 
-            sizer.Add(item=winOgr)
+            sizer.Add(item = winOgr)
             winOgr.Show()
             p['value'] = winOgr.GetDsn()
             
-            self.hsizer.Add(item=sizer,
-                            flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_TOP,
-                            border=5)
+            self.hsizer.Add(item = sizer,
+                            flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT | wx.RIGHT | wx.TOP | wx.ALIGN_TOP,
+                            border = 5)
         
-        self.hsizer.Add(item=rbox,
-                        flag=wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT |
+        self.hsizer.Add(item = rbox,
+                        flag = wx.ADJUST_MINSIZE | wx.BOTTOM | wx.LEFT |
                         wx.RIGHT | wx.ALIGN_TOP,
-                        border=5)
+                        border = 5)
         
         self.hsizer.Layout()
         self.Layout()
@@ -1934,7 +1934,7 @@
         verbose = self.FindWindowById(self.task.get_flag('verbose')['wxId'][0])
         quiet = self.FindWindowById(self.task.get_flag('quiet')['wxId'][0])
         if event.IsChecked():
-            if event.GetId() == verbose.GetId():
+            if event.GetId() ==  verbose.GetId():
                 if quiet.IsChecked():
                     quiet.SetValue(False)
                     self.task.get_flag('quiet')['value'] = False
@@ -1952,7 +1952,7 @@
             sel = event.GetSelection()
 
         if hasattr(self, "manual_tab_id") and \
-                sel == self.manual_tab_id:
+                sel ==  self.manual_tab_id:
             # calling LoadPage() is strangely time-consuming (only first call)
             # FIXME: move to helpPage.__init__()
             if not self.manual_tab.IsLoaded():
@@ -1961,21 +1961,21 @@
 
         self.Layout()
 
-    def OnColorChange( self, event ):
+    def OnColorChange(self, event):
         myId = event.GetId()
         for p in self.task.params:
             if 'wxId' in p and myId in p['wxId']:
                 has_button = p['wxId'][1] is not None
-                if has_button and wx.FindWindowById( p['wxId'][1] ).GetValue() == True:
+                if has_button and wx.FindWindowById(p['wxId'][1]).GetValue() ==  True:
                     p[ 'value' ] = 'none'
                 else:
-                    colorchooser = wx.FindWindowById( p['wxId'][0] )
+                    colorchooser = wx.FindWindowById(p['wxId'][0])
                     new_color = colorchooser.GetValue()[:]
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # under wx2.8.1
-                    new_label = rgb2str.get( new_color, ':'.join(map(str,new_color)) )
-                    colorchooser.SetLabel( new_label )
-                    colorchooser.SetColour( new_color )
+                    new_label = rgb2str.get(new_color, ':'.join(map(str,new_color)))
+                    colorchooser.SetLabel(new_label)
+                    colorchooser.SetColour(new_color)
                     colorchooser.Refresh()
                     p[ 'value' ] = colorchooser.GetLabel()
         self.OnUpdateValues()
@@ -1999,7 +1999,7 @@
         for p in self.task.params:
             if 'wxId' in p and me in p['wxId']:
                 theParam = p
-                myIndex = p['wxId'].index( me )
+                myIndex = p['wxId'].index(me)
 
         # Unpack current value list
         currentValues = {}
@@ -2016,10 +2016,10 @@
         currentValueList = [] 
         for v in theParam['values']:
             if currentValues.has_key(v):
-                currentValueList.append( v )
+                currentValueList.append(v)
 
         # Pack it back
-        theParam['value'] = ','.join( currentValueList )
+        theParam['value'] = ','.join(currentValueList)
 
         self.OnUpdateValues()
 
@@ -2048,9 +2048,9 @@
         if name in ('LayerSelect', 'DriverSelect', 'TableSelect',
                     'LocationSelect', 'MapsetSelect', 'ProjSelect'):
             porf['value'] = me.GetStringSelection()
-        elif name == 'GdalSelect':
+        elif name ==  'GdalSelect':
             porf['value'] = event.dsn
-        elif name == 'ModelParam':
+        elif name ==  'ModelParam':
             porf['parameterized'] = me.IsChecked()
         else:
             porf['value'] = me.GetValue()
@@ -2082,17 +2082,17 @@
     def createCmd(self, ignoreErrors = False):
         """!Produce a command line string (list) or feeding into GRASS.
 
-        If ignoreErrors==True then it will return whatever has been
+        If ignoreErrors == True then it will return whatever has been
         built so far, even though it would not be a correct command
         for GRASS.
         """
         try:
-            cmd = self.task.getCmd(ignoreErrors=ignoreErrors)
+            cmd = self.task.getCmd(ignoreErrors = ignoreErrors)
         except ValueError, err:
-            dlg = wx.MessageDialog(parent=self,
-                                   message=unicode(err),
-                                   caption=_("Error in %s") % self.task.name,
-                                   style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+            dlg = wx.MessageDialog(parent = self,
+                                   message = unicode(err),
+                                   caption = _("Error in %s") % self.task.name,
+                                   style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
             dlg.ShowModal()
             dlg.Destroy()
             cmd = None
@@ -2102,14 +2102,12 @@
     def OnSize(self, event):
         width = event.GetSize()[0]
         fontsize = self.GetFont().GetPointSize()
-        text_width = width / (fontsize - 3)
-        if text_width < 70:
-            text_width = 70
+        text_width = max(width / (fontsize - 3), 70)
         
         for id in self.label_id:
             win = self.FindWindowById(id)
             label = win.GetLabel()
-            label_new = '\n'.join(textwrap.wrap(label, text_width ))
+            label_new = '\n'.join(textwrap.wrap(label, text_width))
             win.SetLabel(label_new)
             
         event.Skip()
@@ -2157,7 +2155,7 @@
     Parses GRASS commands when module is imported and used
     from Layer Manager.
     """
-    def __init__(self, parent=-1):
+    def __init__(self, parent = -1):
         self.parent = parent
         self.grass_task = None
         self.cmd = list()
@@ -2191,7 +2189,7 @@
         """
         start = time.time()
         dcmd_params = {}
-        if completed == None:
+        if completed ==  None:
             get_dcmd = None
             layer = None
             dcmd_params = None
@@ -2219,8 +2217,8 @@
             i = 0
             cmd_validated = [cmd[0]]
             for option in cmd[1:]:
-                if option[0] == '-': # flag
-                    if option[1] == '-':
+                if option[0] ==  '-': # flag
+                    if option[1] ==  '-':
                         self.grass_task.set_flag(option[2:], True)
                     else:
                         self.grass_task.set_flag(option[1], True)
@@ -2229,7 +2227,7 @@
                     try:
                         key, value = option.split('=', 1)
                     except:
-                        if i == 0: # add key name of first parameter if not given
+                        if i ==  0: # add key name of first parameter if not given
                             key = self.grass_task.firstParam
                             value = option
                         else:
@@ -2250,27 +2248,27 @@
                         except ValueError:
                             mapset = grass.find_file(value, element)['mapset']
                             curr_mapset = grass.gisenv()['MAPSET']
-                            if mapset and mapset != curr_mapset:
+                            if mapset and mapset !=  curr_mapset:
                                 value = value + '@' + mapset
                         
                     self.grass_task.set_param(key, value)
                     cmd_validated.append(key + '=' + value)
-                    i = i + 1
+                    i += 1
             
             # update original command list
             cmd = cmd_validated
         
         if show is not None:
-            self.mf = mainFrame(parent=self.parent, ID=wx.ID_ANY,
-                                task_description=self.grass_task,
-                                get_dcmd=get_dcmd, layer=layer)
+            self.mf = mainFrame(parent = self.parent, ID = wx.ID_ANY,
+                                task_description = self.grass_task,
+                                get_dcmd = get_dcmd, layer = layer)
         else:
             self.mf = None
         
         if get_dcmd is not None:
             # update only propwin reference
-            get_dcmd(dcmd=None, layer=layer, params=None,
-                     propwin=self.mf)
+            get_dcmd(dcmd = None, layer = layer, params = None,
+                     propwin = self.mf)
         
         if show is not None:
             self.mf.notebookpanel.OnUpdateSelection(None)
@@ -2309,7 +2307,7 @@
                     age = p.get('age', '')
                     prompt = p.get('prompt', '')
                     element = p.get('element', '') 
-                    if age == 'old' and \
+                    if age ==  'old' and \
                             element in ('cell', 'grid3', 'vector') and \
                             prompt in ('raster', '3d-raster', 'vector'):
                         return p.get('name', None)
@@ -2359,11 +2357,11 @@
     def TransferFromWindow(self):
         return True # Prevent wxDialog from complaining.
      
-if __name__ == "__main__":
+if __name__ ==  "__main__":
 
-    if len(sys.argv) == 1:
+    if len(sys.argv) ==  1:
         sys.exit(_("usage: %s <grass command>") % sys.argv[0])
-    if sys.argv[1] != 'test':
+    if sys.argv[1] !=  'test':
         q = wx.LogNull()
         cmd = shlex.split(sys.argv[1])
         task = grassTask(cmd[0])
@@ -2373,12 +2371,12 @@
     else: #Test
         # Test grassTask from within a GRASS session
         if os.getenv("GISBASE") is not None:
-            task = grassTask( "d.vect" )
+            task = grassTask("d.vect")
             task.get_param('map')['value'] = "map_name"
             task.get_flag('v')['value'] = True
             task.get_param('layer')['value'] = 1
             task.get_param('bcolor')['value'] = "red"
-            assert ' '.join( task.getCmd() ) == "d.vect -v map=map_name layer=1 bcolor=red"
+            assert ' '.join(task.getCmd()) ==  "d.vect -v map = map_name layer = 1 bcolor = red"
         # Test interface building with handmade grassTask,
         # possibly outside of a GRASS session.
         task = grassTask()
@@ -2435,7 +2433,7 @@
             "gisprompt" : False,
             "multiple" : "yes",
             # values must be an array of strings
-            "values" : str2rgb.keys() + map( str, str2rgb.values() )
+            "values" : str2rgb.keys() + map(str, str2rgb.values())
             },{
             "name" : "a_file",
             "description" : "A file selector",
@@ -2459,6 +2457,6 @@
             "value" : True
             }
             ]
-        q=wx.LogNull()
-        GrassGUIApp( task ).MainLoop()
+        q = wx.LogNull()
+        GrassGUIApp(task).MainLoop()
 



More information about the grass-commit mailing list