]> git.gag.com Git - debian/gnuradio/commitdiff
Blacklist certain ID names, such as python builtins, and gnuradio modules.
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 14 May 2009 22:04:10 +0000 (22:04 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Thu, 14 May 2009 22:04:10 +0000 (22:04 +0000)
git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@11032 221aa14e-8319-0410-a670-987f0aec2ac5

grc/src/gui/MainWindow.py
grc/src/gui/NotebookPage.py
grc/src/platforms/python/Param.py

index 2106b8ea192c06f4c488bd61ea3e6422e48f3fe1..bd5f73a80852a884619cc69ed2a304b414028876 100644 (file)
@@ -145,7 +145,6 @@ class MainWindow(gtk.Window):
                try: #try to load from file
                        if file_path: Messages.send_start_load(file_path)
                        flow_graph = self._platform.get_new_flow_graph()
-                       flow_graph.handle_states = self.handle_states
                        page = NotebookPage(
                                self,
                                flow_graph=flow_graph,
index 0d6a4a87c331c8a4f736a8e16b1e2542ac752ba4..a3ec5b4e21f795e6452e7bba2d523cbf16adb74a 100644 (file)
@@ -91,6 +91,7 @@ class NotebookPage(gtk.HBox):
                self.pack_start(self.scrolled_window)
                #inject drawing area and handle states into flow graph
                self.get_flow_graph().drawing_area = self.get_drawing_area()
+               self.get_flow_graph().handle_states = main_window.handle_states
                self.show_all()
 
        def get_drawing_area(self): return self.drawing_area
index e75a882a47b531f5b01ff1c27606ef6f637ee62c..10caa4c2126a1961e8454b0f17982bdc9115fbda 100644 (file)
@@ -63,6 +63,9 @@ class FileParam(EntryParam):
                        self._handle_changed()
                file_dialog.destroy() #destroy the dialog
 
+#blacklist certain ids, its not complete, but should help
+import __builtin__
+ID_BLACKLIST = ['options', 'gr', 'blks2', 'wxgui', 'wx', 'math', 'forms', 'firdes'] + dir(__builtin__)
 #define types, native python + numpy
 VECTOR_TYPES = (tuple, list, set, numpy.ndarray)
 COMPLEX_TYPES = [complex, numpy.complex, numpy.complex64, numpy.complex128]
@@ -309,6 +312,10 @@ class Param(_Param):
                        except:
                                self._add_error_message('ID "%s" is not unique.'%v)
                                raise Exception
+                       try: assert v not in ID_BLACKLIST
+                       except:
+                               self._add_error_message('ID "%s" is blacklisted.'%v)
+                               raise Exception
                        return v
                #########################
                # Grid Position Type