Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wxGUI/preferences: allow the user save/load single-window mode panes layout #3312

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions gui/wxpython/core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ def _defaultSettings(self):
"region": {
"resAlign": {"enabled": False},
},
"singleWinPanesLayoutPos": {
"enabled": False,
"pos": "",
},
},
#
# datacatalog
Expand Down
56 changes: 56 additions & 0 deletions gui/wxpython/gui_core/preferences.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
havePwd = False

import wx
import wx.lib.agw.aui as aui
import wx.lib.colourselect as csel
import wx.lib.mixins.listctrl as listmix
import wx.lib.scrolledpanel as SP
Expand Down Expand Up @@ -473,6 +474,43 @@ def _createGeneralPage(self, notebook):

gridSizer.Add(defaultPos, pos=(row, 0), span=(1, 2))

#
# single window layout panes position
#
row += 1
singleWinPanesLayoutPos = wx.CheckBox(
parent=panel,
id=wx.ID_ANY,
label=_("Save current single window panes layout as default"),
name="SingleWinPanesLayoutPos",
)
singleWinPanesLayoutPos.SetValue(
self.settings.Get(
group="general",
key="singleWinPanesLayoutPos",
subkey="enabled",
)
)
singleWinPanesLayoutPos.SetToolTip(
wx.ToolTip(
_(
"Save current position and size of single-window mode panes"
" and use as default for next sessions."
)
)
)
if not self.settings.Get(
group="appearance",
key="singleWindow",
subkey="enabled",
):
singleWinPanesLayoutPos.Disable()
self.winId[
"general:singleWinPanesLayoutPos:enabled"
] = singleWinPanesLayoutPos.GetId()

gridSizer.Add(singleWinPanesLayoutPos, pos=(row, 0), span=(1, 2))

gridSizer.AddGrowableCol(0)
sizer.Add(gridSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
border.Add(sizer, proportion=0, flag=wx.ALL | wx.EXPAND, border=3)
Expand Down Expand Up @@ -1902,6 +1940,24 @@ def _updateSettings(self):
group="general", key="defWindowPos", subkey="dim", value=dim
)

#
# update single window panes layout
#
single_win_panes_layout_pos = self.settings.Get(
group="general",
key="singleWinPanesLayoutPos",
subkey="enabled",
)
if single_window and single_win_panes_layout_pos:
aui_manager = aui.GetManager(self.parent)
if aui_manager:
self.settings.Set(
group="general",
key="singleWinPanesLayoutPos",
subkey="pos",
value=aui_manager.SavePerspective(),
)

return True

def OnCheckColorTable(self, event):
Expand Down
14 changes: 14 additions & 0 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,20 @@ def BuildPanes(self):

wx.CallAfter(self.datacatalog.LoadItems)

single_win_panes_layout_pos_enabled = UserSettings.Get(
group="general",
key="singleWinPanesLayoutPos",
subkey="enabled",
)

single_win_panes_layout_pos = UserSettings.Get(
group="general",
key="singleWinPanesLayoutPos",
subkey="pos",
)
if single_win_panes_layout_pos_enabled and single_win_panes_layout_pos:
self._auimgr.LoadPerspective(single_win_panes_layout_pos)

self._auimgr.Update()

def BindEvents(self):
Expand Down
Loading