1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-03-13 12:01:38 +00:00

Initial work on #653

- Update both qt/directories_dialog.py and qt/result_window.py to have
the same resizing on out of bounds.
- Update moveToScreenCenter to do most of the checks needed
- Add additional preference to help track maximized position of
results window
This commit is contained in:
2020-05-13 23:07:14 -05:00
parent debf309a9a
commit fa87f76298
4 changed files with 39 additions and 23 deletions

View File

@@ -15,9 +15,8 @@ import logging
from hscommon.util import first
from PyQt5.QtCore import QStandardPaths
from PyQt5.QtGui import QPixmap, QIcon
from PyQt5.QtGui import QPixmap, QIcon, QGuiApplication
from PyQt5.QtWidgets import (
QDesktopWidget,
QSpacerItem,
QSizePolicy,
QAction,
@@ -27,8 +26,21 @@ from PyQt5.QtWidgets import (
def moveToScreenCenter(widget):
frame = widget.frameGeometry()
frame.moveCenter(QDesktopWidget().availableGeometry().center())
widget.move(frame.topLeft())
if QGuiApplication.screenAt(frame.center()) is None:
# if center not on any screen use default screen
screen = QGuiApplication.screens[0].availableGeometry()
else:
screen = QGuiApplication.screenAt(frame.center()).availableGeometry()
# moves to center of screen if partially off screen
if screen.contains(frame) is False:
# make sure the frame is not larger than screen
# resize does not seem to take frame size into account (move does)
widget.resize(
frame.size().boundedTo(screen.size() - (frame.size() - widget.size()))
)
frame = widget.frameGeometry()
frame.moveCenter(screen.center())
widget.move(frame.topLeft())
def verticalSpacer(size=None):