commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10097 - gnuradio/trunk/grc/src/gui


From: jblum
Subject: [Commit-gnuradio] r10097 - gnuradio/trunk/grc/src/gui
Date: Sun, 30 Nov 2008 16:55:36 -0700 (MST)

Author: jblum
Date: 2008-11-30 16:55:36 -0700 (Sun, 30 Nov 2008)
New Revision: 10097

Modified:
   gnuradio/trunk/grc/src/gui/FileDialogs.py
Log:
check extension on save

Modified: gnuradio/trunk/grc/src/gui/FileDialogs.py
===================================================================
--- gnuradio/trunk/grc/src/gui/FileDialogs.py   2008-11-30 18:53:29 UTC (rev 
10096)
+++ gnuradio/trunk/grc/src/gui/FileDialogs.py   2008-11-30 23:55:36 UTC (rev 
10097)
@@ -119,12 +119,12 @@
                #############################################
                if self.type in (SAVE_FLOW_GRAPH, SAVE_IMAGE):
                        filename = self.get_filename()
-                       for extension, filter in (
-                               (Preferences.file_extension(), 
get_flow_graph_files_filter()),
-                               (IMAGE_FILE_EXTENSION, 
get_image_files_filter()),
-                       ): #append the missing file extension if the filter 
matches
-                               if filename[len(filename)-len(extension):] != 
extension \
-                                       and filter == self.get_filter(): 
filename += extension
+                       extension = {
+                               SAVE_FLOW_GRAPH: Preferences.file_extension(),
+                               SAVE_IMAGE: IMAGE_FILE_EXTENSION,
+                       }[self.type]
+                       #append the missing file extension if the filter matches
+                       if path.splitext(filename)[1].lower() != extension: 
filename += extension
                        self.set_current_name(path.basename(filename)) #show 
the filename with extension
                        if path.exists(filename): #ask the user to confirm 
overwrite
                                if MessageDialogHelper(





reply via email to

[Prev in Thread] Current Thread [Next in Thread]