[GRASS-SVN] r35511 - in grass/trunk/gui/wxpython: gui_modules icons
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Jan 20 15:03:08 EST 2009
Author: martinl
Date: 2009-01-20 15:03:08 -0500 (Tue, 20 Jan 2009)
New Revision: 35511
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_command.py
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/icons/icon.py
Log:
fix wxGUI to work with p.mon
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-01-20 19:48:32 UTC (rev 35510)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2009-01-20 20:03:08 UTC (rev 35511)
@@ -32,6 +32,8 @@
import tempfile
import copy
+import gui_modules.globalvar as globalvar
+globalvar.CheckForWx()
import wx
import wx.aui
@@ -46,6 +48,9 @@
gmpath = os.path.join(globalvar.ETCWXDIR, "icons")
sys.path.append(gmpath)
+grassPath = os.path.join(globalvar.ETCDIR, "python")
+sys.path.append(grassPath)
+
import render
import toolbars
import menuform
@@ -463,7 +468,8 @@
Change choicebook page to match display.
Or set display for georectifying
"""
- if self.gismanager.georectifying:
+ if self.gismanager and \
+ self.gismanager.georectifying:
# in georectifying session; display used to get get geographic
# coordinates for GCPs
self.OnPointer(event)
@@ -959,16 +965,14 @@
if self.toolbars['nviz']:
self.toolbars['nviz'].OnExit()
-
- if self.page:
+
+ if not self.gismanager:
+ self.Destroy()
+ elif self.page:
pgnum = self.layerbook.GetPageIndex(self.page)
if pgnum > -1:
self.layerbook.DeletePage(pgnum)
- ### self.Destroy()
- # if event:
- # event.Skip() <- causes application crash
-
def GetRender(self):
"""
Returns the current instance of render.Map()
@@ -1641,7 +1645,7 @@
if __name__ == "__main__":
# redraw map, if new command appears
self.redraw = False
- status = Command(self, Map)
+ status = Command(self, Map, cmdfilename)
status.start()
self.timer = wx.PyTimer(self.watcher)
# check each 0.1s
@@ -1675,9 +1679,9 @@
cmdfilename = sys.argv[2]
import gettext
- gettext.install("gm_map") # replace with the appropriate catalog name
+ gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode=True)
- print "Starting monitor <%s>" % (title)
+ print >> sys.stderr, "\nStarting monitor <%s>...\n" % (title)
gm_map = MapApp(0)
# set title
@@ -1688,6 +1692,6 @@
os.remove(cmdfilename)
os.system("""g.gisenv set="GRASS_PYCMDFILE" """)
- print "Stoping monitor <%s>" % (title)
+ print >> sys.stderr, "\nStoping monitor <%s>...\n" % (title)
- sys.exit()
+ sys.exit(0)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_command.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_command.py 2009-01-20 19:48:32 UTC (rev 35510)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_command.py 2009-01-20 20:03:08 UTC (rev 35511)
@@ -14,6 +14,9 @@
@author Jachym Cepicky
"""
+import sys
+import time
+
from threading import Thread
class Command(Thread):
@@ -21,14 +24,14 @@
Creates thread which will observe the command file and see, if
there is new command to be executed
"""
- def __init__ (self, parent, Map):
+ def __init__ (self, parent, Map, cmdfile):
Thread.__init__(self)
global cmdfilename
self.parent = parent
self.map = Map
- self.cmdfile = open(cmdfilename, "r")
+ self.cmdfile = open(cmdfile, "r")
def run(self):
"""
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-01-20 19:48:32 UTC (rev 35510)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-01-20 20:03:08 UTC (rev 35511)
@@ -688,7 +688,8 @@
if len(self.polycoords) > 0:
self.DrawLines(self.pdcTmp)
- if self.parent.gismanager.georectifying:
+ if self.parent.gismanager and \
+ self.parent.gismanager.georectifying:
# -> georectifier (redraw GCPs)
if self.parent.toolbars['georect']:
coordtype = 'gcpcoord'
Modified: grass/trunk/gui/wxpython/icons/icon.py
===================================================================
--- grass/trunk/gui/wxpython/icons/icon.py 2009-01-20 19:48:32 UTC (rev 35510)
+++ grass/trunk/gui/wxpython/icons/icon.py 2009-01-20 20:03:08 UTC (rev 35511)
@@ -21,8 +21,8 @@
import os
import sys
-import wxversion
-wxversion.select('2.8')
+import gui_modules.globalvar as globalvar
+globalvar.CheckForWx()
import wx
gmPath = os.path.join(os.getenv("GISBASE"), "etc", "wxpython", "gui_modules")
More information about the grass-commit
mailing list