Browse Source

wxGUI/psmap: implement file option

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@54227 15284696-431f-4ddb-bdfa-cd5b030d7da7
Anna Petrášová 12 years ago
parent
commit
de7b0e57c8
2 changed files with 11 additions and 7 deletions
  1. 6 2
      gui/wxpython/psmap/frame.py
  2. 5 5
      gui/wxpython/psmap/g.gui.psmap.py

+ 6 - 2
gui/wxpython/psmap/frame.py

@@ -382,7 +382,7 @@ class PsMapFrame(wx.Frame):
             instrFile.close()   
             
     def OnLoadFile(self, event):
-        """!Load file and read instructions"""
+        """!Launch file dialog and load selected file"""
         #find file
         filename = ''
         dlg = wx.FileDialog(self, message = "Find instructions file", defaultDir = "", 
@@ -394,6 +394,10 @@ class PsMapFrame(wx.Frame):
         if not filename:
             return
         # load instructions
+        self.LoadFile(filename)
+
+    def LoadFile(self, filename):
+        """!Load file and read instructions"""
         readObjectId = []
         readInstruction = Instruction(parent = self, objectsToDraw = readObjectId)
         ok = readInstruction.Read(filename)
@@ -410,7 +414,7 @@ class PsMapFrame(wx.Frame):
             #self.canvas.ZoomAll()
             
             self.DialogDataChanged(self.objectId)
-            
+
     def OnPageSetup(self, event = None):
         """!Specify paper size, margins and orientation"""
         id = self.instruction.FindInstructionByType('page').id

+ 5 - 5
gui/wxpython/psmap/g.gui.psmap.py

@@ -6,7 +6,7 @@
 # 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
+#  This program is free software; you can redistribute 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.
@@ -51,11 +51,11 @@ def main():
     app = wx.PySimpleApp()
     wx.InitAllImageHandlers()
     frame = PsMapFrame(parent = None)
-    if options['file']:
-        grass.fatal(_("To be implemented"))
-    
     frame.Show()
-    
+
+    if options['file']:
+        frame.LoadFile(options['file'])
+
     app.MainLoop()
 
 if __name__ == "__main__":