Mirage2/src/core/containers/right_box.py

49 lines
1.2 KiB
Python

# Python imports
# Lib imports
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
# Application imports
from .image_view_scroll import ImageViewScroll
from ..widgets.button_controls import ButtonControls
from ..widgets.path_label import PathLabel
from ..widgets.ocr_window import OCRWindow
class RightBox(Gtk.Box):
def __init__(self):
super(RightBox, self).__init__()
self._setup_styling()
self._setup_signals()
self._subscribe_to_events()
self._load_widgets()
self.show_all()
def _setup_styling(self):
self.set_vexpand(True)
self.set_hexpand(True)
self.set_orientation(Gtk.Orientation.VERTICAL)
def _setup_signals(self):
...
def _subscribe_to_events(self):
event_system.subscribe("background_fill", self._toggle_background)
def _load_widgets(self):
window = OCRWindow()
self.add(ButtonControls())
self.add(PathLabel())
self.add(ImageViewScroll())
def _toggle_background(self):
ctx = self.get_style_context()
ctx.remove_class("background-fill") if ctx.has_class("background-fill") else ctx.add_class("background-fill")