[GRASS-SVN] r54029 - in grass/trunk/gui/wxpython: gui_core nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Nov 25 04:14:03 PST 2012


Author: annakrat
Date: 2012-11-25 04:14:02 -0800 (Sun, 25 Nov 2012)
New Revision: 54029

Modified:
   grass/trunk/gui/wxpython/gui_core/dialogs.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/gui_core/ghelp.py
   grass/trunk/gui/wxpython/gui_core/goutput.py
   grass/trunk/gui/wxpython/gui_core/gselect.py
   grass/trunk/gui/wxpython/gui_core/mapdisp.py
   grass/trunk/gui/wxpython/gui_core/mapwindow.py
   grass/trunk/gui/wxpython/gui_core/preferences.py
   grass/trunk/gui/wxpython/gui_core/toolbars.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
Log:
wxGUI: fix indentation, remove unused code

Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -50,7 +50,7 @@
 from gui_core.gselect import ElementSelect, LocationSelect, MapsetSelect, Select, OgrTypeSelect, GdalSelect, MapsetSelect
 from gui_core.forms   import GUI
 from gui_core.widgets import SingleSymbolPanel, EVT_SYMBOL_SELECTION_CHANGED, GListCtrl
-from core.utils       import GetListOfMapsets, GetLayerNameFromCmd, GetValidLayerName
+from core.utils       import GetLayerNameFromCmd, GetValidLayerName
 from core.settings    import UserSettings, GetDisplayVectSettings
 from core.debug       import Debug
 
@@ -1076,7 +1076,7 @@
                                    caption = _("Unapplied changes"),
                                    style = wx.YES_NO | wx.ICON_QUESTION | wx.YES_DEFAULT)
             if dlg.ShowModal() == wx.ID_YES:
-                self.ApplyChanges(showResult = True)
+                self.ApplyChanges()
                 
             dlg.Destroy()
             
@@ -1189,7 +1189,7 @@
         """!Clear notification string"""
         self.infoLabel.SetLabel("")
        
-    def ApplyChanges(self, showResult):
+    def ApplyChanges(self):
         """!Create or edit group"""
         group = self.currentGroup
         if not group:
@@ -1212,11 +1212,11 @@
         
     def OnApply(self, event):
         """!Apply changes"""
-        self.ApplyChanges(showResult = True)
+        self.ApplyChanges()
         
     def OnOk(self, event):
         """!Apply changes and close dialog"""
-        if self.ApplyChanges(showResult = False):
+        if self.ApplyChanges():
             self.OnClose(event)
         
     def OnClose(self, event):
@@ -1448,8 +1448,8 @@
     def OnFilter(self, event):
         """!Apply filter for map names"""
         if len(event.GetString()) == 0:
-           self.layers.Set(self.map_layers) 
-           return 
+            self.layers.Set(self.map_layers) 
+            return 
         
         list = []
         for layer in self.map_layers:
@@ -2550,7 +2550,6 @@
         
         panels = []
         self.symbolPanels = []
-        maxImages = 0
         
         for folder in folders:
             panel = wx.Panel(parent, style = wx.BORDER_RAISED)

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -50,11 +50,11 @@
 import string
 import textwrap
 import os
-import time
 import copy
 import locale
 from threading import Thread
 import Queue
+import re
 
 gisbase = os.getenv("GISBASE")
 if gisbase is None:
@@ -196,7 +196,7 @@
                         self.data[win.GetParent().SetType] = {'etype': element_dict[type_param.get('value')]}
 
             map = layer = None
-            driver = db = table = None
+            driver = db = None
             if name in ('LayerSelect', 'ColumnSelect'):
                 if p.get('element', '') == 'vector': # -> vector
                     # get map name
@@ -336,8 +336,6 @@
         while True:
             requestId, callable, args, kwds = self.requestQ.get()
             
-            requestTime = time.time()
-            
             self.request = callable(*args, **kwds)
 
             self.resultQ.put((requestId, self.request.run()))
@@ -385,7 +383,7 @@
             pass
         
         wx.Frame.__init__(self, parent = parent, id = id, title = title,
-                          name = "MainFrame", **kwargs)
+                          name = "MainFrame", style = style, **kwargs)
         
         self.locale = wx.Locale(language = wx.LANGUAGE_DEFAULT)
         
@@ -627,8 +625,8 @@
                     hasattr(self, "closebox") and \
                     self.closebox.IsChecked() and \
                     (returncode == 0):
-                # was closed also when aborted but better is leave it open
-                wx.FutureCall(2000, self.Close)
+            # was closed also when aborted but better is leave it open
+            wx.FutureCall(2000, self.Close)
 
     def OnMapCreated(self, event):
         if hasattr(self, "addbox") and self.addbox.IsChecked():
@@ -824,7 +822,6 @@
         #
         # flags
         #
-        text_style = wx.FONTWEIGHT_NORMAL
         visible_flags = [ f for f in self.task.flags if not f.get('hidden', False) == True ]
         for f in visible_flags:
             which_sizer = tabsizer[ f['guisection'] ]
@@ -897,7 +894,6 @@
             else:
                 title = text_beautify(p['description'])
                 tooltip = None
-            txt = None
             
             prompt = p.get('prompt', '')
             
@@ -1132,7 +1128,6 @@
                                                        isRaster = isRaster)
                         p['wxId'] = [ selection.GetId(), ]
                         selection.Bind(wx.EVT_COMBOBOX, self.OnSetValue)
-                        formatSelector = False
                         selection.Bind(wx.EVT_TEXT, self.OnUpdateSelection)
                     else:
                         elem = p.get('element', None)
@@ -1757,7 +1752,10 @@
             win.SetValue('')
         
     def OnVectorFormat(self, event):
-        """!Change vector format (native / ogr)"""
+        """!Change vector format (native / ogr).
+
+        Currently unused.        
+        """
         sel = event.GetSelection()
         idEvent = event.GetId()
         p = self.task.get_param(value = idEvent, element = 'wxId', raiseError = False)
@@ -2083,7 +2081,7 @@
         """!Get validated command"""
         return self.cmd
     
-    def ParseCommand(self, cmd, gmpath = None, completed = None):
+    def ParseCommand(self, cmd, completed = None):
         """!Parse command
         
         Note: cmd is given as list
@@ -2092,7 +2090,6 @@
          - add key name for first parameter if not given
          - change mapname to mapname at mapset
         """
-        start = time.time()
         dcmd_params = {}
         if completed == None:
             get_dcmd = None
@@ -2134,13 +2131,13 @@
                 else: # parameter
                     try:
                         key, value = option.split('=', 1)
-                    except:
+                    except ValueError:
                         if self.grass_task.firstParam:
                             if i == 0: # add key name of first parameter if not given
                                 key = self.grass_task.firstParam
                                 value = option
                             else:
-                                raise GException, _("Unable to parse command '%s'") % ' '.join(cmd)
+                                raise gcmd.GException, _("Unable to parse command '%s'") % ' '.join(cmd)
                         else:
                             continue
                     

Modified: grass/trunk/gui/wxpython/gui_core/ghelp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/ghelp.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/ghelp.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -20,6 +20,7 @@
 import os
 import codecs
 import platform
+import re
 
 import wx
 from wx.html import HtmlWindow
@@ -629,7 +630,10 @@
         super(HelpWindow, self).OnLinkClicked(linkinfo)
         
     def fillContentsFromFile(self, htmlFile, skipDescription = True):
-        """!Load content from file"""
+        """!Load content from file.
+        
+        Currently not used.        
+        """
         aLink = re.compile(r'(<a href="?)(.+\.html?["\s]*>)', re.IGNORECASE)
         imgLink = re.compile(r'(<img src="?)(.+\.[png|gif])', re.IGNORECASE)
         try:

Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -707,7 +707,7 @@
     """!Standalone GConsole for testing only"""
     def __init__(self, parent, id = wx.ID_ANY, title = "GConsole Test Frame",
                  style = wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL, **kwargs):
-        wx.Frame.__init__(self, parent = parent, id = id, title = title)
+        wx.Frame.__init__(self, parent = parent, id = id, title = title, style = style)
 
         panel = wx.Panel(self, id = wx.ID_ANY)
         

Modified: grass/trunk/gui/wxpython/gui_core/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/gselect.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/gselect.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -658,7 +658,6 @@
         """!Reset"""
         for layer in self.layers:
             table = self.layers[layer]["table"] # get table desc
-            columns = self.tables[table]
             for name in self.tables[table].keys():
                 self.tables[table][name]['values'] = []
                 self.tables[table][name]['ids']    = []
@@ -2017,8 +2016,8 @@
             if self.mapWin and \
                     self.mapWin.UnregisterMouseEventHandler(wx.EVT_LEFT_DOWN,  
                                                             self._onMapClickHandler):
-                    self.registered = False
-                    return
+                self.registered = False
+                return
             
             self.buttonInsCoords.SetToggle(False)           
     

Modified: grass/trunk/gui/wxpython/gui_core/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapdisp.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/mapdisp.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -221,8 +221,8 @@
         raise NotImplementedError("GetWindow")
         
     def GetMapToolbar(self):
-       """!Returns toolbar with zooming tools"""
-       raise NotImplementedError("GetMapToolbar")
+        """!Returns toolbar with zooming tools"""
+        raise NotImplementedError("GetMapToolbar")
        
     def GetToolbar(self, name):
         """!Returns toolbar if exists else None.

Modified: grass/trunk/gui/wxpython/gui_core/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/mapwindow.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/mapwindow.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -37,7 +37,7 @@
      - Cell2Pixel (if it is possible)
     """
     def __init__(self, parent, giface, Map, frame,
-                 id = wx.ID_ANY, tree = None, lmgr = None, **kwargs):
+                 tree = None, lmgr = None, **kwargs):
         self.parent = parent # MapFrame
         self.Map    = Map
         self.frame = frame
@@ -91,7 +91,7 @@
             self.Bind(ev, self.EventTypeHandler(handlers))
     
     def EventTypeHandler(self, evHandlers):
-         return lambda event:self.HandlersCaller(event, evHandlers)  
+        return lambda event:self.HandlersCaller(event, evHandlers)  
     
     def HandlersCaller(self, event, handlers):
         """!Hepler function which calls all handlers registered for

Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -29,7 +29,6 @@
 import os
 import sys
 import copy
-import locale
 try:
     import pwd
     havePwd = True
@@ -47,7 +46,7 @@
 
 from core          import globalvar
 from core.gcmd     import RunCommand, GError
-from core.utils    import ListOfMapsets, GetColorTables, ReadEpsgCodes, GetSettingsPath, StoreEnvVariable
+from core.utils    import ListOfMapsets, GetColorTables, ReadEpsgCodes, StoreEnvVariable
 from core.settings import UserSettings
 from gui_core.dialogs import SymbolDialog
 
@@ -400,12 +399,7 @@
         panel.SetSizer(border)
         
         return panel
-    
 
-        panel.SetSizer(border)
-        
-        return panel
-
     def _createAppearancePage(self, notebook):
         """!Create notebook page for display settings"""
         panel = SP.ScrolledPanel(parent = notebook, id = wx.ID_ANY)
@@ -1600,16 +1594,7 @@
         border.Fit(self)
         
         self.Layout()
-        
-    def EvtRadioBox(self, event):
-        if event.GetInt() == 0:
-            self.fonttype = 'grassfont'
-        elif event.GetInt() == 1:
-            self.fonttype = 'truetype'
 
-        self.fontlist = self.GetFonts(self.fonttype)
-        self.fontlb.SetItems(self.fontlist)
-
     def OnEncoding(self, event):
         self.encoding = event.GetString()
 
@@ -1630,23 +1615,19 @@
         parses fonts directory or fretypecap file to get a list of fonts for the listbox
         """
         fontlist = []
-
-        cmd = ["d.font", "-l"]
-
         ret = RunCommand('d.font',
                          read = True,
                          flags = 'l')
-
         if not ret:
             return fontlist
 
         dfonts = ret.splitlines()
         dfonts.sort(lambda x,y: cmp(x.lower(), y.lower()))
         for item in range(len(dfonts)):
-           # ignore duplicate fonts and those starting with #
-           if not dfonts[item].startswith('#') and \
+            # ignore duplicate fonts and those starting with #
+            if not dfonts[item].startswith('#') and \
                   dfonts[item] != dfonts[item-1]:
-              fontlist.append(dfonts[item])
+                fontlist.append(dfonts[item])
 
         return fontlist
 
@@ -1728,8 +1709,7 @@
 
 class CheckListMapset(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):
     """!List of mapset/owner/group"""
-    def __init__(self, parent, pos = wx.DefaultPosition,
-                 log = None):
+    def __init__(self, parent, log = None):
         self.parent = parent
         
         wx.ListCtrl.__init__(self, parent, wx.ID_ANY,

Modified: grass/trunk/gui/wxpython/gui_core/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/toolbars.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/gui_core/toolbars.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -16,8 +16,6 @@
 @author Martin Landa <landa.martin gmail.com>
 """
 
-import os
-import sys
 import platform
 
 import wx

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2012-11-25 11:22:21 UTC (rev 54028)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2012-11-25 12:14:02 UTC (rev 54029)
@@ -72,7 +72,7 @@
         self.parent = parent # MapFrame
         
         glcanvas.GLCanvas.__init__(self, parent, id)
-        MapWindow.__init__(self, parent = parent, giface = giface, id = id, frame = frame,
+        MapWindow.__init__(self, parent = parent, giface = giface, frame = frame,
                            Map = Map, tree = tree, lmgr = lmgr)
         self.Hide()
         



More information about the grass-commit mailing list