Skip to content

Commit

Permalink
wxGUI: set window offset (OS panel) for single/multiple window mode (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmszi authored Oct 9, 2022
1 parent c4d157f commit 822ceb8
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
7 changes: 7 additions & 0 deletions gui/wxpython/lmgr/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,13 @@ def show_menu_errors(messages):
try:
x, y = map(int, dim.split(",")[0:2])
w, h = map(int, dim.split(",")[2:4])
client_disp = wx.ClientDisplayRect()
if x == 1:
# Get client display x offset (OS panel)
x = client_disp[0]
if y == 1:
# Get client display y offset (OS panel)
y = client_disp[1]
self.SetPosition((x, y))
self.SetSize((w, h))
except:
Expand Down
13 changes: 11 additions & 2 deletions gui/wxpython/main_window/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,16 +177,25 @@ def show_menu_errors(messages):
try:
x, y = map(int, dim.split(",")[0:2])
w, h = map(int, dim.split(",")[2:4])
client_disp = wx.ClientDisplayRect()
if x == 1:
# Get client display x offset (OS panel)
x = client_disp[0]
if y == 1:
# Get client display y offset (OS panel)
y = client_disp[1]
self.SetPosition((x, y))
self.SetSize((w, h))
except Exception:
pass
self.Layout()
self.Fit()
else:
self.Layout()
self.Fit()
# does center (of screen) make sense for lmgr?
self.Centre()

self.Layout()
self.Fit()
self.Show()

# load workspace file if requested
Expand Down
10 changes: 10 additions & 0 deletions gui/wxpython/mapdisp/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1714,16 +1714,26 @@ def __init__(self, parent, giface, id, tree, lmgr, idx, Map, title, **kwargs):
)
)
# use default frame window layout
client_disp = wx.ClientDisplayRect()
if UserSettings.Get(group="general", key="defWindowPos", subkey="enabled"):
dim = UserSettings.Get(group="general", key="defWindowPos", subkey="dim")
idx = 4 + idx * 4
try:
x, y = map(int, dim.split(",")[idx : idx + 2])
w, h = map(int, dim.split(",")[idx + 2 : idx + 4])
if x == 1:
# Get client display x offset (OS panel)
x = client_disp[0]
if y == 1:
# Get client display y offset (OS panel)
y = client_disp[1]
parent.SetPosition((x, y))
parent.SetSize((w, h))
except Exception:
pass
else:
# Set client display x, y offset (OS panel)
parent.SetPosition((client_disp[0], client_disp[1]))

# bindings
parent.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
Expand Down

0 comments on commit 822ceb8

Please sign in to comment.