diff options
Diffstat (limited to 'grc/gui/MainWindow.py')
-rw-r--r-- | grc/gui/MainWindow.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py index 6d36f4cf7..9fcbe2a6c 100644 --- a/grc/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -1,5 +1,5 @@ """ -Copyright 2008 Free Software Foundation, Inc. +Copyright 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Radio GNU Radio Companion is free software; you can redistribute it and/or @@ -19,9 +19,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA from Constants import \ NEW_FLOGRAPH_TITLE, DEFAULT_REPORTS_WINDOW_WIDTH -from Actions import \ - APPLICATION_QUIT, FLOW_GRAPH_KILL, \ - FLOW_GRAPH_SAVE, get_accel_group +import Actions import pygtk pygtk.require('2.0') import gtk @@ -67,20 +65,19 @@ PAGE_TITLE_MARKUP_TMPL = """\ class MainWindow(gtk.Window): """The topmost window with menus, the tool bar, and other major windows.""" - def __init__(self, handle_states, platform): + def __init__(self, platform): """ - MainWindow contructor. - @param handle_states the callback function + MainWindow contructor + Setup the menu, toolbar, flowgraph editor notebook, block selection window... """ self._platform = platform #setup window - self.handle_states = handle_states gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) vbox = gtk.VBox() self.hpaned = gtk.HPaned() self.add(vbox) #create the menu bar and toolbar - self.add_accel_group(get_accel_group()) + self.add_accel_group(Actions.get_accel_group()) vbox.pack_start(Bars.MenuBar(), False) vbox.pack_start(Bars.Toolbar(), False) vbox.pack_start(self.hpaned) @@ -123,7 +120,7 @@ class MainWindow(gtk.Window): This method in turns calls the state handler to quit. @return true """ - self.handle_states(APPLICATION_QUIT) + Actions.APPLICATION_QUIT() return True def _handle_page_change(self, notebook, page, page_num): @@ -137,7 +134,7 @@ class MainWindow(gtk.Window): """ self.current_page = self.notebook.get_nth_page(page_num) Messages.send_page_switch(self.current_page.get_file_path()) - self.handle_states() + Actions.PAGE_CHANGE() ############################################################ # Report Window @@ -223,12 +220,12 @@ class MainWindow(gtk.Window): self._set_page(self.page_to_be_closed) #unsaved? ask the user if not self.page_to_be_closed.get_saved() and self._save_changes(): - self.handle_states(FLOW_GRAPH_SAVE) #try to save + Actions.FLOW_GRAPH_SAVE() #try to save if not self.page_to_be_closed.get_saved(): #still unsaved? self.page_to_be_closed = None #set the page to be closed back to None return #stop the flow graph if executing - if self.page_to_be_closed.get_pid(): self.handle_states(FLOW_GRAPH_KILL) + if self.page_to_be_closed.get_pid(): Actions.FLOW_GRAPH_KILL() #remove the page self.notebook.remove_page(self.notebook.page_num(self.page_to_be_closed)) if ensure and self.notebook.get_n_pages() == 0: self.new_page() #no pages, make a new one |