浏览代码

introduce g.gui.psmap

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54225 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 12 年之前
父节点
当前提交
8c9d7ab661

+ 1 - 1
gui/wxpython/Makefile

@@ -1,6 +1,6 @@
 MODULE_TOPDIR = ../..
 
-SUBDIRS = docs animation mapswipe gmodeler rlisetup
+SUBDIRS = docs animation mapswipe gmodeler rlisetup psmap
 EXTRA_CLEAN_FILES = menustrings.py build_ext.pyc
 
 include $(MODULE_TOPDIR)/include/Make/Dir.make

+ 5 - 0
gui/wxpython/psmap/Makefile

@@ -0,0 +1,5 @@
+MODULE_TOPDIR = ../../..
+
+include $(MODULE_TOPDIR)/include/Make/GuiScript.make
+
+default: guiscript

+ 3 - 19
gui/wxpython/psmap/frame.py

@@ -21,9 +21,6 @@ import textwrap
 import Queue
 from math import sin, cos, pi, sqrt
 
-if __name__ == "__main__":
-    sys.path.append(os.path.join(os.getenv('GISBASE'), 'etc', 'gui', 'wxpython'))
-from core             import globalvar
 import wx
 
 try:
@@ -33,6 +30,7 @@ except ImportError:
 
 import grass.script as grass
 
+from core               import globalvar
 from gui_core.menu      import Menu
 from core.gconsole      import CmdThread, EVT_CMD_DONE
 from psmap.toolbars     import PsMapToolbar
@@ -1008,11 +1006,11 @@ class PsMapFrame(wx.Frame):
         if self.parent and self.parent.GetName() == 'LayerManager':
             log = self.parent.GetLogWindow()
             log.RunCmd(['g.manual',
-                        'entry=wxGUI.PsMap'])
+                        'entry=wxGUI.psmap'])
         else:
             RunCommand('g.manual',
                        quiet = True,
-                       entry = 'wxGUI.PsMap')
+                       entry = 'wxGUI.psmap')
         
     def OnAbout(self, event):
         """!Display About window"""
@@ -2220,17 +2218,3 @@ def GhostscriptForWindows(tile, size, fp):
         except: pass
 
     return im
-
-def main():
-    import gettext
-    gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
-    
-    app = wx.PySimpleApp()
-    wx.InitAllImageHandlers()
-    frame = PsMapFrame()
-    frame.Show()
-    
-    app.MainLoop()
-
-if __name__ == "__main__":
-    main()

+ 2 - 4
gui/wxpython/docs/wxGUI.PsMap.html

@@ -2,9 +2,6 @@
 <!-- meta page index: wxGUI -->
 <h2>DESCRIPTION</h2>
 
-<b>Note:</b> <em>wxGUI Cartographic Composer is currently under
-development.</em>
-
 <p>
 <b>wxGUI Cartographic Composer</b> also called <em>wx.psmap</em> is
 a <em><a href="wxGUI.html">wxGUI</a></em> extension which allows the
@@ -200,7 +197,8 @@ See also <a href="http://grass.osgeo.org/wiki/WxGUI_Cartographic_Composer">wiki<
 
 <h2>AUTHORS</h2>
 
-Anna Kratochvilova, Czech Technical Univesity (CTU) in Prague, Czech Republic (bachelor's final project 2011, mentor: Martin Landa)
+Anna Kratochvilova, Czech Technical Univesity in Prague, Czech
+Republic (bachelor's final project 2011, mentor: Martin Landa)
 
 <p>
 <i>$Date$</i>

+ 63 - 0
gui/wxpython/psmap/g.gui.psmap.py

@@ -0,0 +1,63 @@
+#!/usr/bin/env python
+############################################################################
+#
+# MODULE:    g.gui.psmap
+# AUTHOR(S): Anna Kratochvilova <kratochanna gmail.com>
+# PURPOSE:   Cartographic Composer
+# COPYRIGHT: (C) 2011-2012 by Anna Kratochvilova, and the GRASS Development Team
+#
+#  This program is free software; you can 1redistribute it and/or
+#  modify it under the terms of the GNU General Public License as
+#  published by the Free Software Foundation; either version 2 of the
+#  License, or (at your option) any later version.
+#
+#  This program is distributed in the hope that it will be useful, but
+#  WITHOUT ANY WARRANTY; without even the implied warranty of
+#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+#  General Public License for more details.
+#
+############################################################################
+
+#%module
+#% description: Tool for creating hardcopy map outputs.
+#% keywords: general
+#% keywords: gui
+#% keywords: printing
+#%end
+#%option G_OPT_F_INPUT
+#% key: file
+#% label: File containing mapping instructions
+#% description: See ps.map manual for details
+#% key_desc: name
+#% required: no
+#%end
+
+import os
+import sys
+import gettext
+
+import  wx
+
+import grass.script as grass
+
+sys.path.append(os.path.join(os.environ['GISBASE'], "etc", "gui", "wxpython"))
+
+from psmap.frame        import PsMapFrame
+from psmap.instructions import Instruction
+
+def main():
+    gettext.install('grasswxpy', os.path.join(os.getenv("GISBASE"), 'locale'), unicode = True)
+    
+    app = wx.PySimpleApp()
+    wx.InitAllImageHandlers()
+    frame = PsMapFrame(parent = None)
+    if options['file']:
+        grass.fatal(_("To be implemented"))
+    
+    frame.Show()
+    
+    app.MainLoop()
+
+if __name__ == "__main__":
+    options, flags = grass.parser()
+    main()