diff options
author | jblum | 2008-11-30 23:55:36 +0000 |
---|---|---|
committer | jblum | 2008-11-30 23:55:36 +0000 |
commit | ac06546bb238161e493c9f25f5cf4e5b188ee291 (patch) | |
tree | b0efb592c05c742c316751ab7f51329d04029a73 | |
parent | 5e84bb4e73836b8d0016b75c7ba6de0ae9af6e6e (diff) | |
download | gnuradio-ac06546bb238161e493c9f25f5cf4e5b188ee291.tar.gz gnuradio-ac06546bb238161e493c9f25f5cf4e5b188ee291.tar.bz2 gnuradio-ac06546bb238161e493c9f25f5cf4e5b188ee291.zip |
check extension on save
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10097 221aa14e-8319-0410-a670-987f0aec2ac5
-rw-r--r-- | grc/src/gui/FileDialogs.py | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/grc/src/gui/FileDialogs.py b/grc/src/gui/FileDialogs.py index efd3fecfe..7c10d9844 100644 --- a/grc/src/gui/FileDialogs.py +++ b/grc/src/gui/FileDialogs.py @@ -119,12 +119,12 @@ class FileDialog(FileDialogHelper): ############################################# 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( |