summaryrefslogtreecommitdiff
path: root/grc/gui/MainWindow.py
diff options
context:
space:
mode:
authorJohnathan Corgan2009-09-15 08:41:21 -0700
committerJohnathan Corgan2009-09-15 08:41:21 -0700
commit9d2c4b0625dac26c86974453518aa5b034fc849e (patch)
treebfed69062238116588c5160e4a3a98959302f311 /grc/gui/MainWindow.py
parent2f663bacb14822efc95da006da26fa67f63ab315 (diff)
parent3fb876217316bb8ac9a59fffc75bb3c523ae1704 (diff)
downloadgnuradio-9d2c4b0625dac26c86974453518aa5b034fc849e.tar.gz
gnuradio-9d2c4b0625dac26c86974453518aa5b034fc849e.tar.bz2
gnuradio-9d2c4b0625dac26c86974453518aa5b034fc849e.zip
Merge branch 'grc' of http://gnuradio.org/git/jblum into master
* 'grc' of http://gnuradio.org/git/jblum: fixed issue where entry boxes lost focus (mishandling of hide changing) fixed bool converter in forms to work with non bool options tweaked key handling callbacks fix for uniformity convention with gtk signal name strings Simply Actions module imports, using module prefix. Reworked actions api and actions objects: Move key press extraction logic into actions module. rename variable, use keysyms in props dialog use the keymap's translate_keyboard_state, use the key value rather than name ignore irrelevant modifiers and events pending properties dialog with ok/cancel buttons
Diffstat (limited to 'grc/gui/MainWindow.py')
-rw-r--r--grc/gui/MainWindow.py23
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