From 6970a408e3f4a60d503149cabc0197c76cd16985 Mon Sep 17 00:00:00 2001 From: Sebastian Koslowski <koslowski@kit.edu> Date: Fri, 25 Sep 2015 12:15:45 +0200 Subject: grc: add File->New submenu with generate modes preset, Bar.py refactoring --- grc/gui/MainWindow.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'grc/gui/MainWindow.py') diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py index 03a4b536f2..f658a85062 100644 --- a/grc/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -65,12 +65,17 @@ PAGE_TITLE_MARKUP_TMPL = """\ class MainWindow(gtk.Window): """The topmost window with menus, the tool bar, and other major windows.""" - def __init__(self, platform): + def __init__(self, platform, action_handler_callback): """ MainWindow contructor Setup the menu, toolbar, flowgraph editor notebook, block selection window... """ self._platform = platform + gen_opts = platform.get_block('options').get_param('generate_options') + generate_mode_default = gen_opts.get_value() + generate_modes = [ + (o.get_key(), o.get_name(), o.get_key() == generate_mode_default) + for o in gen_opts.get_options()] #setup window gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL) vbox = gtk.VBox() @@ -78,7 +83,8 @@ class MainWindow(gtk.Window): self.add(vbox) #create the menu bar and toolbar self.add_accel_group(Actions.get_accel_group()) - vbox.pack_start(Bars.MenuBar(), False) + menu_bar = Bars.MenuBar(generate_modes, action_handler_callback) + vbox.pack_start(menu_bar, False) vbox.pack_start(Bars.Toolbar(), False) vbox.pack_start(self.hpaned) #create the notebook -- cgit v1.2.3