[GRASS-SVN] r49850 -
grass/branches/develbranch_6/gui/wxpython/modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Dec 21 07:52:00 EST 2011
Author: martinl
Date: 2011-12-21 04:52:00 -0800 (Wed, 21 Dec 2011)
New Revision: 49850
Modified:
grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py
Log:
wxGUI/colorrules: fix dialog on Windows
Modified: grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py 2011-12-21 07:17:12 UTC (rev 49849)
+++ grass/branches/develbranch_6/gui/wxpython/modules/colorrules.py 2011-12-21 12:52:00 UTC (rev 49850)
@@ -74,7 +74,7 @@
self.clearAll = wx.Button(parent, id = wx.ID_ANY, label = _("Clear all"))
# determines how many rules should be added
self.numRules = wx.SpinCtrl(parent, id = wx.ID_ANY,
- min = 1, max = 1e6)
+ min = 1, max = 1e6, initial = 1)
# add rules
self.btnAdd = wx.Button(parent, id = wx.ID_ADD)
@@ -230,8 +230,11 @@
try:
table = self.parent.colorTable
except AttributeError:
- # due to scrollpanel in vector dialog
- table = self.parent.GetParent().colorTable
+ # due to panel/scrollpanel in vector dialog
+ if isinstance(self.parent.GetParent(), RasterColorTable):
+ table = self.parent.GetParent().colorTable
+ else:
+ table = self.parent.GetParent().GetParent().colorTable
if table:
self.SetRasterRule(num, val)
else:
@@ -318,6 +321,8 @@
self.SetIcon(wx.Icon(os.path.join(globalvar.ETCICONDIR, 'grass.ico'), wx.BITMAP_TYPE_ICO))
+ self.panel = wx.Panel(parent = self, id = wx.ID_ANY)
+
# instance of render.Map to be associated with display
self.Map = Map()
@@ -368,12 +373,13 @@
label = " %s " % maplabel)
inputSizer = wx.StaticBoxSizer(inputBox, wx.VERTICAL)
- self.selectionInput = Select(parent, id = wx.ID_ANY,
+ self.selectionInput = Select(parent = parent, id = wx.ID_ANY,
size = globalvar.DIALOG_GSELECT_SIZE,
type = self.mapType)
# layout
inputSizer.Add(item = self.selectionInput,
flag = wx.ALIGN_CENTER_VERTICAL | wx.ALL | wx.EXPAND, border = 5)
+
return inputSizer
def _createFileSelection(self, parent):
@@ -431,12 +437,12 @@
Map = self.Map)
self.preview.EraseMap()
- def _createButtons(self):
+ def _createButtons(self, parent):
"""!Create buttons for leaving dialog"""
- self.btnHelp = wx.Button(parent = self, id = wx.ID_HELP)
- self.btnCancel = wx.Button(parent = self, id = wx.ID_CANCEL)
- self.btnApply = wx.Button(parent = self, id = wx.ID_APPLY)
- self.btnOK = wx.Button(parent = self, id = wx.ID_OK)
+ self.btnHelp = wx.Button(parent, id = wx.ID_HELP)
+ self.btnCancel = wx.Button(parent, id = wx.ID_CANCEL)
+ self.btnApply = wx.Button(parent, id = wx.ID_APPLY)
+ self.btnOK = wx.Button(parent, id = wx.ID_OK)
self.btnOK.SetDefault()
self.btnOK.Enable(False)
@@ -480,7 +486,7 @@
# preview window
self._createPreview(parent = parent)
- bodySizer.Add(item = self.preview, pos = (row, 2), flag = wx.EXPAND)
+ bodySizer.Add(item = self.preview, pos = (row, 2))
row += 1
# add ckeck all and clear all
@@ -746,7 +752,9 @@
self._initLayer()
- self.SetMinSize(self.GetSize())
+ # self.SetMinSize(self.GetSize())
+ self.SetMinSize((650, 700))
+
self.CentreOnScreen()
self.Show()
@@ -756,35 +764,35 @@
#
# map selection
#
- mapSelection = self._createMapSelection(parent = self)
+ mapSelection = self._createMapSelection(parent = self.panel)
sizer.Add(item = mapSelection, proportion = 0,
flag = wx.ALL | wx.EXPAND, border = 5)
#
# manage extern tables
#
- fileSelection = self._createFileSelection(parent = self)
+ fileSelection = self._createFileSelection(parent = self.panel)
sizer.Add(item = fileSelection, proportion = 0,
flag = wx.ALL | wx.EXPAND, border = 5)
#
# body & preview
#
- bodySizer = self._createBody(parent = self)
+ bodySizer = self._createBody(parent = self.panel)
sizer.Add(item = bodySizer, proportion = 1,
flag = wx.ALL | wx.EXPAND, border = 5)
#
# buttons
#
- btnSizer = self._createButtons()
- sizer.Add(item = wx.StaticLine(parent = self, id = wx.ID_ANY,
+ btnSizer = self._createButtons(parent = self.panel)
+ sizer.Add(item = wx.StaticLine(parent = self.panel, id = wx.ID_ANY,
style = wx.LI_HORIZONTAL), proportion = 0,
flag = wx.EXPAND | wx.ALL, border = 5)
sizer.Add(item = btnSizer, proportion = 0,
flag = wx.ALL | wx.ALIGN_RIGHT, border = 5)
- self.SetSizer(sizer)
+ self.panel.SetSizer(sizer)
sizer.Layout()
- sizer.Fit(self)
+ sizer.Fit(self.panel)
self.Layout()
def OnSelectionInput(self, event):
@@ -880,9 +888,7 @@
"""!Show GRASS manual page"""
cmd = 'r.colors'
ColorTable.RunHelp(self, cmd = cmd)
-
-
-
+
class VectorColorTable(ColorTable):
def __init__(self, parent, attributeType, **kwargs):
"""!Dialog for interactively entering color rules for vector maps"""
@@ -930,10 +936,11 @@
self.cr_label.SetLabel(_("Enter vector attribute values or percents:"))
else:
self.cr_label.SetLabel(_("Enter vector attribute values:"))
- self.SetMinSize(self.GetSize())
+
+ #self.SetMinSize(self.GetSize())
+ self.SetMinSize((650, 700))
+
self.CentreOnScreen()
-
- self.SetSize((-1, 760))
self.Show()
def _createVectorAttrb(self, parent):
@@ -1010,7 +1017,7 @@
def _doLayout(self):
"""!Do main layout"""
- scrollPanel = scrolled.ScrolledPanel(self, id = wx.ID_ANY, size = (650, 500),
+ scrollPanel = scrolled.ScrolledPanel(parent = self.panel, id = wx.ID_ANY,
style = wx.TAB_TRAVERSAL)
scrollPanel.SetupScrolling()
sizer = wx.BoxSizer(wx.VERTICAL)
@@ -1051,20 +1058,21 @@
#
# buttons
#
- btnSizer = self._createButtons()
+ btnSizer = self._createButtons(self.panel)
mainsizer = wx.BoxSizer(wx.VERTICAL)
mainsizer.Add(scrollPanel, proportion = 1, flag = wx.EXPAND | wx.ALL, border = 5)
- mainsizer.Add(item = wx.StaticLine(parent = self, id = wx.ID_ANY,
+ mainsizer.Add(item = wx.StaticLine(parent = self.panel, id = wx.ID_ANY,
style = wx.LI_HORIZONTAL), proportion = 0,
flag = wx.EXPAND | wx.ALL, border = 5)
mainsizer.Add(item = btnSizer, proportion = 0,
flag = wx.ALL | wx.ALIGN_RIGHT | wx.EXPAND, border = 5)
- self.SetSizer(mainsizer)
+ self.panel.SetSizer(mainsizer)
mainsizer.Layout()
- mainsizer.Fit(self)
-
+ mainsizer.Fit(self.panel)
+ self.Layout()
+
def OnPaneChanged(self, event = None):
# redo the layout
self.Layout()
@@ -1343,10 +1351,10 @@
columns = self.properties['sourceColumn']
if self.properties['loadColumn']:
columns += ',' + self.properties['loadColumn']
-
+
+ sep = ';'
if self.inmap:
outFile = tempfile.NamedTemporaryFile(mode = 'w+b')
- sep = '|'
ret = RunCommand('v.db.select',
quiet = True,
flags = 'c',
More information about the grass-commit
mailing list