summaryrefslogtreecommitdiff
path: root/plugins/motion_capture
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/motion_capture')
-rw-r--r--plugins/motion_capture/plugin.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/plugins/motion_capture/plugin.py b/plugins/motion_capture/plugin.py
index e5d37c7..1c655c5 100644
--- a/plugins/motion_capture/plugin.py
+++ b/plugins/motion_capture/plugin.py
@@ -166,9 +166,16 @@ class MotionCapturePlugin(LabPlugin):
self._win.set_px_per_mm(state.get("px_per_mm", 10.0))
if checked:
- geo = self._ctx.main_window.geometry()
if not self._win.isVisible():
- self._win.move(geo.right() + 8, geo.top() + 40)
+ from PyQt6.QtWidgets import QApplication
+ mw = self._ctx.main_window
+ screen = QApplication.screenAt(mw.geometry().center()) or QApplication.primaryScreen()
+ avail = screen.availableGeometry()
+ geo = mw.normalGeometry()
+ self._win.adjustSize()
+ x = max(avail.left(), min(geo.right() + 8, avail.right() - self._win.width()))
+ y = max(avail.top(), min(geo.top() + 40, avail.bottom() - self._win.height()))
+ self._win.move(x, y)
self._win.show()
self._win.raise_()
else: