فهرست منبع

wxGUI: colorrules module cleaned
map scale mode fixed
workspace updated for constrain comp resolution
various minor fixes


git-svn-id: https://svn.osgeo.org/grass/grass/trunk@33728 15284696-431f-4ddb-bdfa-cd5b030d7da7

Martin Landa 16 سال پیش
والد
کامیت
175de4687b

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 470 - 345
gui/wxpython/gui_modules/colorrules.py


+ 1 - 0
gui/wxpython/gui_modules/globalvar.py

@@ -86,6 +86,7 @@ DIALOG_SPIN_SIZE = (150, -1)
 DIALOG_COMBOBOX_SIZE = (300, -1)
 DIALOG_GSELECT_SIZE = (400, -1)
 DIALOG_TEXTCTRL_SIZE = (400, -1)
+DIALOG_LAYER_SIZE = (100, -1)
 
 MAP_WINDOW_SIZE = (680, 520)
 HIST_WINDOW_SIZE = (500, 350)

+ 5 - 3
gui/wxpython/gui_modules/gselect.py

@@ -405,14 +405,15 @@ class VectorDBInfo:
                 self.tables[table][name]['values'] = []
                 self.tables[table][name]['ids']    = []
         
-class LayerSelect(wx.ComboBox):
+class LayerSelect(wx.Choice):
     """
     Creates combo box for selecting data layers defined for vector.
     The 'layer' terminology is likely to change for GRASS 7
     """
     def __init__(self, parent,
                  id=wx.ID_ANY, pos=wx.DefaultPosition,
-                 size=wx.DefaultSize, vector=None, choices=[]):
+                 size=globalvar.DIALOG_LAYER_SIZE,
+                 vector=None, choices=[]):
 
         super(LayerSelect, self).__init__(parent, id, pos=pos, size=size,
                                           choices=choices)
@@ -438,7 +439,8 @@ class ColumnSelect(wx.ComboBox):
                  id=wx.ID_ANY, value='', pos=wx.DefaultPosition,
                  size=wx.DefaultSize, vector=None, layer=1, choices=[]):
 
-        super(ColumnSelect, self).__init__(parent, id, value, pos, size, choices)
+        super(ColumnSelect, self).__init__(parent, id, value, pos, size, choices,
+                                           style=wx.CB_READONLY)
 
         if not vector:
             return

+ 18 - 11
gui/wxpython/gui_modules/mapdisp.py

@@ -3060,23 +3060,24 @@ class MapFrame(wx.Frame):
                 raise ValueError
             value = int(scale[2:])
         except ValueError:
-            self.mapScale.SetValue('1:' + str(int(self.mapScaleValue)))
+            self.mapScale.SetValue('1:%ld' % int(self.mapScaleValue))
             return
 
         dEW = value * (self.Map.region['cols'] / self.ppm[0])
         dNS = value * (self.Map.region['rows'] / self.ppm[1])
-        self.Map.region['n'] = self.Map.region['center_northing'] + dNS / 2
-        self.Map.region['s'] = self.Map.region['center_northing'] - dNS / 2
-        self.Map.region['w'] = self.Map.region['center_easting']  - dEW / 2
-        self.Map.region['e'] = self.Map.region['center_easting']  + dEW / 2
-
+        self.Map.region['n'] = self.Map.region['center_northing'] + dNS / 2.
+        self.Map.region['s'] = self.Map.region['center_northing'] - dNS / 2.
+        self.Map.region['w'] = self.Map.region['center_easting']  - dEW / 2.
+        self.Map.region['e'] = self.Map.region['center_easting']  + dEW / 2.
+        
         # add to zoom history
         self.MapWindow.ZoomHistory(self.Map.region['n'], self.Map.region['s'],
                                    self.Map.region['e'], self.Map.region['w'])
-
+        
         # redraw a map
         self.MapWindow.UpdateMap()
-
+        self.mapScale.SetFocus()
+        
     def StatusbarUpdate(self):
         """Update statusbar content"""
 
@@ -3158,12 +3159,16 @@ class MapFrame(wx.Frame):
 
             xscale = (region['e'] - region['w']) / (region['cols'] / self.ppm[0])
             yscale = (region['n'] - region['s']) / (region['rows'] / self.ppm[1])
-            scale = (xscale + yscale) / 2
+            scale = (xscale + yscale) / 2.
+            
             Debug.msg(3, "MapFrame.StatusbarUpdate(mapscale): xscale=%f, yscale=%f -> scale=%f" % \
                           (xscale, yscale, scale))
 
             self.statusbar.SetStatusText("")
-            self.mapScale.SetValue("1:%ld" % scale)
+            try:
+                self.mapScale.SetValue("1:%ld" % (scale + 0.5))
+            except TypeError:
+                pass
             self.mapScaleValue = scale
             self.mapScale.Show()
 
@@ -3915,12 +3920,14 @@ class MapFrame(wx.Frame):
         self.PopupMenu(zoommenu)
         zoommenu.Destroy()
 
-    def SetProperties(self, render=False, mode=0, showCompExtent=False):
+    def SetProperties(self, render=False, mode=0, showCompExtent=False,
+                      constrainRes=False):
         """Set properies of map display window"""
         self.autoRender.SetValue(render)
         self.toggleStatus.SetSelection(mode)
         self.StatusbarUpdate()
         self.showRegion.SetValue(showCompExtent)
+        self.compResolution.SetValue(constrainRes)
         if showCompExtent:
             self.MapWindow.regionCoords = []
         

+ 1 - 1
gui/wxpython/gui_modules/render.py

@@ -244,7 +244,7 @@ class Layer(object):
         """Set layer type"""
         if type not in ('raster', '3d-raster', 'vector',
                         'overlay', 'command',
-                        'shaded', 'rgb', 'his', 'rastarrow',
+                        'shaded', 'rgb', 'his', 'rastarrow', 'rastnum',
                         'thememap', 'themechart', 'grid', 'labels',
                         'geodesic','rhumb'):
             raise gcmd.GStdError(_("Unsupported map layer type '%s'") % str(type))

+ 4 - 1
gui/wxpython/gui_modules/workspace.py

@@ -101,7 +101,8 @@ class ProcessWorkspaceFile(HandlerBase):
                 "showCompExtent" : bool(int(attrs.get('showCompExtent', "0"))),
                 "pos"            : pos,
                 "size"           : size,
-                "extent"         : extent})
+                "extent"         : extent,
+                "constrainRes"   : bool(int(attrs.get('constrainRes', "0")))})
             
         elif name == 'group':
             self.groupName    = attrs.get('name', None)
@@ -370,11 +371,13 @@ class WriteWorkspaceFile(object):
             
             file.write('%s<display render="%d" '
                        'mode="%d" showCompExtent="%d" '
+                       'constrainRes="%d" '
                        'dim="%d,%d,%d,%d" '
                        'extent="%f,%f,%f,%f">\n' % (' ' * self.indent,
                                                     int(mapTree.mapdisplay.autoRender.IsChecked()),
                                                     mapTree.mapdisplay.toggleStatus.GetSelection(),
                                                     int(mapTree.mapdisplay.showRegion.IsChecked()),
+                                                    int(mapTree.mapdisplay.compResolution.IsChecked()),
                                                     displayPos[0],
                                                     displayPos[1],
                                                     displaySize[0],

+ 7 - 6
gui/wxpython/wxgui.py

@@ -669,8 +669,9 @@ class GMFrame(wx.Frame):
 
                 # set windows properties
                 mapdisplay[-1].SetProperties(render=display['render'],
-                                         mode=display['mode'],
-                                         showCompExtent=display['showCompExtent'])
+                                             mode=display['mode'],
+                                             showCompExtent=display['showCompExtent'],
+                                             constrainRes=display['constrainRes'])
 
                 # set position and size of map display
                 if UserSettings.Get(group='workspace', key='posDisplay', subkey='enabled') is False:
@@ -1240,10 +1241,10 @@ class GMFrame(wx.Frame):
         rastmenu.AppendItem(addrastarrow)
         self.Bind(wx.EVT_MENU, self.AddRastarrow, addrastarrow)
 
-        #        addrastnums = wx.MenuItem(rastmenu, -1, Icons ["addrnum"].GetLabel())
-        #        addrastnums.SetBitmap(Icons["addrnum"].GetBitmap (self.iconsize))
-        #        rastmenu.AppendItem(addrastnums)
-        #        self.Bind(wx.EVT_MENU, self.AddRastnum, addrastnums)
+        addrastnums = wx.MenuItem(rastmenu, -1, Icons ["addrnum"].GetLabel())
+        addrastnums.SetBitmap(Icons["addrnum"].GetBitmap (self.iconsize))
+        rastmenu.AppendItem(addrastnums)
+        self.Bind(wx.EVT_MENU, self.AddRastnum, addrastnums)
 
         # Popup the menu.  If an item is selected then its handler
         # will be called before PopupMenu returns.