commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] r9751 - in gnuradio/trunk/grc: . src/gui


From: jblum
Subject: [Commit-gnuradio] r9751 - in gnuradio/trunk/grc: . src/gui
Date: Wed, 8 Oct 2008 14:17:18 -0600 (MDT)

Author: jblum
Date: 2008-10-08 14:17:18 -0600 (Wed, 08 Oct 2008)
New Revision: 9751

Modified:
   gnuradio/trunk/grc/src/gui/ActionHandler.py
   gnuradio/trunk/grc/src/gui/MainWindow.py
   gnuradio/trunk/grc/src/gui/NotebookPage.py
   gnuradio/trunk/grc/todo.txt
Log:
read-only aware

Modified: gnuradio/trunk/grc/src/gui/ActionHandler.py
===================================================================
--- gnuradio/trunk/grc/src/gui/ActionHandler.py 2008-10-08 19:28:59 UTC (rev 
9750)
+++ gnuradio/trunk/grc/src/gui/ActionHandler.py 2008-10-08 20:17:18 UTC (rev 
9751)
@@ -328,7 +328,10 @@
                elif state == Actions.FLOW_GRAPH_CLOSE:
                        self.main_window.close_page()
                elif state == Actions.FLOW_GRAPH_SAVE:
-                       if not self.get_page().get_file_path(): 
self.handle_states(Actions.FLOW_GRAPH_SAVE_AS)
+                       #read-only or undefines file path, do save-as
+                       if self.get_page().get_read_only() or not 
self.get_page().get_file_path():
+                               self.handle_states(Actions.FLOW_GRAPH_SAVE_AS)
+                       #otherwise try to save
                        else:
                                try:
                                        
ParseXML.to_file(self.get_flow_graph().export_data(), 
self.get_page().get_file_path())
@@ -338,12 +341,12 @@
                                        self.get_page().set_saved(False)
                elif state == Actions.FLOW_GRAPH_SAVE_AS:
                        file_path = 
SaveFlowGraphFileDialog(self.get_page().get_file_path()).run()
-                       if file_path != None:
+                       if file_path is not None:
                                self.get_page().set_file_path(file_path)
                                self.handle_states(Actions.FLOW_GRAPH_SAVE)
                elif state == Actions.FLOW_GRAPH_SCREEN_CAPTURE:
                        file_path = 
SaveImageFileDialog(self.get_page().get_file_path()).run()
-                       if file_path != None:
+                       if file_path is not None:
                                pixmap = 
self.get_flow_graph().get_drawing_area().pixmap
                                width, height = pixmap.get_size()
                                pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, 
0, 8, width, height)

Modified: gnuradio/trunk/grc/src/gui/MainWindow.py
===================================================================
--- gnuradio/trunk/grc/src/gui/MainWindow.py    2008-10-08 19:28:59 UTC (rev 
9750)
+++ gnuradio/trunk/grc/src/gui/MainWindow.py    2008-10-08 20:17:18 UTC (rev 
9751)
@@ -246,6 +246,7 @@
                                        ' - Editing: ',
                                        (self.get_page().get_file_path() or 
NEW_FLOGRAPH_TITLE),
                                        (self.get_page().get_saved() and ' ' or 
'*'), #blank must be non empty
+                                       (self.get_page().get_read_only() and ' 
(read-only)' or ''),
                                )
                        )
                else: title = MAIN_WINDOW_PREFIX + ' - Editor '
@@ -262,6 +263,7 @@
                        page.set_text(''.join((
                                                (title or NEW_FLOGRAPH_TITLE),
                                                (page.get_saved() and ' ' or 
'*'), #blank must be non empty
+                                               (page.get_read_only() and ' 
(ro)' or ''),
                                        )
                                )
                        )

Modified: gnuradio/trunk/grc/src/gui/NotebookPage.py
===================================================================
--- gnuradio/trunk/grc/src/gui/NotebookPage.py  2008-10-08 19:28:59 UTC (rev 
9750)
+++ gnuradio/trunk/grc/src/gui/NotebookPage.py  2008-10-08 20:17:18 UTC (rev 
9751)
@@ -135,6 +135,15 @@
                """
                return self._flow_graph
 
+       def get_read_only(self):
+               """
+               Get the read-only state of the file.
+               Always false for empty path.
+               @return true for read-only
+               """
+               if not self.get_file_path(): return False
+               return not os.access(self.get_file_path(), os.W_OK)
+
        def get_file_path(self):
                """
                Get the file path for the flow graph.

Modified: gnuradio/trunk/grc/todo.txt
===================================================================
--- gnuradio/trunk/grc/todo.txt 2008-10-08 19:28:59 UTC (rev 9750)
+++ gnuradio/trunk/grc/todo.txt 2008-10-08 20:17:18 UTC (rev 9751)
@@ -32,7 +32,6 @@
 -dont hide vlen controller when vlen > 1
 -dont generate py files in .grc file dir
 -save/restore cwd
--check for .grc file readonly, ro message in window, no save option
 
 ##################################################
 # External





reply via email to

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