mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Format files with black
- Format all files with black - Update tox.ini flake8 arguments to be compatible - Add black to requirements-extra.txt - Reduce ignored flake8 rules and fix a few violations
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
# Created By: Virgil Dupras
|
||||
# Created On: 2009-05-17
|
||||
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
||||
#
|
||||
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
#
|
||||
# This software is licensed under the "GPLv3" License as described in the "LICENSE" file,
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.gnu.org/licenses/gpl-3.0.html
|
||||
|
||||
from PyQt5.QtCore import Qt, QAbstractTableModel
|
||||
@@ -11,18 +11,19 @@ from PyQt5.QtWidgets import QHeaderView, QTableView
|
||||
|
||||
from hscommon.trans import trget
|
||||
|
||||
tr = trget('ui')
|
||||
tr = trget("ui")
|
||||
|
||||
HEADER = [tr("Attribute"), tr("Selected"), tr("Reference")]
|
||||
|
||||
|
||||
class DetailsModel(QAbstractTableModel):
|
||||
def __init__(self, model, **kwargs):
|
||||
super().__init__(**kwargs)
|
||||
self.model = model
|
||||
|
||||
|
||||
def columnCount(self, parent):
|
||||
return len(HEADER)
|
||||
|
||||
|
||||
def data(self, index, role):
|
||||
if not index.isValid():
|
||||
return None
|
||||
@@ -31,15 +32,19 @@ class DetailsModel(QAbstractTableModel):
|
||||
column = index.column()
|
||||
row = index.row()
|
||||
return self.model.row(row)[column]
|
||||
|
||||
|
||||
def headerData(self, section, orientation, role):
|
||||
if orientation == Qt.Horizontal and role == Qt.DisplayRole and section < len(HEADER):
|
||||
if (
|
||||
orientation == Qt.Horizontal
|
||||
and role == Qt.DisplayRole
|
||||
and section < len(HEADER)
|
||||
):
|
||||
return HEADER[section]
|
||||
return None
|
||||
|
||||
|
||||
def rowCount(self, parent):
|
||||
return self.model.row_count()
|
||||
|
||||
|
||||
|
||||
class DetailsTable(QTableView):
|
||||
def __init__(self, *args):
|
||||
@@ -47,7 +52,7 @@ class DetailsTable(QTableView):
|
||||
self.setAlternatingRowColors(True)
|
||||
self.setSelectionBehavior(QTableView.SelectRows)
|
||||
self.setShowGrid(False)
|
||||
|
||||
|
||||
def setModel(self, model):
|
||||
QTableView.setModel(self, model)
|
||||
# The model needs to be set to set header stuff
|
||||
@@ -61,4 +66,3 @@ class DetailsTable(QTableView):
|
||||
vheader = self.verticalHeader()
|
||||
vheader.setVisible(False)
|
||||
vheader.setDefaultSectionSize(18)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user