[GRASS-SVN] r30682 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Mar 21 10:38:12 EDT 2008
Author: martinl
Date: 2008-03-21 10:38:12 -0400 (Fri, 21 Mar 2008)
New Revision: 30682
Modified:
grass/trunk/gui/wxpython/gui_modules/gdialogs.py
grass/trunk/gui/wxpython/gui_modules/globalvar.py
grass/trunk/gui/wxpython/gui_modules/menuform.py
Log:
wxGUI: common widget dimension settings moved to globavar module
In NewVectorDialog use gselect instead of wxTextCtrl
Modified: grass/trunk/gui/wxpython/gui_modules/gdialogs.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2008-03-21 13:39:19 UTC (rev 30681)
+++ grass/trunk/gui/wxpython/gui_modules/gdialogs.py 2008-03-21 14:38:12 UTC (rev 30682)
@@ -19,6 +19,8 @@
import gcmd
import grassenv
+import globalvar
+import gselect
from preferences import globalSettings as UserSettings
class NewVectorDialog(wx.Dialog):
@@ -37,9 +39,9 @@
self.label = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
label=_("Name for new vector map:"))
- self.mapName = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY,
- value='', size=(250, -1),
- style=wx.TE_PROCESS_ENTER)
+ self.mapName = gselect.Select(parent=self.panel, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
+ type='vector', mapsets=[grassenv.GetGRASSVariable('MAPSET'),])
+
self.mapName.Bind(wx.EVT_TEXT, self.OnMapName)
# TODO remove (see Preferences dialog)
@@ -113,7 +115,7 @@
p = gcmd.Command(cmd)
- if p.returncode == 0:
- return outmap
+ if p.returncode == 0:
+ return outmap
return None
Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py 2008-03-21 13:39:19 UTC (rev 30681)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py 2008-03-21 14:38:12 UTC (rev 30682)
@@ -56,7 +56,13 @@
FN.FNB_TABS_BORDER_SIMPLE
FNPageColor = wx.Colour(125,200,175)
-"""@brief File name extension binaries/scripts"""
+"""Dialog widget dimension"""
+DIALOG_SPIN_SIZE = (150, -1)
+DIALOG_COMBOBOX_SIZE = (300, -1)
+DIALOG_GSELECT_SIZE = (400, -1)
+DIALOG_TEXTCTRL_SIZE = (400, -1)
+
+"""File name extension binaries/scripts"""
if subprocess.mswindows:
EXT_BIN = '.exe'
EXT_SCT = '.bat'
Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py 2008-03-21 13:39:19 UTC (rev 30681)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py 2008-03-21 14:38:12 UTC (rev 30682)
@@ -103,21 +103,6 @@
utils.reexec_with_pythonw()
-ID_ABOUT_COMMAND = 102
-
-#
-# Widgets dimension
-#
-SPIN_SIZE = (150, -1)
-COMBOBOX_SIZE = (300, -1)
-GSELECT_SIZE = (400, -1)
-TEXTCTRL_SIZE = (400, -1)
-
-#
-# Global GRASS variables
-#
-CURR_MAPSET = grassenv.GetGRASSVariable('MAPSET')
-
# From lib/gis/col_str.c, except purple which is mentioned
# there but not given RGB values
str2rgb = {'aqua': (100, 128, 255),
@@ -1009,11 +994,11 @@
except ValueError:
minValue = -1e6
maxValue = 1e6
- txt2 = wx.SpinCtrl(parent=which_panel, id=wx.ID_ANY, size=SPIN_SIZE,
+ txt2 = wx.SpinCtrl(parent=which_panel, id=wx.ID_ANY, size=globalvar.DIALOG_SPIN_SIZE,
min=minValue, max=maxValue)
else:
txt2 = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
- size=TEXTCTRL_SIZE)
+ size=globalvar.DIALOG_TEXTCTRL_SIZE)
if p.get('value','') != '':
txt2.SetValue(p['value']) # parameter previously set
which_sizer.Add(item=txt2, proportion=0,
@@ -1027,7 +1012,7 @@
which_sizer.Add(item=txt, proportion=0,
flag=wx.ADJUST_MINSIZE | wx.TOP | wx.RIGHT | wx.LEFT, border=5)
cb = wx.ComboBox(parent=which_panel, id=wx.ID_ANY, value=p.get('default',''),
- size=COMBOBOX_SIZE,
+ size=globalvar.DIALOG_COMBOBOX_SIZE,
choices=valuelist, style=wx.CB_DROPDOWN)
if p.get('value','') != '':
cb.SetValue(p['value']) # parameter previously set
@@ -1049,13 +1034,13 @@
if p.get('multiple','yes') == 'yes' or \
p.get('type','string') == 'string':
txt3 = wx.TextCtrl(parent=which_panel, value = p.get('default',''),
- size=TEXTCTRL_SIZE)
+ size=globalvar.DIALOG_TEXTCTRL_SIZE)
txt3.Bind(wx.EVT_TEXT, self.OnSetValue)
else:
minValue = -1e9
maxValue = 1e9
txt3 = wx.SpinCtrl(parent=which_panel, value=p.get('default',''),
- size=SPIN_SIZE,
+ size=globalvar.DIALOG_SPIN_SIZE,
min=minValue, max=maxValue)
txt3.Bind(wx.EVT_SPINCTRL, self.OnSetValue)
txt3.Bind(wx.EVT_TEXT, self.OnSetValue)
@@ -1077,11 +1062,11 @@
else:
multiple = False
if p.get('age','') == 'new':
- mapsets = [CURR_MAPSET,]
+ mapsets = [grassenv.GetGRASSVariable('MAPSET'),]
else:
mapsets = None
- selection = gselect.Select(parent=which_panel, id=wx.ID_ANY, size=GSELECT_SIZE,
+ selection = gselect.Select(parent=which_panel, id=wx.ID_ANY, size=globalvar.DIALOG_GSELECT_SIZE,
type=p.get('element',''), multiple=multiple, mapsets=mapsets)
if p.get('value','') != '':
selection.SetValue(p['value']) # parameter previously set
@@ -1132,7 +1117,7 @@
# file selector
elif p.get('prompt','') != 'color' and p.get('element', '') == 'file':
fbb = filebrowse.FileBrowseButton(parent=which_panel, id=wx.ID_ANY,
- size=GSELECT_SIZE, labelText='',
+ size=globalvar.DIALOG_GSELECT_SIZE, labelText='',
dialogTitle=_('Choose %s') % \
p.get('description',_('File')),
buttonText=_('Browse'),
@@ -1406,7 +1391,7 @@
if self.grass_task.get_param(key)['element'] in ['cell', 'vector']:
# mapname -> mapname at mapset
if '@' not in value:
- value = value + '@' + CURR_MAPSET
+ value = value + '@' + grassenv.GetGRASSVariable('MAPSET')
self.grass_task.set_param(key, value)
cmd_validated.append(key + '=' + value)
i = i + 1
More information about the grass-commit
mailing list