mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-05-08 01:39:50 +00:00
More updates for pyqt6
This commit is contained in:
parent
66e69a3854
commit
4d56bd3515
@ -1,5 +1,5 @@
|
|||||||
from typing import Tuple, List, Union
|
from typing import Tuple, List, Union
|
||||||
from PyQt5.QtGui import QImage
|
from PyQt6.QtGui import QImage
|
||||||
|
|
||||||
_block = Tuple[int, int, int]
|
_block = Tuple[int, int, int]
|
||||||
|
|
||||||
|
@ -6,8 +6,9 @@
|
|||||||
# 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 Qt
|
from PyQt6.QtCore import Qt
|
||||||
from PyQt5.QtWidgets import (
|
from PyQt6.QtGui import QShowEvent
|
||||||
|
from PyQt6.QtWidgets import (
|
||||||
QDialog,
|
QDialog,
|
||||||
QVBoxLayout,
|
QVBoxLayout,
|
||||||
QHBoxLayout,
|
QHBoxLayout,
|
||||||
@ -17,8 +18,10 @@ from PyQt5.QtWidgets import (
|
|||||||
QLabel,
|
QLabel,
|
||||||
QTableView,
|
QTableView,
|
||||||
QAbstractItemView,
|
QAbstractItemView,
|
||||||
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from core.gui.problem_dialog import ProblemDialog as ProblemDiaglogModel
|
||||||
from qt.util import move_to_screen_center
|
from qt.util import move_to_screen_center
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
from qt.problem_table import ProblemTable
|
from qt.problem_table import ProblemTable
|
||||||
@ -27,52 +30,56 @@ tr = trget("ui")
|
|||||||
|
|
||||||
|
|
||||||
class ProblemDialog(QDialog):
|
class ProblemDialog(QDialog):
|
||||||
def __init__(self, parent, model, **kwargs):
|
def __init__(self, parent: QWidget, model: ProblemDiaglogModel, **kwargs) -> None:
|
||||||
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
flags = Qt.WindowType.CustomizeWindowHint | Qt.WindowType.WindowTitleHint | Qt.WindowType.WindowSystemMenuHint
|
||||||
super().__init__(parent, flags, **kwargs)
|
super().__init__(parent, flags, **kwargs)
|
||||||
self._setupUi()
|
|
||||||
self.model = model
|
self.model = model
|
||||||
self.model.view = self
|
self.table_view = QTableView(self)
|
||||||
self.table = ProblemTable(self.model.problem_table, view=self.tableView)
|
self.table = ProblemTable(self.model.problem_table, view=self.table_view)
|
||||||
|
self._setupUi()
|
||||||
|
|
||||||
self.revealButton.clicked.connect(self.model.reveal_selected_dupe)
|
def _setupUi(self) -> None:
|
||||||
self.closeButton.clicked.connect(self.accept)
|
|
||||||
|
|
||||||
def _setupUi(self):
|
|
||||||
self.setWindowTitle(tr("Problems!"))
|
self.setWindowTitle(tr("Problems!"))
|
||||||
self.resize(413, 323)
|
self.resize(413, 323)
|
||||||
self.verticalLayout = QVBoxLayout(self)
|
main_layout = QVBoxLayout(self)
|
||||||
self.label = QLabel(self)
|
notice_label = QLabel(self)
|
||||||
msg = tr(
|
msg = tr(
|
||||||
"There were problems processing some (or all) of the files. The cause of "
|
"There were problems processing some (or all) of the files. The cause of "
|
||||||
"these problems are described in the table below. Those files were not "
|
"these problems are described in the table below. Those files were not "
|
||||||
"removed from your results."
|
"removed from your results."
|
||||||
)
|
)
|
||||||
self.label.setText(msg)
|
notice_label.setText(msg)
|
||||||
self.label.setWordWrap(True)
|
notice_label.setWordWrap(True)
|
||||||
self.verticalLayout.addWidget(self.label)
|
main_layout.addWidget(notice_label)
|
||||||
self.tableView = QTableView(self)
|
|
||||||
self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
|
|
||||||
self.tableView.setSelectionMode(QAbstractItemView.SingleSelection)
|
|
||||||
self.tableView.setSelectionBehavior(QAbstractItemView.SelectRows)
|
|
||||||
self.tableView.setShowGrid(False)
|
|
||||||
self.tableView.horizontalHeader().setStretchLastSection(True)
|
|
||||||
self.tableView.verticalHeader().setDefaultSectionSize(18)
|
|
||||||
self.tableView.verticalHeader().setHighlightSections(False)
|
|
||||||
self.verticalLayout.addWidget(self.tableView)
|
|
||||||
self.horizontalLayout = QHBoxLayout()
|
|
||||||
self.revealButton = QPushButton(self)
|
|
||||||
self.revealButton.setText(tr("Reveal Selected"))
|
|
||||||
self.horizontalLayout.addWidget(self.revealButton)
|
|
||||||
spacer_item = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
||||||
self.horizontalLayout.addItem(spacer_item)
|
|
||||||
self.closeButton = QPushButton(self)
|
|
||||||
self.closeButton.setText(tr("Close"))
|
|
||||||
self.closeButton.setDefault(True)
|
|
||||||
self.horizontalLayout.addWidget(self.closeButton)
|
|
||||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
|
||||||
|
|
||||||
def showEvent(self, event):
|
self.table_view.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
|
||||||
|
self.table_view.setSelectionMode(QAbstractItemView.SelectionMode.SingleSelection)
|
||||||
|
self.table_view.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
|
||||||
|
self.table_view.setShowGrid(False)
|
||||||
|
self.table_view.horizontalHeader().setStretchLastSection(True)
|
||||||
|
self.table_view.verticalHeader().setDefaultSectionSize(18)
|
||||||
|
self.table_view.verticalHeader().setHighlightSections(False)
|
||||||
|
main_layout.addWidget(self.table_view)
|
||||||
|
|
||||||
|
button_layout = QHBoxLayout()
|
||||||
|
reveal_button = QPushButton(self)
|
||||||
|
reveal_button.setText(tr("Reveal Selected"))
|
||||||
|
button_layout.addWidget(reveal_button)
|
||||||
|
|
||||||
|
spacer_item = QSpacerItem(40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum)
|
||||||
|
button_layout.addItem(spacer_item)
|
||||||
|
|
||||||
|
close_button = QPushButton(self)
|
||||||
|
close_button.setText(tr("Close"))
|
||||||
|
close_button.setDefault(True)
|
||||||
|
button_layout.addWidget(close_button)
|
||||||
|
|
||||||
|
main_layout.addLayout(button_layout)
|
||||||
|
|
||||||
|
reveal_button.clicked.connect(self.model.reveal_selected_dupe)
|
||||||
|
close_button.clicked.connect(self.accept)
|
||||||
|
|
||||||
|
def showEvent(self, event: QShowEvent) -> None:
|
||||||
# have to do this here as the frameGeometry is not correct until shown
|
# have to do this here as the frameGeometry is not correct until shown
|
||||||
move_to_screen_center(self)
|
move_to_screen_center(self)
|
||||||
super().showEvent(event)
|
super().showEvent(event)
|
||||||
|
8
run.py
8
run.py
@ -9,9 +9,9 @@ import sys
|
|||||||
import os.path as op
|
import os.path as op
|
||||||
import gc
|
import gc
|
||||||
|
|
||||||
from PyQt5.QtCore import QCoreApplication
|
from PyQt6.QtCore import QCoreApplication
|
||||||
from PyQt5.QtGui import QIcon, QPixmap
|
from PyQt6.QtGui import QIcon, QPixmap
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt6.QtWidgets import QApplication
|
||||||
|
|
||||||
from hscommon.trans import install_gettext_trans_under_qt
|
from hscommon.trans import install_gettext_trans_under_qt
|
||||||
from qt.error_report_dialog import install_excepthook
|
from qt.error_report_dialog import install_excepthook
|
||||||
@ -61,7 +61,7 @@ def main():
|
|||||||
# Let the Python interpreter runs every 500ms to handle signals. This is
|
# Let the Python interpreter runs every 500ms to handle signals. This is
|
||||||
# required because Python cannot handle signals while the Qt event loop is
|
# required because Python cannot handle signals while the Qt event loop is
|
||||||
# running.
|
# running.
|
||||||
from PyQt5.QtCore import QTimer
|
from PyQt6.QtCore import QTimer
|
||||||
|
|
||||||
timer = QTimer()
|
timer = QTimer()
|
||||||
timer.start(500)
|
timer.start(500)
|
||||||
|
@ -32,15 +32,15 @@ install_requires =
|
|||||||
Send2Trash>=1.3.0
|
Send2Trash>=1.3.0
|
||||||
mutagen>=1.45.1
|
mutagen>=1.45.1
|
||||||
distro>=1.5.0
|
distro>=1.5.0
|
||||||
PyQt5 >=5.14.1,<6.0; sys_platform != 'linux'
|
PyQt6 >=6.3.0,<7.0; sys_platform != 'linux'
|
||||||
pywin32>=228; sys_platform == 'win32'
|
pywin32>=228; sys_platform == 'win32'
|
||||||
semantic-version>=2.0.0,<3.0.0
|
semantic-version>=2.0.0,<3.0.0
|
||||||
xxhash>=3.0.0,<4.0.0
|
xxhash>=3.0.0,<4.0.0
|
||||||
setup_requires =
|
setup_requires =
|
||||||
sphinx>=3.0.0
|
sphinx>=5.0.0
|
||||||
polib>=1.1.0
|
polib>=1.1.0
|
||||||
tests_require =
|
tests_require =
|
||||||
pytest >=6,<7
|
pytest >=7,<8
|
||||||
include_package_data = true
|
include_package_data = true
|
||||||
|
|
||||||
[options.entry_points]
|
[options.entry_points]
|
||||||
|
@ -245,7 +245,7 @@ Section "Uninstall"
|
|||||||
; Remove Files & Folders in Install Folder
|
; Remove Files & Folders in Install Folder
|
||||||
RMDir /r "$INSTDIR\core"
|
RMDir /r "$INSTDIR\core"
|
||||||
RMDir /r "$INSTDIR\help"
|
RMDir /r "$INSTDIR\help"
|
||||||
RMDir /r "$INSTDIR\PyQt5"
|
RMDir /r "$INSTDIR\PyQt6"
|
||||||
RMDir /r "$INSTDIR\qt"
|
RMDir /r "$INSTDIR\qt"
|
||||||
RMDir /r "$INSTDIR\locale"
|
RMDir /r "$INSTDIR\locale"
|
||||||
Delete "$INSTDIR\*.exe"
|
Delete "$INSTDIR\*.exe"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user