Browse Source

wxGUI major code reorganization (more fixes)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@49363 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 13 years ago
parent
commit
187a27ee2a

+ 2 - 2
gui/wxpython/lmgr/layertree.py

@@ -545,8 +545,8 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.histogramFrame = self.mapdisplay.histogram
 
         if not self.histogramFrame:
-            self.histogramFrame = HistFrame(self, size = globalvar.HIST_WINDOW_SIZE,
-                                            style = wx.DEFAULT_FRAME_STYLE)
+            self.histogramFrame = HistogramFrame(self, size = globalvar.HIST_WINDOW_SIZE,
+                                                 style = wx.DEFAULT_FRAME_STYLE)
             self.histogramFrame.CentreOnScreen()
             # show new display
             self.histogramFrame.Show()

+ 5 - 7
gui/wxpython/mapdisp/frame.py

@@ -965,7 +965,7 @@ class MapFrame(MapFrameBase):
         self.MapWindow.SetCursor(self.cursors["pencil"])
         
         # initiating output
-        style = self._layerManager.goutput.cmd_output.StyleWarning
+        style = self._layerManager.goutput.cmdOutput.StyleWarning
         self._layerManager.goutput.WriteLog(_('Click and drag with left mouse button '
                                               'to measure.%s'
                                               'Double click with left button to clear.') % \
@@ -1035,10 +1035,8 @@ class MapFrame(MapFrameBase):
                 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(self, size = wx.Size(700, 300),
+                                    rasterList = raster)
         self.profile.Show()
         # Open raster select dialog to make sure that a raster (and the desired raster)
         # is selected to be profiled
@@ -1136,8 +1134,8 @@ class MapFrame(MapFrameBase):
     def OnHistogram(self, event):
         """!Init histogram display canvas and tools
         """
-        self.histogram = HistFrame(parent = self, id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
-                                   style = wx.DEFAULT_FRAME_STYLE)
+        self.histogram = HistogramFrame(parent = self, id = wx.ID_ANY, size = globalvar.HIST_WINDOW_SIZE,
+                                        style = wx.DEFAULT_FRAME_STYLE)
         
         # show new display
         self.histogram.Show()

+ 2 - 2
gui/wxpython/wxgui.py

@@ -1060,9 +1060,9 @@ class GMFrame(wx.Frame):
         cmd = self.GetMenuCmd(event)
         
         if cmd[0] == 'r.colors':
-            ctable = colorrules.RasterColorTable(self)
+            ctable = RasterColorTable(self)
         else:
-            ctable = colorrules.VectorColorTable(self, attributeType = 'color')
+            ctable = VectorColorTable(self, attributeType = 'color')
         ctable.CentreOnScreen()
         ctable.Show()
         

+ 1 - 0
gui/wxpython/wxplot/base.py

@@ -23,6 +23,7 @@ import wx.lib.plot as plot
 from core.globalvar import ETCICONDIR
 from core.settings  import UserSettings
 from wxplot.dialogs import TextDialog, OptDialog
+from core.render    import Map
 
 import grass.script as grass
 

+ 3 - 2
gui/wxpython/wxplot/dialogs.py

@@ -23,8 +23,9 @@ import wx
 import wx.lib.colourselect  as csel
 import wx.lib.scrolledpanel as scrolled
 
-from core          import globalvar
-from core.settings import UserSettings
+from core             import globalvar
+from core.settings    import UserSettings
+from gui_core.gselect import Select
 
 from grass.script import core  as grass
 

+ 6 - 4
gui/wxpython/wxplot/histogram.py

@@ -23,6 +23,8 @@ import grass.script as grass
 
 from gui_core.toolbars import BaseToolbar
 from wxplot.base       import BasePlotFrame
+from icons.icon        import Icons
+from wxplot.dialogs    import HistRasterDialog, PlotStatsFrame
 
 class Histogram2Frame(BasePlotFrame):
     def __init__(self, parent, id, pos, style, size, rasterList = []):
@@ -74,7 +76,7 @@ class Histogram2Frame(BasePlotFrame):
     def OnSelectRaster(self, event):
         """!Select raster map(s) to profile
         """
-        dlg = dialogs.HistRasterDialog(parent = self)
+        dlg = HistRasterDialog(parent = self)
 
         if dlg.ShowModal() == wx.ID_OK:
             self.rasterList = dlg.rasterList
@@ -211,8 +213,8 @@ class Histogram2Frame(BasePlotFrame):
             stats = _('Statistics for %s\n\n%s\n') % (rast, ret)
             message.append(stats)
             
-        stats = dialogs.PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
-                                      title = title)
+        stats = PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
+                               title = title)
 
         if stats.Show() == wx.ID_CLOSE:
             stats.Destroy()       
@@ -221,7 +223,7 @@ class Histogram2Toolbar(BaseToolbar):
     """!Toolbar for histogramming raster map
     """ 
     def __init__(self, parent):
-        AbstractToolbar.__init__(self, parent)
+        BaseToolbar.__init__(self, parent)
         
         self.InitToolbar(self._toolbarData())
         

+ 8 - 6
gui/wxpython/wxplot/profile.py

@@ -36,13 +36,15 @@ except ImportError:
 
 from wxplot.base       import BasePlotFrame
 from gui_core.toolbars import BaseToolbar
+from icons.icon        import Icons
+from wxplot.dialogs    import ProfileRasterDialog, PlotStatsFrame
 
 class ProfileFrame(BasePlotFrame):
     """!Mainframe for displaying profile of one or more raster maps. Uses wx.lib.plot.
     """
-    def __init__(self, parent, id, pos, style, size, rasterList = []):
-
-        BasePlotFrame.__init__(self, parent)
+    def __init__(self, parent, id = wx.ID_ANY, style = wx.DEFAULT_FRAME_STYLE, 
+                 rasterList = [], **kwargs):
+        BasePlotFrame.__init__(self, parent, **kwargs)
 
         self.toolbar = ProfileToolbar(parent = self)
         self.SetToolBar(self.toolbar)
@@ -102,7 +104,7 @@ class ProfileFrame(BasePlotFrame):
     def OnSelectRaster(self, event):
         """!Select raster map(s) to profile
         """
-        dlg = dialogs.ProfileRasterDialog(parent = self)
+        dlg = ProfileRasterDialog(parent = self)
 
         if dlg.ShowModal() == wx.ID_OK:
             self.rasterList = dlg.rasterList
@@ -374,8 +376,8 @@ class ProfileFrame(BasePlotFrame):
             except:
                 pass
             
-        stats = dialogs.PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
-                                      title = title)
+        stats = PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
+                               title = title)
 
         if stats.Show() == wx.ID_CLOSE:
             stats.Destroy()       

+ 6 - 5
gui/wxpython/wxplot/scatter.py

@@ -23,6 +23,8 @@ import grass.script as grass
 
 from wxplot.base       import BasePlotFrame
 from gui_core.toolbars import BaseToolbar
+from icons.icon        import Icons
+from wxplot.dialogs    import ScatterRasterDialog, PlotStatsFrame
 
 class ScatterFrame(BasePlotFrame):
     """!Mainframe for displaying bivariate scatter plot of two raster maps. Uses wx.lib.plot.
@@ -74,7 +76,7 @@ class ScatterFrame(BasePlotFrame):
     def OnSelectRaster(self, event):
         """!Select raster map(s) to profile
         """
-        dlg = dialogs.ScatterRasterDialog(parent = self)
+        dlg = ScatterRasterDialog(parent = self)
 
         if dlg.ShowModal() == wx.ID_OK:
             rlist = dlg.rasterList
@@ -250,17 +252,17 @@ class ScatterFrame(BasePlotFrame):
             str = eqtitle + eq + num + rval + rsq + ftest
             message.append(str)
             
-        stats = dialogs.PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
+        stats = PlotStatsFrame(self, id = wx.ID_ANY, message = message, 
                                       title = title)
 
         if stats.Show() == wx.ID_CLOSE:
             stats.Destroy()       
 
-class ScatterplotToolbar(BaseToolbar):
+class ScatterToolbar(BaseToolbar):
     """!Toolbar for bivariate scatterplots of raster map pairs
     """ 
     def __init__(self, parent):
-        AbstractToolbar.__init__(self, parent)
+        BaseToolbar.__init__(self, parent)
         
         self.InitToolbar(self._toolbarData())
         
@@ -270,7 +272,6 @@ class ScatterplotToolbar(BaseToolbar):
     def _toolbarData(self):
         """!Toolbar data"""
         icons = Icons['plot']
-#        icons2 = Icons['modeler']
         return self._getToolbarData((('addraster', Icons['layerManager']["addRast"],
                                       self.parent.OnSelectRaster),
                                      (None, ),