فهرست منبع

wxGUI: fix trac https://trac.osgeo.org/grass/ticket/442

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@35447 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 16 سال پیش
والد
کامیت
31ec2bdd76
2فایلهای تغییر یافته به همراه22 افزوده شده و 18 حذف شده
  1. 21 10
      gui/wxpython/gui_modules/mapdisp.py
  2. 1 8
      gui/wxpython/gui_modules/mapdisp_window.py

+ 21 - 10
gui/wxpython/gui_modules/mapdisp.py

@@ -860,16 +860,27 @@ class MapFrame(wx.Frame):
         """
         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"
-
-        dlg = wx.FileDialog(self, "Choose a file name to save the image (no need to add extension)",
+        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)"),
             defaultDir = "",
             defaultFile = "",
             wildcard = filetype,

+ 1 - 8
gui/wxpython/gui_modules/mapdisp_window.py

@@ -483,14 +483,7 @@ class BufferedWindow(MapWindow, wx.Window):
 
         # 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)