commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r11204 - in gnuradio/branches/developers/jblum/grc/grc


From: jblum
Subject: [Commit-gnuradio] r11204 - in gnuradio/branches/developers/jblum/grc/grc: . gui
Date: Mon, 15 Jun 2009 18:56:51 -0600 (MDT)

Author: jblum
Date: 2009-06-15 18:56:51 -0600 (Mon, 15 Jun 2009)
New Revision: 11204

Modified:
   gnuradio/branches/developers/jblum/grc/grc/gui/FileDialogs.py
   gnuradio/branches/developers/jblum/grc/grc/todo.txt
Log:
templated warning messages in file dialog (now escaped/character-safe)

Modified: gnuradio/branches/developers/jblum/grc/grc/gui/FileDialogs.py
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/gui/FileDialogs.py       
2009-06-16 00:52:16 UTC (rev 11203)
+++ gnuradio/branches/developers/jblum/grc/grc/gui/FileDialogs.py       
2009-06-16 00:56:51 UTC (rev 11204)
@@ -26,11 +26,24 @@
        NEW_FLOGRAPH_TITLE
 import Preferences
 from os import path
+import Utils
 
+##################################################
+# Constants
+##################################################
 OPEN_FLOW_GRAPH = 'open flow graph'
 SAVE_FLOW_GRAPH = 'save flow graph'
 SAVE_IMAGE = 'save image'
 
+FILE_OVERWRITE_MARKUP_TMPL="""\
+File <b>$encode($filename)</b> Exists!\nWould you like to overwrite the 
existing file?"""
+
+FILE_DNE_MARKUP_TMPL="""\
+File <b>$encode($filename)</b> Does not Exist!"""
+
+##################################################
+# File Filters
+##################################################
 ##the filter for flow graph files
 def get_flow_graph_files_filter():
        filter = gtk.FileFilter()
@@ -52,6 +65,9 @@
        filter.add_pattern('*')
        return filter
 
+##################################################
+# File Dialogs
+##################################################
 class FileDialogHelper(gtk.FileChooserDialog):
        """
        A wrapper class for the gtk file chooser dialog.
@@ -128,7 +144,7 @@
                        if path.exists(filename): #ask the user to confirm 
overwrite
                                if MessageDialogHelper(
                                        gtk.MESSAGE_QUESTION, 
gtk.BUTTONS_YES_NO, 'Confirm Overwrite!',
-                                       'File <b>"%s"</b> Exists!\nWould you 
like to overwrite the existing file?'%filename,
+                                       
Utils.parse_template(FILE_OVERWRITE_MARKUP_TMPL, filename=filename),
                                ) == gtk.RESPONSE_NO: return 
self.get_rectified_filename()
                        return filename
                #############################################
@@ -140,7 +156,7 @@
                                if not path.exists(filename): #show a warning 
and re-run
                                        MessageDialogHelper(
                                                gtk.MESSAGE_WARNING, 
gtk.BUTTONS_CLOSE, 'Cannot Open!',
-                                               'File <b>"%s"</b> Does not 
Exist!'%filename,
+                                               
Utils.parse_template(FILE_DNE_MARKUP_TMPL, filename=filename),
                                        )
                                        return self.get_rectified_filename()
                        return filenames

Modified: gnuradio/branches/developers/jblum/grc/grc/todo.txt
===================================================================
--- gnuradio/branches/developers/jblum/grc/grc/todo.txt 2009-06-16 00:52:16 UTC 
(rev 11203)
+++ gnuradio/branches/developers/jblum/grc/grc/todo.txt 2009-06-16 00:56:51 UTC 
(rev 11204)
@@ -1,10 +1,4 @@
 ##################################################
-# TODO
-##################################################
-* templates in FileDialogs for MessageDialogHelper markup
-* dictionary find/replace in expr_utils, replaces expr_prepend
-
-##################################################
 # Blocks
 ##################################################
 * probe: also non-float outputs





reply via email to

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