Ver código fonte

wxGUI: clean up ProfileFrame and HistFrame constructors

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@48592 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 anos atrás
pai
commit
df93a065fc

+ 7 - 8
gui/wxpython/gui_modules/layertree.py

@@ -46,12 +46,12 @@ import mapdisp
 import render
 import histogram
 import utils
-import profile
-from debug import Debug as Debug
-from icon import Icons as Icons
+from wxplot      import ProfileFrame
+from debug       import Debug
+from icon        import Icons
 from preferences import globalSettings as UserSettings
-from vdigit import haveVDigit
-from gcmd import GWarning
+from vdigit      import haveVDigit
+from gcmd        import GWarning
 
 TREE_ITEM_HEIGHT = 25
 
@@ -521,9 +521,8 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.profileFrame = self.mapdisplay.profile
 
         if not self.profileFrame:
-            self.profileFrame = profile.ProfileFrame(self.mapdisplay,
-                                                     id = wx.ID_ANY, pos = wx.DefaultPosition, size = (700,300),
-                                                     style = wx.DEFAULT_FRAME_STYLE, rasterList = [mapLayer.GetName()])
+            self.profileFrame = ProfileFrame(parent = self.mapdisplay,
+                                             rasterList = [mapLayer.GetName()])
             # show new display
             self.profileFrame.Show()
         

+ 4 - 8
gui/wxpython/gui_modules/mapdisp.py

@@ -1645,10 +1645,8 @@ class MapFrame(wx.Frame):
                 self.tree.GetPyData(self.tree.layer_selected)[0]['type'] == 'raster':
             raster.append(self.tree.GetPyData(self.tree.layer_selected)[0]['maplayer'].name)
 
-        self.profile = ProfileFrame(self,
-                                            id = wx.ID_ANY, pos = wx.DefaultPosition, size = (700,300),
-                                            style = wx.DEFAULT_FRAME_STYLE, 
-                                            rasterList = raster)
+        self.profile = ProfileFrame(parent = self,
+                                    rasterList = raster)
         self.profile.Show()
         # Open raster select dialog to make sure that a raster (and the desired raster)
         # is selected to be profiled
@@ -1715,10 +1713,8 @@ class MapFrame(wx.Frame):
                 continue
             raster.append(self.tree.GetPyData(layer)[0]['maplayer'].GetName())
 
-        self.histogramPyPlot = HistFramePyPlot(self, id = wx.ID_ANY, 
-                                                pos = wx.DefaultPosition, size = (700,300),
-                                                style = wx.DEFAULT_FRAME_STYLE, 
-                                                rasterList = raster)
+        self.histogramPyPlot = HistFramePyPlot(parent = self,
+                                               rasterList = raster)
         self.histogramPyPlot.Show()
         # Open raster select dialog to make sure that a raster (and the desired raster)
         # is selected to be histogrammed

+ 9 - 7
gui/wxpython/gui_modules/wxplot.py

@@ -48,7 +48,7 @@ except ImportError:
 
 class AbstractPlotFrame(wx.Frame):
     """!Abstract PyPlot display frame class"""
-    def __init__(self, parent = None, id = wx.ID_ANY, title='', size = (700, 300),
+    def __init__(self, parent, id = wx.ID_ANY, title = '', size = (700, 400),
                  style = wx.DEFAULT_FRAME_STYLE, rasterList = [],  **kwargs):
 
         wx.Frame.__init__(self, parent, id, title, size = size, style = style, **kwargs)
@@ -497,11 +497,12 @@ class AbstractPlotFrame(wx.Frame):
         self.Destroy()
         
 class HistFrame(AbstractPlotFrame):
-    def __init__(self, parent, id, pos, style, size,
-                 title = _("GRASS Histogramming Tool"), rasterList = []):
+    def __init__(self, parent, title = _("GRASS Histogramming Tool"),
+                 rasterList = [], **kwargs):
         """!Mainframe for displaying histogram of raster map. Uses wx.lib.plot.
         """
-        AbstractPlotFrame.__init__(self, parent)
+        AbstractPlotFrame.__init__(self, parent, title = title,
+                                   rasterList = rasterList, **kwargs)
         
         self.toolbar = Histogram2Toolbar(parent = self)
         self.SetToolBar(self.toolbar)
@@ -678,10 +679,11 @@ class HistFrame(AbstractPlotFrame):
 class ProfileFrame(AbstractPlotFrame):
     """!Mainframe for displaying profile of one or more raster maps. Uses wx.lib.plot.
     """
-    def __init__(self, parent, id, pos, style, size,
-                 title = _("GRASS Profile Analysis Tool"), rasterList = []):
+    def __init__(self, parent, title = _("GRASS Profile Analysis Tool"),
+                 rasterList = [], **kwargs):
 
-        AbstractPlotFrame.__init__(self, parent)
+        AbstractPlotFrame.__init__(self, parent, title = title,
+                                   rasterList = rasterList, **kwargs)
 
         self.toolbar = ProfileToolbar(parent = self)
         self.SetToolBar(self.toolbar)