Просмотр исходного кода

wxGUI/preferences: add new option for random colors (vector)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@72387 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 7 лет назад
Родитель
Сommit
0c06fa4c20
2 измененных файлов с 22 добавлено и 0 удалено
  1. 7 0
      gui/wxpython/core/settings.py
  2. 15 0
      gui/wxpython/gui_core/preferences.py

+ 7 - 0
gui/wxpython/core/settings.py

@@ -320,6 +320,9 @@ class Settings:
                         'enabled': True
                     },
                 },
+                'randomColors': {
+                    'enabled': False,
+                },
             },
             #
             # vdigit
@@ -1294,4 +1297,8 @@ def GetDisplayVectSettings():
             types.append(ftype)
     settings.append('type=%s' % ','.join(types))
 
+    if UserSettings.Get(group='vectorLayer',
+                        key='randomColors', subkey='enabled'):
+        settings.append('-c')
+
     return settings

+ 15 - 0
gui/wxpython/gui_core/preferences.py

@@ -1416,6 +1416,21 @@ class PreferencesDialog(PreferencesBaseDialog):
             hlWidth, pos=(row, col + 1),
             span=(1, 2),
             flag=wx.ALIGN_RIGHT)
+        
+        # random colors
+        row +=1
+        randomColors = wx.CheckBox(parent=panel, id=wx.ID_ANY, label=_(
+            "Random colors according to category number "))
+        randomColors.SetValue(
+            self.settings.Get(
+                group='vectorLayer',
+                key='randomColors',
+                subkey='enabled'))
+        self.winId['vectorLayer:randomColors:enabled'] = randomColors.GetId()
+        gridSizer.Add(
+            randomColors, pos=(row, 0),
+            span=(1, 2),
+            flag=wx.ALIGN_LEFT)
 
         # symbol
         row = 0