[GRASS-SVN] r52166 - in grass/trunk/gui/wxpython: core gui_core lmgr

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jun 20 06:43:48 PDT 2012


Author: annakrat
Date: 2012-06-20 06:43:47 -0700 (Wed, 20 Jun 2012)
New Revision: 52166

Modified:
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/core/utils.py
   grass/trunk/gui/wxpython/gui_core/dialogs.py
   grass/trunk/gui/wxpython/gui_core/forms.py
   grass/trunk/gui/wxpython/gui_core/goutput.py
   grass/trunk/gui/wxpython/gui_core/preferences.py
   grass/trunk/gui/wxpython/lmgr/frame.py
   grass/trunk/gui/wxpython/lmgr/layertree.py
Log:
wxGUI/settings: added possibility to set default vector layer appearance

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/core/settings.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -27,7 +27,7 @@
 
 from core       import globalvar
 from core.gcmd  import GException, GError
-from core.utils import GetSettingsPath, PathJoin
+from core.utils import GetSettingsPath, PathJoin, rgb2str
 
 class Settings:
     """!Generic class where to store settings"""
@@ -242,15 +242,48 @@
                 'verbosity' : {
                     'selection' : 'grassenv'
                     },
-                # d.rast
-                'rasterOpaque' : {
+                'addNewLayer' : {
+                    'enabled' : True,
+                    },
+                'interactiveInput' : {
+                    'enabled' : True,
+                    },
+                },
+            #
+            # d.rast
+            #
+            'rasterLayer': {
+                'opaque': {
                     'enabled' : False
                     },
-                'rasterColorTable' : {
-                    'enabled'   : False,
-                    'selection' : 'rainbow',
+                'colorTable': {
+                    'enabled' : False,
+                    'selection' : 'rainbow'
                     },
-                # d.vect
+                },
+            #
+            # d.vect
+            #
+            'vectorLayer': {
+                'featureColor': {
+                    'color' : (0, 0, 0),
+                    'transparent' : {
+                        'enabled': False
+                        }
+                    },
+                'areaFillColor': {
+                    'color' : (200, 200, 200),
+                    'transparent' : {
+                        'enabled': False
+                        }
+                    },
+                'line': {
+                    'width' : 0,
+                    },
+                'point': {
+                    'symbol': 'basic/x',
+                    'size' : 5,
+                    },
                 'showType': {
                     'point' : {
                         'enabled' : True
@@ -271,12 +304,6 @@
                         'enabled' : True
                         },
                     },
-                'addNewLayer' : {
-                    'enabled' : True,
-                    },
-                'interactiveInput' : {
-                    'enabled' : True,
-                    },
                 },
             #
             # vdigit
@@ -1098,3 +1125,27 @@
             self.userSettings[key] = copy.deepcopy(self.defaultSettings[key])
         
 UserSettings = Settings()
+
+def GetDisplayVectSettings():
+    settings = list()
+    if not UserSettings.Get(group = 'vectorLayer', key = 'featureColor', subkey = ['transparent', 'enabled']):
+        featureColor = UserSettings.Get(group = 'vectorLayer', key = 'featureColor', subkey = 'color')
+        settings.append('color=%s' % rgb2str.get(featureColor, ':'.join(map(str,featureColor))))
+    else:
+        settings.append('color=none')
+    if not UserSettings.Get(group = 'vectorLayer', key = 'areaFillColor', subkey = ['transparent', 'enabled']):
+        fillColor = UserSettings.Get(group = 'vectorLayer', key = 'areaFillColor', subkey = 'color')
+        settings.append('fcolor=%s' % rgb2str.get(fillColor, ':'.join(map(str,fillColor))))
+    else:
+        settings.append('fcolor=none')
+    
+    settings.append('width=%s' % UserSettings.Get(group = 'vectorLayer', key = 'line', subkey = 'width'))
+    settings.append('icon=%s' % UserSettings.Get(group = 'vectorLayer', key = 'point', subkey = 'symbol'))
+    settings.append('size=%s' % UserSettings.Get(group = 'vectorLayer', key = 'point', subkey = 'size'))
+    types = []
+    for ftype in ['point', 'line', 'boundary', 'centroid', 'area', 'face']:
+         if UserSettings.Get(group = 'vectorLayer', key = 'showType', subkey = [ftype, 'enabled']):
+             types.append(ftype)
+    settings.append('type=%s' % ','.join(types))
+
+    return settings

Modified: grass/trunk/gui/wxpython/core/utils.py
===================================================================
--- grass/trunk/gui/wxpython/core/utils.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/core/utils.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -28,6 +28,7 @@
 
 from core.gcmd  import RunCommand
 from core.debug import Debug
+# from core.settings import UserSettings
 
 def normalize_whitespace(text):
     """!Remove redundant whitespace from a string"""
@@ -745,3 +746,42 @@
         return os.path.join(os.getenv('APPDATA'), 'grass%d' % version)
     
     return os.path.join(os.getenv('HOME'), '.grass%d' % version)
+
+
+
+# From lib/gis/col_str.c, except purple which is mentioned
+# there but not given RGB values
+str2rgb = {'aqua': (100, 128, 255),
+           'black': (0, 0, 0),
+           'blue': (0, 0, 255),
+           'brown': (180, 77, 25),
+           'cyan': (0, 255, 255),
+           'gray': (128, 128, 128),
+           'green': (0, 255, 0),
+           'grey': (128, 128, 128),
+           'indigo': (0, 128, 255),
+           'magenta': (255, 0, 255),
+           'orange': (255, 128, 0),
+           'purple': (128, 0, 128),
+           'red': (255, 0, 0),
+           'violet': (128, 0, 255),
+           'white': (255, 255, 255),
+           'yellow': (255, 255, 0)}
+rgb2str = {}
+for (s,r) in str2rgb.items():
+    rgb2str[ r ] = s
+
+
+def color_resolve(color):
+    if len(color) > 0 and color[0] in "0123456789":
+        rgb = tuple(map(int, color.split(':')))
+        label = color
+    else:
+        # Convert color names to RGB
+        try:
+            rgb = str2rgb[color]
+            label = color
+        except KeyError:
+            rgb = (200, 200, 200)
+            label = _('Select Color')
+    return (rgb, label)

Modified: grass/trunk/gui/wxpython/gui_core/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/dialogs.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/gui_core/dialogs.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -51,7 +51,7 @@
 from gui_core.forms   import GUI
 from gui_core.widgets import SingleSymbolPanel, EVT_SYMBOL_SELECTION_CHANGED
 from core.utils       import GetListOfMapsets, GetLayerNameFromCmd, GetValidLayerName
-from core.settings    import UserSettings
+from core.settings    import UserSettings, GetDisplayVectSettings
 from core.debug       import Debug
 
 wxApplyMapLayers, EVT_APPLY_MAP_LAYERS= NewEvent()
@@ -1743,7 +1743,7 @@
         if self.importType == 'gdal':
             cmd = ['d.rast',
                    'map=%s' % name]
-            if UserSettings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'):
+            if UserSettings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'):
                 cmd.append('-n')
             
             item = maptree.AddLayer(ltype = 'raster',
@@ -1753,7 +1753,7 @@
             item = maptree.AddLayer(ltype = 'vector',
                                     lname = name, lchecked = False,
                                     lcmd = ['d.vect',
-                                            'map=%s' % name],
+                                            'map=%s' % name] + GetDisplayVectSettings(),
                                     multiple = False)
         
         maptree.mapdisplay.MapWindow.ZoomToMap()

Modified: grass/trunk/gui/wxpython/gui_core/forms.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/forms.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/gui_core/forms.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -93,27 +93,6 @@
 
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
 
-# From lib/gis/col_str.c, except purple which is mentioned
-# there but not given RGB values
-str2rgb = {'aqua': (100, 128, 255),
-           'black': (0, 0, 0),
-           'blue': (0, 0, 255),
-           'brown': (180, 77, 25),
-           'cyan': (0, 255, 255),
-           'gray': (128, 128, 128),
-           'green': (0, 255, 0),
-           'grey': (128, 128, 128),
-           'indigo': (0, 128, 255),
-           'magenta': (255, 0, 255),
-           'orange': (255, 128, 0),
-           'purple': (128, 0, 128),
-           'red': (255, 0, 0),
-           'violet': (128, 0, 255),
-           'white': (255, 255, 255),
-           'yellow': (255, 255, 0)}
-rgb2str = {}
-for (s,r) in str2rgb.items():
-    rgb2str[ r ] = s
 
 """!Hide some options in the GUI"""
 #_blackList = { 'enabled' : False,
@@ -122,19 +101,6 @@
 _blackList = { 'enabled' : False,
                'items'   : {} }
 
-def color_resolve(color):
-    if len(color) > 0 and color[0] in "0123456789":
-        rgb = tuple(map(int, color.split(':')))
-        label = color
-    else:
-        # Convert color names to RGB
-        try:
-            rgb = str2rgb[color]
-            label = color
-        except KeyError:
-            rgb = (200, 200, 200)
-            label = _('Select Color')
-    return (rgb, label)
 
 def text_beautify(someString , width = 70):
     """!Make really long texts shorter, clean up whitespace and remove
@@ -1340,9 +1306,9 @@
                     default_color = (200,200,200)
                     label_color = _("Select Color")
                     if p.get('default','') !=  '':
-                        default_color, label_color = color_resolve(p['default'])
-                    if p.get('value','') !=  '': # parameter previously set
-                        default_color, label_color = color_resolve(p['value'])
+                        default_color, label_color = utils.color_resolve(p['default'])
+                    if p.get('value','') !=  '' and p.get('value','') != 'none': # parameter previously set
+                        default_color, label_color = utils.color_resolve(p['value'])
                     if prompt == 'color_none':
                         this_sizer = wx.BoxSizer(orient = wx.HORIZONTAL)
                     else:
@@ -1358,7 +1324,7 @@
                     btn_colour.Bind(csel.EVT_COLOURSELECT,  self.OnColorChange)
                     if prompt == 'color_none':
                         none_check = wx.CheckBox(which_panel, wx.ID_ANY, _("Transparent"))
-                        if p.get('value','') !=  '' and p.get('value',[''])[0] == "none":
+                        if p.get('value','')  == "none":
                             none_check.SetValue(True)
                         else:
                             none_check.SetValue(False)
@@ -1806,7 +1772,7 @@
                     new_color = colorchooser.GetValue()[:]
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # under wx2.8.1
-                    new_label = rgb2str.get(new_color, ':'.join(map(str,new_color)))
+                    new_label = utils.rgb2str.get(new_color, ':'.join(map(str,new_color)))
                     colorchooser.SetLabel(new_label)
                     colorchooser.SetColour(new_color)
                     colorchooser.Refresh()
@@ -2238,7 +2204,7 @@
             "gisprompt" : False,
             "multiple" : "yes",
             # values must be an array of strings
-            "values" : str2rgb.keys() + map(str, str2rgb.values())
+            "values" : utils.str2rgb.keys() + map(str, utils.str2rgb.values())
             },{
             "name" : "a_file",
             "description" : "A file selector",

Modified: grass/trunk/gui/wxpython/gui_core/goutput.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/goutput.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/gui_core/goutput.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -44,7 +44,7 @@
 from gui_core.forms  import GUI
 from gui_core.prompt import GPromptSTC
 from core.debug      import Debug
-from core.settings   import UserSettings, Settings
+from core.settings   import UserSettings, Settings, GetDisplayVectSettings
 from gui_core.ghelp  import SearchModuleWindow
 
 wxCmdOutput,   EVT_CMD_OUTPUT   = NewEvent()
@@ -139,9 +139,9 @@
             time.sleep(.1)
 
             # set default color table for raster data
-            if UserSettings.Get(group = 'cmd', key = 'rasterColorTable', subkey = 'enabled') and \
+            if UserSettings.Get(group = 'rasterLayer', key = 'colorTable', subkey = 'enabled') and \
                     args[0][0][:2] == 'r.':
-                colorTable = UserSettings.Get(group = 'cmd', key = 'rasterColorTable', subkey = 'selection')
+                colorTable = UserSettings.Get(group = 'rasterLayer', key = 'colorTable', subkey = 'selection')
                 mapName = None
                 if args[0][0] == 'r.mapcalc':
                     try:
@@ -950,8 +950,9 @@
                                 lcmd = ['d.rast',
                                         'map=%s' % name]
                             else:
+                                defaultParams = GetDisplayVectSettings()
                                 lcmd = ['d.vect',
-                                        'map=%s' % name]
+                                        'map=%s' % name] + defaultParams
                             mapTree.AddLayer(ltype = prompt,
                                              lcmd = lcmd,
                                              lname = name)

Modified: grass/trunk/gui/wxpython/gui_core/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/gui_core/preferences.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/gui_core/preferences.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -48,6 +48,7 @@
 from core.gcmd     import RunCommand
 from core.utils    import ListOfMapsets, GetColorTables, ReadEpsgCodes, GetSettingsPath
 from core.settings import UserSettings
+from gui_core.dialogs import SymbolDialog
 
 wxSettingsChanged, EVT_SETTINGS_CHANGED = NewEvent()
 
@@ -189,6 +190,8 @@
                 value = win.IsChecked()
             elif win.GetName() == 'GetStringSelection':
                 value = win.GetStringSelection()
+            elif win.GetName() == 'GetLabel':
+                value = win.GetLabel()
             elif win.GetName() == 'GetColour':
                 value = tuple(win.GetValue())
             else:
@@ -244,6 +247,7 @@
         self._createAppearancePage(self.notebook)
         self._createDisplayPage(self.notebook)
         self._createCmdPage(self.notebook)
+        self._createLayersPage(self.notebook)
         self._createAttributeManagerPage(self.notebook)
         self._createProjectionPage(self.notebook)
         
@@ -821,10 +825,20 @@
         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
         border.Add(item = sizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 3)
         
+        panel.SetSizer(border)
+        
+        return panel
+
+    def _createLayersPage(self, notebook):
+        """!Create notebook page for layer settings"""
+        panel = wx.Panel(parent = notebook, id = wx.ID_ANY)
+        notebook.AddPage(page = panel, text = _("Layers"))
+        
+        border = wx.BoxSizer(wx.VERTICAL)
         #
         # raster settings
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Raster settings"))
+        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Default raster settings"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         
         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
@@ -837,8 +851,8 @@
         rasterOpaque = wx.CheckBox(parent = panel, id = wx.ID_ANY,
                                     label = _("Make null cells opaque"),
                                     name = 'IsChecked')
-        rasterOpaque.SetValue(self.settings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'))
-        self.winId['cmd:rasterOpaque:enabled'] = rasterOpaque.GetId()
+        rasterOpaque.SetValue(self.settings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'))
+        self.winId['rasterLayer:opaque:enabled'] = rasterOpaque.GetId()
         
         gridSizer.Add(item = rasterOpaque,
                       pos = (row, 0), span = (1, 2))
@@ -848,8 +862,8 @@
         rasterCTCheck = wx.CheckBox(parent = panel, id = wx.ID_ANY,
                                     label = _("Default color table"),
                                     name = 'IsChecked')
-        rasterCTCheck.SetValue(self.settings.Get(group = 'cmd', key = 'rasterColorTable', subkey = 'enabled'))
-        self.winId['cmd:rasterColorTable:enabled'] = rasterCTCheck.GetId()
+        rasterCTCheck.SetValue(self.settings.Get(group = 'rasterLayer', key = 'colorTable', subkey = 'enabled'))
+        self.winId['rasterLayer:colorTable:enabled'] = rasterCTCheck.GetId()
         rasterCTCheck.Bind(wx.EVT_CHECKBOX, self.OnCheckColorTable)
         
         gridSizer.Add(item = rasterCTCheck,
@@ -858,8 +872,8 @@
         rasterCTName = wx.Choice(parent = panel, id = wx.ID_ANY, size = (200, -1),
                                choices = GetColorTables(),
                                name = "GetStringSelection")
-        rasterCTName.SetStringSelection(self.settings.Get(group = 'cmd', key = 'rasterColorTable', subkey = 'selection'))
-        self.winId['cmd:rasterColorTable:selection'] = rasterCTName.GetId()
+        rasterCTName.SetStringSelection(self.settings.Get(group = 'rasterLayer', key = 'colorTable', subkey = 'selection'))
+        self.winId['rasterLayer:colorTable:selection'] = rasterCTName.GetId()
         if not rasterCTCheck.IsChecked():
             rasterCTName.Enable(False)
         
@@ -872,10 +886,10 @@
         #
         # vector settings
         #
-        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Vector settings"))
+        box   = wx.StaticBox (parent = panel, id = wx.ID_ANY, label = " %s " % _("Default vector settings"))
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         
-        gridSizer = wx.FlexGridSizer (cols = 7, hgap = 3, vgap = 3)
+        gridSizer = wx.FlexGridSizer (cols = 7, hgap = 10, vgap = 3)
         
         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
                                          label = _("Display:")),
@@ -884,12 +898,100 @@
         for type in ('point', 'line', 'centroid', 'boundary',
                      'area', 'face'):
             chkbox = wx.CheckBox(parent = panel, label = type)
-            checked = self.settings.Get(group = 'cmd', key = 'showType',
+            checked = self.settings.Get(group = 'vectorLayer', key = 'showType',
                                         subkey = [type, 'enabled'])
             chkbox.SetValue(checked)
-            self.winId['cmd:showType:%s:enabled' % type] = chkbox.GetId()
+            self.winId['vectorLayer:showType:%s:enabled' % type] = chkbox.GetId()
             gridSizer.Add(item = chkbox)
 
+        sizer.Add(item = gridSizer, proportion = 0, flag = wx.ALL | wx.EXPAND, border = 5)
+
+        row = col = 0
+        gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
+        gridSizer.AddGrowableCol(0)
+        gridSizer.AddGrowableCol(3)
+
+        # feature color
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                           label = _("Feature color:")),
+                      flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, 0))
+        featureColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
+                                         colour = self.settings.Get(group = 'vectorLayer',
+                                                                    key = 'featureColor',
+                                                                    subkey = 'color'),
+                                         size = globalvar.DIALOG_COLOR_SIZE)
+        featureColor.SetName('GetColour')
+        self.winId['vectorLayer:featureColor:color'] = featureColor.GetId()
+        gridSizer.Add(item = featureColor, pos = (row, col + 2), flag = wx.ALIGN_RIGHT)
+        
+        transpFeature = wx.CheckBox(parent  = panel, id = wx.ID_ANY,
+                                    label = _("Transparent"), name = "IsChecked")
+        transpFeature.SetValue(self.settings.Get(group = 'vectorLayer', key = 'featureColor',
+                                                     subkey =  ['transparent', 'enabled']))
+        self.winId['vectorLayer:featureColor:transparent:enabled'] = transpFeature.GetId()
+        gridSizer.Add(item = transpFeature, pos = (row, col + 1), flag = wx.ALIGN_CENTER_VERTICAL)
+
+
+        # area fill color
+        row += 1
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                           label = _("Area fill color:")),
+                      flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, col))
+        fillColor = csel.ColourSelect(parent = panel, id = wx.ID_ANY,
+                                      colour = self.settings.Get(group = 'vectorLayer',
+                                                                 key = 'areaFillColor',
+                                                                 subkey = 'color'),
+                                      size = globalvar.DIALOG_COLOR_SIZE)
+        fillColor.SetName('GetColour')
+        self.winId['vectorLayer:areaFillColor:color'] = fillColor.GetId()
+        gridSizer.Add(item = fillColor, pos = (row, col + 2), flag = wx.ALIGN_RIGHT)
+
+        transpArea = wx.CheckBox(parent  = panel, id = wx.ID_ANY,
+                                 label = _("Transparent"), name = "IsChecked")
+        transpArea.SetValue(self.settings.Get(group = 'vectorLayer', key = 'areaFillColor',
+                                              subkey = ['transparent', 'enabled']))
+        self.winId['vectorLayer:areaFillColor:transparent:enabled'] = transpArea.GetId()
+        gridSizer.Add(item = transpArea, pos = (row, col + 1), flag = wx.ALIGN_CENTER_VERTICAL)
+
+        # line
+        row += 1
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                           label = _("Line width:")),
+                      flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, col))
+        hlWidth = wx.SpinCtrl(parent = panel, id = wx.ID_ANY, size = (50, -1),
+                              initial = self.settings.Get(group = 'vectorLayer', key = 'line', subkey = 'width'),
+                              min = 1, max = 1e6, name = "GetValue")
+        self.winId['vectorLayer:line:width'] = hlWidth.GetId()
+        gridSizer.Add(item = hlWidth, pos = (row, col + 1), span = (1, 2), flag = wx.ALIGN_RIGHT)
+
+        # symbol
+        row = 0
+        col = 4
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                           label = _("Symbol size:")),
+                      flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, col))
+        ptSize = wx.SpinCtrl(parent = panel, id = wx.ID_ANY, size = (50, -1),
+                              initial = self.settings.Get(group = 'vectorLayer', key = 'point', subkey = 'size'),
+                              min = 1, max = 1e6, name = "GetValue")
+        self.winId['vectorLayer:point:size'] = ptSize.GetId()
+        gridSizer.Add(item = ptSize, pos = (row, col + 2), flag = wx.ALIGN_RIGHT)
+
+        row += 1
+        gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                           label = _("Symbol:")),
+                      flag = wx.ALIGN_CENTER_VERTICAL, pos = (row, col))
+        symbolPath = self.settings.Get(group = 'vectorLayer', key = 'point', subkey = 'symbol')
+        symbolLabel = wx.StaticText(parent = panel, id = wx.ID_ANY,
+                                    label = symbolPath, name = 'GetLabel')
+        symbolLabel.SetMinSize((150, -1))
+        self.winId['vectorLayer:point:symbol'] = symbolLabel.GetId()
+        gridSizer.Add(item = symbolLabel, flag = wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT, pos = (row, col + 1))
+
+        bitmap = wx.Bitmap(os.path.join(globalvar.ETCSYMBOLDIR, symbolPath) + '.png')
+        bb = wx.BitmapButton(parent = panel, id = wx.ID_ANY, bitmap = bitmap, name = "symbolButton")
+        bb.Bind(wx.EVT_BUTTON, self.OnSetSymbol)
+        gridSizer.Add(item = bb, pos = (row, col + 2))
+
         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
         border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
         
@@ -1163,7 +1265,7 @@
 
     def OnCheckColorTable(self, event):
         """!Set/unset default color table"""
-        win = self.FindWindowById(self.winId['cmd:rasterColorTable:selection'])
+        win = self.FindWindowById(self.winId['rasterLayer:colorTable:selection'])
         if event.IsChecked():
             win.Enable()
         else:
@@ -1288,6 +1390,18 @@
 
         event.Skip()
 
+    def OnSetSymbol(self, event):
+        """!Opens symbol dialog"""
+        winId = self.winId['vectorLayer:point:symbol']
+        label = self.FindWindowById(winId)
+        bb = self.FindWindowByName('symbolButton')
+        dlg = SymbolDialog(self, symbolPath = globalvar.ETCSYMBOLDIR,
+                           currentSymbol = label.GetLabel())
+        if dlg.ShowModal() == wx.ID_OK:
+            img = dlg.GetSelectedSymbol(fullPath = True)
+            label.SetLabel(dlg.GetSelectedSymbol(fullPath = False))
+            bb.SetBitmapLabel(wx.Bitmap(img + '.png'))
+
     def OnEnableWheelZoom(self, event):
         """!Enable/disable wheel zoom mode control"""
         checkId = self.winId['display:mouseWheelZoom:enabled']

Modified: grass/trunk/gui/wxpython/lmgr/frame.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/frame.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/lmgr/frame.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -39,7 +39,7 @@
 from grass.script          import core as grass
 
 from core.gcmd             import RunCommand, GError, GMessage
-from core.settings         import UserSettings
+from core.settings         import UserSettings, GetDisplayVectSettings
 from gui_core.preferences  import MapsetAccess, PreferencesDialog, EVT_SETTINGS_CHANGED
 from lmgr.layertree        import LayerTree, LMIcons
 from lmgr.menudata         import ManagerData
@@ -1434,7 +1434,7 @@
                 cmd = ['d.rast3d', 'map=%s' % layerName]
                 wxType = '3d-raster'
             elif ltype == 'vect':
-                cmd = ['d.vect', 'map=%s' % layerName]
+                cmd = ['d.vect', 'map=%s' % layerName] + GetDisplayVectSettings()
                 wxType = 'vector'
             else:
                 GError(parent = self,

Modified: grass/trunk/gui/wxpython/lmgr/layertree.py
===================================================================
--- grass/trunk/gui/wxpython/lmgr/layertree.py	2012-06-20 11:21:28 UTC (rev 52165)
+++ grass/trunk/gui/wxpython/lmgr/layertree.py	2012-06-20 13:43:47 UTC (rev 52166)
@@ -38,7 +38,7 @@
 from core.utils          import GetLayerNameFromCmd
 from wxplot.profile      import ProfileFrame
 from core.debug          import Debug
-from core.settings       import UserSettings
+from core.settings       import UserSettings, GetDisplayVectSettings
 from vdigit.main         import haveVDigit
 from core.gcmd           import GWarning
 from gui_core.toolbars   import BaseIcons
@@ -986,7 +986,7 @@
             self.GetPyData(layer)[0]['cmd'] = module.GetCmd()
         elif ltype == 'raster':
             cmd = ['d.rast']
-            if UserSettings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'):
+            if UserSettings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'):
                 cmd.append('-n')
                          
         elif ltype == '3d-raster':
@@ -994,7 +994,7 @@
                                         
         elif ltype == 'rgb':
             cmd = ['d.rgb']
-            if UserSettings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'):
+            if UserSettings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'):
                 cmd.append('-n')
             
         elif ltype == 'his':
@@ -1010,13 +1010,8 @@
             cmd = ['d.rast.num']
             
         elif ltype == 'vector':
-            types = list()
-            for ftype in ['point', 'line', 'boundary', 'centroid', 'area', 'face']:
-                if UserSettings.Get(group = 'cmd', key = 'showType', subkey = [ftype, 'enabled']):
-                    types.append(ftype)
+            cmd = ['d.vect'] + GetDisplayVectSettings()
             
-            cmd = ['d.vect', 'type=%s' % ','.join(types)]
-            
         elif ltype == 'thememap':
             # -s flag requested, otherwise only first thematic category is displayed
             # should be fixed by C-based d.thematic.* modules



More information about the grass-commit mailing list