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

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Sep 22 12:44:40 EDT 2011


Author: martinl
Date: 2011-09-22 09:44:40 -0700 (Thu, 22 Sep 2011)
New Revision: 48416

Modified:
   grass/trunk/gui/wxpython/gui_modules/profile.py
Log:
wxGUI/profile: update code to follow wxGUI coding rules


Modified: grass/trunk/gui/wxpython/gui_modules/profile.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/profile.py	2011-09-22 16:15:55 UTC (rev 48415)
+++ grass/trunk/gui/wxpython/gui_modules/profile.py	2011-09-22 16:44:40 UTC (rev 48416)
@@ -1,7 +1,7 @@
 """!
 @package profile
 
-Profile analysis of GRASS raster maps and images.
+Profile analysis of raster maps and images.
 
 Uses PyPlot (wx.lib.plot.py)
 
@@ -11,7 +11,7 @@
  - TextDialog
  - OptDialog
 
-(C) 2007-2008 by the GRASS Development Team
+(C) 2007-2008, 2011 by the GRASS Development Team
 
 This program is free software under the GNU General Public License
 (>=v2). Read the file COPYING that comes with GRASS for details.
@@ -31,36 +31,34 @@
     import numpy
     import wx.lib.plot as plot
 except ImportError:
-    msg= _("This module requires the NumPy module, which could not be "
-           "imported. It probably is not installed (it's not part of the "
-           "standard Python distribution). See the Numeric Python site "
-           "(http://numpy.scipy.org) for information on downloading source or "
-           "binaries.")
+    msg = _("This module requires the NumPy module, which could not be "
+            "imported. It probably is not installed (it's not part of the "
+            "standard Python distribution). See the Numeric Python site "
+            "(http://numpy.scipy.org) for information on downloading source or "
+            "binaries.")
     print >> sys.stderr, "profile.py: " + msg
 
 import globalvar
-import render
-import menuform
-import disp_print
-import gselect
 import gcmd
-import toolbars
-from debug import Debug as Debug
-from icon import Icons as Icons
-from preferences import globalSettings as UserSettings
+from render       import Map
+from gselect      import Select
+from toolbars     import ProfileToolbar
+from debug        import Debug
+from icon         import Icons
+from preferences  import globalSettings as UserSettings
+
 from grass.script import core as grass
 
 class ProfileFrame(wx.Frame):
     """!Mainframe for displaying profile of raster map. Uses wx.lib.plot.
     """
-    def __init__(self, parent=None, id=wx.ID_ANY, title=_("GRASS Profile Analysis Tool"),
-                 rasterList=[],
-                 pos=wx.DefaultPosition, size=wx.DefaultSize,
-                 style=wx.DEFAULT_FRAME_STYLE):
+    def __init__(self, parent = None, id = wx.ID_ANY, title = _("GRASS Profile Analysis Tool"),
+                 rasterList = [],
+                 style = wx.DEFAULT_FRAME_STYLE, **kwargs):
 
         self.parent = parent # MapFrame
         self.mapwin = self.parent.MapWindow
-        self.Map = render.Map()  # instance of render.Map to be associated with display
+        self.Map = Map()  # instance of render.Map to be associated with display
 
         self.pstyledict = { 'solid' : wx.SOLID,
                             'dot' : wx.DOT,
@@ -71,7 +69,7 @@
         self.ptfilldict = { 'transparent' : wx.TRANSPARENT,
                             'solid' : wx.SOLID }
 
-        wx.Frame.__init__(self, parent, id, title, pos, size, style)
+        wx.Frame.__init__(self, parent, id, title, style = style, **kwargs)
 
         #
         # Icon
@@ -81,18 +79,13 @@
         #
         # Add toolbar
         #
-        self.toolbar = toolbars.ProfileToolbar(parent=self)
+        self.toolbar = ProfileToolbar(parent = self)
         self.SetToolBar(self.toolbar)
         
         #
-        # Set the size & cursor
-        #
-        self.SetClientSize(size)
-
-        #
         # Add statusbar
         #
-        self.statusbar = self.CreateStatusBar(number=2, style=0)
+        self.statusbar = self.CreateStatusBar(number = 2, style = 0)
         self.statusbar.SetStatusWidths([-2, -1])
 
         #
@@ -123,7 +116,7 @@
             self.raster[idx]['datalist'] = []
             # first (default) profile line
             self.raster[idx]['pline'] = None
-            self.raster[idx]['prop'] = UserSettings.Get(group='profile', key='raster' + str(idx))
+            self.raster[idx]['prop'] = UserSettings.Get(group = 'profile', key = 'raster' + str(idx))
             # changing color string to tuple
             colstr = str(self.raster[idx]['prop']['pcolor'])
             self.raster[idx]['prop']['pcolor'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
@@ -157,31 +150,31 @@
 
         self.properties = {}
         self.properties['font'] = {}
-        self.properties['font']['prop'] = UserSettings.Get(group='profile', key='font')
+        self.properties['font']['prop'] = UserSettings.Get(group = 'profile', key = 'font')
         self.properties['font']['wxfont'] = wx.Font(11, wx.FONTFAMILY_SWISS,
                                                     wx.FONTSTYLE_NORMAL,
                                                     wx.FONTWEIGHT_NORMAL)
         
-        self.properties['marker'] = UserSettings.Get(group='profile', key='marker')
+        self.properties['marker'] = UserSettings.Get(group = 'profile', key = 'marker')
         # changing color string to tuple
         colstr = str(self.properties['marker']['color'])
         self.properties['marker']['color'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
 
-        self.properties['grid'] = UserSettings.Get(group='profile', key='grid')
+        self.properties['grid'] = UserSettings.Get(group = 'profile', key = 'grid')
         # changing color string to tuple
         colstr = str(self.properties['grid']['color'])
         self.properties['grid']['color'] = tuple(int(colval) for colval in colstr.strip('()').split(','))
                 
         self.properties['x-axis'] = {}
         
-        self.properties['x-axis']['prop'] = UserSettings.Get(group='profile', key='x-axis')
+        self.properties['x-axis']['prop'] = UserSettings.Get(group = 'profile', key = 'x-axis')
         self.properties['x-axis']['axis'] = None
 
         self.properties['y-axis'] = {}
-        self.properties['y-axis']['prop'] = UserSettings.Get(group='profile', key='y-axis')
+        self.properties['y-axis']['prop'] = UserSettings.Get(group = 'profile', key = 'y-axis')
         self.properties['y-axis']['axis'] = None
         
-        self.properties['legend'] = UserSettings.Get(group='profile', key='legend')
+        self.properties['legend'] = UserSettings.Get(group = 'profile', key = 'legend')
         
         # zooming disabled
         self.zoom = False
@@ -223,14 +216,14 @@
         
         self.mapwin.mouse['use'] = 'profile'
         self.mapwin.mouse['box'] = 'line'
-        self.mapwin.pen = wx.Pen(colour='Red', width=2, style=wx.SHORT_DASH)
-        self.mapwin.polypen = wx.Pen(colour='dark green', width=2, style=wx.SHORT_DASH)
+        self.mapwin.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
+        self.mapwin.polypen = wx.Pen(colour = 'dark green', width = 2, style = wx.SHORT_DASH)
         self.mapwin.SetCursor(self.Parent.cursors["cross"])
 
     def OnSelectRaster(self, event):
         """!Select raster map(s) to profile
         """
-        dlg = SetRasterDialog(parent=self)
+        dlg = SetRasterDialog(parent = self)
 
         if dlg.ShowModal() == wx.ID_OK:
             for r in self.raster.keys():
@@ -238,7 +231,7 @@
 
             # plot profile
             if self.raster[0]['name'] and len(self.mapwin.polycoords) > 0:
-                self.OnCreateProfile(event=None)
+                self.OnCreateProfile(event = None)
 
         dlg.Destroy()
 
@@ -419,29 +412,25 @@
             transect_res = self.transect_length / 500
         else: transect_res = curr_res
         
-        try:
-            ret = gcmd.RunCommand("r.profile",
-                             input=raster,
-                             profile=coords,
-                             res=transect_res,
-                             null="nan",
-                             quiet=True,
-                             read = True)
+        ret = gcmd.RunCommand("r.profile",
+                              parent = self,
+                              input = raster,
+                              profile = coords,
+                              res = transect_res,
+                              null = "nan",
+                              quiet = True,
+                              read = True)
+        
+        if not ret:
+            return dataset
             
-            if not ret:
-                return dataset
-            
-            for line in ret.splitlines():
-                dist, elev = line.strip().split(' ')
-                if elev != 'nan':
-                    datalist.append((dist,elev))
+        for line in ret.splitlines():
+            dist, elev = line.strip().split(' ')
+            if elev != 'nan':
+                datalist.append((dist,elev))
 
-            return datalist
-        except gcmd.GException, e:
-            gcmd.GError(parent = self,
-                        message = e.value)
-            return None
-
+        return datalist
+    
     def OnCreateProfile(self, event):
         """!Main routine for creating a profile. Uses r.profile to
         create a list of distance,cell value pairs. This is passed to
@@ -451,10 +440,10 @@
         """
     
         if len(self.mapwin.polycoords) == 0 or self.raster[0]['name'] == '':
-            dlg = wx.MessageDialog(parent=self,
-                                   message=_('You must draw a transect to profile in the map display window.'),
-                                   caption=_('Nothing to profile'),
-                                   style=wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
+            dlg = wx.MessageDialog(parent = self,
+                                   message = _('You must draw a transect to profile in the map display window.'),
+                                   caption = _('Nothing to profile'),
+                                   style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
             dlg.ShowModal()
             dlg.Destroy()
             return
@@ -480,14 +469,14 @@
         self.plotlist = []
         if len(self.seglist) > 0 :
             self.ppoints = plot.PolyMarker(self.seglist,
-                                           legend=' ' + self.properties['marker']['legend'],
-                                           colour=wx.Color(self.properties['marker']['color'][0],
+                                           legend = ' ' + self.properties['marker']['legend'],
+                                           colour = wx.Color(self.properties['marker']['color'][0],
                                                            self.properties['marker']['color'][1],
                                                            self.properties['marker']['color'][2],
                                                            255),
-                                           size=self.properties['marker']['size'],
-                                           fillstyle=self.ptfilldict[self.properties['marker']['fill']],
-                                           marker=self.properties['marker']['type'])
+                                           size = self.properties['marker']['size'],
+                                           fillstyle = self.ptfilldict[self.properties['marker']['fill']],
+                                           marker = self.properties['marker']['type'])
             self.plotlist.append(self.ppoints)
 
         for r in self.raster.itervalues():
@@ -497,10 +486,10 @@
                                r['prop']['pcolor'][2],
                                255)
                 r['pline'] = plot.PolyLine(r['datalist'],
-                                           colour=col,
-                                           width=r['prop']['pwidth'],
-                                           style=self.pstyledict[r['prop']['pstyle']],
-                                           legend=r['plegend'])
+                                           colour = col,
+                                           width = r['prop']['pwidth'],
+                                           style = self.pstyledict[r['prop']['pstyle']],
+                                           legend = r['plegend'])
 
                 self.plotlist.append(r['pline'])
 
@@ -575,11 +564,10 @@
         """    
         wildcard = _("Comma separated value (*.csv)|*.csv")
         
-        dlg = wx.FileDialog(
-            self, message=_("Path and prefix (for raster name) to save profile values..."),
-            defaultDir=os.getcwd(), 
-            defaultFile="",  wildcard=wildcard, style=wx.SAVE
-            )
+        dlg = wx.FileDialog(parent = self,
+                            message = _("Path and prefix (for raster name) to save profile values..."),
+                            defaultDir = os.getcwd(), 
+                            defaultFile = "",  wildcard = wildcard, style = wx.SAVE)
         if dlg.ShowModal() == wx.ID_OK:
             path = dlg.GetPath()
             
@@ -593,9 +581,9 @@
                 try:
                     file = open(pfile, "w")
                 except IOError:
-                    wx.MessageBox(parent=self,
-                                  message=_("Unable to open file <%s> for writing.") % pfile,
-                                  caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+                    wx.MessageBox(parent = self,
+                                  message = _("Unable to open file <%s> for writing.") % pfile,
+                                  caption = _("Error"), style = wx.OK | wx.ICON_ERROR | wx.CENTRE)
                     return False
                 for datapair in r['datalist']:
                     file.write('%d,%d\n' % (float(datapair[0]),float(datapair[1])))
@@ -627,9 +615,9 @@
         dc.DrawText(s, sx , sy+1)
 
     def OnMouseLeftDown(self,event):
-        s= "Left Mouse Down at Point: (%.4f, %.4f)" % self.client._getXY(event)
-        self.SetStatusText(s)
-        event.Skip()            #allows plotCanvas OnMouseLeftDown to be called
+        self.SetStatusText(_("Left Mouse Down at Point: (%.4f, %.4f)") % \
+                               self.client._getXY(event))
+        event.Skip() # allows plotCanvas OnMouseLeftDown to be called
 
     def OnMotion(self, event):
         # indicate when mouse is outside the plot area
@@ -638,11 +626,11 @@
         if self.client.GetEnablePointLabel() == True:
             #make up dict with info for the pointLabel
             #I've decided to mark the closest point on the closest curve
-            dlst= self.client.GetClosetPoint( self.client._getXY(event), pointScaled= True)
+            dlst= self.client.GetClosetPoint( self.client._getXY(event), pointScaled =  True)
             if dlst != []:      #returns [] if none
                 curveNum, legend, pIndex, pointXY, scaledXY, distance = dlst
                 #make up dictionary to pass to my user function (see DrawPointLabel)
-                mDataDict= {"curveNum":curveNum, "legend":legend, "pIndex":pIndex,\
+                mDataDict =  {"curveNum":curveNum, "legend":legend, "pIndex":pIndex,\
                     "pointXY":pointXY, "scaledXY":scaledXY}
                 #pass dict to update the pointLabel
                 self.client.UpdatePointLabel(mDataDict)
@@ -651,17 +639,14 @@
     def ProfileOptionsMenu(self, event):
         """!Popup menu for profile and text options
         """
-        point = wx.GetMousePosition()
         popt = wx.Menu()
-        # Add items to the menu
-        settext = wx.MenuItem(popt, -1, 'Profile text settings')
-        popt.AppendItem(settext)
-        self.Bind(wx.EVT_MENU, self.PText, settext)
-
-        setgrid = wx.MenuItem(popt, -1, 'Profile plot settings')
-        popt.AppendItem(setgrid)
-        self.Bind(wx.EVT_MENU, self.POptions, setgrid)
-
+        
+        for title, handler in ((_('Profile text settings'), self.PText),
+                               (_('Profile plot settings'), self.POptions)):
+            item = wx.MenuItem(popt, wx.ID_ANY, title)
+            popt.AppendItem(item)
+            self.Bind(wx.EVT_MENU, handler, item)
+        
         # Popup the menu.  If an item is selected then its handler
         # will be called before PopupMenu returns.
         self.PopupMenu(popt)
@@ -694,12 +679,12 @@
             self.profile.setXLabel(dlg.xlabel)
             self.profile.setYLabel(dlg.ylabel)
         
-        self.OnRedraw(event=None)
+        self.OnRedraw(event = None)
     
     def PText(self, event):
         """!Set custom text values for profile title and axis labels.
         """
-        dlg = TextDialog(parent=self, id=wx.ID_ANY, title=_('Profile text settings'))
+        dlg = TextDialog(parent = self, id = wx.ID_ANY, title = _('Profile text settings'))
 
         if dlg.ShowModal() == wx.ID_OK:
             self.OnPText(dlg)
@@ -711,7 +696,7 @@
         style; marker size, color, fill, and style; grid and legend
         options.  Calls OptDialog class.
         """
-        dlg = OptDialog(parent=self, id=wx.ID_ANY, title=_('Profile settings'))
+        dlg = OptDialog(parent = self, id = wx.ID_ANY, title = _('Profile settings'))
         btnval = dlg.ShowModal()
 
         if btnval == wx.ID_SAVE:
@@ -724,21 +709,15 @@
     def PrintMenu(self, event):
         """!Print options and output menu
         """
-        point = wx.GetMousePosition()
         printmenu = wx.Menu()
-        # Add items to the menu
-        setup = wx.MenuItem(printmenu, -1,'Page setup')
-        printmenu.AppendItem(setup)
-        self.Bind(wx.EVT_MENU, self.OnPageSetup, setup)
-
-        preview = wx.MenuItem(printmenu, -1,'Print preview')
-        printmenu.AppendItem(preview)
-        self.Bind(wx.EVT_MENU, self.OnPrintPreview, preview)
-
-        doprint = wx.MenuItem(printmenu, -1,'Print display')
-        printmenu.AppendItem(doprint)
-        self.Bind(wx.EVT_MENU, self.OnDoPrint, doprint)
-
+        
+        for title, handler in ((_('Page setup'), self.OnPageSetup),
+                               (_('Print preview'), self.OnPrintPreview),
+                               (_('Print display'), self.OnDoPrint)):
+            item = wx.MenuItem(printmenu, wx.ID_ANY, title)
+            printmenu.AppendItem(item)
+            self.Bind(wx.EVT_MENU, handler, item)
+        
         # Popup the menu.  If an item is selected then its handler
         # will be called before PopupMenu returns.
         self.PopupMenu(printmenu)
@@ -767,19 +746,17 @@
         self.mapwin.polycoords = []
         self.mapwin.SetCursor(self.Parent.cursors["default"])
 
-        self.mapwin.UpdateMap(render=False, renderVector=False)
+        self.mapwin.UpdateMap(render = False, renderVector = False)
 
         self.Destroy()
 
 class SetRasterDialog(wx.Dialog):
-    def __init__(self, parent, id=wx.ID_ANY, title=_("Select raster map to profile"),
-                 pos=wx.DefaultPosition, size=wx.DefaultSize,
-                 style=wx.DEFAULT_DIALOG_STYLE):
+    def __init__(self, parent, id = wx.ID_ANY, title = _("Select raster map to profile"),
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
         """!Dialog to select raster maps to profile.
         """
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
 
-        wx.Dialog.__init__(self, parent, id, title, pos, size, style)
-
         self.parent = parent
         self.coordstr = self.parent.coordstr
 
@@ -803,33 +780,33 @@
 
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.GridBagSizer (hgap=3, vgap=3)
+        box = wx.GridBagSizer (hgap = 3, vgap = 3)
         
         i = 0
         for txt in [_("Select raster map 1 (required):"),
                     _("Select raster map 2 (optional):"),
                     _("Select raster map 3 (optional):")]:
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=txt)
-            box.Add(item=label,
-                    flag=wx.ALIGN_CENTER_VERTICAL, pos=(i, 0))
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = txt)
+            box.Add(item = label,
+                    flag = wx.ALIGN_CENTER_VERTICAL, pos = (i, 0))
             
-            selection = gselect.Select(self, id=wx.ID_ANY,
-                                       size=globalvar.DIALOG_GSELECT_SIZE,
-                                       type='cell')
+            selection = Select(self, id = wx.ID_ANY,
+                               size = globalvar.DIALOG_GSELECT_SIZE,
+                               type = 'cell')
             selection.SetValue(str(self.raster[i]['name']))
             self.raster[i]['id'] = selection.GetChildren()[0].GetId()
             selection.Bind(wx.EVT_TEXT, self.OnSelection)
             
-            box.Add(item=selection, pos=(i, 1))
+            box.Add(item = selection, pos = (i, 1))
             
             i += 1 
             
-        sizer.Add(item=box, proportion=0,
-                  flag=wx.ALL, border=10)
+        sizer.Add(item = box, proportion = 0,
+                  flag = wx.ALL, border = 10)
 
-        line = wx.StaticLine(parent=self, id=wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
-        sizer.Add(item=line, proportion=0,
-                  flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border=5)
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 5)
 
         btnsizer = wx.StdDialogButtonSizer()
 
@@ -841,7 +818,7 @@
         btnsizer.AddButton(btn)
         btnsizer.Realize()
 
-        sizer.Add(item=btnsizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
+        sizer.Add(item = btnsizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
         self.SetSizer(sizer)
         sizer.Fit(self)
@@ -854,12 +831,12 @@
                 break
 
 class TextDialog(wx.Dialog):
-    def __init__(self, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
-                 style=wx.DEFAULT_DIALOG_STYLE):
+    def __init__(self, parent, id, title, 
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
         """!Dialog to set profile text options: font, title
         and font size, axis labels and font size
         """
-        wx.Dialog.__init__(self, parent, id, title, pos, size, style)
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
         #
         # initialize variables
         #
@@ -900,124 +877,124 @@
         # dialog layout
         sizer = wx.BoxSizer(wx.VERTICAL)
 
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Text settings"))
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Text settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
 
         #
         # profile title
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Profile title:"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
-        self.ptitleentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(250,-1))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Profile title:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        self.ptitleentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (250,-1))
         # self.ptitleentry.SetFont(self.font)
         self.ptitleentry.SetValue(self.ptitle)
-        gridSizer.Add(item=self.ptitleentry, pos=(0, 1))
+        gridSizer.Add(item = self.ptitleentry, pos = (0, 1))
 
         #
         # title font
         #
-        tlabel = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Title font size (pts):"))
-        gridSizer.Add(item=tlabel, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
-        self.ptitlesize = wx.SpinCtrl(parent=self, id=wx.ID_ANY, value="", pos=(30, 50),
-                                      size=(50,-1), style=wx.SP_ARROW_KEYS)
+        tlabel = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Title font size (pts):"))
+        gridSizer.Add(item = tlabel, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.ptitlesize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                      size = (50,-1), style = wx.SP_ARROW_KEYS)
         self.ptitlesize.SetRange(5,100)
         self.ptitlesize.SetValue(int(self.properties['font']['prop']['titleSize']))
-        gridSizer.Add(item=self.ptitlesize, pos=(1, 1))
+        gridSizer.Add(item = self.ptitlesize, pos = (1, 1))
 
         #
         # x-axis label
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("X-axis label:"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
-        self.xlabelentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(250,-1))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("X-axis label:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+        self.xlabelentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (250,-1))
         # self.xlabelentry.SetFont(self.font)
         self.xlabelentry.SetValue(self.xlabel)
-        gridSizer.Add(item=self.xlabelentry, pos=(2, 1))
+        gridSizer.Add(item = self.xlabelentry, pos = (2, 1))
 
         #
         # y-axis label
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Y-axis label:"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
-        self.ylabelentry = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(250,-1))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Y-axis label:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+        self.ylabelentry = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (250,-1))
         # self.ylabelentry.SetFont(self.font)
         self.ylabelentry.SetValue(self.ylabel)
-        gridSizer.Add(item=self.ylabelentry, pos=(3, 1))
+        gridSizer.Add(item = self.ylabelentry, pos = (3, 1))
 
         #
         # font size
         #
-        llabel = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Label font size (pts):"))
-        gridSizer.Add(item=llabel, flag=wx.ALIGN_CENTER_VERTICAL, pos=(4, 0))
-        self.axislabelsize = wx.SpinCtrl(parent=self, id=wx.ID_ANY, value="", pos=(30, 50),
-                                         size=(50, -1), style=wx.SP_ARROW_KEYS)
+        llabel = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Label font size (pts):"))
+        gridSizer.Add(item = llabel, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+        self.axislabelsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", pos = (30, 50),
+                                         size = (50, -1), style = wx.SP_ARROW_KEYS)
         self.axislabelsize.SetRange(5, 100) 
         self.axislabelsize.SetValue(int(self.properties['font']['prop']['axisSize']))
-        gridSizer.Add(item=self.axislabelsize, pos=(4,1))
+        gridSizer.Add(item = self.axislabelsize, pos = (4,1))
 
-        boxSizer.Add(item=gridSizer)
-        sizer.Add(item=boxSizer, flag=wx.ALL | wx.EXPAND, border=3)
+        boxSizer.Add(item = gridSizer)
+        sizer.Add(item = boxSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         #
         # font settings
         #
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Font settings"))
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Font settings"))
         boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
-        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
         gridSizer.AddGrowableCol(1)
 
         #
         # font family
         #
-        label1 = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Font family:"))
-        gridSizer.Add(item=label1, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
-        self.ffamilycb = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(250, -1),
-                                choices=self.ffamilydict.keys(), style=wx.CB_DROPDOWN)
+        label1 = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Font family:"))
+        gridSizer.Add(item = label1, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        self.ffamilycb = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+                                     choices = self.ffamilydict.keys(), style = wx.CB_DROPDOWN)
         self.ffamilycb.SetStringSelection('swiss')
         for item in self.ffamilydict.items():
             if self.fontfamily == item[1]:
                 self.ffamilycb.SetStringSelection(item[0])
                 break
-        gridSizer.Add(item=self.ffamilycb, pos=(0, 1), flag=wx.ALIGN_RIGHT)
+        gridSizer.Add(item = self.ffamilycb, pos = (0, 1), flag = wx.ALIGN_RIGHT)
 
         #
         # font style
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style:"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
-        self.fstylecb = wx.ComboBox(parent=self, id=wx.ID_ANY, size=(250, -1),
-                                    choices=self.fstyledict.keys(), style=wx.CB_DROPDOWN)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        self.fstylecb = wx.ComboBox(parent = self, id = wx.ID_ANY, size = (250, -1),
+                                    choices = self.fstyledict.keys(), style = wx.CB_DROPDOWN)
         self.fstylecb.SetStringSelection('normal')
         for item in self.fstyledict.items():
             if self.fontstyle == item[1]:
                 self.fstylecb.SetStringSelection(item[0])
                 break
-        gridSizer.Add(item=self.fstylecb, pos=(1, 1), flag=wx.ALIGN_RIGHT)
+        gridSizer.Add(item = self.fstylecb, pos = (1, 1), flag = wx.ALIGN_RIGHT)
 
         #
         # font weight
         #
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Weight:"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
-        self.fwtcb = wx.ComboBox(parent=self, size=(250, -1),
-                                 choices=self.fwtdict.keys(), style=wx.CB_DROPDOWN)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Weight:"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+        self.fwtcb = wx.ComboBox(parent = self, size = (250, -1),
+                                 choices = self.fwtdict.keys(), style = wx.CB_DROPDOWN)
         self.fwtcb.SetStringSelection('normal')
         for item in self.fwtdict.items():
             if self.fontweight == item[1]:
                 self.fwtcb.SetStringSelection(item[0])
                 break
 
-        gridSizer.Add(item=self.fwtcb, pos=(2, 1), flag=wx.ALIGN_RIGHT)
+        gridSizer.Add(item = self.fwtcb, pos = (2, 1), flag = wx.ALIGN_RIGHT)
                       
-        boxSizer.Add(item=gridSizer, flag=wx.EXPAND)
-        sizer.Add(item=boxSizer, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
+        boxSizer.Add(item = gridSizer, flag = wx.EXPAND)
+        sizer.Add(item = boxSizer, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
 
-        line = wx.StaticLine(parent=self, id=wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
-        sizer.Add(item=line, proportion=0,
-                  flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border=3)
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
 
         #
         # buttons
@@ -1047,9 +1024,9 @@
         btnStdSizer.Realize()
         
         btnSizer = wx.BoxSizer(wx.HORIZONTAL)
-        btnSizer.Add(item=btnSave, proportion=0, flag=wx.ALIGN_LEFT | wx.ALL, border=5)
-        btnSizer.Add(item=btnStdSizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
-        sizer.Add(item=btnSizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
+        btnSizer.Add(item = btnSave, proportion = 0, flag = wx.ALIGN_LEFT | wx.ALL, border = 5)
+        btnSizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
+        sizer.Add(item = btnSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
         #
         # bindings
@@ -1085,8 +1062,8 @@
         """!Button 'Save' pressed"""
         self.UpdateSettings()
         fileSettings = {}
-        UserSettings.ReadSettingsFile(settings=fileSettings)
-        fileSettings['profile'] = UserSettings.Get(group='profile')
+        UserSettings.ReadSettingsFile(settings = fileSettings)
+        fileSettings['profile']  =  UserSettings.Get(group = 'profile')
         file = UserSettings.SaveToFile(fileSettings)
         self.parent.parent.GetLayerManager().goutput.WriteLog(_('Profile settings saved to file \'%s\'.') % file)
         self.EndModal(wx.ID_OK)
@@ -1106,13 +1083,13 @@
         self.EndModal(wx.ID_CANCEL)
         
 class OptDialog(wx.Dialog):
-    def __init__(self, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize,
-                 style=wx.DEFAULT_DIALOG_STYLE): 
+    def __init__(self, parent, id, title, 
+                 style = wx.DEFAULT_DIALOG_STYLE, **kwargs):
         """!Dialog to set various profile options, including: line
         width, color, style; marker size, color, fill, and style; grid
         and legend options.
         """
-        wx.Dialog.__init__(self, parent, id, title, pos, size, style)
+        wx.Dialog.__init__(self, parent, id, title, style = style, **kwargs)
         # init variables
         self.pstyledict = parent.pstyledict
         self.ptfilldict = parent.ptfilldict
@@ -1148,8 +1125,8 @@
         #
         # profile line settings
         #
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Profile line settings"))
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Profile line settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
         idx = 1
@@ -1158,113 +1135,113 @@
         self.wxId['pstyle'] = []
         self.wxId['plegend'] = []
         for r in self.raster.itervalues():
-            box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                               label=" %s %d " % (_("Profile"), idx))
+            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                               label = " %s %d " % (_("Profile"), idx))
             boxSizer = wx.StaticBoxSizer(box, wx.VERTICAL)
             
-            gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
             row = 0            
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Line color"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            pcolor = csel.ColourSelect(parent=self, id=wx.ID_ANY, colour=r['prop']['pcolor'])
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line color"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            pcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = r['prop']['pcolor'])
             self.wxId['pcolor'].append(pcolor.GetId())
-            gridSizer.Add(item=pcolor, pos=(row, 1))
+            gridSizer.Add(item = pcolor, pos = (row, 1))
 
             row += 1
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Line width"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            pwidth = wx.SpinCtrl(parent=self, id=wx.ID_ANY, value="",
-                                 size=(50,-1), style=wx.SP_ARROW_KEYS)
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line width"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            pwidth = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+                                 size = (50,-1), style = wx.SP_ARROW_KEYS)
             pwidth.SetRange(1, 10)
             pwidth.SetValue(r['prop']['pwidth'])
             self.wxId['pwidth'].append(pwidth.GetId())
-            gridSizer.Add(item=pwidth, pos=(row, 1))
+            gridSizer.Add(item = pwidth, pos = (row, 1))
 
             row +=1
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Line style"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            pstyle = wx.ComboBox(parent=self, id=wx.ID_ANY, 
-                                 size=(120, -1), choices=self.pstyledict.keys(), style=wx.CB_DROPDOWN)
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Line style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            pstyle = wx.ComboBox(parent = self, id = wx.ID_ANY, 
+                                 size = (120, -1), choices = self.pstyledict.keys(), style = wx.CB_DROPDOWN)
             pstyle.SetStringSelection(r['prop']['pstyle'])
             self.wxId['pstyle'].append(pstyle.GetId())
-            gridSizer.Add(item=pstyle, pos=(row, 1))
+            gridSizer.Add(item = pstyle, pos = (row, 1))
 
             row += 1
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            plegend = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(200,-1))
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            plegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
             plegend.SetValue(r['plegend'])
-            gridSizer.Add(item=plegend, pos=(row, 1))
+            gridSizer.Add(item = plegend, pos = (row, 1))
             self.wxId['plegend'].append(plegend.GetId())
-            boxSizer.Add(item=gridSizer)
+            boxSizer.Add(item = gridSizer)
 
             if idx == 0:
                 flag = wx.ALL
             else:
                 flag = wx.TOP | wx.BOTTOM | wx.RIGHT
-            boxMainSizer.Add(item=boxSizer, flag=flag, border=3)
+            boxMainSizer.Add(item = boxSizer, flag = flag, border = 3)
 
             idx += 1
             
-        sizer.Add(item=boxMainSizer, flag=wx.ALL | wx.EXPAND, border=3)
+        sizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         middleSizer = wx.BoxSizer(wx.HORIZONTAL)
         
         #
         # segment marker settings
         #
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Transect segment marker settings"))
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Transect segment marker settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
         self.wxId['marker'] = {}
-        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Color"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(0, 0))
-        ptcolor = csel.ColourSelect(parent=self, id=wx.ID_ANY, colour=self.properties['marker']['color'])
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Color"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (0, 0))
+        ptcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.properties['marker']['color'])
         self.wxId['marker']['color'] = ptcolor.GetId()
-        gridSizer.Add(item=ptcolor, pos=(0, 1))
+        gridSizer.Add(item = ptcolor, pos = (0, 1))
 
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Size"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(1, 0))
-        ptsize = wx.SpinCtrl(parent=self, id=wx.ID_ANY, value="",
-                             size=(50, -1), style=wx.SP_ARROW_KEYS)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Size"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (1, 0))
+        ptsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "",
+                             size = (50, -1), style = wx.SP_ARROW_KEYS)
         ptsize.SetRange(1, 10)
         ptsize.SetValue(self.properties['marker']['size'])
         self.wxId['marker']['size'] = ptsize.GetId()
-        gridSizer.Add(item=ptsize, pos=(1, 1))
+        gridSizer.Add(item = ptsize, pos = (1, 1))
         
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(2, 0))
-        ptfill = wx.ComboBox(parent=self, id=wx.ID_ANY,
-                             size=(120, -1), choices=self.ptfilldict.keys(), style=wx.CB_DROPDOWN)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (2, 0))
+        ptfill = wx.ComboBox(parent = self, id = wx.ID_ANY,
+                             size = (120, -1), choices = self.ptfilldict.keys(), style = wx.CB_DROPDOWN)
         ptfill.SetStringSelection(self.properties['marker']['fill'])
         self.wxId['marker']['fill'] = ptfill.GetId()
-        gridSizer.Add(item=ptfill, pos=(2, 1))
+        gridSizer.Add(item = ptfill, pos = (2, 1))
         
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(3, 0))
-        ptlegend = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(200,-1))
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (3, 0))
+        ptlegend = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (200,-1))
         ptlegend.SetValue(self.properties['marker']['legend'])
         self.wxId['marker']['legend'] = ptlegend.GetId()
-        gridSizer.Add(item=ptlegend, pos=(3, 1))
+        gridSizer.Add(item = ptlegend, pos = (3, 1))
                 
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Type"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(4, 0))
-        pttype = wx.ComboBox(parent=self, 
-                             size=(200, -1), choices=self.pttypelist, style=wx.CB_DROPDOWN)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Type"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (4, 0))
+        pttype = wx.ComboBox(parent = self, 
+                             size = (200, -1), choices = self.pttypelist, style = wx.CB_DROPDOWN)
         pttype.SetStringSelection(self.properties['marker']['type'])
         self.wxId['marker']['type'] = pttype.GetId()
-        gridSizer.Add(item=pttype, pos=(4, 1))
+        gridSizer.Add(item = pttype, pos = (4, 1))
 
-        boxMainSizer.Add(item=gridSizer, flag=wx.ALL, border=3)
-        middleSizer.Add(item=boxMainSizer, flag=wx.ALL | wx.EXPAND, border=3)
+        boxMainSizer.Add(item = gridSizer, flag = wx.ALL, border = 3)
+        middleSizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         #
         # axis options
         #
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Axis settings"))
+        box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Axis settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
 
         self.wxId['x-axis'] = {}
@@ -1272,55 +1249,55 @@
         idx = 0
         for axis, atype in [(_("X-Axis"), 'x-axis'),
                      (_("Y-Axis"), 'y-axis')]:
-            box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                               label=" %s " % axis)
+            box = wx.StaticBox(parent = self, id = wx.ID_ANY,
+                               label = " %s " % axis)
             boxSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
-            gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+            gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
 
             prop = self.properties[atype]['prop']
             
             row = 0
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Style"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            type = wx.ComboBox(parent=self, id=wx.ID_ANY,
-                               size=(100, -1), choices=self.axislist, style=wx.CB_DROPDOWN)
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Style"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            type = wx.ComboBox(parent = self, id = wx.ID_ANY,
+                               size = (100, -1), choices = self.axislist, style = wx.CB_DROPDOWN)
             type.SetStringSelection(prop['type']) 
             self.wxId[atype]['type'] = type.GetId()
-            gridSizer.Add(item=type, pos=(row, 1))
+            gridSizer.Add(item = type, pos = (row, 1))
             
             row += 1
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Custom min"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            min = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(70, -1))
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Custom min"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            min = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (70, -1))
             min.SetValue(str(prop['min']))
             self.wxId[atype]['min'] = min.GetId()
-            gridSizer.Add(item=min, pos=(row, 1))
+            gridSizer.Add(item = min, pos = (row, 1))
 
             row += 1
-            label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Custom max"))
-            gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-            max = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(70, -1))
+            label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Custom max"))
+            gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+            max = wx.TextCtrl(parent = self, id = wx.ID_ANY, value = "", size = (70, -1))
             max.SetValue(str(prop['max']))
             self.wxId[atype]['max'] = max.GetId()
-            gridSizer.Add(item=max, pos=(row, 1))
+            gridSizer.Add(item = max, pos = (row, 1))
             
             row += 1
-            log = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Log scale"))
+            log = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _("Log scale"))
             log.SetValue(prop['log'])
             self.wxId[atype]['log'] = log.GetId()
-            gridSizer.Add(item=log, pos=(row, 0), span=(1, 2))
+            gridSizer.Add(item = log, pos = (row, 0), span = (1, 2))
 
             if idx == 0:
                 flag = wx.ALL | wx.EXPAND
             else:
                 flag = wx.TOP | wx.BOTTOM | wx.RIGHT | wx.EXPAND
 
-            boxSizer.Add(item=gridSizer, flag=wx.ALL, border=3)
-            boxMainSizer.Add(item=boxSizer, flag=flag, border=3)
+            boxSizer.Add(item = gridSizer, flag = wx.ALL, border = 3)
+            boxMainSizer.Add(item = boxSizer, flag = flag, border = 3)
 
             idx += 1
             
-        middleSizer.Add(item=boxMainSizer, flag=wx.ALL | wx.EXPAND, border=3)
+        middleSizer.Add(item = boxMainSizer, flag = wx.ALL | wx.EXPAND, border = 3)
 
         #
         # grid & legend options
@@ -1328,52 +1305,52 @@
         self.wxId['grid'] = {}
         self.wxId['legend'] = {}
         self.wxId['font'] = {}
-        box = wx.StaticBox(parent=self, id=wx.ID_ANY,
-                           label=" %s " % _("Grid and Legend settings"))
+        box  =  wx.StaticBox(parent = self, id = wx.ID_ANY,
+                           label = " %s " % _("Grid and Legend settings"))
         boxMainSizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)
-        gridSizer = wx.GridBagSizer(vgap=5, hgap=5)
+        gridSizer = wx.GridBagSizer(vgap = 5, hgap = 5)
 
         row = 0
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Grid color"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-        gridcolor = csel.ColourSelect(parent=self, id=wx.ID_ANY, colour=self.properties['grid']['color'])
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Grid color"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        gridcolor = csel.ColourSelect(parent = self, id = wx.ID_ANY, colour = self.properties['grid']['color'])
         self.wxId['grid']['color'] = gridcolor.GetId()
-        gridSizer.Add(item=gridcolor, pos=(row, 1))
+        gridSizer.Add(item = gridcolor, pos = (row, 1))
 
         row +=1
-        gridshow = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Show grid"))
+        gridshow = wx.CheckBox(parent = self, id = wx.ID_ANY, label = _("Show grid"))
         gridshow.SetValue(self.properties['grid']['enabled'])
         self.wxId['grid']['enabled'] = gridshow.GetId()
-        gridSizer.Add(item=gridshow, pos=(row, 0), span=(1, 2))
+        gridSizer.Add(item = gridshow, pos = (row, 0), span = (1, 2))
 
         row +=1
-        label = wx.StaticText(parent=self, id=wx.ID_ANY, label=_("Legend font size"))
-        gridSizer.Add(item=label, flag=wx.ALIGN_CENTER_VERTICAL, pos=(row, 0))
-        legendfontsize = wx.SpinCtrl(parent=self, id=wx.ID_ANY, value="", 
-                                     size=(50, -1), style=wx.SP_ARROW_KEYS)
+        label = wx.StaticText(parent = self, id = wx.ID_ANY, label = _("Legend font size"))
+        gridSizer.Add(item = label, flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        legendfontsize = wx.SpinCtrl(parent = self, id = wx.ID_ANY, value = "", 
+                                     size = (50, -1), style = wx.SP_ARROW_KEYS)
         legendfontsize.SetRange(5,100)
         legendfontsize.SetValue(int(self.properties['font']['prop']['legendSize']))
         self.wxId['font']['legendSize'] = legendfontsize.GetId()
-        gridSizer.Add(item=legendfontsize, pos=(row, 1))
+        gridSizer.Add(item = legendfontsize, pos = (row, 1))
 
         row += 1
-        legendshow = wx.CheckBox(parent=self, id=wx.ID_ANY, label=_("Show legend"))
+        legendshow  =  wx.CheckBox(parent = self, id = wx.ID_ANY, label = _("Show legend"))
         legendshow.SetValue(self.properties['legend']['enabled'])
         self.wxId['legend']['enabled'] = legendshow.GetId()
-        gridSizer.Add(item=legendshow, pos=(row, 0), span=(1, 2))
+        gridSizer.Add(item = legendshow, pos = (row, 0), span = (1, 2))
 
-        boxMainSizer.Add(item=gridSizer, flag=flag, border=3)
+        boxMainSizer.Add(item = gridSizer, flag = flag, border = 3)
 
-        middleSizer.Add(item=boxMainSizer, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
+        middleSizer.Add(item = boxMainSizer, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
 
-        sizer.Add(item=middleSizer, flag=wx.ALL, border=0)
+        sizer.Add(item = middleSizer, flag = wx.ALL, border = 0)
         
         #
         # line & buttons
         #
-        line = wx.StaticLine(parent=self, id=wx.ID_ANY, size=(20, -1), style=wx.LI_HORIZONTAL)
-        sizer.Add(item=line, proportion=0,
-                  flag=wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border=3)
+        line = wx.StaticLine(parent = self, id = wx.ID_ANY, size = (20, -1), style = wx.LI_HORIZONTAL)
+        sizer.Add(item = line, proportion = 0,
+                  flag = wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT, border = 3)
 
         #
         # buttons
@@ -1399,7 +1376,7 @@
         btnStdSizer.AddButton(btnApply)
         btnStdSizer.Realize()
         
-        sizer.Add(item=btnStdSizer, proportion=0, flag=wx.ALIGN_RIGHT | wx.ALL, border=5)
+        sizer.Add(item = btnStdSizer, proportion = 0, flag = wx.ALIGN_RIGHT | wx.ALL, border = 5)
 
         self.SetSizer(sizer)
         sizer.Fit(self)
@@ -1435,8 +1412,8 @@
         """!Button 'Save' pressed"""
         self.UpdateSettings()
         fileSettings = {}
-        UserSettings.ReadSettingsFile(settings=fileSettings)
-        fileSettings['profile'] = UserSettings.Get(group='profile')
+        UserSettings.ReadSettingsFile(settings = fileSettings)
+        fileSettings['profile'] = UserSettings.Get(group = 'profile')
         file = UserSettings.SaveToFile(fileSettings)
         self.parent.parent.GetLayerManager().goutput.WriteLog(_('Profile settings saved to file \'%s\'.') % file)
         self.parent.SetGraphStyle()



More information about the grass-commit mailing list