Skip to content

Commit 5e10986

Browse files
committed
Persist tool window position
1 parent ed5c156 commit 5e10986

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

SidebarGUIPlugin.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ def __init__(self):
2121
self._prepare_stage_view_id = "SolidView" # can be "SolidView" or "XRayView"
2222

2323
Application.getInstance().pluginsLoaded.connect(self._onPluginsLoaded)
24-
Application.getInstance().getPreferences().addPreference("sidebargui/expand_extruder_configuration", False)
25-
Application.getInstance().getPreferences().addPreference("sidebargui/expand_legend", True)
26-
Application.getInstance().getPreferences().addPreference("sidebargui/docked_sidebar", True)
24+
preferences = Application.getInstance().getPreferences()
25+
preferences.addPreference("sidebargui/expand_extruder_configuration", False)
26+
preferences.addPreference("sidebargui/expand_legend", True)
27+
preferences.addPreference("sidebargui/docked_sidebar", True)
28+
preferences.addPreference("sidebargui/settings_window_left", 65535)
29+
preferences.addPreference("sidebargui/settings_window_top", 65535)
30+
preferences.addPreference("sidebargui/settings_window_height", 0)
2731

2832
self._controller = Application.getInstance().getController()
2933
self._controller.activeStageChanged.connect(self._onStageChanged)

resources/qml/SidebarStageMenu.qml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,8 +315,15 @@ Item
315315
minimumWidth: UM.Theme.getSize("print_setup_widget").width
316316
maximumWidth: minimumWidth
317317
width: minimumWidth
318+
318319
minimumHeight: Math.floor(1.5 * minimumWidth)
319-
height: minimumHeight
320+
height: UM.Preferences.getValue("sidebargui/settings_window_height") != 0 ? UM.Preferences.getValue("sidebargui/settings_window_left") : minimumHeight
321+
onHeightChanged: UM.Preferences.setValue("sidebargui/settings_window_height", height)
322+
323+
x: UM.Preferences.getValue("sidebargui/settings_window_left") != 65535 ? UM.Preferences.getValue("sidebargui/settings_window_left") : undefined
324+
y: UM.Preferences.getValue("sidebargui/settings_window_top") != 65535 ? UM.Preferences.getValue("sidebargui/settings_window_top") : undefined
325+
onXChanged: UM.Preferences.setValue("sidebargui/settings_window_left", x)
326+
onYChanged: UM.Preferences.setValue("sidebargui/settings_window_top", y)
320327

321328
property string tooltipText
322329
property var tooltipPosition

0 commit comments

Comments
 (0)