-
- def init_navbar() -> Gtk.Box:
- navbar = Gtk.Box(orientation=OR_H)
- _add_button(navbar, 'sidebar', lambda _: self.toggle_side_box())
- self.topbar = Gtk.Label()
- navbar.append(self.topbar)
- return navbar
-
- def init_metadata_box() -> Gtk.TextView:
- text_view = Gtk.TextView(wrap_mode=Gtk.WrapMode.WORD_CHAR,
- editable=False)
- text_view.set_size_request(300, -1)
- self.metadata = text_view.get_buffer()
- return text_view
-
- def init_key_control() -> None:
- key_ctl = Gtk.EventControllerKey(
- propagation_phase=Gtk.PropagationPhase.CAPTURE)
- key_ctl.connect('key-pressed',
- lambda _, kval, _0, _1: self.handle_keypress(kval))
- self.add_controller(key_ctl)
- self.prev_key = [0]
-
- def setup_css() -> None:
- css_provider = Gtk.CssProvider()
- css_provider.load_from_data(CSS)
- Gtk.StyleContext.add_provider_for_display(
- self.get_display(), css_provider,
- Gtk.STYLE_PROVIDER_PRIORITY_USER)
-