2010-04-12 13:29:56 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2010-04-12
|
2011-04-12 08:04:01 +00:00
|
|
|
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
2010-04-12 13:29:56 +00:00
|
|
|
#
|
2010-09-30 10:17:41 +00:00
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2010-04-12 13:29:56 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
2010-04-12 13:29:56 +00:00
|
|
|
|
|
|
|
from PyQt4.QtCore import Qt
|
2010-10-04 13:29:00 +00:00
|
|
|
from PyQt4.QtGui import (QDialog, QVBoxLayout, QHBoxLayout, QPushButton, QSpacerItem, QSizePolicy,
|
|
|
|
QLabel, QTableView, QAbstractItemView, QApplication)
|
2010-04-12 13:29:56 +00:00
|
|
|
|
2011-11-01 19:44:18 +00:00
|
|
|
from hscommon.trans import trget
|
2010-04-12 13:29:56 +00:00
|
|
|
from .problem_table import ProblemTable
|
|
|
|
|
2011-11-01 19:44:18 +00:00
|
|
|
tr = trget('ui')
|
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
class ProblemDialog(QDialog):
|
2012-01-16 14:29:57 +00:00
|
|
|
def __init__(self, parent, model):
|
2010-04-12 13:29:56 +00:00
|
|
|
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
|
|
|
QDialog.__init__(self, parent, flags)
|
|
|
|
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)
|
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)
|
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)
|
2011-11-04 18:37:07 +00:00
|
|
|
msg = tr("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 "
|
|
|
|
"removed from your results.")
|
|
|
|
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)
|
|
|
|
spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum)
|
|
|
|
self.horizontalLayout.addItem(spacerItem)
|
|
|
|
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)
|
2010-04-12 13:29:56 +00:00
|
|
|
|
2010-10-04 13:29:00 +00:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
import sys
|
|
|
|
from ..testapp import TestApp
|
|
|
|
app = QApplication([])
|
|
|
|
dgapp = TestApp()
|
|
|
|
dialog = ProblemDialog(None, dgapp)
|
|
|
|
dialog.show()
|
|
|
|
sys.exit(app.exec_())
|