[GRASS-SVN] r30646 - in grass/branches/releasebranch_6_3/gui/wxpython: . gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Mar 19 10:18:50 EDT 2008


Author: martinl
Date: 2008-03-19 10:18:49 -0400 (Wed, 19 Mar 2008)
New Revision: 30646

Modified:
   grass/branches/releasebranch_6_3/gui/wxpython/README
   grass/branches/releasebranch_6_3/gui/wxpython/gis_set.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/dbm.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/gcmd.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/globalvar.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/goutput.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/menuform.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/preferences.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/render.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/utils.py
   grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/wxgui_utils.py
   grass/branches/releasebranch_6_3/gui/wxpython/wxgui.py
Log:
wxGUI: synchronized with trunk (for RC6)


Modified: grass/branches/releasebranch_6_3/gui/wxpython/README
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/README	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/README	2008-03-19 14:18:49 UTC (rev 30646)
@@ -1,8 +1,10 @@
 wxPython GRASS Graphical User Interface
 =======================================
 
-0 - REQUIREMENTS
+$Date$
 
+1 - REQUIREMENTS
+
  GRASS GIS >= 6.3
  Python >= 2.4
  wxPython >= 2.8.1.1
@@ -36,19 +38,9 @@
 	 python-wxgtk2.8 wx2.8-doc wx2.8-examples \
 	 wx2.8-headers wx2.8-i18n
 
-1 - INSTALLATION
-
-Go to:
-
-$ cd gui/wxpython
-
-and run 
-
-$ make
-
 2 - STARTUP WITH GRASS INITIALIZATION
 
-If you want to run wxPython GUI automatically when you start
+If you want to launch wxPython GUI automatically when you start
 GRASS, edit your .grassrc6 file to replace
 
 GRASS_GUI: tcktk (or whatever you have here)
@@ -59,11 +51,11 @@
 
 or easier start new GRASS session with -wxpython switch.
 
-$ grass -wxpython
+$ grass63 -wxpython
 
 3 - STARTUP FROM GRASS TERMINAL
 
-Simply type
+Simply run
 
 $ g.gui wxpython
 
@@ -71,11 +63,11 @@
 
 You can also specify workspace file to load on startup.
 
-$ g.gui gui=wxpython workspace=myworkspace.grc
+$ g.gui gui=wxpython workspace=myworkspace.gxw
 
 4 - CLI Display scripts
 
-Note: This section is out-dated.
+Note: This section is out-dated!
 
 This is going to be replacement for command line tools like d.rast and
 d.vect.
@@ -122,23 +114,24 @@
 
 5 - DEBUGGING
 
-To enable GUI debugging messages on given level set GRASS_DEBUG_WX
-environment variables, e.g.
+To enable GUI debug messages on given level set GRASS_DEBUG_WX
+environment variable, e.g.
 
 $ export GRASS_WX_DEBUG=3
 
 6 - ICON THEMES
 
 Currently two icon themes are available:
+
     * original GRASS (based on TCL/TK GUI prototype)
-    * Silk-based
+    * Silk-based (default)
 
 User can change icon theme in Preferences dialog
 ('Config->Preferences').
 
 7 - DIGITIZATION TOOL
 
-To enable digitization tool you need to compile 'vdigit'
+To enable digitizer you need to compile 'vdigit'
 component. Note that you must configure GRASS with C++ (--with-cxx),
 Python (--with-python) and wxWidgets (--with-wxwidgets) support.
 
@@ -150,10 +143,10 @@
 
 $ sudo ln -s /usr/lib/python2.4/site-packages/wx-2.8-gtk2-unicode/wx/_gdi_.so /usr/local/lib/libgdi.so
 
-Make sure you set up LD_LIBRARY_PATH or noted '/usr/local/lib' in
-/etc/ld.so.conf.
+Then update LD_LIBRARY_PATH or add '/usr/local/lib' to /etc/ld.so.conf
+(in this case run 'sudo ldconfig').
 
-$ sudo ldconfig
+TODO: Don't use direct linking here.
 
 Then you can compile the driver
 

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gis_set.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gis_set.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gis_set.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -28,16 +28,15 @@
 ### i18N
 import gettext
 
+from gui_modules import globalvar
+globalvar.CheckForWx()
 from gui_modules import utils
 
-utils.CheckForWx()
 import wx
 import wx.html
 import wx.lib.rcsizer as rcs
 import wx.lib.filebrowsebutton as filebrowse
 
-from gui_modules import globalvar
-
 class GRASSStartup(wx.Frame):
     """GRASS start-up screen"""
     def __init__(self, parent=None, id=wx.ID_ANY, style=wx.DEFAULT_FRAME_STYLE):
@@ -199,13 +198,23 @@
         if location:
             # list of locations
             self.UpdateLocations(self.gisdbase)
-            self.lblocations.SetSelection(self.listOfLocations.index(location))
-
+            try:
+                self.lblocations.SetSelection(self.listOfLocations.index(location))
+            except ValueError:
+                print >> sys.stderr, _("ERROR: Location <%s> not found in GISDBASE (%s)") %  \
+                    (location, self.gisdbase)
+                
             # list of mapsets
             self.UpdateMapsets(os.path.join(self.gisdbase,location))
-            mapset =self._getRCValue("MAPSET")
-            if  mapset:
-                self.lbmapsets.SetSelection(self.listOfMapsets.index(mapset))
+            mapset = self._getRCValue("MAPSET")
+            if mapset:
+                try:
+                    self.lbmapsets.SetSelection(self.listOfMapsets.index(mapset))
+                except ValueError:
+                    self.lbmapsets.Clear()
+                    print >> sys.stderr, _("ERROR: Mapset <%s> not found") % \
+                        (mapset)
+
                 # self.bstart.Enable(True)
 
     def _do_layout(self):

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/dbm.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/dbm.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/dbm.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -41,6 +41,9 @@
 import gettext
 gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
 
+import globalvar
+globalvar.CheckForWx()
+
 import wx
 import wx.lib.mixins.listctrl as listmix
 import wx.lib.flatnotebook as FN
@@ -49,7 +52,6 @@
 import sqlbuilder
 import grassenv
 import gcmd
-import globalvar
 import utils
 from debug import Debug as Debug
 from preferences import globalSettings as UserSettings
@@ -2971,11 +2973,18 @@
         # list of available layers & (table, database, driver)
         for line in layerCommand.ReadStdOutput():
             lineList = line.split(' ')
-            self.layers[int(lineList[0])] = { "table"    : lineList[1],
-                                              "key"      : lineList[2],
-                                              "database" : lineList[3],
-                                              "driver"   : lineList[4] }
-
+            if '/' in lineList[0]:
+                lineList[0], layer_name = lineList[0].split('/')
+            else:
+                layer_name = None
+            self.layers[int(lineList[0])] = {
+                "name"     : layer_name,
+                "table"    : lineList[1],
+                "key"      : lineList[2],
+                "database" : lineList[3],
+                "driver"   : lineList[4]
+                }
+            
         if (len(self.layers.keys()) == 0):
             return False
 

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/gcmd.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/gcmd.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/gcmd.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -358,7 +358,8 @@
                                     os.linesep, os.linesep,
                                     _("Details:"),
                                     os.linesep,
-                                    self.PrintModuleOutput()))
+                                    self.cmdThread.rerr))
+#                                    self.PrintModuleOutput()))
                 elif rerr == sys.stderr: # redirect message to sys
                     stderr.write("Execution failed: '%s'" % (' '.join(self.cmd)))
                     stderr.write("%sDetails:%s%s" % (os.linesep,
@@ -370,7 +371,6 @@
             Debug.msg (3, "Command(): cmd='%s', wait=%s, returncode=?, alive=%s" % \
                            (' '.join(cmd), wait, self.cmdThread.isAlive()))
 
-
         if message_format:
             os.environ["GRASS_MESSAGE_FORMAT"] = message_format
         else:
@@ -503,20 +503,23 @@
         
     def run(self):
         """Run command"""
+        if len(self.cmd) == 0:
+            return
+
         self.startTime = time.time()
         # TODO: wx.Exectute/wx.Process (?)
-        self.module = Popen(self.cmd,
-                            stdin=subprocess.PIPE,
-                            stdout=subprocess.PIPE,
-                            stderr=subprocess.PIPE)
-
+        try:
+            self.module = Popen(self.cmd,
+                                stdin=subprocess.PIPE,
+                                stdout=subprocess.PIPE,
+                                stderr=subprocess.PIPE)
+        except OSError, e:
+            raise CmdError(self.cmd[0], str(e))
+        
         if self.stdin: # read stdin if requested ...
             self.module.stdin.write(self.stdin)
             self.module.stdin.close()
 
-        if not self.module:
-            return
-
         # redirect standard outputs...
         if self.stdout or self.stderr:
             self.__redirect_stream()
@@ -571,7 +574,7 @@
                 # line = self.__read_all(self.module.stderr)
                 line = recv_some(self.module, e=0, stderr=1)
                 self.stderr.write(line)
-
+                
         # get the last output
         if self.stdout:
             # line = self.__read_all(self.module.stdout)
@@ -583,7 +586,7 @@
             self.stderr.write(line)
 
         self.rerr = self.__parseString(line)
-
+       
         if hasattr(self.stderr, "gmstc"):
             # -> GMConsole
             if self._want_abort: # abort running process
@@ -609,6 +612,10 @@
                 err += line + '%s' % os.linesep
             elif err != '' and 'GRASS_INFO_END' in line:
                 err += line
+            elif 'ERROR' in line:
+                err += line
+            elif err != '':
+                err += line
                 
         return err
         

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/globalvar.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/globalvar.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/globalvar.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -93,3 +93,23 @@
 
 """@Toolbar icon size"""
 toolbarSize = (24, 24)
+
+def CheckForWx():
+    """Try to import wx module and check its version"""
+    majorVersion = 2.8
+    minorVersion = 1.1
+    try:
+        import wx
+        version = wx.__version__
+        if float(version[:3]) < majorVersion:
+            raise ValueError('You are using wxPython version %s' % str(version))
+        if float(version[:3]) == 2.8 and \
+                float(version[4:]) < minorVersion:
+            raise ValueError('You are using wxPython version %s' % str(version))
+
+    except (ImportError, ValueError), e:
+        print >> sys.stderr, 'ERROR: ' + str(e) + \
+            '. wxPython >= %s.%s is required. Detailed information in README file.' % \
+            (str(majorVersion), str(minorVersion))
+        sys.exit(1)
+

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/goutput.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/goutput.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/goutput.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -322,6 +322,8 @@
 
     def write(self, s):
         s = s.replace('\n', os.linesep)
+        # remove/replace escape sequences '\b' or '\r' from stream
+        s = s.replace('\b', '').replace('\r', '%s' % os.linesep)
         message = ''
         for line in s.split(os.linesep):
             if len(line) == 0:

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/menuform.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/menuform.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/menuform.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -52,13 +52,17 @@
 import textwrap
 import os
 from os import system
+import time
+start = time.time()
 
 ### i18N
 import gettext
 gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
 
-import utils
-utils.CheckForWx()
+
+import globalvar
+globalvar.CheckForWx()
+
 import wx
 import wx.lib.flatnotebook as FN
 import wx.lib.colourselect as csel
@@ -72,8 +76,9 @@
 HandlerBase=xml.sax.handler.ContentHandler
 from xml.sax import make_parser
 
+import utils
+
 gisbase = os.getenv("GISBASE")
-import globalvar
 if gisbase is None:
     print >>sys.stderr, "We don't seem to be properly installed, or we are being run outside GRASS. Expect glitches."
     gisbase = os.path.join(os.path.dirname( sys.argv[0] ), os.path.pardir)
@@ -477,6 +482,7 @@
 
         wx.html.HtmlWindow.__init__(self, *args, **kwargs)
         self.fspath = gisbase + "/docs/html/"
+
         self.SetStandardFonts ( size = 10 )
         self.SetBorders(10)
         wx.InitAllImageHandlers()
@@ -485,10 +491,11 @@
             if skip_description:
                 self.fillContentsFromFile ( self.fspath + grass_command + ".html",
                                             skip_description=skip_description )
+                self.Ok = True
             else:
-                ### FIXME: calling self.LoadPage is too time costly (why?)
-                self.LoadPage(self.fspath + grass_command + ".html")
-                self.Ok = True
+                ### FIXME: calling LoadPage() is strangely time-consuming (only first call)
+                # self.LoadPage(self.fspath + grass_command + ".html")
+                self.Ok = False
         else:
             self.SetPage( text )
             self.Ok = True
@@ -791,7 +798,10 @@
     def OnCancel(self, event):
         """Cancel button pressed"""
         self.MakeModal(False)
-        self.Destroy()
+        if self.get_dcmd:
+            self.Hide()
+        else:
+            self.Destroy()
 
     def OnCloseWindow(self, event):
         """Close the main window"""
@@ -864,7 +874,8 @@
         nbStyle = globalvar.FNPageStyle
         self.notebook = FN.FlatNotebook( self, id=wx.ID_ANY, style=nbStyle)
         self.notebook.SetTabAreaColour(globalvar.FNPageColor)
-        self.notebook.Bind( FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange )
+        self.notebook.Bind(FN.EVT_FLATNOTEBOOK_PAGE_CHANGED, self.OnPageChange)
+
         tab = {}
         tabsizer = {}
         for section in sections:
@@ -875,18 +886,20 @@
 
         # are we running from command line?
         ### add 'command output' tab regardless standalone dialog
-        #        if standalone:
-        self.goutput = goutput.GMConsole(parent=self, margin=False)
-        self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output") )
-        self.outpageid = self.notebook.GetPageCount() - 1
+        if self.parent.get_dcmd is None:
+            self.goutput = goutput.GMConsole(parent=self, margin=False)
+            self.outpage = self.notebook.AddPage(self.goutput, text=_("Command output") )
+            self.outpageid = self.notebook.GetPageCount() - 1
+        else:
+            self.goutput = None
 
-        manual_tab =  helpPanel( parent = self.notebook, grass_command = self.task.name)
-        if manual_tab.Ok:
-            manual_tabsizer = wx.BoxSizer(wx.VERTICAL)
-            self.notebook.AddPage( manual_tab, text = _("Manual") )
+        self.manual_tab = helpPanel(parent = self.notebook, grass_command = self.task.name)
+        self.manual_tabsizer = wx.BoxSizer(wx.VERTICAL)
+        self.notebook.AddPage(self.manual_tab, text=_("Manual"))
+        self.manual_tab_id = self.notebook.GetPageCount() - 1
 
         self.notebook.SetSelection(0)
-        panelsizer.Add( self.notebook, 1, flag=wx.EXPAND )
+        panelsizer.Add(item=self.notebook, proportion=1, flag=wx.EXPAND )
 
         #
         # flags
@@ -983,8 +996,8 @@
                 else:
                     if len(valuelist) == 1: # -> textctrl
                         txt = wx.StaticText(parent=which_panel,
-                                            label = "%s. %s=%s" (title, _('Valid range'),
-                                                                 str(valuelist).strip("[]'") + ':'))
+                                            label = "%s. %s %s" % (title, _('Valid range'),
+                                                                   str(valuelist[0]) + ':'))
                         which_sizer.Add(item=txt, proportion=0,
                                         flag=wx.ADJUST_MINSIZE | wx.TOP | wx.RIGHT | wx.LEFT, border=5)
 
@@ -1164,13 +1177,13 @@
 
         # TODO: be less arbitrary with these 600
         self.panelMinHeight = 100
-        self.constrained_size = (min(600, maxsizes[0]) + 25, min(600, maxsizes[1]))
+        self.constrained_size = (min(600, maxsizes[0]) + 25, min(600, maxsizes[1]) + 25)
         for section in sections:
             tab[section].SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
             # tab[section].SetMinSize( constrained_size )
 
-        if manual_tab.Ok:
-            manual_tab.SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
+        if self.manual_tab.Ok:
+            self.manual_tab.SetMinSize( (self.constrained_size[0], self.panelMinHeight) )
             # manual_tab.SetMinSize( constrained_size )
 
         self.SetSizer( panelsizer )
@@ -1195,6 +1208,14 @@
         event.Skip()
 
     def OnPageChange(self, event):
+        if hasattr(self, "manual_tab_id") and \
+                event.GetSelection() == self.manual_tab_id:
+            # calling LoadPage() is strangely time-consuming (only first call)
+            # FIXME: move to helpPage.__init__()
+            if not self.manual_tab.Ok:
+                self.manual_tab.LoadPage(self.manual_tab.fspath + self.task.name + ".html")
+                self.manual_tab.Ok = True
+
         self.Layout()
 
     def OnColorChange( self, event ):
@@ -1314,6 +1335,7 @@
         self.mf = mainFrame(parent=None, ID=wx.ID_ANY, task_description=self.grass_task)
         self.mf.Show(True)
         self.SetTopWindow(self.mf)
+        # print >> sys.stderr, time.time() - start
         return True
 
 class GUI:
@@ -1334,6 +1356,7 @@
         * add key name for first parameter if not given
         * change mapname to mapname at mapset
         """
+        start = time.time()
         dcmd_params = {}
         if completed == None:
             get_dcmd = None
@@ -1394,13 +1417,19 @@
         self.mf = mainFrame(parent=self.parent, ID=wx.ID_ANY,
                             task_description=self.grass_task,
                             get_dcmd=get_dcmd, layer=layer)
-
+        
+        if get_dcmd is not None:
+            # update only propwin reference
+            get_dcmd(dcmd=None, layer=layer, params=None,
+                     propwin=self.mf)
+        
         if show:
             self.mf.Show(show)
             self.mf.MakeModal(modal)
         else:
             self.mf.OnApply(None)
-
+        
+        # print >> sys.stderr, time.time() - start
         return cmd
 
 class StaticWrapText(wx.StaticText):

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/preferences.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/preferences.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/preferences.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -22,10 +22,14 @@
 import os
 import sys
 import copy
+import stat
+if os.name in ('posix', 'mac'):
+    import pwd
 
 import wx
 import wx.lib.filebrowsebutton as filebrowse
 import wx.lib.colourselect as csel
+import wx.lib.mixins.listctrl as listmix
 from wx.lib.wordwrap import wordwrap
 
 import gcmd
@@ -51,6 +55,7 @@
             #
             'general': {
                 'mapsetPath'  : { 'selection' : 0 }, # current mapset search path
+                'changeOpacityLevel' : { 'enabled' : False }, # show opacity level widget
                 },
             #
             # display
@@ -431,6 +436,31 @@
         sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
         border.Add(item=sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
 
+        #
+        # Layer Manager settings
+        #
+        box   = wx.StaticBox (parent=panel, id=wx.ID_ANY, label=" %s " % _("Layer Manager settings"))
+        sizer = wx.StaticBoxSizer(box, wx.VERTICAL)
+
+        gridSizer = wx.GridBagSizer (hgap=3, vgap=3)
+        gridSizer.AddGrowableCol(0)
+
+        #
+        # show opacily level
+        #
+        row = 0
+        changeOpacityLevel = wx.CheckBox(parent=panel, id=wx.ID_ANY,
+                                       label=_("Opacity level editable"),
+                                       name='IsChecked')
+        changeOpacityLevel.SetValue(self.settings.Get(group='general', key='changeOpacityLevel', subkey='enabled'))
+        self.winId['general:changeOpacityLevel:enabled'] = changeOpacityLevel.GetId()
+
+        gridSizer.Add(item=changeOpacityLevel,
+                      pos=(row, 0), span=(1, 2))
+        
+        sizer.Add(item=gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
+        border.Add(item=sizer, proportion=0, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=3)
+
         panel.SetSizer(border)
         
         return panel
@@ -926,8 +956,9 @@
     Controls setting options and displaying/hiding map overlay decorations
     """
     def __init__(self, parent, id, title=_('Set/unset access to mapsets in current location'),
-                 pos=wx.DefaultPosition, size=(-1, -1),
+                 pos=wx.DefaultPosition, size=(350, 400),
                  style=wx.DEFAULT_DIALOG_STYLE|wx.RESIZE_BORDER):
+        
         wx.Dialog.__init__(self, parent, id, title, pos, size, style)
 
         self.all_mapsets, self.accessible_mapsets = utils.ListOfMapsets()
@@ -942,9 +973,8 @@
         sizer.Add(item=label, proportion=0,
                   flag=wx.ALL, border=5)
 
-        self.mapsetlb = wx.CheckListBox(parent=self, id=wx.ID_ANY, pos=wx.DefaultPosition,
-                                        size=(350,200), choices=self.all_mapsets)
-        self.mapsetlb.Bind(wx.EVT_CHECKLISTBOX, self.OnCheckMapset)
+        self.mapsetlb = CheckListMapset(parent=self)
+        self.mapsetlb.LoadData(self.all_mapsets)
         
         sizer.Add(item=self.mapsetlb, proportion=1,
                   flag=wx.ALL | wx.EXPAND, border=5)
@@ -952,10 +982,11 @@
         # check all accessible mapsets
         if globalSettings.Get(group='general', key='mapsetPath', subkey='selection') == 1:
             for mset in self.all_mapsets:
-                self.mapsetlb.Check(self.all_mapsets.index(mset), True)
+                self.mapsetlb.CheckItem(self.all_mapsets.index(mset), True)
         else:
             for mset in self.accessible_mapsets:
-                self.mapsetlb.Check(self.all_mapsets.index(mset), True)
+                self.mapsetlb.CheckItem(self.all_mapsets.index(mset), True)
+                pass
 
         # dialog buttons
         line = wx.StaticLine(parent=self, id=wx.ID_ANY,
@@ -980,14 +1011,8 @@
         self.SetSizer(sizer)
         sizer.Fit(self)
 
-        self.SetMinSize(self.GetBestSize())
+        self.SetMinSize(size)
         
-    def OnCheckMapset(self, event):
-        """Mapset checked/unchecked"""
-        mapset = self.mapsetlb.GetString(event.GetSelection())
-        if mapset == 'PERMANENT' or mapset == self.curr_mapset:
-            self.mapsetlb.Check(event.GetSelection(), True)
-        
     def GetMapsets(self):
         """Get list of checked mapsets"""
         ms = []
@@ -998,3 +1023,47 @@
             i += 1
 
         return ms
+
+class CheckListMapset(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin, listmix.CheckListCtrlMixin):
+    """List of mapset/owner/group"""
+    def __init__(self, parent, pos=wx.DefaultPosition,
+                 log=None):
+        self.parent = parent
+        
+        wx.ListCtrl.__init__(self, parent, wx.ID_ANY,
+                             style=wx.LC_REPORT)
+        listmix.CheckListCtrlMixin.__init__(self)
+        self.log = log
+
+        # setup mixins
+        listmix.ListCtrlAutoWidthMixin.__init__(self)
+
+    def LoadData(self, mapsets):
+        """Load data into list"""
+        self.InsertColumn(0, _('Mapset'))
+        self.InsertColumn(1, _('Owner'))
+        self.InsertColumn(2, _('Group'))
+        locationPath = os.path.join(grassenv.GetGRASSVariable('GISDBASE'),
+                                    grassenv.GetGRASSVariable('LOCATION_NAME'))
+        for mapset in mapsets:
+            index = self.InsertStringItem(sys.maxint, mapset)
+            mapsetPath = os.path.join(locationPath,
+                                      mapset)
+            stat_info = os.stat(mapsetPath)
+	    if os.name in ('posix', 'mac'):
+                self.SetStringItem(index, 1, "%s" % pwd.getpwuid(stat_info.st_uid)[0])
+                # FIXME: get group name
+                self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid) 
+	    else:
+                # FIXME: no pwd under MS Windows (owner: 0, group: 0)
+                self.SetStringItem(index, 1, "%-8s" % stat_info.st_uid)
+                self.SetStringItem(index, 2, "%-8s" % stat_info.st_gid)
+                
+        self.SetColumnWidth(col=0, width=wx.LIST_AUTOSIZE)
+        self.SetColumnWidth(col=1, width=wx.LIST_AUTOSIZE)
+        
+    def OnCheckItem(self, index, flag):
+        """Mapset checked/unchecked"""
+        mapset = self.parent.all_mapsets[index]
+        if mapset == 'PERMANENT' or mapset == self.parent.curr_mapset:
+            self.CheckItem(index, True)

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/render.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/render.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -83,6 +83,8 @@
 
         @return name of file with rendered image or None
         """
+        if len(self.cmdlist) == 0:
+            return
 
         Debug.msg (3, "MapLayer.Render(): type=%s" % \
                    (self.type))
@@ -143,7 +145,10 @@
         if not self.name:
             return ''
 
-        return self.name.split('@')[1]
+        try:
+            return self.name.split('@')[1]
+        except IndexError:
+            return self.name
 
     def GetCmd(self, string=False):
         """
@@ -691,7 +696,7 @@
         return self.mapfile
 
     def AddLayer(self, type, command, name=None,
-                 l_active=True, l_hidden=False, l_opacity=1, l_render=False):
+                 l_active=True, l_hidden=False, l_opacity=1.0, l_render=False):
         """
         Adds generic display command layer to list of layers
 

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/utils.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/utils.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/utils.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -127,25 +127,6 @@
         
     return catstr.strip(',')
 
-def CheckForWx():
-    """Try to import wx module and check its version"""
-    majorVersion = 2.8
-    minorVersion = 1.1
-    try:
-        import wx
-        version = wx.__version__
-        if float(version[:3]) < majorVersion:
-            raise ValueError('You are using wxPython version %s' % str(version))
-        if float(version[:3]) == 2.8 and \
-                float(version[4:]) < minorVersion:
-            raise ValueError('You are using wxPython version %s' % str(version))
-
-    except (ImportError, ValueError), e:
-        print >> sys.stderr, 'ERROR: ' + str(e) + \
-            '. wxPython >= %s.%s is required. Detailed information in README file.' % \
-            (str(majorVersion), str(minorVersion))
-        sys.exit(1)
-
 def ListOfMapsets():
     """Get list of available/accessible mapsets
 

Modified: grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/wxgui_utils.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/gui_modules/wxgui_utils.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -5,10 +5,6 @@
     * AbstractLayer
     * Layer
     * LayerTree
-    * GMConsole
-    * GMStdout
-    * GMStrerr
-    * GMStc
     * LoadMapLayersDialog
 
 PURPOSE:    Utility classes for GRASS wxPython GUI. Main functions include tree control
@@ -19,7 +15,7 @@
             Jachym Cepicky (Mendel University of Agriculture)
             Martin Landa <landa.martin gmail.com>
 
-COPYRIGHT:  (C) 2007 by the GRASS Development Team
+COPYRIGHT:  (C) 2007-2008 by the GRASS Development Team
             This program is free software under the GNU General Public
             License (>=v2). Read the file COPYING that comes with GRASS
             for details.
@@ -50,6 +46,8 @@
 except:
     from compat import subprocess
 
+TREE_ITEM_HEIGHT = 25
+
 # define event for GRASS console (running GRASS command in separate thread)
 (UpdateGMConsoleEvent, EVT_UPDATE_GMCONSOLE) = wx.lib.newevent.NewEvent()
 
@@ -62,17 +60,18 @@
                  id=wx.ID_ANY, pos=wx.DefaultPosition,
                  size=wx.DefaultSize, style=wx.SUNKEN_BORDER,
                  ctstyle=CT.TR_HAS_BUTTONS | CT.TR_HAS_VARIABLE_ROW_HEIGHT |
-                 CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT|
-                 CT.TR_EDIT_LABELS|CT.TR_MULTIPLE,
+                 CT.TR_HIDE_ROOT | CT.TR_ROW_LINES | CT.TR_FULL_ROW_HIGHLIGHT |
+                 CT.TR_EDIT_LABELS | CT.TR_SINGLE,
                  idx=None, gismgr=None, notebook=None, auimgr=None, showMapDisplay=True):
         CT.CustomTreeCtrl.__init__(self, parent, id, pos, size, style, ctstyle)
 
         ### SetAutoLayout() causes that no vertical scrollbar is displayed
         ### when some layers are not visible in layer tree
-        # self.SetAutoLayout(True)
+        self.SetAutoLayout(True)
         self.SetGradientStyle(1)
         self.EnableSelectionGradient(True)
-        self.SetFirstGradientColour(wx.Colour(150, 150, 150))
+        self.SetFirstGradientColour(wx.Colour(100, 100, 100))
+        self.SetSecondGradientColour(wx.Colour(150, 150, 150))
 
         self.Map = render.Map()    # instance of render.Map to be associated with display
         self.root = None           # ID of layer tree root node
@@ -107,15 +106,15 @@
             self.mapdisplay.Refresh()
             self.mapdisplay.Update()
 
-        self.root = self.AddRoot("Map Layers")
+        self.root = self.AddRoot(_("Map Layers"))
         self.SetPyData(self.root, (None,None))
 
         #create image list to use with layer tree
-        il = wx.ImageList(16, 16, False)
+        il = wx.ImageList(16, 16, mask=False)
 
-        trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, (16,16))
+        trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER_OPEN, wx.ART_OTHER, (16, 16))
         self.folder_open = il.Add(trart)
-        trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16,16))
+        trart = wx.ArtProvider.GetBitmap(wx.ART_FOLDER, wx.ART_OTHER, (16, 16))
         self.folder = il.Add(trart)
 
         bmpsize = (16, 16)
@@ -161,8 +160,6 @@
         trgif = Icons["addcmd"].GetBitmap(bmpsize)
         self.cmd_icon = il.Add(trgif)
 
-        checksize = il.GetSize(0)
-        checkbmp = il.GetBitmap(0)
         self.AssignImageList(il)
 
         # use when groups implemented
@@ -177,7 +174,7 @@
         self.Bind(wx.EVT_TREE_DELETE_ITEM,      self.OnDeleteLayer)
         self.Bind(wx.EVT_TREE_BEGIN_DRAG,       self.OnBeginDrag)
         self.Bind(wx.EVT_TREE_END_DRAG,         self.OnEndDrag)
-        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnContextMenu)
+        self.Bind(wx.EVT_TREE_ITEM_RIGHT_CLICK, self.OnLayerContextMenu)
         self.Bind(wx.EVT_TREE_END_LABEL_EDIT,   self.OnChangeLayerName)
         self.Bind(wx.EVT_KEY_UP,                self.OnKeyUp)
         # self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
@@ -194,9 +191,8 @@
         """Change layer name"""
         Debug.msg (3, "LayerTree.OnChangeLayerName: name=%s" % event.GetLabel())
 
-    def OnContextMenu (self, event):
-        """Context Layer Menu"""
-
+    def OnLayerContextMenu (self, event):
+        """Contextual menu for item/layer"""
         if not self.layer_selected:
             event.Skip()
             return
@@ -217,6 +213,7 @@
             self.popupID5 = wx.NewId()
             self.popupID6 = wx.NewId()
             self.popupID7 = wx.NewId()
+            self.popupID8 = wx.NewId()
             
         self.popupMenu = wx.Menu()
         # general item
@@ -231,6 +228,13 @@
         if ltype != "group" and \
                 ltype != "command": # properties
             self.popupMenu.AppendSeparator()
+            self.popupMenu.Append(self.popupID8, text=_("Change opacity level"), kind=wx.ITEM_CHECK)
+            if self.FindWindowById(self.GetPyData(self.layer_selected)[0]['ctrl']).GetName() == 'spinCtrl':
+                checked = True
+            else:
+                checked = False
+            self.popupMenu.Check(self.popupID8, checked)
+            self.Bind(wx.EVT_MENU, self.OnPopupOpacityLevel, id=self.popupID8)
             self.popupMenu.Append(self.popupID3, text=_("Properties"))
             self.Bind(wx.EVT_MENU, self.OnPopupProperties, id=self.popupID3)
 
@@ -368,6 +372,35 @@
         """Popup properties dialog"""
         self.PropertiesDialog(self.layer_selected)
 
+    def OnPopupOpacityLevel(self, event):
+        """Popup opacity level indicator"""
+        if not self.GetPyData(self.layer_selected)[0]['ctrl']:
+            return
+
+        win = self.FindWindowById(self.GetPyData(self.layer_selected)[0]['ctrl'])
+        type = win.GetName()
+
+        self.layer_selected.DeleteWindow()
+
+        opacity = self.GetPyData(self.layer_selected)[0]['maplayer'].GetOpacity()
+        if type == 'staticText':
+            ctrl = wx.SpinCtrl(self, id=wx.ID_ANY, value="",
+                               style=wx.SP_ARROW_KEYS, initial=100, min=0, max=100,
+                               name='spinCtrl')
+            ctrl.SetValue(opacity)
+            self.Bind(wx.EVT_SPINCTRL, self.OnOpacity, ctrl)
+        else:
+            ctrl = wx.StaticText(self, id=wx.ID_ANY,
+                                 name='staticText')
+            if opacity < 100:
+                ctrl.SetLabel('   (' + str(opacity) + '%)')
+                
+        self.GetPyData(self.layer_selected)[0]['ctrl'] = ctrl.GetId()
+        self.layer_selected.SetWindow(ctrl)
+
+        self.RefreshSelected()
+        self.Refresh()
+        
     def RenameLayer (self, event):
         """Rename layer"""
         self.EditLabel(self.layer_selected)
@@ -378,6 +411,7 @@
 
         Note: lcmd is given as a list
         """
+
         self.first = True
         params = {} # no initial options parameters
 
@@ -397,15 +431,19 @@
         elif ltype == 'group':
             # group item
             ctrl = None
-            grouptext = 'Layer group:' + str(self.groupnode)
+            grouptext = _('Layer group:') + str(self.groupnode)
             self.groupnode += 1
         else:
             # all other items (raster, vector, ...)
-            ctrl = wx.SpinCtrl(self, id=wx.ID_ANY, value="", pos=(30, 50),
-                               style=wx.SP_ARROW_KEYS, initial=100, min=0, max=100)
-            
-            self.Bind(wx.EVT_SPINCTRL, self.OnOpacity, ctrl)
-
+            if UserSettings.Get(group='general', key='changeOpacityLevel', subkey='enabled'):
+                ctrl = wx.SpinCtrl(self, id=wx.ID_ANY, value="",
+                                   style=wx.SP_ARROW_KEYS, initial=100, min=0, max=100,
+                                   name='spinCtrl')
+                
+                self.Bind(wx.EVT_SPINCTRL, self.OnOpacity, ctrl)
+            else:
+                ctrl = wx.StaticText(self, id=wx.ID_ANY,
+                                     name='staticText')
         # add layer to the layer tree
         if self.layer_selected and self.layer_selected != self.GetRootItem():
             if self.GetPyData(self.layer_selected)[0]['type'] != 'group':
@@ -442,43 +480,43 @@
         # add text and icons for each layer ltype
         if ltype == 'raster':
             self.SetItemImage(layer, self.rast_icon)
-            self.SetItemText(layer, 'raster (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('raster'), _('(double click to set properties)')))
         elif ltype == 'rgb':
             self.SetItemImage(layer, self.rgb_icon)
-            self.SetItemText(layer, 'RGB (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('RGB'), _('(double click to set properties)')))
         elif ltype == 'his':
             self.SetItemImage(layer, self.his_icon)
-            self.SetItemText(layer, 'HIS (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('HIS'), _('(double click to set properties)')))
         elif ltype == 'shaded':
             self.SetItemImage(layer, self.shaded_icon)
-            self.SetItemText(layer, 'Shaded relief (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('Shaded relief'), _('(double click to set properties)')))
         elif ltype == 'rastnum':
             self.SetItemImage(layer, self.rnum_icon)
-            self.SetItemText(layer, 'raster cell numbers (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('raster cell numbers'), _('(double click to set properties)')))
         elif ltype == 'rastarrow':
             self.SetItemImage(layer, self.rarrow_icon)
-            self.SetItemText(layer, 'raster flow arrows (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('raster flow arrows'), _('(double click to set properties)')))
         elif ltype == 'vector':
             self.SetItemImage(layer, self.vect_icon)
-            self.SetItemText(layer, 'vector (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('vector'), _('(double click to set properties)')))
         elif ltype == 'thememap':
             self.SetItemImage(layer, self.theme_icon)
-            self.SetItemText(layer, 'thematic map (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('thematic map'), _('(double click to set properties)')))
         elif ltype == 'themechart':
             self.SetItemImage(layer, self.chart_icon)
-            self.SetItemText(layer, 'thematic charts (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('thematic charts'), _('(double click to set properties)')))
         elif ltype == 'grid':
             self.SetItemImage(layer, self.grid_icon)
-            self.SetItemText(layer, 'grid (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('grid'), _('(double click to set properties)')))
         elif ltype == 'geodesic':
             self.SetItemImage(layer, self.geodesic_icon)
-            self.SetItemText(layer, 'geodesic line (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('geodesic line'), _('(double click to set properties)')))
         elif ltype == 'rhumb':
             self.SetItemImage(layer, self.rhumb_icon)
-            self.SetItemText(layer, 'rhumbline (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('rhumbline'), _('(double click to set properties)')))
         elif ltype == 'labels':
             self.SetItemImage(layer, self.labels_icon)
-            self.SetItemText(layer, 'vector labels (double click to set properties)')
+            self.SetItemText(layer, '%s %s' % (_('vector labels'), _('(double click to set properties)')))
         elif ltype == 'command':
             self.SetItemImage(layer, self.cmd_icon)
         elif ltype == 'group':
@@ -490,7 +528,11 @@
         if ltype != 'group':
             if lopacity:
                 opacity = lopacity
-                ctrl.SetValue(int(lopacity * 100))
+                if UserSettings.Get(group='general', key='changeOpacityLevel', subkey='enabled'):
+                    ctrl.SetValue(int(lopacity * 100))
+                else:
+                    if opacity < 1.0:
+                        ctrl.SetLabel('   (' + str(int(opacity * 100)) + '%)')
             else:
                 opacity = 1.0
             if lcmd and len(lcmd) > 1:
@@ -502,10 +544,15 @@
                 render = False
                 name = None
 
+            if ctrl:
+                ctrlId = ctrl.GetId()
+            else:
+                ctrlId = None
+                
             # add a data object to hold the layer's command (does not apply to generic command layers)
             self.SetPyData(layer, ({'cmd': cmd,
                                     'type' : ltype,
-                                    'ctrl' : ctrl,
+                                    'ctrl' : ctrlId,
                                     'maplayer' : None,
                                     'prowin' : None}, 
                                    None))
@@ -538,15 +585,25 @@
         if checked is True:
             self.mapdisplay.onRenderGauge.SetRange(len(self.Map.GetListOfLayers(l_active=True)))
 
+        # layer.SetHeight(TREE_ITEM_HEIGHT)
+
         return layer
 
     def PropertiesDialog (self, layer, show=True):
         """Launch the properties dialog"""
-        global gmpath
+        if self.GetPyData(layer)[0].has_key('propwin') and \
+                self.GetPyData(layer)[0]['propwin'] is not None:
+            # recycle GUI dialogs
+            if self.GetPyData(layer)[0]['propwin'].IsShown():
+                self.GetPyData(layer)[0]['propwin'].SetFocus()
+            else:
+                self.GetPyData(layer)[0]['propwin'].Show()
+            return
+        
         completed = ''
         params = self.GetPyData(layer)[1]
         ltype  = self.GetPyData(layer)[0]['type']
-
+                
         Debug.msg (3, "LayerTree.PropertiesDialog(): ltype=%s" % \
                    ltype)
 
@@ -684,7 +741,7 @@
 
     def OnCmdChanged(self, event):
         """Change command string"""
-        ctrl = event.GetEventObject()
+        ctrl = event.GetEventObject().GetId()
         cmd = event.GetString()
         layer = None
 
@@ -714,7 +771,7 @@
         """
         Debug.msg (3, "LayerTree.OnOpacity(): %s" % event.GetInt())
 
-        ctrl = event.GetEventObject()
+        ctrl = event.GetEventObject().GetId()
         maplayer = None
 
         vislayer = self.GetFirstVisibleItem()
@@ -742,6 +799,7 @@
             self.mapdisplay.OnRender(None)
 
     def OnChangeSel(self, event):
+        """Selection changed"""
         oldlayer = event.GetOldItem()
         layer = event.GetItem()
         self.layer_selected = layer
@@ -789,6 +847,15 @@
         Debug.msg (4, "LayerTree.RecreateItem(): layer=%s" % \
                    self.GetItemText(oldItem))
 
+        # fetch data (olditem)
+        text    = self.GetItemText(oldItem)
+        image   = self.GetItemImage(oldItem, 0)
+        if self.GetPyData(oldItem)[0]['ctrl']:
+            oldctrl = self.FindWindowById(self.GetPyData(oldItem)[0]['ctrl'])
+        else:
+            oldctrl = None
+        checked = self.IsItemChecked(oldItem)
+        
         # recreate spin/text control for layer
         if self.GetPyData(oldItem)[0]['type'] == 'command':
             newctrl = wx.TextCtrl(self, id=wx.ID_ANY, value='',
@@ -800,16 +867,21 @@
                 pass
             newctrl.Bind(wx.EVT_TEXT_ENTER, self.OnCmdChanged)
             newctrl.Bind(wx.EVT_TEXT,       self.OnCmdChanged)
-        elif self.GetPyData(oldItem)[0]['type'] == 'group':
+        elif self.GetPyData(oldItem)[0]['type'] == 'group' or oldctrl is None:
             newctrl = None
         else:
-            newctrl = wx.SpinCtrl(self, id=wx.ID_ANY, value="", pos=(30, 50),
-                                  style=wx.SP_ARROW_KEYS, min=0, max=100)
-            try:
-                newctrl.SetValue(self.GetPyData(oldItem)[0]['maplayer'].GetOpacity())
-            except:
-                newctrl.SetValue(100)
-            self.Bind(wx.EVT_SPINCTRL, self.OnOpacity, newctrl)
+            opacity = self.GetPyData(oldItem)[0]['maplayer'].GetOpacity()
+            if oldctrl.GetName() == 'staticText':
+                newctrl = wx.StaticText(self, id=wx.ID_ANY,
+                                        name='staticText')
+                if opacity < 100:
+                    newctrl.SetLabel('   (' + str(opacity) + '%)')
+            else:
+                newctrl = wx.SpinCtrl(self, id=wx.ID_ANY, value="",
+                                      style=wx.SP_ARROW_KEYS, min=0, max=100,
+                                      name='spinCtrl')
+                newctrl.SetValue(opacity)
+                self.Bind(wx.EVT_SPINCTRL, self.OnOpacity, newctrl)
 
         # decide where to put new layer and put it there
         if not parent:
@@ -817,16 +889,11 @@
         else:
             flag = 0
 
-        # fetch data
-        text    = self.GetItemText(oldItem)
-        image   = self.GetItemImage(oldItem, 0)
-        wind    = self.GetItemWindow(oldItem)
-        checked = self.IsItemChecked(oldItem)
         if self.GetPyData(oldItem)[0]['type'] == 'group':
             windval = None
             data    = None
         else:
-            windval = self.GetItemWindow(oldItem).GetValue()
+            windval = self.GetPyData(self.layer_selected)[0]['maplayer'].GetOpacity()
             data    = self.GetPyData(oldItem)
 
         # create GenericTreeItem instance
@@ -859,11 +926,14 @@
 
         # add layer at new position
         self.SetPyData(newItem, self.GetPyData(oldItem))
-        self.GetPyData(newItem)[0]['ctrl'] = newctrl
-
+        if newctrl:
+            self.GetPyData(newItem)[0]['ctrl'] = newctrl.GetId()
+        else:
+            self.GetPyData(newItem)[0]['ctrl'] = None
+            
         self.CheckItem(newItem, checked=checked)
 
-        event.Skip()
+        # newItem.SetHeight(TREE_ITEM_HEIGHT)
 
         return newItem
 
@@ -895,7 +965,11 @@
             self.Expand(newItem)
 
         # delete layer at original position
-        self.Delete(old) # entry in render.Map layers list automatically deleted by OnDeleteLayer handler
+        try:
+            self.Delete(old) # entry in render.Map layers list automatically deleted by OnDeleteLayer handler
+        except AttributeError:
+            # FIXME being ugly (item.SetWindow(None))
+            pass
 
         # reorder layers in render.Map to match new order after drag and drop
         self.ReorderLayers()
@@ -910,14 +984,17 @@
         """Process layer data"""
 
         # set layer text to map name
-        mapname = utils.GetLayerNameFromCmd(dcmd)
-        self.SetItemText(layer, mapname)
+        if dcmd:
+            mapname = utils.GetLayerNameFromCmd(dcmd)
+            self.SetItemText(layer, mapname)
 
         # update layer data
-        self.SetPyData(layer, (self.GetPyData(layer)[0], params))
-        self.GetPyData(layer)[0]['cmd'] = dcmd
+        if params:
+            self.SetPyData(layer, (self.GetPyData(layer)[0], params))
+        if dcmd:
+            self.GetPyData(layer)[0]['cmd'] = dcmd
         self.GetPyData(layer)[0]['propwin'] = propwin
-
+        
         # check layer as active
         # self.CheckItem(layer, checked=True)
 
@@ -962,15 +1039,16 @@
         type = self.GetPyData(item)[0]['type']
 
         if type == 'command':
-            if self.GetItemWindow(item).GetValue() != None:
-                cmdlist = self.GetItemWindow(item).GetValue().split(' ')
+            win = self.FindWindowById(self.GetPyData(item)[0]['ctrl'])
+            if win.GetValue() != None:
+                cmdlist = win.GetValue().split(' ')
                 opac = 1.0
                 chk = self.IsItemChecked(item)
                 hidden = not self.IsVisible(item)
         elif type != 'group':
             if self.GetPyData(item)[0] is not None:
                 cmdlist = self.GetPyData(item)[0]['cmd']
-                opac = float(self.GetItemWindow(item).GetValue())/100
+                opac = self.GetPyData(item)[0]['maplayer'].GetOpacity(float=True)
                 chk = self.IsItemChecked(item)
                 hidden = not self.IsVisible(item)
         maplayer = self.Map.ChangeLayer(layer=self.GetPyData(item)[0]['maplayer'], type=type,
@@ -987,6 +1065,8 @@
         if self.mapdisplay.autoRender.GetValue(): 
             self.mapdisplay.OnRender(None)
 
+        # item.SetHeight(TREE_ITEM_HEIGHT)
+
     def setNotebookPage(self,pg):
         self.parent.notebook.SetSelection(pg)
 

Modified: grass/branches/releasebranch_6_3/gui/wxpython/wxgui.py
===================================================================
--- grass/branches/releasebranch_6_3/gui/wxpython/wxgui.py	2008-03-19 14:11:01 UTC (rev 30645)
+++ grass/branches/releasebranch_6_3/gui/wxpython/wxgui.py	2008-03-19 14:18:49 UTC (rev 30646)
@@ -52,8 +52,9 @@
 gmpath = icons.__path__[0]
 sys.path.append(gmpath)
 
-import gui_modules.utils as utils
-utils.CheckForWx()
+import gui_modules.globalvar as globalvar
+globalvar.CheckForWx()
+
 import wx
 import wx.aui
 import wx.combo
@@ -67,6 +68,7 @@
 except:
     import compat.subprocess as subprocess
 
+import gui_modules.utils as utils
 import gui_modules.preferences as preferences
 import gui_modules.wxgui_utils as wxgui_utils
 import gui_modules.mapdisp as mapdisp
@@ -80,7 +82,6 @@
 import gui_modules.gcmd as gcmd
 import gui_modules.georect as georect
 import gui_modules.dbm as dbm
-import gui_modules.globalvar as globalvar
 import gui_modules.workspace as workspace
 import gui_modules.goutput as goutput
 from   gui_modules.debug import Debug as Debug
@@ -749,10 +750,9 @@
         try:
             file = open(filename, "w")
         except IOError:
-            dlg = wx.MessageDialog(self, _("Unable to open workspace file <%s> for writing.") % filename,
-                                   _("Error"), wx.OK | wx.ICON_ERROR)
-            dlg.ShowModal()
-            dlg.Destroy()
+            wx.MessageBox(parent=self,
+                          message=_("Unable to open workspace file <%s> for writing.") % filename,
+                          caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
             return False
 
         try:
@@ -773,17 +773,16 @@
             self.indent =- 4
             file.write('%s</gxw>\n' % (' ' * self.indent))
             del self.indent
-        except:
-            dlg = wx.MessageDialog(self, _("Writing current settings to workspace file failed."),
-                                   _("Error"), wx.OK | wx.ICON_ERROR)
-            dlg.ShowModal()
-            dlg.Destroy()
+        except StandardError, e:
+            file.close()
+            wx.MessageBox(parent=self, message=_("Writing current settings to workspace file failed (%s)." % e),
+                          caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
             return False
 
         file.close()
-
+        
         return True
-
+    
     def OnWorkspaceClose(self, event=None):
         """Close file with workspace definition
 
@@ -919,7 +918,6 @@
         if not label:
             toolbar.AddSeparator()
             return
-
         tool = toolbar.AddLabelTool(id=wx.ID_ANY, label=label, bitmap=icon, shortHelp=help)
         self.Bind(wx.EVT_TOOL, handler, tool)
 
@@ -1233,7 +1231,7 @@
 
         dlg = wx.MessageDialog (parent=self, message=message,
                                 caption=_("Remove map layer"),
-                                style=wx.YES_NO | wx.NO_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
+                                style=wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
 
         if dlg.ShowModal() in [wx.ID_NO, wx.ID_CANCEL]:
             dlg.Destroy()



More information about the grass-commit mailing list