[GRASS-SVN] r41740 - in grass/trunk: gui/wxpython lib/init
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Apr 6 06:17:10 EDT 2010
Author: martinl
Date: 2010-04-06 06:17:10 -0400 (Tue, 06 Apr 2010)
New Revision: 41740
Added:
grass/trunk/gui/wxpython/gis_set_error.py
Modified:
grass/trunk/lib/init/grass.py
Log:
show error dialog when wxGUI is used
Added: grass/trunk/gui/wxpython/gis_set_error.py
===================================================================
--- grass/trunk/gui/wxpython/gis_set_error.py (rev 0)
+++ grass/trunk/gui/wxpython/gis_set_error.py 2010-04-06 10:17:10 UTC (rev 41740)
@@ -0,0 +1,39 @@
+"""!
+ at package gis_set_error.py
+
+GRASS start-up screen error message.
+
+(C) 2010 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.
+
+ at author Martin Landa <landa.martin gmail.com>
+"""
+
+import os
+import sys
+
+import gui_modules.globalvar as globalvar
+if not os.getenv("GRASS_WXBUNDLED"):
+ globalvar.CheckForWx()
+import wx
+
+def main():
+ app = wx.PySimpleApp()
+
+ if len(sys.argv) == 1:
+ msg = "Unknown reason"
+ else:
+ msg = ''
+ for m in sys.argv[1:]:
+ msg += m
+
+ wx.MessageBox(caption = "Error",
+ message = msg,
+ style = wx.OK | wx.ICON_ERROR)
+
+ app.MainLoop()
+
+if __name__ == "__main__":
+ main()
Modified: grass/trunk/lib/init/grass.py
===================================================================
--- grass/trunk/lib/init/grass.py 2010-04-05 21:56:29 UTC (rev 41739)
+++ grass/trunk/lib/init/grass.py 2010-04-06 10:17:10 UTC (rev 41740)
@@ -3,12 +3,13 @@
#
# MODULE: GRASS initialization (Python)
# AUTHOR(S): Original author unknown - probably CERL
-# Andreas Lange - Germany - andreas.lange at rhein-main.de
-# Huidae Cho - Korea - grass4u at gmail.com
-# Justin Hickey - Thailand - jhickey at hpcc.nectec.or.th
-# Markus Neteler - Germany/Italy - neteler at itc.it
+# Andreas Lange - Germany - andreas.lange at rhein-main.de
+# Huidae Cho - Korea - grass4u at gmail.com
+# Justin Hickey - Thailand - jhickey at hpcc.nectec.or.th
+# Markus Neteler - Germany/Italy - neteler at itc.it
# Hamish Bowman - New Zealand - hamish_b at yahoo,com
# Converted to Python (based on init.sh) by Glynn Clements
+# Martin Landa - Czech Republic - landa.martin at gmail.com
# PURPOSE: Sets up some environment variables.
# It also parses any remaining command line options for
# setting the GISDBASE, LOCATION, and/or MAPSET.
@@ -523,15 +524,23 @@
ret = call([gfile("etc", "lock"),
lockfile,
"%d" % os.getpid()])
+
if ret == 0:
- pass
+ msg = None
elif ret == 2:
- fatal("%s is currently running GRASS in selected mapset (file %s found). Concurrent use not allowed."
- % (user, lockfile))
+ msg = "%s is currently running GRASS in selected mapset (file %s found). " \
+ "Concurrent use not allowed." % \
+ (user, lockfile)
else:
- fatal("Unable to properly access \"%s\"\n" % lockfile +
- "Please notify system personel.")
-
+ msg = "Unable to properly access \"%s\"\n" % \
+ lockfile + "Please notify system personel."
+
+ if msg:
+ if grass_gui == "wxpython":
+ thetest = call([os.getenv('GRASS_PYTHON'), os.path.join(wxpython_base, "gis_set_error.py"), msg])
+ else:
+ fatal(msg)
+
def make_fontcap():
fc = os.getenv('GRASS_FONT_CAP')
if fc and not os.access(fc, os.R_OK):
More information about the grass-commit
mailing list