2022-01-23 22:56:27 +00:00
|
|
|
# Python imports
|
|
|
|
|
2023-01-29 06:06:52 +00:00
|
|
|
# Lib imports
|
2022-01-23 22:56:27 +00:00
|
|
|
import gi
|
|
|
|
gi.require_version('Gtk', '3.0')
|
2022-03-07 23:45:37 +00:00
|
|
|
gi.require_version('Gdk', '3.0')
|
2022-10-14 01:58:44 +00:00
|
|
|
from gi.repository import Gtk
|
|
|
|
from gi.repository import Gdk
|
|
|
|
from gi.repository import GLib
|
2022-01-23 22:56:27 +00:00
|
|
|
|
|
|
|
# Application imports
|
2023-03-18 20:30:29 +00:00
|
|
|
from .mixins.signals_mixins import SignalsMixins
|
2022-02-25 23:53:58 +00:00
|
|
|
from .mixins.dummy_mixin import DummyMixin
|
2022-10-14 01:58:44 +00:00
|
|
|
from .controller_data import ControllerData
|
|
|
|
from .core_widget import CoreWidget
|
2022-01-23 22:56:27 +00:00
|
|
|
|
|
|
|
|
2022-06-15 03:30:41 +00:00
|
|
|
|
2023-01-29 06:06:52 +00:00
|
|
|
|
2023-03-18 20:30:29 +00:00
|
|
|
class Controller(DummyMixin, SignalsMixins, ControllerData):
|
2022-10-14 01:58:44 +00:00
|
|
|
def __init__(self, args, unknownargs):
|
2023-03-18 21:02:05 +00:00
|
|
|
self.setup_controller_data()
|
|
|
|
|
2022-10-14 01:58:44 +00:00
|
|
|
self._setup_styling()
|
|
|
|
self._setup_signals()
|
|
|
|
self._subscribe_to_events()
|
2022-06-15 03:30:41 +00:00
|
|
|
|
2022-01-23 22:56:27 +00:00
|
|
|
self.print_hello_world() # A mixin method from the DummyMixin file
|
|
|
|
|
2023-02-24 00:48:37 +00:00
|
|
|
logger.info(f"Made it past {self.__class__} loading...")
|
|
|
|
|
2022-10-01 04:35:03 +00:00
|
|
|
|
2022-10-14 01:58:44 +00:00
|
|
|
def _setup_styling(self):
|
|
|
|
...
|
2022-10-01 04:35:03 +00:00
|
|
|
|
2022-10-14 01:58:44 +00:00
|
|
|
def _setup_signals(self):
|
2023-03-18 21:02:05 +00:00
|
|
|
self.window.connect("focus-out-event", self.unset_keys_and_data)
|
|
|
|
self.window.connect("key-press-event", self.on_global_key_press_controller)
|
|
|
|
self.window.connect("key-release-event", self.on_global_key_release_controller)
|
2022-01-23 22:56:27 +00:00
|
|
|
|
2022-10-14 01:58:44 +00:00
|
|
|
def _subscribe_to_events(self):
|
|
|
|
event_system.subscribe("handle_file_from_ipc", self.handle_file_from_ipc)
|
2023-03-19 20:37:43 +00:00
|
|
|
event_system.subscribe("tggl_top_main_menubar", self._tggl_top_main_menubar)
|
2022-01-23 22:56:27 +00:00
|
|
|
|
2022-10-14 01:58:44 +00:00
|
|
|
def load_glade_file(self):
|
|
|
|
self.builder = Gtk.Builder()
|
|
|
|
self.builder.add_from_file(settings.get_glade_file())
|
2023-02-24 00:48:37 +00:00
|
|
|
self.builder.expose_object("main_window", self.window)
|
|
|
|
|
2022-10-14 01:58:44 +00:00
|
|
|
settings.set_builder(self.builder)
|
|
|
|
self.core_widget = CoreWidget()
|
|
|
|
|
|
|
|
settings.register_signals_to_builder([self, self.core_widget])
|
|
|
|
|
|
|
|
def get_core_widget(self):
|
|
|
|
return self.core_widget
|
2023-03-19 20:37:43 +00:00
|
|
|
|
|
|
|
def _tggl_top_main_menubar(self):
|
|
|
|
print("_tggl_top_main_menubar > stub...")
|