|
@@ -60,19 +60,17 @@ class RulesPanel:
|
|
|
self.attributeType = attributeType
|
|
|
self.properties = properties
|
|
|
self.parent = parent
|
|
|
+ self.panelWidth = panelWidth
|
|
|
|
|
|
- self.mainPanel = scrolled.ScrolledPanel(parent, id = wx.ID_ANY,
|
|
|
- size = (panelWidth, 300),
|
|
|
- style = wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER)
|
|
|
- self.mainPanel.SetupScrolling(scroll_x = False)
|
|
|
self.mainSizer = wx.FlexGridSizer(cols = 3, vgap = 6, hgap = 4)
|
|
|
# put small border at the top of panel
|
|
|
for i in range(3):
|
|
|
self.mainSizer.Add(item = wx.Size(3, 3))
|
|
|
|
|
|
- self.mainPanel.SetSizer(self.mainSizer)
|
|
|
- self.mainPanel.SetAutoLayout(True)
|
|
|
-
|
|
|
+ self.mainPanel = scrolled.ScrolledPanel(parent, id = wx.ID_ANY,
|
|
|
+ size = (self.panelWidth, 300),
|
|
|
+ style = wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER)
|
|
|
+
|
|
|
# (un)check all
|
|
|
self.checkAll = wx.CheckBox(parent, id = wx.ID_ANY, label = _("Check all"))
|
|
|
self.checkAll.SetValue(True)
|
|
@@ -87,12 +85,15 @@ class RulesPanel:
|
|
|
self.btnAdd.Bind(wx.EVT_BUTTON, self.OnAddRules)
|
|
|
self.checkAll.Bind(wx.EVT_CHECKBOX, self.OnCheckAll)
|
|
|
self.clearAll.Bind(wx.EVT_BUTTON, self.OnClearAll)
|
|
|
-
|
|
|
+
|
|
|
+ self.mainPanel.SetSizer(self.mainSizer)
|
|
|
+ self.mainPanel.SetAutoLayout(True)
|
|
|
+ self.mainPanel.SetupScrolling()
|
|
|
|
|
|
def Clear(self):
|
|
|
"""!Clear and widgets and delete information"""
|
|
|
self.ruleslines.clear()
|
|
|
- self.mainPanel.DestroyChildren()
|
|
|
+ self.mainSizer.Clear(deleteWindows=True)
|
|
|
|
|
|
def OnCheckAll(self, event):
|
|
|
"""!(Un)check all rules"""
|
|
@@ -113,10 +114,9 @@ class RulesPanel:
|
|
|
self.AddRules(nrules)
|
|
|
|
|
|
def AddRules(self, nrules, start = False):
|
|
|
- """!Add rules
|
|
|
-
|
|
|
+ """!Add rules
|
|
|
@param start set widgets (not append)"""
|
|
|
-
|
|
|
+
|
|
|
snum = len(self.ruleslines.keys())
|
|
|
if start:
|
|
|
snum = 0
|
|
@@ -157,7 +157,7 @@ class RulesPanel:
|
|
|
if not start:
|
|
|
self.ruleslines[enable.GetId()] = { 'value' : '',
|
|
|
self.attributeType: init }
|
|
|
-
|
|
|
+
|
|
|
self.mainSizer.Add(item = enable, proportion = 0,
|
|
|
flag = wx.ALIGN_CENTER_VERTICAL)
|
|
|
self.mainSizer.Add(item = txt_ctrl, proportion = 0,
|
|
@@ -167,7 +167,6 @@ class RulesPanel:
|
|
|
|
|
|
self.mainPanel.Layout()
|
|
|
self.mainPanel.SetupScrolling(scroll_x = False)
|
|
|
-
|
|
|
|
|
|
def OnRuleEnable(self, event):
|
|
|
"""!Rule enabled/disabled"""
|
|
@@ -504,11 +503,7 @@ class ColorTable(wx.Frame):
|
|
|
flag = wx.ALIGN_CENTER_VERTICAL)
|
|
|
bodySizer.Add(item = self.rulesPanel.btnAdd, pos = (row, 1))
|
|
|
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- return bodySizer
|
|
|
-
|
|
|
+ return bodySizer
|
|
|
|
|
|
def InitDisplay(self):
|
|
|
"""!Initialize preview display, set dimensions and region
|
|
@@ -530,6 +525,7 @@ class ColorTable(wx.Frame):
|
|
|
ret = self.CreateColorTable()
|
|
|
if not ret:
|
|
|
gcmd.GMessage(parent = self, message = _("No valid color rules given."))
|
|
|
+
|
|
|
if self.colorTable:
|
|
|
self.UseAttrColumn(False)
|
|
|
else:
|
|
@@ -633,8 +629,8 @@ class ColorTable(wx.Frame):
|
|
|
"""!Load current color table (using `r(v).colors.out`)
|
|
|
|
|
|
@param mapType map type (raster or vector)"""
|
|
|
-
|
|
|
self.rulesPanel.Clear()
|
|
|
+
|
|
|
if mapType == 'raster':
|
|
|
cmd = ['r.colors.out',
|
|
|
'read=True',
|
|
@@ -657,7 +653,7 @@ class ColorTable(wx.Frame):
|
|
|
self.OnPreview()
|
|
|
return
|
|
|
|
|
|
- self.ReadColorTable(ctable = ctable)
|
|
|
+ self.ReadColorTable(ctable = ctable)
|
|
|
|
|
|
def CreateColorTable(self, tmp = False):
|
|
|
"""!Creates color table
|
|
@@ -1105,6 +1101,7 @@ class VectorColorTable(ColorTable):
|
|
|
|
|
|
def OnCheckColumn(self, event):
|
|
|
"""!Use color column instead of color table"""
|
|
|
+
|
|
|
if self.useColumn.GetValue():
|
|
|
self.properties['loadColumn'] = self.fromColumn.GetStringSelection()
|
|
|
self.properties['storeColumn'] = self.toColumn.GetStringSelection()
|
|
@@ -1122,9 +1119,7 @@ class VectorColorTable(ColorTable):
|
|
|
self.fromColumn.Enable(False)
|
|
|
self.toColumn.Enable(False)
|
|
|
self.colorTable = True
|
|
|
-
|
|
|
self.LoadTable()
|
|
|
-
|
|
|
|
|
|
def EnableVectorAttributes(self, enable):
|
|
|
"""!Enable/disable part of dialog connected with db"""
|
|
@@ -1157,9 +1152,10 @@ class VectorColorTable(ColorTable):
|
|
|
self.inmap = None
|
|
|
|
|
|
self.UpdateDialog()
|
|
|
-
|
|
|
+
|
|
|
def UpdateDialog(self):
|
|
|
"""!Update dialog after map selection"""
|
|
|
+
|
|
|
if not self.inmap:
|
|
|
self.DisableClearAll()
|
|
|
return
|
|
@@ -1191,7 +1187,6 @@ class VectorColorTable(ColorTable):
|
|
|
for prop in ('sourceColumn', 'loadColumn', 'storeColumn'):
|
|
|
self.properties[prop] = ''
|
|
|
self.EnableVectorAttributes(False)
|
|
|
-
|
|
|
else: # db connection exist
|
|
|
# initialize layer selection combobox
|
|
|
self.EnableVectorAttributes(True)
|
|
@@ -1210,10 +1205,11 @@ class VectorColorTable(ColorTable):
|
|
|
# initialize column selection comboboxes
|
|
|
|
|
|
self.OnLayerSelection(event = None)
|
|
|
+
|
|
|
if self.version7 and self.attributeType == 'color':
|
|
|
self.useColumn.SetValue(False)
|
|
|
self.OnCheckColumn(event = None)
|
|
|
-
|
|
|
+
|
|
|
self.LoadTable()
|
|
|
|
|
|
self.btnPreview.Enable(enable)
|
|
@@ -1615,10 +1611,8 @@ class ThematicVectorTable(VectorColorTable):
|
|
|
for vector maps for thematic mapping in nviz"""
|
|
|
self.vectorType = vectorType
|
|
|
VectorColorTable.__init__(self, parent = parent, **kwargs)
|
|
|
-
|
|
|
-
|
|
|
- self.SetTitle(_("Thematic mapping for vector map in 3D view"))
|
|
|
-
|
|
|
+
|
|
|
+ self.SetTitle(_("Thematic mapping for vector map in 3D view"))
|
|
|
|
|
|
def _initLayer(self):
|
|
|
"""!Set initial layer when opening dialog"""
|
|
@@ -1818,4 +1812,4 @@ class BufferedWindow(wx.Window):
|
|
|
def EraseMap(self):
|
|
|
"""!Erase preview"""
|
|
|
self.Draw(self.pdc, pdctype = 'clear')
|
|
|
-
|
|
|
+
|