mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 17:59:50 +00:00
Compare commits
3 Commits
3045361243
...
b0baa5bfd6
Author | SHA1 | Date | |
---|---|---|---|
b0baa5bfd6 | |||
22996ee914 | |||
|
31ec9c667f |
@ -9,6 +9,7 @@
|
|||||||
from PyQt5.QtCore import Qt
|
from PyQt5.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import QDockWidget, QWidget
|
from PyQt5.QtWidgets import QDockWidget, QWidget
|
||||||
|
|
||||||
|
from qtlib.util import move_to_screen_center
|
||||||
from .details_table import DetailsModel
|
from .details_table import DetailsModel
|
||||||
from hscommon.plat import ISLINUX
|
from hscommon.plat import ISLINUX
|
||||||
|
|
||||||
@ -73,3 +74,9 @@ class DetailsDialog(QDockWidget):
|
|||||||
def refresh(self):
|
def refresh(self):
|
||||||
self.tableModel.beginResetModel()
|
self.tableModel.beginResetModel()
|
||||||
self.tableModel.endResetModel()
|
self.tableModel.endResetModel()
|
||||||
|
|
||||||
|
def showEvent(self, event):
|
||||||
|
if self._wasDocked is False:
|
||||||
|
# have to do this here as the frameGeometry is not correct until shown
|
||||||
|
move_to_screen_center(self)
|
||||||
|
super().showEvent(event)
|
||||||
|
@ -32,7 +32,7 @@ from PyQt5.QtGui import QPixmap, QIcon
|
|||||||
|
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
from hscommon.plat import ISLINUX
|
from hscommon.plat import ISLINUX
|
||||||
from qtlib.util import horizontal_wrap
|
from qtlib.util import horizontal_wrap, move_to_screen_center
|
||||||
from qtlib.preferences import get_langnames
|
from qtlib.preferences import get_langnames
|
||||||
from enum import Flag, auto
|
from enum import Flag, auto
|
||||||
|
|
||||||
@ -369,6 +369,11 @@ use the modifier key to drag the floating window around"
|
|||||||
section_to_update = Sections.DISPLAY
|
section_to_update = Sections.DISPLAY
|
||||||
self.resetToDefaults(section_to_update)
|
self.resetToDefaults(section_to_update)
|
||||||
|
|
||||||
|
def showEvent(self, event):
|
||||||
|
# have to do this here as the frameGeometry is not correct until shown
|
||||||
|
move_to_screen_center(self)
|
||||||
|
super().showEvent(event)
|
||||||
|
|
||||||
|
|
||||||
class ColorPickerButton(QPushButton):
|
class ColorPickerButton(QPushButton):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
|
@ -19,6 +19,7 @@ from PyQt5.QtWidgets import (
|
|||||||
QAbstractItemView,
|
QAbstractItemView,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from qtlib.util import move_to_screen_center
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
from .problem_table import ProblemTable
|
from .problem_table import ProblemTable
|
||||||
|
|
||||||
@ -70,3 +71,8 @@ class ProblemDialog(QDialog):
|
|||||||
self.closeButton.setDefault(True)
|
self.closeButton.setDefault(True)
|
||||||
self.horizontalLayout.addWidget(self.closeButton)
|
self.horizontalLayout.addWidget(self.closeButton)
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||||
|
|
||||||
|
def showEvent(self, event):
|
||||||
|
# have to do this here as the frameGeometry is not correct until shown
|
||||||
|
move_to_screen_center(self)
|
||||||
|
super().showEvent(event)
|
||||||
|
@ -55,7 +55,7 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
size_policy.setVerticalStretch(0)
|
size_policy.setVerticalStretch(0)
|
||||||
size_policy.setHeightForWidth(self.sizeThresholdSpinBox.sizePolicy().hasHeightForWidth())
|
size_policy.setHeightForWidth(self.sizeThresholdSpinBox.sizePolicy().hasHeightForWidth())
|
||||||
self.sizeThresholdSpinBox.setSizePolicy(size_policy)
|
self.sizeThresholdSpinBox.setSizePolicy(size_policy)
|
||||||
self.sizeThresholdSpinBox.setMaximumSize(QSize(100, 16777215))
|
self.sizeThresholdSpinBox.setMaximumSize(QSize(300, 16777215))
|
||||||
self.sizeThresholdSpinBox.setRange(0, 1000000)
|
self.sizeThresholdSpinBox.setRange(0, 1000000)
|
||||||
self.horizontalLayout_2.addWidget(self.sizeThresholdSpinBox)
|
self.horizontalLayout_2.addWidget(self.sizeThresholdSpinBox)
|
||||||
self.label_6 = QLabel(self.widget)
|
self.label_6 = QLabel(self.widget)
|
||||||
@ -70,7 +70,7 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
self.sizeSaturationSpinBox = QSpinBox(self.widget)
|
self.sizeSaturationSpinBox = QSpinBox(self.widget)
|
||||||
size_policy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
|
size_policy = QSizePolicy(QSizePolicy.Maximum, QSizePolicy.Fixed)
|
||||||
self.sizeSaturationSpinBox.setSizePolicy(size_policy)
|
self.sizeSaturationSpinBox.setSizePolicy(size_policy)
|
||||||
self.sizeSaturationSpinBox.setMaximumSize(QSize(100, 16777215))
|
self.sizeSaturationSpinBox.setMaximumSize(QSize(300, 16777215))
|
||||||
self.sizeSaturationSpinBox.setRange(0, 1000000)
|
self.sizeSaturationSpinBox.setRange(0, 1000000)
|
||||||
self.horizontalLayout_2a.addWidget(self.sizeSaturationSpinBox)
|
self.horizontalLayout_2a.addWidget(self.sizeSaturationSpinBox)
|
||||||
self.label_6a = QLabel(self.widget)
|
self.label_6a = QLabel(self.widget)
|
||||||
@ -88,7 +88,7 @@ class PreferencesDialog(PreferencesDialogBase):
|
|||||||
self.horizontalLayout_2b.addWidget(self.bigFilePartialHashesBox)
|
self.horizontalLayout_2b.addWidget(self.bigFilePartialHashesBox)
|
||||||
self.bigSizeThresholdSpinBox = QSpinBox(self.widget)
|
self.bigSizeThresholdSpinBox = QSpinBox(self.widget)
|
||||||
self.bigSizeThresholdSpinBox.setSizePolicy(size_policy)
|
self.bigSizeThresholdSpinBox.setSizePolicy(size_policy)
|
||||||
self.bigSizeThresholdSpinBox.setMaximumSize(QSize(100, 16777215))
|
self.bigSizeThresholdSpinBox.setMaximumSize(QSize(300, 16777215))
|
||||||
self.bigSizeThresholdSpinBox.setRange(0, 1000000)
|
self.bigSizeThresholdSpinBox.setRange(0, 1000000)
|
||||||
self.horizontalLayout_2b.addWidget(self.bigSizeThresholdSpinBox)
|
self.horizontalLayout_2b.addWidget(self.bigSizeThresholdSpinBox)
|
||||||
self.label_6b = QLabel(self.widget)
|
self.label_6b = QLabel(self.widget)
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
# which should be included with this package. The terms are also available at
|
# which should be included with this package. The terms are also available at
|
||||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
from PyQt5.QtCore import QRect, pyqtSlot, Qt
|
from PyQt5.QtCore import QRect, pyqtSlot, Qt, QEvent
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QWidget,
|
QWidget,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
@ -77,8 +77,8 @@ class TabWindow(QMainWindow):
|
|||||||
def restoreGeometry(self):
|
def restoreGeometry(self):
|
||||||
if self.app.prefs.mainWindowRect is not None:
|
if self.app.prefs.mainWindowRect is not None:
|
||||||
self.setGeometry(self.app.prefs.mainWindowRect)
|
self.setGeometry(self.app.prefs.mainWindowRect)
|
||||||
else:
|
if self.app.prefs.mainWindowIsMaximized:
|
||||||
move_to_screen_center(self)
|
self.showMaximized()
|
||||||
|
|
||||||
def _setupMenu(self):
|
def _setupMenu(self):
|
||||||
"""Setup the menubar boiler plates which will be filled by the underlying
|
"""Setup the menubar boiler plates which will be filled by the underlying
|
||||||
@ -211,8 +211,20 @@ class TabWindow(QMainWindow):
|
|||||||
# QTabWidget will assign its geometry after restoring it
|
# QTabWidget will assign its geometry after restoring it
|
||||||
prefs = self.app.prefs
|
prefs = self.app.prefs
|
||||||
prefs.mainWindowIsMaximized = self.isMaximized()
|
prefs.mainWindowIsMaximized = self.isMaximized()
|
||||||
|
if not self.isMaximized():
|
||||||
prefs.mainWindowRect = self.geometry()
|
prefs.mainWindowRect = self.geometry()
|
||||||
|
|
||||||
|
def showEvent(self, event):
|
||||||
|
if not self.isMaximized():
|
||||||
|
# have to do this here as the frameGeometry is not correct until shown
|
||||||
|
move_to_screen_center(self)
|
||||||
|
super().showEvent(event)
|
||||||
|
|
||||||
|
def changeEvent(self, event):
|
||||||
|
if event.type() == QEvent.Type.WindowStateChange and not self.isMaximized():
|
||||||
|
move_to_screen_center(self)
|
||||||
|
super().changeEvent(event)
|
||||||
|
|
||||||
def closeEvent(self, close_event):
|
def closeEvent(self, close_event):
|
||||||
# Force closing of our tabbed widgets in reverse order so that the
|
# Force closing of our tabbed widgets in reverse order so that the
|
||||||
# directories dialog (which usually is at index 0) will be called last
|
# directories dialog (which usually is at index 0) will be called last
|
||||||
|
@ -18,6 +18,7 @@ from PyQt5.QtWidgets import (
|
|||||||
QApplication,
|
QApplication,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from qtlib.util import move_to_screen_center
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
|
|
||||||
tr = trget("qtlib")
|
tr = trget("qtlib")
|
||||||
@ -71,6 +72,11 @@ class AboutBox(QDialog):
|
|||||||
self.verticalLayout.addWidget(self.buttonBox)
|
self.verticalLayout.addWidget(self.buttonBox)
|
||||||
self.horizontalLayout.addLayout(self.verticalLayout)
|
self.horizontalLayout.addLayout(self.verticalLayout)
|
||||||
|
|
||||||
|
def showEvent(self, event):
|
||||||
|
# have to do this here as the frameGeometry is not correct until shown
|
||||||
|
move_to_screen_center(self)
|
||||||
|
super().showEvent(event)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
import sys
|
import sys
|
||||||
|
@ -16,9 +16,8 @@ from core.util import executable_folder
|
|||||||
from hscommon.util import first
|
from hscommon.util import first
|
||||||
|
|
||||||
from PyQt5.QtCore import QStandardPaths
|
from PyQt5.QtCore import QStandardPaths
|
||||||
from PyQt5.QtGui import QPixmap, QIcon
|
from PyQt5.QtGui import QPixmap, QIcon, QGuiApplication
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt5.QtWidgets import (
|
||||||
QDesktopWidget,
|
|
||||||
QSpacerItem,
|
QSpacerItem,
|
||||||
QSizePolicy,
|
QSizePolicy,
|
||||||
QAction,
|
QAction,
|
||||||
@ -28,7 +27,18 @@ from PyQt5.QtWidgets import (
|
|||||||
|
|
||||||
def move_to_screen_center(widget):
|
def move_to_screen_center(widget):
|
||||||
frame = widget.frameGeometry()
|
frame = widget.frameGeometry()
|
||||||
frame.moveCenter(QDesktopWidget().availableGeometry().center())
|
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())
|
widget.move(frame.topLeft())
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user