Skip to content

Commit

Permalink
feat(main, settings): save last window size
Browse files Browse the repository at this point in the history
  • Loading branch information
actionless committed Dec 28, 2018
1 parent 1f31ab5 commit 1d7772e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions oomox_gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ def _on_export_plugin(self, action, _param=None):

def _on_quit(self, _arg1, _arg2):
self.check_unsaved_changes()
UI_SETTINGS.window_width, UI_SETTINGS.window_height = self.get_size()
UI_SETTINGS.save()

def _on_show_help(self, _action, _param=None):
Expand Down Expand Up @@ -580,8 +581,10 @@ def _init_window(self):
self.set_wmclass("oomox", "Oomox")
self.set_role("Oomox-GUI")
self.connect("delete-event", self._on_quit)
self.set_default_size(width=600, height=400) # @TODO: save in ui-settings
self.set_hide_titlebar_when_maximized(False)
self.set_default_size(
width=UI_SETTINGS.window_width,
height=UI_SETTINGS.window_height
)

self._init_headerbar()

Expand Down
2 changes: 2 additions & 0 deletions oomox_gui/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def __setattr__(self, item, value):
PRESET_LIST_MIN_SIZE = 250
UI_SETTINGS = OomoxSettings(
config_name='ui_config', default_config=dict(
window_width=600,
window_height=400,
preset_list_width=PRESET_LIST_MIN_SIZE,
preset_list_sections_expanded={},
)
Expand Down

0 comments on commit 1d7772e

Please sign in to comment.