summaryrefslogtreecommitdiff
path: root/grc/gui
diff options
context:
space:
mode:
Diffstat (limited to 'grc/gui')
-rw-r--r--grc/gui/ActionHandler.py24
-rw-r--r--grc/gui/MainWindow.py7
2 files changed, 21 insertions, 10 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index b10737d4db..ad4dc35073 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -23,7 +23,7 @@ from __future__ import absolute_import, print_function
import os
import subprocess
-from gi.repository import Gtk
+from gi.repository import Gtk, GObject
from . import Dialogs, Preferences, Actions, Executor, FileDialogs, Utils
from .MainWindow import MainWindow
@@ -33,13 +33,14 @@ from .PropsDialog import PropsDialog
from ..core import ParseXML, Messages
-class ActionHandler:
+class ActionHandler(Gtk.Application):
"""
The action handler will setup all the major window components,
and handle button presses and flow graph operations from the GUI.
"""
def __init__(self, file_paths, platform):
+ Gtk.Application.__init__(self)
"""
ActionHandler constructor.
Create the main window, setup the message handler, import the preferences,
@@ -54,16 +55,25 @@ class ActionHandler:
for action in Actions.get_all_actions(): action.connect('activate', self._handle_action)
#setup the main window
self.platform = platform
- self.main_window = MainWindow(platform, self._handle_action)
+
+ #initialize
+ self.init_file_paths = [os.path.abspath(file_path) for file_path in file_paths]
+ self.init = False
+
+ def do_startup(self):
+ Gtk.Application.do_startup(self)
+
+ def do_activate(self):
+ Gtk.Application.do_activate(self)
+
+ self.main_window = MainWindow(self, self.platform, self._handle_action)
self.main_window.connect('delete-event', self._quit)
self.main_window.connect('key-press-event', self._handle_key_press)
self.get_focus_flag = self.main_window.get_focus_flag
#setup the messages
Messages.register_messenger(self.main_window.add_console_line)
- Messages.send_init(platform)
- #initialize
- self.init_file_paths = [os.path.abspath(file_path) for file_path in file_paths]
- self.init = False
+ Messages.send_init(self.platform)
+
Actions.APPLICATION_INITIALIZE()
def _handle_key_press(self, widget, event):
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index 3d4bf10308..e86273e288 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -41,7 +41,7 @@ from ..core import Messages
############################################################
# Main window
############################################################
-class MainWindow(Gtk.Window):
+class MainWindow(Gtk.ApplicationWindow):
"""The topmost window with menus, the tool bar, and other major windows."""
# Constants the action handler can use to indicate which panel visibility to change.
@@ -49,16 +49,17 @@ class MainWindow(Gtk.Window):
CONSOLE = 1
VARIABLES = 2
- def __init__(self, platform, action_handler_callback):
+ def __init__(self, app, platform, action_handler_callback):
"""
MainWindow constructor
Setup the menu, toolbar, flow graph editor notebook, block selection window...
"""
+ Gtk.ApplicationWindow.__init__(self, title="GNU Radio Companion", application=app)
+
self._platform = platform
Preferences.load(platform)
# Setup window
- GObject.GObject.__init__(self)
vbox = Gtk.VBox()
self.add(vbox)