2012-03-14 16:47:21 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2012-03-13
|
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
|
2012-03-14 16:47:21 +00:00
|
|
|
|
2013-10-20 19:15:09 +00:00
|
|
|
from PyQt5.QtCore import Qt
|
2020-01-01 02:16:27 +00:00
|
|
|
from PyQt5.QtWidgets import (
|
|
|
|
QDialog,
|
|
|
|
QVBoxLayout,
|
|
|
|
QPushButton,
|
|
|
|
QTableView,
|
|
|
|
QAbstractItemView,
|
|
|
|
)
|
2012-03-14 16:47:21 +00:00
|
|
|
|
|
|
|
from hscommon.trans import trget
|
2022-05-09 00:22:08 +00:00
|
|
|
from qt.util import horizontal_wrap
|
2012-03-14 16:47:21 +00:00
|
|
|
from .ignore_list_table import IgnoreListTable
|
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
tr = trget("ui")
|
|
|
|
|
2012-03-14 16:47:21 +00:00
|
|
|
|
|
|
|
class IgnoreListDialog(QDialog):
|
2013-10-20 19:53:59 +00:00
|
|
|
def __init__(self, parent, model, **kwargs):
|
2012-03-14 16:47:21 +00:00
|
|
|
flags = Qt.CustomizeWindowHint | Qt.WindowTitleHint | Qt.WindowSystemMenuHint
|
2013-10-20 19:53:59 +00:00
|
|
|
super().__init__(parent, flags, **kwargs)
|
2020-07-12 14:58:01 +00:00
|
|
|
self.specific_actions = frozenset()
|
2012-03-14 16:47:21 +00:00
|
|
|
self._setupUi()
|
|
|
|
self.model = model
|
|
|
|
self.model.view = self
|
|
|
|
self.table = IgnoreListTable(self.model.ignore_list_table, view=self.tableView)
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2012-03-14 16:47:21 +00:00
|
|
|
self.removeSelectedButton.clicked.connect(self.model.remove_selected)
|
|
|
|
self.clearButton.clicked.connect(self.model.clear)
|
2012-03-15 18:23:38 +00:00
|
|
|
self.closeButton.clicked.connect(self.accept)
|
2014-10-13 19:08:59 +00:00
|
|
|
|
2012-03-14 16:47:21 +00:00
|
|
|
def _setupUi(self):
|
|
|
|
self.setWindowTitle(tr("Ignore List"))
|
|
|
|
self.resize(540, 330)
|
|
|
|
self.verticalLayout = QVBoxLayout(self)
|
2020-07-12 14:58:01 +00:00
|
|
|
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
2012-03-14 16:47:21 +00:00
|
|
|
self.tableView = QTableView()
|
|
|
|
self.tableView.setEditTriggers(QAbstractItemView.NoEditTriggers)
|
|
|
|
self.tableView.setSelectionMode(QAbstractItemView.ExtendedSelection)
|
|
|
|
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.tableView.verticalHeader().setVisible(False)
|
2020-07-12 14:17:18 +00:00
|
|
|
self.tableView.setWordWrap(False)
|
2012-03-14 16:47:21 +00:00
|
|
|
self.verticalLayout.addWidget(self.tableView)
|
|
|
|
self.removeSelectedButton = QPushButton(tr("Remove Selected"))
|
|
|
|
self.clearButton = QPushButton(tr("Clear"))
|
2012-03-15 18:23:38 +00:00
|
|
|
self.closeButton = QPushButton(tr("Close"))
|
2014-10-13 19:08:59 +00:00
|
|
|
self.verticalLayout.addLayout(
|
2021-08-24 05:12:23 +00:00
|
|
|
horizontal_wrap([self.removeSelectedButton, self.clearButton, None, self.closeButton])
|
2014-10-13 19:08:59 +00:00
|
|
|
)
|
|
|
|
|
2020-01-01 02:16:27 +00:00
|
|
|
# --- model --> view
|
2012-03-14 16:47:21 +00:00
|
|
|
def show(self):
|
2013-10-20 19:53:59 +00:00
|
|
|
super().show()
|