2010-04-12 13:29:56 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2010-04-12
|
2015-01-03 21:30:57 +00:00
|
|
|
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
2014-10-13 19:08:59 +00:00
|
|
|
#
|
2015-01-03 21:33:16 +00:00
|
|
|
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
2014-10-13 19:08:59 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2010-04-12 13:29:56 +00:00
|
|
|
|
2013-10-20 19:15:09 +00:00
|
|
|
from PyQt5.QtCore import Qt
|
2014-10-13 19:08:59 +00:00
|
|
|
from PyQt5.QtWidgets import (
|
2020-01-01 02:16:27 +00:00
|
|
|
QDialog,
|
|
|
|
QVBoxLayout,
|
|
|
|
QHBoxLayout,
|
|
|
|
QPushButton,
|
|
|
|
QSpacerItem,
|
|
|
|
QSizePolicy,
|
|
|
|
QLabel,
|
|
|
|
QTableView,
|
|
|
|
QAbstractItemView,
|
2014-10-13 19:08:59 +00:00
|
|
|
)
|
2010-04-12 13:29:56 +00:00
|
|
|
|
2022-05-09 00:22:08 +00:00
|
|
|
from qt.util import move_to_screen_center
|
2011-11-01 19:44:18 +00:00
|
|
|
from hscommon.trans import trget
|
2022-05-09 06:40:08 +00:00
|
|
|
from qt.problem_table import ProblemTable
|
2010-04-12 13:29:56 +00:00
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
tr = trget("ui")
|
|
|
|
|
2011-11-01 19:44:18 +00:00
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
class ProblemDialog(QDialog):
|
2013-10-20 19:53:59 +00:00
|
|
|
def __init__(self, parent, model, **kwargs):
|
2010-04-12 13:29:56 +00:00
|
|
|
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
2013-10-20 19:53:59 +00:00
|
|
|
super().__init__(parent, flags, **kwargs)
|
2010-04-12 13:29:56 +00:00
|
|
|
self._setupUi()
|
2012-01-16 14:29:57 +00:00
|
|
|
self.model = model
|
|
|
|
self.model.view = self
|
|
|
|
self.table = ProblemTable(self.model.problem_table, view=self.tableView)
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2010-04-12 13:29:56 +00:00
|
|
|
self.revealButton.clicked.connect(self.model.reveal_selected_dupe)
|
2010-10-04 13:29:00 +00:00
|
|
|
self.closeButton.clicked.connect(self.accept)
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2010-04-12 13:29:56 +00:00
|
|
|
def _setupUi(self):
|
2011-01-21 12:57:54 +00:00
|
|
|
self.setWindowTitle(tr("Problems!"))
|
2010-10-04 13:29:00 +00:00
|
|
|
self.resize(413, 323)
|
|
|
|
self.verticalLayout = QVBoxLayout(self)
|
|
|
|
self.label = QLabel(self)
|
2014-10-13 19:08:59 +00:00
|
|
|
msg = tr(
|
|
|
|
"There were problems processing some (or all) of the files. The cause of "
|
2011-11-04 18:37:07 +00:00
|
|
|
"these problems are described in the table below. Those files were not "
|
2014-10-13 19:08:59 +00:00
|
|
|
"removed from your results."
|
|
|
|
)
|
2011-11-04 18:37:07 +00:00
|
|
|
self.label.setText(msg)
|
2010-10-04 13:29:00 +00:00
|
|
|
self.label.setWordWrap(True)
|
|
|
|
self.verticalLayout.addWidget(self.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)
|
2011-01-21 12:57:54 +00:00
|
|
|
self.revealButton.setText(tr("Reveal Selected"))
|
2010-10-04 13:29:00 +00:00
|
|
|
self.horizontalLayout.addWidget(self.revealButton)
|
2021-08-24 05:12:23 +00:00
|
|
|
spacer_item = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
|
|
self.horizontalLayout.addItem(spacer_item)
|
2010-10-04 13:29:00 +00:00
|
|
|
self.closeButton = QPushButton(self)
|
2011-01-21 12:57:54 +00:00
|
|
|
self.closeButton.setText(tr("Close"))
|
2010-10-04 13:29:00 +00:00
|
|
|
self.closeButton.setDefault(True)
|
|
|
|
self.horizontalLayout.addWidget(self.closeButton)
|
|
|
|
self.verticalLayout.addLayout(self.horizontalLayout)
|
2021-08-28 04:26:19 +00:00
|
|
|
|
|
|
|
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)
|