[GRASS-SVN] r30419 - in grass/trunk/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Mar 2 07:55:24 EST 2008


Author: martinl
Date: 2008-03-02 07:55:24 -0500 (Sun, 02 Mar 2008)
New Revision: 30419

Modified:
   grass/trunk/gui/wxpython/gis_set.py
   grass/trunk/gui/wxpython/gui_modules/dbm.py
   grass/trunk/gui/wxpython/gui_modules/gcmd.py
   grass/trunk/gui/wxpython/gui_modules/globalvar.py
   grass/trunk/gui/wxpython/gui_modules/gselect.py
   grass/trunk/gui/wxpython/gui_modules/mapdisp.py
   grass/trunk/gui/wxpython/gui_modules/menuform.py
   grass/trunk/gui/wxpython/gui_modules/render.py
   grass/trunk/gui/wxpython/gui_modules/toolbars.py
   grass/trunk/gui/wxpython/gui_modules/utils.py
   grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
   grass/trunk/gui/wxpython/wxgui.py
Log:
wxGUI: progress in MSYS fixes (basic GUI features, GUI dialog, Attribute Table Manager). Use wx.Panel instances.

Modified: grass/trunk/gui/wxpython/gis_set.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gis_set.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -53,6 +53,8 @@
 
         wx.Frame.__init__(self, parent=parent, id=id, style=style)
 
+	self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
+
         #
         # graphical elements
         #
@@ -67,68 +69,69 @@
 
         # labels
         ### crashes when LOCATION doesn't exist
-        # versionCmd = gcmd.Command(['g.version' + globalvar.EXT_BIN], log=None)
+        # versionCmd = gcmd.Command(['g.version'], log=None)
         # grassVersion = versionCmd.ReadStdOutput()[0].replace('GRASS', '').strip()
         versionFile = open(os.path.join(globalvar.ETCDIR, "VERSIONNUMBER"))
         grassVersion = versionFile.readline().replace('%s' % os.linesep, '').strip()
         versionFile.close()
 
-        self.select_box = wx.StaticBox (parent=self, id=wx.ID_ANY,
+        self.select_box = wx.StaticBox (parent=self.panel, id=wx.ID_ANY,
                                         label=" %s " % _("Choose project location and mapset"))
 
-        self.manage_box = wx.StaticBox (parent=self, id=wx.ID_ANY,
+        self.manage_box = wx.StaticBox (parent=self.panel, id=wx.ID_ANY,
                                         label=" %s " % _("Manage"))
-        self.lwelcome = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.lwelcome = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                       label=_("Welcome to GRASS GIS %s\n"
                                               "The world's leading open source GIS") % grassVersion,
                                       style=wx.ALIGN_CENTRE)
         #self.SetFont(wx.Font(pointSize=9, family=wx.FONTFAMILY_DEFAULT,
         #                     style=wx.NORMAL, weight=wx.NORMAL))
-        self.ltitle = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.ltitle = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                     label=_("Select an existing project location and mapset\n"
                                             "or define a new location"),
                                     style=wx.ALIGN_CENTRE)
-        self.ldbase = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.ldbase = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                     label=_("GIS Data Directory:"))
-        self.llocation = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.llocation = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                        label=_("Project location\n(projection/coordinate system)"),
                                        style=wx.ALIGN_CENTRE)
-        self.lmapset = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.lmapset = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                      label=_("Accessible mapsets\n(directories of GIS files)"),
                                      style=wx.ALIGN_CENTRE)
-        self.lcreate = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.lcreate = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                      label=_("Create new mapset\nin selected location"),
                                      style=wx.ALIGN_CENTRE)
-        self.ldefine = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.ldefine = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                      label=_("Define new location"),
                                      style=wx.ALIGN_CENTRE)
-        self.lmanageloc = wx.StaticText(parent=self, id=wx.ID_ANY,
+        self.lmanageloc = wx.StaticText(parent=self.panel, id=wx.ID_ANY,
                                         label=_("Rename/delete selected\nmapset or location"),
                                         style=wx.ALIGN_CENTRE)
 
         # buttons
-        self.bstart = wx.Button(parent=self, id=wx.ID_ANY,
+        self.bstart = wx.Button(parent=self.panel, id=wx.ID_ANY,
                                 label=_("Start GRASS"), size=(180, -1))
         self.bstart.SetDefault()
-        self.bexit = wx.Button(parent=self, id=wx.ID_EXIT)
-        self.bhelp = wx.Button(parent=self, id=wx.ID_HELP)
-        self.bbrowse = wx.Button(parent=self, id=wx.ID_ANY,
+        self.bexit = wx.Button(parent=self.panel, id=wx.ID_EXIT)
+        self.bhelp = wx.Button(parent=self.panel, id=wx.ID_HELP)
+        self.bbrowse = wx.Button(parent=self.panel, id=wx.ID_ANY,
                                  label=_("Browse"))
-        self.bmapset = wx.Button(parent=self, id=wx.ID_ANY,
+        self.bmapset = wx.Button(parent=self.panel, id=wx.ID_ANY,
                                  label=_("Create mapset"))
-        self.bwizard = wx.Button(parent=self, id=wx.ID_ANY,
+        self.bwizard = wx.Button(parent=self.panel, id=wx.ID_ANY,
                                  label=_("Location wizard"))
-        self.manageloc = wx.Choice(parent=self, id=wx.ID_ANY,
+        self.manageloc = wx.Choice(parent=self.panel, id=wx.ID_ANY,
                                    choices=['Rename mapset','Rename location',
                                             'Delete mapset', 'Delete location'])
+	self.manageloc.SetSelection(0)
 
         # textinputs
-        self.tgisdbase = wx.TextCtrl(parent=self, id=wx.ID_ANY, value="", size=(300, -1),
+        self.tgisdbase = wx.TextCtrl(parent=self.panel, id=wx.ID_ANY, value="", size=(300, -1),
                                      style=wx.TE_LEFT)
 
         # TODO: sort list, but keep mapsets aligned to sorted locations
         # Locations
-        self.lpanel = wx.Panel(parent=self,id=wx.ID_ANY)
+        self.lpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self.lblocations = wx.ListBox(parent=self.lpanel,
                                       id=wx.ID_ANY, size=(180, 200),
                                       choices=self.listOfLocations,
@@ -136,7 +139,7 @@
 
         # TODO: sort; but keep PERMANENT on top of list
         # Mapsets
-        self.mpanel = wx.Panel(parent=self,id=wx.ID_ANY)
+        self.mpanel = wx.Panel(parent=self.panel, id=wx.ID_ANY)
         self.lbmapsets = wx.ListBox(parent=self.mpanel,
                                     id=wx.ID_ANY, size=(150, 200),
                                     choices=self.listOfMapsets,
@@ -298,7 +301,7 @@
                   flag=wx.ADJUST_MINSIZE |
                   wx.ALIGN_CENTER_VERTICAL |
                   wx.ALIGN_CENTER_HORIZONTAL |
-                  wx.BOTTOM | wx.TOP,
+                  wx.ALL,
                   border=5) # image
         sizer.Add(item=self.lwelcome, # welcome message
                   proportion=0,
@@ -334,10 +337,11 @@
                   wx.RIGHT | wx.LEFT,
                   border=5)
 
-        self.SetAutoLayout(True)
-        self.SetSizer(sizer)
-        sizer.Fit(self)
+        self.panel.SetAutoLayout(True)
+        self.panel.SetSizer(sizer)
+        sizer.Fit(self.panel)
         sizer.SetSizeHints(self)
+
         self.Layout()
 
     def _read_grassrc(self):
@@ -609,11 +613,11 @@
 
     def OnStart(self, event):
         """'Start GRASS' button clicked"""
-        gcmd.Command(["g.gisenv" + globalvar.EXT_BIN,
+        gcmd.Command(["g.gisenv",
                       "set=GISDBASE=%s" % self.tgisdbase.GetValue()])
-        gcmd.Command(["g.gisenv" + globalvar.EXT_BIN,
+        gcmd.Command(["g.gisenv",
                       "set=LOCATION_NAME=%s" % self.listOfLocations[self.lblocations.GetSelection()]])
-        gcmd.Command(["g.gisenv" + globalvar.EXT_BIN,
+        gcmd.Command(["g.gisenv",
                       "set=MAPSET=%s" % self.listOfMapsets[self.lbmapsets.GetSelection()]])
 
         self.Destroy()

Modified: grass/trunk/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/dbm.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -37,6 +37,10 @@
 import locale
 import tempfile
 
+### i18N
+import gettext
+gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
+
 import wx
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.flatnotebook as FN
@@ -201,7 +205,8 @@
         i = 0
         outFile.seek(0)
         while True:
-            record = outFile.readline().replace(os.linesep, '')
+            # os.linesep doesn't work here (MSYS)
+            record = outFile.readline().replace('\n', '')
             if not record:
                 break
             self.itemDataMap[i] = []
@@ -362,6 +367,8 @@
 
         wx.Frame.__init__(self, parent, id, title, size=(900,600), style=style)
 
+        self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
+
         try:
             self.map        = self.parent.curr_page.maptree.Map
             self.mapdisplay = self.parent.curr_page.maptree.mapdisplay
@@ -420,7 +427,7 @@
         # really needed (ML)
         # self.notebook.SetFont(wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.NORMAL, 0, ''))
 
-        self.notebook = FN.FlatNotebook(parent=self, id=wx.ID_ANY,
+        self.notebook = FN.FlatNotebook(parent=self.panel, id=wx.ID_ANY,
                                         style=FN.FNB_BOTTOM |
                                         FN.FNB_NO_NAV_BUTTONS |
                                         FN.FNB_FANCY_TABS)
@@ -464,8 +471,8 @@
         #
         # buttons
         #
-        self.btnApply      = wx.Button(parent=self, id=wx.ID_APPLY)
-        self.btnQuit       = wx.Button(parent=self, id=wx.ID_EXIT)
+        self.btnApply      = wx.Button(parent=self.panel, id=wx.ID_APPLY)
+        self.btnQuit       = wx.Button(parent=self.panel, id=wx.ID_EXIT)
         # self.btn_unselect = wx.Button(self, -1, "Unselect")
 
         # events

Modified: grass/trunk/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gcmd.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/gcmd.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -44,6 +44,8 @@
 from threading import Thread
 
 # import wxgui_utils # log window
+import globalvar
+import utils
 from debug import Debug as Debug
 
 class GException(Exception):
@@ -222,6 +224,12 @@
                   stdout=None, stderr=sys.stderr):
 
         self.cmd = cmd
+	# hack around platform-specific extension for binaries
+	if self.cmd[0] in globalvar.grassCmd['script']:
+	    self.cmd[0] = self.cmd[0] + globalvar.EXT_SCT
+	else:
+	    self.cmd[0] = self.cmd[0] + globalvar.EXT_BIN
+
         self.stderr = stderr
 
         #

Modified: grass/trunk/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/globalvar.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/globalvar.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -49,9 +49,33 @@
     FN.FNB_TABS_BORDER_SIMPLE 
 FNPageColor = wx.Colour(125,200,175)
 
+"""@brief File name extension binaries/scripts"""
 if subprocess.mswindows:
     EXT_BIN = '.exe'
     EXT_SCT = '.bat'
 else:
     EXT_BIN = ''
     EXT_SCT = ''
+
+def __getGRASSCmds(bin=True, scripts=True):
+    """
+    Create list of all available GRASS commands to use when
+    parsing string from the command line
+    """
+    gcmdlst = []
+    gisbase = os.environ['GISBASE']
+    if bin is True:
+        gcmdlst = os.listdir(os.path.join(gisbase, 'bin'))
+    if scripts is True:
+        gcmdlst = gcmdlst + os.listdir(os.path.join(gisbase, 'scripts'))
+    # self.gcmdlst = self.gcmdlst + os.listdir(os.path.join(gisbase,'etc','gm','script'))
+
+    return gcmdlst
+
+"""@brief Collected GRASS-relared binaries/scripts"""
+grassCmd = {}
+grassCmd['all'] = __getGRASSCmds()
+grassCmd['script'] = __getGRASSCmds(bin=False)
+
+"""@Toolbar icon size"""
+toolbarSize = (24, 24)
\ No newline at end of file

Modified: grass/trunk/gui/wxpython/gui_modules/gselect.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gselect.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/gselect.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -157,7 +157,7 @@
         with all relevant elements displayed beneath each mapset branch
         """
         #set environmental variables
-        cmdlist = ['g.gisenv' + globalvar.EXT_BIN, 'get=MAPSET']
+        cmdlist = ['g.gisenv', 'get=MAPSET']
         curr_mapset = gcmd.Command(cmdlist).ReadStdOutput()[0]
 
         #mapsets in current location
@@ -222,7 +222,7 @@
             dir_node = self.AddItem('Mapset: '+dir)
             self.seltree.SetItemTextColour(dir_node,wx.Colour(50,50,200))
             try:
-                cmdlist = ['g.mlist' + globalvar.EXT_SCT, 'type=%s' % elementdict[element], 'mapset=%s' % dir]
+                cmdlist = ['g.mlist', 'type=%s' % elementdict[element], 'mapset=%s' % dir]
                 elem_list = gcmd.Command(cmdlist).ReadStdOutput()
                 elem_list.sort()
                 for elem in elem_list:

Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -1983,7 +1983,7 @@
         # for user to set explicitly with g.region
         new = self.Map.AlignResolution()
 
-        cmdRegion = ["g.region" + globalvar.EXT_BIN, "--o",
+        cmdRegion = ["g.region", "--o",
                      "n=%f"    % new['n'],
                      "s=%f"    % new['s'],
                      "e=%f"    % new['e'],
@@ -2015,7 +2015,7 @@
 
         wind = dlg.wind
 
-        p = gcmd.Command (["g.region" + globalvar.EXT_BIN,
+        p = gcmd.Command (["g.region",
 	                   "-ugp", "region=%s" % wind])
 
         if p.returncode == 0:
@@ -2068,7 +2068,7 @@
         """Save region settings"""
         new = self.Map.AlignResolution()
 
-        cmdRegion = ["g.region" + globalvar.EXT_BIN,
+        cmdRegion = ["g.region",
                      "-u",
                      "n=%f" % new['n'],
                      "s=%f" % new['s'],
@@ -2187,6 +2187,7 @@
                                                  "Geometry",
                                                  "Map scale"])
         self.statusText = "Coordinates"
+	self.toggleStatus.SetStringSelection(self.statusText)
         self.statusbar.Bind(wx.EVT_CHOICE, self.OnToggleStatus, self.toggleStatus)
         # auto-rendering checkbox
         self.autoRender = wx.CheckBox(parent=self.statusbar, id=wx.ID_ANY,
@@ -2653,13 +2654,15 @@
                     wWin = rect.width - 6
                 # -> position
                 if win == self.showRegion:
-                    x, y = rect.x + rect.width - wWin, rect.y - 1
+                    x, y = rect.x + rect.width - wWin, rect.y - 2
                 else:
-                    x, y = rect.x + 3, rect.y - 1
+                    x, y = rect.x + 3, rect.y - 2
                 w, h = wWin, rect.height + 2
             else: # choice || auto-rendering
-                x, y = rect.x, rect.y-1
-                w, h = rect.width, rect.height+2
+                x, y = rect.x, rect.y - 2
+                w, h = rect.width, rect.height + 2
+		if idx == 2:
+		    x += 10
 
             win.SetPosition((x, y))
             win.SetSize((w, h))
@@ -2795,13 +2798,13 @@
 
         # build query commands for any selected rasters and vectors
         if raststr != '':
-            rcmd = ['r.what' + globalvar.EXT_BIN, '--q',
+            rcmd = ['r.what', '--q',
                     '-f',
                     'input=%s' % raststr.rstrip(','),
                     'east_north=%f,%f' % (float(east), float(north))]
 
         if vectstr != '':
-            vcmd = ['v.what' + globalvar.EXT_BIN, '--q',
+            vcmd = ['v.what', '--q',
                     '-a',
                     'map=%s' % vectstr.rstrip(','),
                     'east_north=%f,%f' % (float(east), float(north)),

Modified: grass/trunk/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/menuform.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -107,7 +107,8 @@
 HSPACE = 4
 MENU_HEIGHT = 25
 STATUSBAR_HEIGHT = 30
-ENTRY_HEIGHT = 25
+# ENTRY_HEIGHT = 25
+ENTRY_HEIGHT = -1
 STRING_ENTRY_WIDTH = 300
 BUTTON_HEIGHT = 44
 BUTTON_WIDTH = 100
@@ -243,7 +244,7 @@
         built so far, even though it would not be a correct command
         for GRASS.
         """
-        cmd = [self.name + globalvar.EXT_BIN]
+        cmd = [self.name]
         errors = 0
         errStr = ""
 
@@ -553,6 +554,8 @@
         wx.Frame.__init__(self, parent=parent, id=ID, title=title,
                           pos=wx.DefaultPosition, style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL)
 
+	self.panel = wx.Panel(parent=self, id=wx.ID_ANY)
+
         # statusbar
         self.CreateStatusBar()
         # icon
@@ -589,7 +592,7 @@
         topsizer = wx.BoxSizer(wx.HORIZONTAL)
 
         # GRASS logo
-        self.logo = wx.StaticBitmap(parent=self,
+        self.logo = wx.StaticBitmap(parent=self.panel,
                                     bitmap=wx.Bitmap(name=os.path.join(imagepath,
                                                                        'grass-tiny-logo.png'),
                                                      type=wx.BITMAP_TYPE_PNG))
@@ -598,7 +601,7 @@
         guisizer.Add (item=topsizer, proportion=0, flag=wx.EXPAND)
 
         # notebooks
-        self.notebookpanel = cmdPanel (parent=self, task=self.task, standalone=self.standalone)
+        self.notebookpanel = cmdPanel (parent=self.panel, task=self.task, standalone=self.standalone)
         ### add 'command output' tab also for dialog open from menu
         #         if self.standalone:
         self.goutput = self.notebookpanel.goutput
@@ -620,13 +623,13 @@
         # buttons
         btnsizer = wx.BoxSizer(orient=wx.HORIZONTAL)
         # cancel
-        btn_cancel = wx.Button(parent=self, id=wx.ID_CANCEL)
+        btn_cancel = wx.Button(parent=self.panel, id=wx.ID_CANCEL)
         btn_cancel.SetToolTipString(_("Cancel the command settings and ignore changes"))
         btnsizer.Add(item=btn_cancel, proportion=0, flag=wx.ALL | wx.ALIGN_CENTER, border=10)
         btn_cancel.Bind(wx.EVT_BUTTON, self.OnCancel)
         if self.get_dcmd is not None: # A callback has been set up
-            btn_apply = wx.Button(parent=self, id=wx.ID_APPLY)
-            btn_ok = wx.Button(parent=self, id=wx.ID_OK)
+            btn_apply = wx.Button(parent=self.panel, id=wx.ID_APPLY)
+            btn_ok = wx.Button(parent=self.panel, id=wx.ID_OK)
             btn_ok.SetDefault()
 
             btnsizer.Add(item=btn_apply, proportion=0,
@@ -640,11 +643,11 @@
             btn_ok.Bind(wx.EVT_BUTTON, self.OnOK)
         else: # We're standalone
             # run
-            btn_run = wx.Button(parent=self, id=wx.ID_OK, label= _("&Run"))
+            btn_run = wx.Button(parent=self.panel, id=wx.ID_OK, label= _("&Run"))
             btn_run.SetToolTipString(_("Run the command"))
             btn_run.SetDefault()
             # copy
-            btn_clipboard = wx.Button(parent=self, id=wx.ID_COPY, label=_("C&opy"))
+            btn_clipboard = wx.Button(parent=self.panel, id=wx.ID_COPY, label=_("C&opy"))
             btn_clipboard.SetToolTipString(_("Copy the current command string to the clipboard"))
 
             btnsizer.Add(item=btn_run, proportion=0,
@@ -662,7 +665,7 @@
 
         if self.get_dcmd is None:
             # close dialog on run?
-            self.closebox = wx.CheckBox(parent=self,
+            self.closebox = wx.CheckBox(parent=self.panel,
                                         label=_('Close dialog on run'), style = wx.NO_BORDER)
             self.closebox.SetValue(False)
             guisizer.Add(item=self.closebox, proportion=0,
@@ -673,18 +676,23 @@
 
         constrained_size = self.notebookpanel.GetSize()
         # 80 takes the tabbar into account
-        self.notebookpanel.SetSize( (constrained_size[0],constrained_size[1]+80) ) 
+        self.notebookpanel.SetSize( (constrained_size[0] + 25, constrained_size[1] + 80) ) 
         self.notebookpanel.Layout()
-        
+
         # for too long descriptions
-        self.description = StaticWrapText (parent=self, label=self.task.description)
+        self.description = StaticWrapText (parent=self.panel, label=self.task.description)
         topsizer.Add (item=self.description, proportion=1, border=5,
                       flag=wx.ALL | wx.ALIGN_CENTER_VERTICAL | wx.EXPAND)
 
-        guisizer.SetSizeHints(self)
-        self.SetAutoLayout(True)
-        self.SetSizer(guisizer)
-        guisizer.Fit(self)
+        # set frame size
+        self.SetSize(self.notebookpanel.GetSize())
+        self.SetMinSize(self.notebookpanel.GetSize())
+
+        guisizer.SetSizeHints(self.panel)
+        self.panel.SetAutoLayout(True)
+        self.panel.SetSizer(guisizer)
+        guisizer.Fit(self.panel)
+
         self.Layout()
 
     def updateValuesHook(self):
@@ -874,8 +882,8 @@
                 chk.SetToolTipString(tooltip)
             if 'value' in f:
                 chk.SetValue( f['value'] )
-            chk.SetFont(wx.Font(pointSize=fontsize, family=wx.FONTFAMILY_DEFAULT,
-                                style=wx.NORMAL, weight=text_style))
+            # chk.SetFont(wx.Font(pointSize=fontsize, family=wx.FONTFAMILY_DEFAULT,
+            #                    style=wx.NORMAL, weight=text_style))
             which_sizer.Add( item=chk, proportion=0,
                              flag=wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, border=5)
             f['wxId'] = chk.GetId()
@@ -1051,7 +1059,7 @@
                             none_check.SetValue(True)
                         else:
                             none_check.SetValue(False)
-                        none_check.SetFont( wx.Font( fontsize, wx.FONTFAMILY_DEFAULT, wx.NORMAL, text_style, 0, ''))
+                        # none_check.SetFont( wx.Font( fontsize, wx.FONTFAMILY_DEFAULT, wx.NORMAL, text_style, 0, ''))
                         this_sizer.Add(item=none_check, proportion=0,
                                        flag=wx.ADJUST_MINSIZE | wx.LEFT | wx.RIGHT | wx.TOP, border=5)
                         which_sizer.Add( this_sizer )
@@ -1078,7 +1086,7 @@
                     p['wxId'] = fbb.GetChildren()[1].GetId()
 
             if txt is not None:
-                txt.SetFont( wx.Font( fontsize, wx.FONTFAMILY_DEFAULT, wx.NORMAL, text_style, 0, ''))
+                # txt.SetFont( wx.Font( fontsize, wx.FONTFAMILY_DEFAULT, wx.NORMAL, text_style, 0, ''))
                 # create tooltip if given
                 if len(p['values_desc']) > 0:
                     if tooltip:
@@ -1092,6 +1100,9 @@
                 if tooltip:
                     txt.SetToolTipString(tooltip)
 
+	#
+	# determine panel size
+	#
         maxsizes = (0,0)
         for section in sections:
             tabsizer[section].SetSizeHints( tab[section] )
@@ -1108,7 +1119,6 @@
             tab[section].SetMinSize( constrained_size )
         if manual_tab.Ok:
             manual_tab.SetMinSize( constrained_size )
-
         self.SetSizer( panelsizer )
         panelsizer.Fit(self)
         self.hasMain = tab.has_key( _('Main') ) # publish, to enclosing Frame for instance
@@ -1243,7 +1253,7 @@
     """
     def __init__(self, grass_task):
         self.grass_task = grass_task
-        wx.App.__init__(self)
+        wx.App.__init__(self, False)
 
     def OnInit(self):
         self.mf = mainFrame(parent=None, ID=wx.ID_ANY, task_description=self.grass_task)

Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/render.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -247,7 +247,7 @@
                                    "in GRASS GIS to run this program")
             sys.exit(1)
 
-        gisenvCmd = gcmd.Command(["g.gisenv" + globalvar.EXT_BIN])
+        gisenvCmd = gcmd.Command(["g.gisenv"])
 
         for line in gisenvCmd.ReadStdOutput():
             line = line.strip()
@@ -395,7 +395,7 @@
         os.unsetenv("GRASS_REGION")
 
         # do not update & shell style output
-        cmdList = ["g.region" + globalvar.EXT_BIN, "-u", "-g", "-p", "-c"]
+        cmdList = ["g.region", "-u", "-g", "-p", "-c"]
 
         if rast:
             cmdList.append('rast=%s' % rast)
@@ -493,7 +493,7 @@
 
         projinfo = {}
 
-        p = gcmd.Command(['g.proj' + globalvar.EXT_BIN, '-p'])
+        p = gcmd.Command(['g.proj', '-p'])
 
         if p.returncode == 0:
             for line in p.ReadStdOutput():
@@ -640,7 +640,7 @@
             " output=" + mapoutstr
 
         # compose command
-        complist = ["g.pnmcomp" + globalvar.EXT_BIN,
+        complist = ["g.pnmcomp",
                    "in=%s" % ",".join(maps),
 	           "mask=%s" % ",".join(masks),
                    "opacity=%s" % ",".join(opacities),

Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -70,12 +70,9 @@
         self.mapcontent = map
         self.mapdisplay = mapdisplay
 
-        self.toolbar = wx.ToolBar(parent=self.mapdisplay, id=wx.ID_ANY)
+	self.toolbar = wx.ToolBar(parent=self.mapdisplay, id=wx.ID_ANY)
+        self.toolbar.SetToolBitmapSize(globalvar.toolbarSize)
 
-        # self.SetToolBar(self.toolbar)
-        tsize = (24, 24)
-        self.toolbar.SetToolBitmapSize(tsize)
-
         self.InitToolbar(self.mapdisplay, self.toolbar, self.ToolbarData())
 
         # optional tools
@@ -167,8 +164,7 @@
         self.toolbar = wx.ToolBar(parent=self.mapdisplay, id=wx.ID_ANY)
 
         # self.SetToolBar(self.toolbar)
-        tsize = (24, 24)
-        self.toolbar.SetToolBitmapSize(tsize)
+        self.toolbar.SetToolBitmapSize(globalvar.toolbarSize)
 
         self.InitToolbar(self.mapdisplay, self.toolbar, self.ToolbarData())
 
@@ -254,6 +250,7 @@
         self.numOfRows = 1 # number of rows for toolbar
         for row in range(0, self.numOfRows):
             self.toolbar.append(wx.ToolBar(parent=self.parent, id=wx.ID_ANY))
+	    self.toolbar[row].SetToolBitmapSize(globalvar.toolbarSize)
             self.toolbar[row].SetToolBitmapSize(wx.Size(24,24))
 
             # create toolbar

Modified: grass/trunk/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/utils.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/utils.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -37,7 +37,7 @@
     """
     import gcmd
 
-    tempfileCmd = gcmd.Command(["g.tempfile" + globalvar.EXT_BIN,
+    tempfileCmd = gcmd.Command(["g.tempfile",
                                 "pid=%d" % os.getpid()])
 
     tempfile = tempfileCmd.ReadStdOutput()[0].strip()
@@ -191,4 +191,3 @@
 def ListSortLower(list):
     """Sort list items (not case-sensitive)"""
     list.sort(cmp=lambda x, y: cmp(x.lower(), y.lower()))
-    

Modified: grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -1030,7 +1030,6 @@
         # initialize variables
         self.Map             = None
         self.parent          = parent              # GMFrame
-        self.gcmdlst         = self.GetGRASSCmds() # list of commands in bin and scripts
         self.cmdThreads      = []                  # list of command threads (alive or dead)
 
         # progress bar
@@ -1078,19 +1077,6 @@
         self.SetAutoLayout(True)
         self.SetSizer(boxsizer1)
 
-    def GetGRASSCmds(self):
-        """
-        Create list of all available GRASS commands to use when
-        parsing string from the command line
-        """
-        gcmdlst = []
-        gisbase = os.environ['GISBASE']
-        gcmdlst = os.listdir(os.path.join(gisbase,'bin'))
-        gcmdlst = gcmdlst + os.listdir(os.path.join(gisbase,'scripts'))
-        #self.gcmdlst = self.gcmdlst + os.listdir(os.path.join(gisbase,'etc','gm','script'))
-
-        return gcmdlst
-
     def RunCmd(self, command):
         """
         Run in GUI or shell GRASS (or other) commands typed into
@@ -1118,7 +1104,7 @@
         except:
             cmdlist = command
 
-        if cmdlist[0] in self.gcmdlst:
+        if cmdlist[0] in globalvar.grassCmd['all']:
             # send GRASS command without arguments to GUI command interface
             # except display commands (they are handled differently)
             if cmdlist[0][0:2] == "d.": # display GRASS commands

Modified: grass/trunk/gui/wxpython/wxgui.py
===================================================================
--- grass/trunk/gui/wxpython/wxgui.py	2008-03-02 12:18:43 UTC (rev 30418)
+++ grass/trunk/gui/wxpython/wxgui.py	2008-03-02 12:55:24 UTC (rev 30419)
@@ -41,10 +41,7 @@
 from xml.sax import make_parser
 ### i18N
 import gettext
-try:
-    gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
-except:
-    print >> sys.stderr, 'WARNING: Unable to load locale'
+gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
 
 import gui_modules
 gmpath = gui_modules.__path__[0]
@@ -190,11 +187,11 @@
         self.cmdprompt = wx.Panel(self)
 
         label = wx.StaticText(parent=self.cmdprompt, id=wx.ID_ANY, label="Cmd >")
-        label.SetFont(wx.Font(pointSize=11, family=wx.FONTFAMILY_DEFAULT,
-                              style=wx.NORMAL, weight=wx.BOLD))
+	# label.SetFont(wx.Font(pointSize=11, family=wx.FONTFAMILY_DEFAULT,
+        #                      style=wx.NORMAL, weight=wx.BOLD))
         input = wx.TextCtrl(parent=self.cmdprompt, id=wx.ID_ANY,
                             value="",
-                            style=wx.HSCROLL | wx.TE_LINEWRAP | wx.TE_PROCESS_ENTER,
+                            style=wx.TE_LINEWRAP | wx.TE_PROCESS_ENTER,
                             size=(-1, 25))
 
         input.SetFont(wx.Font(10, wx.FONTFAMILY_MODERN, wx.NORMAL, wx.NORMAL, 0, ''))
@@ -307,6 +304,8 @@
         """Creates toolbar"""
 
         self.toolbar = self.CreateToolBar()
+        self.toolbar.SetToolBitmapSize(globalvar.toolbarSize)
+
         for each in self.ToolbarData():
             self.AddToolbarButton(self.toolbar, *each)
         self.toolbar.Realize()



More information about the grass-commit mailing list