Externalized some signal handler logic to new files, better keybinding control
This commit is contained in:
@@ -9,6 +9,7 @@ from gi.repository import Gdk
|
||||
from gi.repository import GLib
|
||||
|
||||
# Application imports
|
||||
from .mixins.signals_mixins import SignalsMixins
|
||||
from .mixins.dummy_mixin import DummyMixin
|
||||
from .controller_data import ControllerData
|
||||
from .core_widget import CoreWidget
|
||||
@@ -16,7 +17,7 @@ from .core_widget import CoreWidget
|
||||
|
||||
|
||||
|
||||
class Controller(DummyMixin, ControllerData):
|
||||
class Controller(DummyMixin, SignalsMixins, ControllerData):
|
||||
def __init__(self, args, unknownargs):
|
||||
self._setup_styling()
|
||||
self._setup_signals()
|
||||
@@ -38,9 +39,6 @@ class Controller(DummyMixin, ControllerData):
|
||||
def _subscribe_to_events(self):
|
||||
event_system.subscribe("handle_file_from_ipc", self.handle_file_from_ipc)
|
||||
|
||||
def handle_file_from_ipc(self, path: str) -> None:
|
||||
print(f"Path From IPC: {path}")
|
||||
|
||||
def load_glade_file(self):
|
||||
self.builder = Gtk.Builder()
|
||||
self.builder.add_from_file(settings.get_glade_file())
|
||||
@@ -53,24 +51,3 @@ class Controller(DummyMixin, ControllerData):
|
||||
|
||||
def get_core_widget(self):
|
||||
return self.core_widget
|
||||
|
||||
|
||||
def on_global_key_release_controller(self, widget: type, event: type) -> None:
|
||||
"""Handler for keyboard events"""
|
||||
keyname = Gdk.keyval_name(event.keyval).lower()
|
||||
if keyname.replace("_l", "").replace("_r", "") in ["control", "alt", "shift"]:
|
||||
if "control" in keyname:
|
||||
self.ctrl_down = False
|
||||
if "shift" in keyname:
|
||||
self.shift_down = False
|
||||
if "alt" in keyname:
|
||||
self.alt_down = False
|
||||
|
||||
|
||||
mapping = keybindings.lookup(event)
|
||||
if mapping:
|
||||
getattr(self, mapping)()
|
||||
return True
|
||||
else:
|
||||
print(f"on_global_key_release_controller > key > {keyname}")
|
||||
print(f"Add logic or remove this from: {self.__class__}")
|
||||
|
||||
Reference in New Issue
Block a user