generated from itdominator/Python-With-Gtk-Template
Persisting window state; fixed onload widgets seen bug; changed toggler keymap
This commit is contained in:
parent
c86c339138
commit
d292a99791
|
@ -20,13 +20,11 @@ class EditorsPaned(Gtk.Paned):
|
|||
self._subscribe_to_events()
|
||||
self._load_widgets()
|
||||
|
||||
self.show_all()
|
||||
self.show()
|
||||
|
||||
|
||||
def _setup_styling(self):
|
||||
self.set_wide_handle(True)
|
||||
self.set_vexpand(True)
|
||||
self.set_hexpand(True)
|
||||
|
||||
def _setup_signals(self):
|
||||
...
|
||||
|
@ -50,12 +48,11 @@ class EditorsContainer(Gtk.Box):
|
|||
self._subscribe_to_events()
|
||||
self._load_widgets()
|
||||
|
||||
self.show_all()
|
||||
self.show()
|
||||
|
||||
|
||||
def _setup_styling(self):
|
||||
self.set_vexpand(True)
|
||||
self.set_hexpand(True)
|
||||
...
|
||||
|
||||
def _setup_signals(self):
|
||||
...
|
||||
|
|
|
@ -52,6 +52,8 @@ class EditorNotebook(EditorEventsMixin, EditorControllerMixin, Gtk.Notebook):
|
|||
|
||||
def _setup_styling(self):
|
||||
self.set_scrollable(True)
|
||||
self.set_vexpand(True)
|
||||
self.set_hexpand(True)
|
||||
|
||||
def _setup_signals(self):
|
||||
self.connect("switch-page", self._switch_page_update)
|
||||
|
|
|
@ -36,13 +36,12 @@ class Window(Gtk.ApplicationWindow):
|
|||
|
||||
settings_manager.set_main_window(self)
|
||||
self._load_widgets(args, unknownargs)
|
||||
self._set_size_constraints()
|
||||
|
||||
self.show()
|
||||
|
||||
|
||||
def _setup_styling(self):
|
||||
self.set_default_size(settings.config.main_window_width,
|
||||
settings.config.main_window_height)
|
||||
self.set_title(f"{app_name}")
|
||||
self.set_icon_from_file( settings_manager.get_window_icon() )
|
||||
self.set_gravity(5) # 5 = CENTER
|
||||
|
@ -65,6 +64,18 @@ class Window(Gtk.ApplicationWindow):
|
|||
|
||||
self.add( self._controller.get_core_widget() )
|
||||
|
||||
def _set_size_constraints(self):
|
||||
_window_x = settings.config.main_window_x
|
||||
_window_y = settings.config.main_window_y
|
||||
_min_width = settings.config.main_window_min_width
|
||||
_min_height = settings.config.main_window_min_height
|
||||
_width = settings.config.main_window_width
|
||||
_height = settings.config.main_window_height
|
||||
|
||||
self.move(_window_x, _window_y - 28)
|
||||
self.set_size_request(_min_width, _min_height)
|
||||
self.set_default_size(_width, _height)
|
||||
|
||||
def _set_window_data(self) -> None:
|
||||
screen = self.get_screen()
|
||||
visual = screen.get_rgba_visual()
|
||||
|
@ -89,6 +100,15 @@ class Window(Gtk.ApplicationWindow):
|
|||
|
||||
|
||||
def _tear_down(self, widget=None, eve=None):
|
||||
size = self.get_size()
|
||||
pos = self.get_position()
|
||||
|
||||
settings_manager.set_main_window_width(size.width)
|
||||
settings_manager.set_main_window_height(size.height)
|
||||
settings_manager.set_main_window_x(pos.root_x)
|
||||
settings_manager.set_main_window_y(pos.root_y)
|
||||
settings_manager.save_settings()
|
||||
|
||||
settings_manager.clear_pid()
|
||||
time.sleep(event_sleep_time)
|
||||
Gtk.main_quit()
|
||||
|
|
|
@ -146,12 +146,12 @@ class SettingsManager(StartCheckMixin, Singleton):
|
|||
method = getattr(target_class, method_name, lambda data: f"No valid key passed...\nkey={method_name}\nargs={data}")
|
||||
return method(data) if data else method()
|
||||
|
||||
def set_main_window_x(self, x = 0): self.settings.config.window_x = x
|
||||
def set_main_window_y(self, y = 0): self.settings.config.window_y = y
|
||||
def set_main_window_width(self, width = 800): self.settings.config.window_width = width
|
||||
def set_main_window_height(self, height = 600): self.settings.config.window_height = height
|
||||
def set_main_window_min_width(self, width = 720): self.settings.config.window_min_width = width
|
||||
def set_main_window_min_height(self, height = 480): self.settings.config.window_min_height = height
|
||||
def set_main_window_x(self, x = 0): self.settings.config.main_window_x = x
|
||||
def set_main_window_y(self, y = 0): self.settings.config.main_window_y = y
|
||||
def set_main_window_width(self, width = 800): self.settings.config.main_window_width = width
|
||||
def set_main_window_height(self, height = 600): self.settings.config.main_window_height = height
|
||||
def set_main_window_min_width(self, width = 720): self.settings.config.main_window_min_width = width
|
||||
def set_main_window_min_height(self, height = 480): self.settings.config.main_window_min_height = height
|
||||
|
||||
def set_trace_debug(self, trace_debug):
|
||||
self._trace_debug = trace_debug
|
||||
|
|
Loading…
Reference in New Issue