QScintilla/Editor.py

branch
5_2_x
changeset 1979
091b85ca9105
parent 1931
0e67826e1991
child 1995
11f09fe72991
--- a/QScintilla/Editor.py	Sun Jul 29 20:03:20 2012 +0200
+++ b/QScintilla/Editor.py	Sat Aug 04 18:56:59 2012 +0200
@@ -2568,7 +2568,16 @@
                 path = os.path.dirname(self.fileName)
             if path is None:
                 path = ""
-            defaultFilter = Preferences.getEditor("DefaultSaveFilter")
+            if self.fileName:
+                filterPattern = "(*{0})".format(os.path.splitext(self.fileName)[1])
+                for filter in Lexers.getSaveFileFiltersList(True):
+                    if filterPattern in filter:
+                        defaultFilter = filter
+                        break
+                else:
+                    defaultFilter = Preferences.getEditor("DefaultSaveFilter")
+            else:
+                defaultFilter = Preferences.getEditor("DefaultSaveFilter")
             fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
                 self,
                 self.trUtf8("Save File"),

eric ide

mercurial