Преглед изворни кода

wxGUI/settings: added possibility to set default vector layer appearance

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@52166 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová пре 13 година
родитељ
комит
794cf0f714

+ 64 - 13
gui/wxpython/core/settings.py

@@ -27,7 +27,7 @@ import locale
 
 
 from core       import globalvar
 from core       import globalvar
 from core.gcmd  import GException, GError
 from core.gcmd  import GException, GError
-from core.utils import GetSettingsPath, PathJoin
+from core.utils import GetSettingsPath, PathJoin, rgb2str
 
 
 class Settings:
 class Settings:
     """!Generic class where to store settings"""
     """!Generic class where to store settings"""
@@ -242,15 +242,48 @@ class Settings:
                 'verbosity' : {
                 'verbosity' : {
                     'selection' : 'grassenv'
                     'selection' : 'grassenv'
                     },
                     },
-                # d.rast
-                'rasterOpaque' : {
+                'addNewLayer' : {
+                    'enabled' : True,
+                    },
+                'interactiveInput' : {
+                    'enabled' : True,
+                    },
+                },
+            #
+            # d.rast
+            #
+            'rasterLayer': {
+                'opaque': {
                     'enabled' : False
                     'enabled' : False
                     },
                     },
-                'rasterColorTable' : {
-                    'enabled'   : False,
-                    'selection' : 'rainbow',
+                'colorTable': {
+                    'enabled' : False,
+                    'selection' : 'rainbow'
+                    },
+                },
+            #
+            # 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,
                     },
                     },
-                # d.vect
                 'showType': {
                 'showType': {
                     'point' : {
                     'point' : {
                         'enabled' : True
                         'enabled' : True
@@ -271,12 +304,6 @@ class Settings:
                         'enabled' : True
                         'enabled' : True
                         },
                         },
                     },
                     },
-                'addNewLayer' : {
-                    'enabled' : True,
-                    },
-                'interactiveInput' : {
-                    'enabled' : True,
-                    },
                 },
                 },
             #
             #
             # vdigit
             # vdigit
@@ -1098,3 +1125,27 @@ class Settings:
             self.userSettings[key] = copy.deepcopy(self.defaultSettings[key])
             self.userSettings[key] = copy.deepcopy(self.defaultSettings[key])
         
         
 UserSettings = Settings()
 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

+ 40 - 0
gui/wxpython/core/utils.py

@@ -28,6 +28,7 @@ from grass.script import task as gtask
 
 
 from core.gcmd  import RunCommand
 from core.gcmd  import RunCommand
 from core.debug import Debug
 from core.debug import Debug
+# from core.settings import UserSettings
 
 
 def normalize_whitespace(text):
 def normalize_whitespace(text):
     """!Remove redundant whitespace from a string"""
     """!Remove redundant whitespace from a string"""
@@ -745,3 +746,42 @@ def GetSettingsPath():
         return os.path.join(os.getenv('APPDATA'), 'grass%d' % version)
         return os.path.join(os.getenv('APPDATA'), 'grass%d' % version)
     
     
     return os.path.join(os.getenv('HOME'), '.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)

+ 3 - 3
gui/wxpython/gui_core/dialogs.py

@@ -51,7 +51,7 @@ from gui_core.gselect import ElementSelect, LocationSelect, MapsetSelect, Select
 from gui_core.forms   import GUI
 from gui_core.forms   import GUI
 from gui_core.widgets import SingleSymbolPanel, EVT_SYMBOL_SELECTION_CHANGED
 from gui_core.widgets import SingleSymbolPanel, EVT_SYMBOL_SELECTION_CHANGED
 from core.utils       import GetListOfMapsets, GetLayerNameFromCmd, GetValidLayerName
 from core.utils       import GetListOfMapsets, GetLayerNameFromCmd, GetValidLayerName
-from core.settings    import UserSettings
+from core.settings    import UserSettings, GetDisplayVectSettings
 from core.debug       import Debug
 from core.debug       import Debug
 
 
 wxApplyMapLayers, EVT_APPLY_MAP_LAYERS= NewEvent()
 wxApplyMapLayers, EVT_APPLY_MAP_LAYERS= NewEvent()
@@ -1743,7 +1743,7 @@ class ImportDialog(wx.Dialog):
         if self.importType == 'gdal':
         if self.importType == 'gdal':
             cmd = ['d.rast',
             cmd = ['d.rast',
                    'map=%s' % name]
                    'map=%s' % name]
-            if UserSettings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'):
+            if UserSettings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'):
                 cmd.append('-n')
                 cmd.append('-n')
             
             
             item = maptree.AddLayer(ltype = 'raster',
             item = maptree.AddLayer(ltype = 'raster',
@@ -1753,7 +1753,7 @@ class ImportDialog(wx.Dialog):
             item = maptree.AddLayer(ltype = 'vector',
             item = maptree.AddLayer(ltype = 'vector',
                                     lname = name, lchecked = False,
                                     lname = name, lchecked = False,
                                     lcmd = ['d.vect',
                                     lcmd = ['d.vect',
-                                            'map=%s' % name],
+                                            'map=%s' % name] + GetDisplayVectSettings(),
                                     multiple = False)
                                     multiple = False)
         
         
         maptree.mapdisplay.MapWindow.ZoomToMap()
         maptree.mapdisplay.MapWindow.ZoomToMap()

+ 6 - 40
gui/wxpython/gui_core/forms.py

@@ -93,27 +93,6 @@ from gui_core.widgets import FloatValidator, GNotebook
 
 
 wxUpdateDialog, EVT_DIALOG_UPDATE = NewEvent()
 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"""
 """!Hide some options in the GUI"""
 #_blackList = { 'enabled' : False,
 #_blackList = { 'enabled' : False,
@@ -122,19 +101,6 @@ for (s,r) in str2rgb.items():
 _blackList = { 'enabled' : False,
 _blackList = { 'enabled' : False,
                'items'   : {} }
                '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):
 def text_beautify(someString , width = 70):
     """!Make really long texts shorter, clean up whitespace and remove
     """!Make really long texts shorter, clean up whitespace and remove
@@ -1340,9 +1306,9 @@ class CmdPanel(wx.Panel):
                     default_color = (200,200,200)
                     default_color = (200,200,200)
                     label_color = _("Select Color")
                     label_color = _("Select Color")
                     if p.get('default','') !=  '':
                     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':
                     if prompt == 'color_none':
                         this_sizer = wx.BoxSizer(orient = wx.HORIZONTAL)
                         this_sizer = wx.BoxSizer(orient = wx.HORIZONTAL)
                     else:
                     else:
@@ -1358,7 +1324,7 @@ class CmdPanel(wx.Panel):
                     btn_colour.Bind(csel.EVT_COLOURSELECT,  self.OnColorChange)
                     btn_colour.Bind(csel.EVT_COLOURSELECT,  self.OnColorChange)
                     if prompt == 'color_none':
                     if prompt == 'color_none':
                         none_check = wx.CheckBox(which_panel, wx.ID_ANY, _("Transparent"))
                         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)
                             none_check.SetValue(True)
                         else:
                         else:
                             none_check.SetValue(False)
                             none_check.SetValue(False)
@@ -1806,7 +1772,7 @@ class CmdPanel(wx.Panel):
                     new_color = colorchooser.GetValue()[:]
                     new_color = colorchooser.GetValue()[:]
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # This is weird: new_color is a 4-tuple and new_color[:] is a 3-tuple
                     # under wx2.8.1
                     # 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.SetLabel(new_label)
                     colorchooser.SetColour(new_color)
                     colorchooser.SetColour(new_color)
                     colorchooser.Refresh()
                     colorchooser.Refresh()
@@ -2238,7 +2204,7 @@ if __name__ == "__main__":
             "gisprompt" : False,
             "gisprompt" : False,
             "multiple" : "yes",
             "multiple" : "yes",
             # values must be an array of strings
             # 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",
             "name" : "a_file",
             "description" : "A file selector",
             "description" : "A file selector",

+ 5 - 4
gui/wxpython/gui_core/goutput.py

@@ -44,7 +44,7 @@ from core.gcmd       import CommandThread, GMessage, GError, GException, EncodeS
 from gui_core.forms  import GUI
 from gui_core.forms  import GUI
 from gui_core.prompt import GPromptSTC
 from gui_core.prompt import GPromptSTC
 from core.debug      import Debug
 from core.debug      import Debug
-from core.settings   import UserSettings, Settings
+from core.settings   import UserSettings, Settings, GetDisplayVectSettings
 from gui_core.ghelp  import SearchModuleWindow
 from gui_core.ghelp  import SearchModuleWindow
 
 
 wxCmdOutput,   EVT_CMD_OUTPUT   = NewEvent()
 wxCmdOutput,   EVT_CMD_OUTPUT   = NewEvent()
@@ -139,9 +139,9 @@ class CmdThread(threading.Thread):
             time.sleep(.1)
             time.sleep(.1)
 
 
             # set default color table for raster data
             # 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.':
                     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
                 mapName = None
                 if args[0][0] == 'r.mapcalc':
                 if args[0][0] == 'r.mapcalc':
                     try:
                     try:
@@ -950,8 +950,9 @@ class GMConsole(wx.SplitterWindow):
                                 lcmd = ['d.rast',
                                 lcmd = ['d.rast',
                                         'map=%s' % name]
                                         'map=%s' % name]
                             else:
                             else:
+                                defaultParams = GetDisplayVectSettings()
                                 lcmd = ['d.vect',
                                 lcmd = ['d.vect',
-                                        'map=%s' % name]
+                                        'map=%s' % name] + defaultParams
                             mapTree.AddLayer(ltype = prompt,
                             mapTree.AddLayer(ltype = prompt,
                                              lcmd = lcmd,
                                              lcmd = lcmd,
                                              lname = name)
                                              lname = name)

+ 126 - 12
gui/wxpython/gui_core/preferences.py

@@ -48,6 +48,7 @@ from core          import globalvar
 from core.gcmd     import RunCommand
 from core.gcmd     import RunCommand
 from core.utils    import ListOfMapsets, GetColorTables, ReadEpsgCodes, GetSettingsPath
 from core.utils    import ListOfMapsets, GetColorTables, ReadEpsgCodes, GetSettingsPath
 from core.settings import UserSettings
 from core.settings import UserSettings
+from gui_core.dialogs import SymbolDialog
 
 
 wxSettingsChanged, EVT_SETTINGS_CHANGED = NewEvent()
 wxSettingsChanged, EVT_SETTINGS_CHANGED = NewEvent()
 
 
@@ -189,6 +190,8 @@ class PreferencesBaseDialog(wx.Dialog):
                 value = win.IsChecked()
                 value = win.IsChecked()
             elif win.GetName() == 'GetStringSelection':
             elif win.GetName() == 'GetStringSelection':
                 value = win.GetStringSelection()
                 value = win.GetStringSelection()
+            elif win.GetName() == 'GetLabel':
+                value = win.GetLabel()
             elif win.GetName() == 'GetColour':
             elif win.GetName() == 'GetColour':
                 value = tuple(win.GetValue())
                 value = tuple(win.GetValue())
             else:
             else:
@@ -244,6 +247,7 @@ class PreferencesDialog(PreferencesBaseDialog):
         self._createAppearancePage(self.notebook)
         self._createAppearancePage(self.notebook)
         self._createDisplayPage(self.notebook)
         self._createDisplayPage(self.notebook)
         self._createCmdPage(self.notebook)
         self._createCmdPage(self.notebook)
+        self._createLayersPage(self.notebook)
         self._createAttributeManagerPage(self.notebook)
         self._createAttributeManagerPage(self.notebook)
         self._createProjectionPage(self.notebook)
         self._createProjectionPage(self.notebook)
         
         
@@ -821,10 +825,20 @@ class PreferencesDialog(PreferencesBaseDialog):
         sizer.Add(item = gridSizer, proportion = 1, flag = wx.ALL | wx.EXPAND, border = 5)
         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)
         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
         # 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)
         sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
         
         
         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
         gridSizer = wx.GridBagSizer (hgap = 3, vgap = 3)
@@ -837,8 +851,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         rasterOpaque = wx.CheckBox(parent = panel, id = wx.ID_ANY,
         rasterOpaque = wx.CheckBox(parent = panel, id = wx.ID_ANY,
                                     label = _("Make null cells opaque"),
                                     label = _("Make null cells opaque"),
                                     name = 'IsChecked')
                                     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,
         gridSizer.Add(item = rasterOpaque,
                       pos = (row, 0), span = (1, 2))
                       pos = (row, 0), span = (1, 2))
@@ -848,8 +862,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         rasterCTCheck = wx.CheckBox(parent = panel, id = wx.ID_ANY,
         rasterCTCheck = wx.CheckBox(parent = panel, id = wx.ID_ANY,
                                     label = _("Default color table"),
                                     label = _("Default color table"),
                                     name = 'IsChecked')
                                     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)
         rasterCTCheck.Bind(wx.EVT_CHECKBOX, self.OnCheckColorTable)
         
         
         gridSizer.Add(item = rasterCTCheck,
         gridSizer.Add(item = rasterCTCheck,
@@ -858,8 +872,8 @@ class PreferencesDialog(PreferencesBaseDialog):
         rasterCTName = wx.Choice(parent = panel, id = wx.ID_ANY, size = (200, -1),
         rasterCTName = wx.Choice(parent = panel, id = wx.ID_ANY, size = (200, -1),
                                choices = GetColorTables(),
                                choices = GetColorTables(),
                                name = "GetStringSelection")
                                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():
         if not rasterCTCheck.IsChecked():
             rasterCTName.Enable(False)
             rasterCTName.Enable(False)
         
         
@@ -872,10 +886,10 @@ class PreferencesDialog(PreferencesBaseDialog):
         #
         #
         # vector settings
         # 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)
         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,
         gridSizer.Add(item = wx.StaticText(parent = panel, id = wx.ID_ANY,
                                          label = _("Display:")),
                                          label = _("Display:")),
@@ -884,12 +898,100 @@ class PreferencesDialog(PreferencesBaseDialog):
         for type in ('point', 'line', 'centroid', 'boundary',
         for type in ('point', 'line', 'centroid', 'boundary',
                      'area', 'face'):
                      'area', 'face'):
             chkbox = wx.CheckBox(parent = panel, label = type)
             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'])
                                         subkey = [type, 'enabled'])
             chkbox.SetValue(checked)
             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)
             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)
         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)
         border.Add(item = sizer, proportion = 0, flag = wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border = 3)
         
         
@@ -1163,7 +1265,7 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
     def OnCheckColorTable(self, event):
     def OnCheckColorTable(self, event):
         """!Set/unset default color table"""
         """!Set/unset default color table"""
-        win = self.FindWindowById(self.winId['cmd:rasterColorTable:selection'])
+        win = self.FindWindowById(self.winId['rasterLayer:colorTable:selection'])
         if event.IsChecked():
         if event.IsChecked():
             win.Enable()
             win.Enable()
         else:
         else:
@@ -1288,6 +1390,18 @@ class PreferencesDialog(PreferencesBaseDialog):
 
 
         event.Skip()
         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):
     def OnEnableWheelZoom(self, event):
         """!Enable/disable wheel zoom mode control"""
         """!Enable/disable wheel zoom mode control"""
         checkId = self.winId['display:mouseWheelZoom:enabled']
         checkId = self.winId['display:mouseWheelZoom:enabled']

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

@@ -39,7 +39,7 @@ sys.path.append(os.path.join(globalvar.ETCDIR, "python"))
 from grass.script          import core as grass
 from grass.script          import core as grass
 
 
 from core.gcmd             import RunCommand, GError, GMessage
 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 gui_core.preferences  import MapsetAccess, PreferencesDialog, EVT_SETTINGS_CHANGED
 from lmgr.layertree        import LayerTree, LMIcons
 from lmgr.layertree        import LayerTree, LMIcons
 from lmgr.menudata         import ManagerData
 from lmgr.menudata         import ManagerData
@@ -1434,7 +1434,7 @@ class GMFrame(wx.Frame):
                 cmd = ['d.rast3d', 'map=%s' % layerName]
                 cmd = ['d.rast3d', 'map=%s' % layerName]
                 wxType = '3d-raster'
                 wxType = '3d-raster'
             elif ltype == 'vect':
             elif ltype == 'vect':
-                cmd = ['d.vect', 'map=%s' % layerName]
+                cmd = ['d.vect', 'map=%s' % layerName] + GetDisplayVectSettings()
                 wxType = 'vector'
                 wxType = 'vector'
             else:
             else:
                 GError(parent = self,
                 GError(parent = self,

+ 4 - 9
gui/wxpython/lmgr/layertree.py

@@ -38,7 +38,7 @@ from modules.histogram   import HistogramFrame
 from core.utils          import GetLayerNameFromCmd
 from core.utils          import GetLayerNameFromCmd
 from wxplot.profile      import ProfileFrame
 from wxplot.profile      import ProfileFrame
 from core.debug          import Debug
 from core.debug          import Debug
-from core.settings       import UserSettings
+from core.settings       import UserSettings, GetDisplayVectSettings
 from vdigit.main         import haveVDigit
 from vdigit.main         import haveVDigit
 from core.gcmd           import GWarning
 from core.gcmd           import GWarning
 from gui_core.toolbars   import BaseIcons
 from gui_core.toolbars   import BaseIcons
@@ -986,7 +986,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             self.GetPyData(layer)[0]['cmd'] = module.GetCmd()
             self.GetPyData(layer)[0]['cmd'] = module.GetCmd()
         elif ltype == 'raster':
         elif ltype == 'raster':
             cmd = ['d.rast']
             cmd = ['d.rast']
-            if UserSettings.Get(group = 'cmd', key = 'rasterOpaque', subkey = 'enabled'):
+            if UserSettings.Get(group = 'rasterLayer', key = 'opaque', subkey = 'enabled'):
                 cmd.append('-n')
                 cmd.append('-n')
                          
                          
         elif ltype == '3d-raster':
         elif ltype == '3d-raster':
@@ -994,7 +994,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
                                         
                                         
         elif ltype == 'rgb':
         elif ltype == 'rgb':
             cmd = ['d.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')
                 cmd.append('-n')
             
             
         elif ltype == 'his':
         elif ltype == 'his':
@@ -1010,12 +1010,7 @@ class LayerTree(treemixin.DragAndDrop, CT.CustomTreeCtrl):
             cmd = ['d.rast.num']
             cmd = ['d.rast.num']
             
             
         elif ltype == 'vector':
         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', 'type=%s' % ','.join(types)]
+            cmd = ['d.vect'] + GetDisplayVectSettings()
             
             
         elif ltype == 'thememap':
         elif ltype == 'thememap':
             # -s flag requested, otherwise only first thematic category is displayed
             # -s flag requested, otherwise only first thematic category is displayed