[GRASS-SVN] r52629 - grass/trunk/gui/wxpython/swipe
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 11 13:48:15 PDT 2012
Author: wenzeslaus
Date: 2012-08-11 13:48:15 -0700 (Sat, 11 Aug 2012)
New Revision: 52629
Added:
grass/trunk/gui/wxpython/swipe/main.py
Log:
wxGUI: swipe: main with g.parser (experimental)
Added: grass/trunk/gui/wxpython/swipe/main.py
===================================================================
--- grass/trunk/gui/wxpython/swipe/main.py (rev 0)
+++ grass/trunk/gui/wxpython/swipe/main.py 2012-08-11 20:48:15 UTC (rev 52629)
@@ -0,0 +1,68 @@
+#!/usr/bin/env python
+
+#%module
+#% description:
+#%end
+#%option G_OPT_R_INPUT
+#% key: first
+#% description: First (top/right) raster map
+#% required: no
+#%end
+#%option G_OPT_R_INPUT
+#% key: second
+#% description: Second (bottom/left) raster map
+#% required: no
+#%end
+
+
+import os
+import sys
+
+import wx
+import gettext
+
+import grass.script as grass
+
+if __name__ == '__main__':
+ sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
+
+from core.settings import UserSettings
+from frame import SwipeMapFrame
+
+
+def main():
+ gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
+
+ driver = UserSettings.Get(group = 'display', key = 'driver', subkey = 'type')
+ if driver == 'png':
+ os.environ['GRASS_RENDER_IMMEDIATE'] = 'png'
+ else:
+ os.environ['GRASS_RENDER_IMMEDIATE'] = 'cairo'
+
+ options, flags = grass.parser()
+
+ first = options['first']
+ second = options['second']
+
+ gfile = grass.find_file(name = first)
+ if not gfile['name']:
+ grass.fatal(_("Raster map <%s> not found") % first)
+
+ gfile = grass.find_file(name = second)
+ if not gfile['name']:
+ grass.fatal(_("Raster map <%s> not found") % second)
+
+ app = wx.PySimpleApp()
+ wx.InitAllImageHandlers()
+
+ frame = SwipeMapFrame()
+ frame.SetFirstRaster(first)
+ frame.SetSecondRaster(second)
+ frame.Show()
+
+ app.MainLoop()
+
+
+if __name__ == '__main__':
+ main()
+
Property changes on: grass/trunk/gui/wxpython/swipe/main.py
___________________________________________________________________
Added: svn:executable
+ *
More information about the grass-commit
mailing list