Moved popups to theor on class sans glade file
This commit is contained in:
parent
0e0802a375
commit
f5eac69c20
|
@ -13,6 +13,9 @@ from gi.repository import GLib
|
||||||
from .controller_data import Controller_Data
|
from .controller_data import Controller_Data
|
||||||
from .mixins.signals_mixins import SignalsMixins
|
from .mixins.signals_mixins import SignalsMixins
|
||||||
|
|
||||||
|
from widgets.popups.plugins_popup_widget import PluginsPopupWidget
|
||||||
|
from widgets.popups.io_popup_widget import IOPopupWidget
|
||||||
|
|
||||||
from widgets.context_menu_widget import ContextMenuWidget
|
from widgets.context_menu_widget import ContextMenuWidget
|
||||||
from widgets.new_file_widget import NewFileWidget
|
from widgets.new_file_widget import NewFileWidget
|
||||||
from widgets.rename_widget import RenameWidget
|
from widgets.rename_widget import RenameWidget
|
||||||
|
@ -53,6 +56,8 @@ class Controller(UI, SignalsMixins, Controller_Data):
|
||||||
# NOTE: Really we will move these to the UI/(New) Window 'base' controller
|
# NOTE: Really we will move these to the UI/(New) Window 'base' controller
|
||||||
# after we're done cleaning and refactoring to use fewer mixins.
|
# after we're done cleaning and refactoring to use fewer mixins.
|
||||||
def _load_widgets(self):
|
def _load_widgets(self):
|
||||||
|
PluginsPopupWidget()
|
||||||
|
IOPopupWidget()
|
||||||
ContextMenuWidget()
|
ContextMenuWidget()
|
||||||
NewFileWidget()
|
NewFileWidget()
|
||||||
RenameWidget()
|
RenameWidget()
|
||||||
|
@ -159,8 +164,14 @@ class Controller(UI, SignalsMixins, Controller_Data):
|
||||||
self.create_files()
|
self.create_files()
|
||||||
if action in ["save_session", "save_session_as", "load_session"]:
|
if action in ["save_session", "save_session_as", "load_session"]:
|
||||||
self.save_load_session(action)
|
self.save_load_session(action)
|
||||||
|
|
||||||
if action == "about_page":
|
if action == "about_page":
|
||||||
event_system.emit("show_about_page")
|
event_system.emit("show_about_page")
|
||||||
|
if action == "io_popup":
|
||||||
|
event_system.emit("show_io_popup")
|
||||||
|
if action == "plugins_popup":
|
||||||
|
event_system.emit("show_plugins_popup")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@endpoint_registry.register(rule="go_home")
|
@endpoint_registry.register(rule="go_home")
|
||||||
|
|
|
@ -11,12 +11,3 @@ from gi.repository import Gtk
|
||||||
class ShowHideMixin:
|
class ShowHideMixin:
|
||||||
def show_messages_popup(self, type, text, seconds=None):
|
def show_messages_popup(self, type, text, seconds=None):
|
||||||
self.message_popup_widget.popup()
|
self.message_popup_widget.popup()
|
||||||
|
|
||||||
def show_plugins_popup(self, widget=None, eve=None):
|
|
||||||
self.builder.get_object("plugin_controls").popup()
|
|
||||||
|
|
||||||
def hide_plugins_popup(self, widget=None, eve=None):
|
|
||||||
self.builder.get_object("plugin_controls").hide()
|
|
||||||
|
|
||||||
def show_io_popup(self, widget=None, eve=None):
|
|
||||||
self.builder.get_object("io_popup").popup()
|
|
||||||
|
|
|
@ -149,21 +149,21 @@ class Settings:
|
||||||
return monitors
|
return monitors
|
||||||
|
|
||||||
|
|
||||||
def get_context_menu_data(self) -> Gtk.Builder: return self._context_menu_data
|
def get_context_menu_data(self) -> Gtk.Builder: return self._context_menu_data
|
||||||
def get_main_window(self) -> Gtk.ApplicationWindow: return self._main_window
|
def get_main_window(self) -> Gtk.ApplicationWindow: return self._main_window
|
||||||
def get_builder(self) -> Gtk.Builder: return self._builder
|
def get_builder(self) -> Gtk.Builder: return self._builder
|
||||||
def get_ui_widgets_path(self) -> Gtk.Builder: return self._UI_WIDEGTS_PATH
|
def get_ui_widgets_path(self) -> Gtk.Builder: return self._UI_WIDEGTS_PATH
|
||||||
def get_logger(self) -> Logger: return self._logger
|
def get_logger(self) -> Logger: return self._logger
|
||||||
def get_keybindings(self) -> Keybindings: return self._keybindings
|
def get_keybindings(self) -> Keybindings: return self._keybindings
|
||||||
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
def get_plugins_path(self) -> str: return self._PLUGINS_PATH
|
||||||
def get_icon_theme(self) -> str: return self._ICON_THEME
|
def get_icon_theme(self) -> str: return self._ICON_THEME
|
||||||
|
|
||||||
def get_success_color(self) -> str: return self._success_color
|
def get_success_color(self) -> str: return self._success_color
|
||||||
def get_warning_color(self) -> str: return self._warning_color
|
def get_warning_color(self) -> str: return self._warning_color
|
||||||
def get_error_color(self) -> str: return self._error_color
|
def get_error_color(self) -> str: return self._error_color
|
||||||
|
|
||||||
def is_trace_debug(self) -> str: return self._trace_debug
|
def is_trace_debug(self) -> str: return self._trace_debug
|
||||||
def is_debug(self) -> str: return self._debug
|
def is_debug(self) -> str: return self._debug
|
||||||
def is_dirty_start(self) -> bool: return self._dirty_start
|
def is_dirty_start(self) -> bool: return self._dirty_start
|
||||||
def clear_pid(self): self._clean_pid()
|
def clear_pid(self): self._clean_pid()
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
import inspect
|
import inspect
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
gi.require_version('Gdk', '3.0')
|
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
import inspect
|
import inspect
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
gi.require_version('Gdk', '3.0')
|
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gdk
|
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
"""
|
||||||
|
Popups module
|
||||||
|
"""
|
|
@ -0,0 +1,42 @@
|
||||||
|
# Python imports
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
import inspect
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
class IOPopupWidget(Gtk.Popover):
|
||||||
|
"""docstring for IOPopupWidget."""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(IOPopupWidget, self).__init__()
|
||||||
|
self.builder = settings.get_builder()
|
||||||
|
|
||||||
|
self.builder.expose_object(f"io_popup", self)
|
||||||
|
|
||||||
|
self._setup_styling()
|
||||||
|
self._setup_signals()
|
||||||
|
self._load_widgets()
|
||||||
|
self.show_all()
|
||||||
|
|
||||||
|
|
||||||
|
def _setup_styling(self):
|
||||||
|
io_button = self.builder.get_object(f"io_button")
|
||||||
|
self.set_relative_to(io_button)
|
||||||
|
self.set_modal(True)
|
||||||
|
self.set_position(Gtk.PositionType.BOTTOM)
|
||||||
|
|
||||||
|
def _setup_signals(self):
|
||||||
|
event_system.subscribe("show_io_popup", self.show_io_popup)
|
||||||
|
|
||||||
|
def _load_widgets(self):
|
||||||
|
vbox = Gtk.Box()
|
||||||
|
self.builder.expose_object(f"io_list", vbox)
|
||||||
|
self.add(vbox)
|
||||||
|
|
||||||
|
def show_io_popup(self, widget=None, eve=None):
|
||||||
|
self.popup()
|
|
@ -0,0 +1,47 @@
|
||||||
|
# Python imports
|
||||||
|
|
||||||
|
# Lib imports
|
||||||
|
import inspect
|
||||||
|
import gi
|
||||||
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk
|
||||||
|
|
||||||
|
# Application imports
|
||||||
|
|
||||||
|
|
||||||
|
class PluginsPopupWidget(Gtk.Popover):
|
||||||
|
"""docstring for PluginsPopupWidget."""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
super(PluginsPopupWidget, self).__init__()
|
||||||
|
self.builder = settings.get_builder()
|
||||||
|
|
||||||
|
self.builder.expose_object(f"plugin_controls", self)
|
||||||
|
|
||||||
|
self._setup_styling()
|
||||||
|
self._setup_signals()
|
||||||
|
self._load_widgets()
|
||||||
|
self.show_all()
|
||||||
|
|
||||||
|
|
||||||
|
def _setup_styling(self):
|
||||||
|
plugins_button = self.builder.get_object(f"plugins_button")
|
||||||
|
self.set_relative_to(plugins_button)
|
||||||
|
self.set_modal(True)
|
||||||
|
self.set_position(Gtk.PositionType.BOTTOM)
|
||||||
|
|
||||||
|
def _setup_signals(self):
|
||||||
|
event_system.subscribe("show_plugins_popup", self.show_plugins_popup)
|
||||||
|
self.connect("button-release-event", self.hide_plugins_popup)
|
||||||
|
self.connect("key-release-event", self.hide_plugins_popup)
|
||||||
|
|
||||||
|
def _load_widgets(self):
|
||||||
|
vbox = Gtk.Box()
|
||||||
|
self.builder.expose_object(f"plugin_control_list", vbox)
|
||||||
|
self.add(vbox)
|
||||||
|
|
||||||
|
def show_plugins_popup(self, widget=None, eve=None):
|
||||||
|
self.popup()
|
||||||
|
|
||||||
|
def hide_plugins_popup(self, widget=None, eve=None):
|
||||||
|
self.hide()
|
|
@ -4,7 +4,6 @@
|
||||||
import gi
|
import gi
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
from gi.repository import Gio
|
|
||||||
|
|
||||||
# Application imports
|
# Application imports
|
||||||
|
|
||||||
|
|
|
@ -367,10 +367,11 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="plugins_button">
|
<object class="GtkButton" id="plugins_button">
|
||||||
<property name="label" translatable="yes">Plugins</property>
|
<property name="label" translatable="yes">Plugins</property>
|
||||||
|
<property name="name">plugins_popup</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<signal name="released" handler="show_plugins_popup" swapped="no"/>
|
<signal name="released" handler="do_action_from_menu_controls" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -445,12 +446,13 @@
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="io_button">
|
<object class="GtkButton" id="io_button">
|
||||||
<property name="label" translatable="yes">I/O</property>
|
<property name="label" translatable="yes">I/O</property>
|
||||||
|
<property name="name">io_popup</property>
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">True</property>
|
<property name="can-focus">True</property>
|
||||||
<property name="receives-default">True</property>
|
<property name="receives-default">True</property>
|
||||||
<property name="image">io_img</property>
|
<property name="image">io_img</property>
|
||||||
<property name="always-show-image">True</property>
|
<property name="always-show-image">True</property>
|
||||||
<signal name="released" handler="show_io_popup" swapped="no"/>
|
<signal name="released" handler="do_action_from_menu_controls" swapped="no"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="expand">True</property>
|
||||||
|
@ -899,23 +901,6 @@
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkPopover" id="io_popup">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="relative-to">io_button</property>
|
|
||||||
<property name="position">bottom</property>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="io_list">
|
|
||||||
<property name="width-request">320</property>
|
|
||||||
<property name="height-request">320</property>
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<object class="GtkPopover" id="message_popup_widget">
|
<object class="GtkPopover" id="message_popup_widget">
|
||||||
<property name="width-request">320</property>
|
<property name="width-request">320</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
@ -1004,22 +989,6 @@
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkPopover" id="plugin_controls">
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="relative-to">plugins_button</property>
|
|
||||||
<signal name="button-release-event" handler="hide_plugins_popup" swapped="no"/>
|
|
||||||
<signal name="key-release-event" handler="hide_plugins_popup" swapped="no"/>
|
|
||||||
<child>
|
|
||||||
<object class="GtkBox" id="plugin_control_list">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="orientation">vertical</property>
|
|
||||||
<child>
|
|
||||||
<placeholder/>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<object class="GtkMessageDialog" id="warning_alert">
|
<object class="GtkMessageDialog" id="warning_alert">
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
<property name="resizable">False</property>
|
<property name="resizable">False</property>
|
||||||
|
|
Loading…
Reference in New Issue