[GRASS-SVN] r35448 - grass/branches/develbranch_6/gui/wxpython/gui_modules

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 16 17:14:50 EST 2009


Author: martinl
Date: 2009-01-16 17:14:50 -0500 (Fri, 16 Jan 2009)
New Revision: 35448

Modified:
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
   grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
Log:
wxGUI: fix trac #442
       (merge from devbr6, r35447)


Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-16 22:13:09 UTC (rev 35447)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py	2009-01-16 22:14:50 UTC (rev 35448)
@@ -865,16 +865,27 @@
         """
         Save image to file
         """
-        filetype =  "BMP file (*.bmp)|*.bmp|"\
-                    "GIF file (*.gif)|*.gif|"\
-                    "JPG file (*.jpg)|*.jpg|"\
-                    "PCX file (*.pcx)|*.pcx|"\
-                    "PNG file (*.png)|*.png|"\
-                    "PNM file (*.pnm)|*.pnm|"\
-                    "TIF file (*.tif)|*.tif|"\
-                    "XPM file (*.xpm)|*.xpm"
+        lext = []
+        for h in self.MapWindow.img.GetHandlers():
+            lext.append(h.GetExtension())
+        
+        filetype =  "BMP file (*.bmp)|*.bmp|"
+        if 'gif' in lext:
+            filetype += "GIF file (*.gif)|*.gif|"
+        if 'jpg' in lext:
+            filetype += "JPG file (*.jpg)|*.jpg|"
+        if 'pcx' in lext:
+            filetype += "PCX file (*.pcx)|*.pcx|"
+        if 'png' in lext:
+            filetype += "PNG file (*.png)|*.png|"
+        if 'pnm' in lext:
+            filetype += "PNM file (*.pnm)|*.pnm|"
+        if 'tif' in lext:
+            filetype += "TIF file (*.tif)|*.tif|"
+        if 'xpm' in lext:
+            filetype += "XPM file (*.xpm)|*.xpm"
 
-        dlg = wx.FileDialog(self, "Choose a file name to save the image (no need to add extension)",
+        dlg = wx.FileDialog(self, _("Choose a file name to save the image (no need to add extension)"),
             defaultDir = "",
             defaultFile = "",
             wildcard = filetype,

Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-01-16 22:13:09 UTC (rev 35447)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp_window.py	2009-01-16 22:14:50 UTC (rev 35448)
@@ -483,14 +483,7 @@
 
         # get the image to be rendered
         self.img = self.GetImage()
-        if self.img != None:
-            self.img.AddHandler(JPEGHandler)
-            self.img.AddHandler(GIFHandler)
-            self.img.AddHandler(BMPHandler)
-            self.img.AddHandler(XPMHandler)
-            self.img.AddHandler(PNMHandler)
-            self.img.AddHandler(PCXHandler)
-
+        
         # update map display
         if self.img and self.Map.width + self.Map.height > 0: # scale image during resize
             self.img = self.img.Scale(self.Map.width, self.Map.height)



More information about the grass-commit mailing list