1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-05-07 09:19:50 +00:00

Compare commits

...

11 Commits

Author SHA1 Message Date
5502b48089
Merge pull request #685 from glubsy/fix_result_window_action
Fix updating result window action upon creation
2020-07-28 20:05:10 -05:00
f02b66fd54
Merge pull request #682 from glubsy/details_table_tweaks
Colorize details table differences, allow moving around of rows
2020-07-28 19:33:21 -05:00
d2235f9bc9
Merge pull request #694 from glubsy/fix_matchblock_freeze
Work around frozen progress dialog
2020-07-28 18:10:24 -05:00
glubsy
5f5f9232c1 Properly wait for multiprocesses to exit
* Fix for #693
2020-07-28 16:44:06 +02:00
glubsy
63b2f95cfa Work around frozen progress dialog
* It seems that matchblock.getmatches() returns too early and the (multi-)processes become zombies
* This is a workaround which seems to work by sleeping for one second and avoid zombie processes
2020-07-25 23:37:41 +02:00
glubsy
61fc4f07ae Fix updating result window action upon creation
* Result Window action was not being properly updated
after the ResultWindow had been created.
There was no way of retrieving the window after it had been closed.
2020-07-07 16:54:08 +02:00
glubsy
c973224fa4 Fix flake8 identation warnings 2020-07-01 03:05:59 +02:00
glubsy
5cbe342d5b Ignore formatting if no data returned from model 2020-06-30 18:32:20 +02:00
glubsy
c6f5031dd8 Add color and bold font if difference in model
* Could be better optimized if there is a way to
set those variables earlier in the model or somewhere
in the viewer when it requests the data.
* Right now it compares strings(?) many times for every role
we handle, which is not ideal.
2020-06-30 04:20:27 +02:00
glubsy
eb6946343b Remove superflous top-left corner button 2020-06-30 01:19:25 +02:00
glubsy
e41a6b878c Allow moving rows around in details table
* Replaces the "Attribute" column with a horizontal header
* We ignore the first value in each row from the model and instead
populate a horizontal header with the value in order to allow
2020-06-30 01:02:56 +02:00
3 changed files with 39 additions and 8 deletions

View File

@ -254,6 +254,7 @@ def getmatches(pictures, cache_path, threshold, match_scaled=False, j=job.nulljo
ref.dimensions # pre-read dimensions for display in results
other.dimensions
result.append(get_match(ref, other, percentage))
pool.join()
return result

View File

@ -283,6 +283,7 @@ class DupeGuru(QObject):
self.resultWindow.close()
self.resultWindow.setParent(None)
self.resultWindow = ResultWindow(self.directories_dialog, self)
self.directories_dialog._updateActionsState()
self.details_dialog = self._get_details_dialog_class()(self.resultWindow, self)
def show_results_window(self):

View File

@ -8,12 +8,13 @@
from PyQt5.QtCore import Qt, QAbstractTableModel
from PyQt5.QtWidgets import QHeaderView, QTableView
from PyQt5.QtGui import QFont, QBrush, QColor
from hscommon.trans import trget
tr = trget("ui")
HEADER = [tr("Attribute"), tr("Selected"), tr("Reference")]
HEADER = [tr("Selected"), tr("Reference")]
class DetailsModel(QAbstractTableModel):
@ -27,11 +28,27 @@ class DetailsModel(QAbstractTableModel):
def data(self, index, role):
if not index.isValid():
return None
if role != Qt.DisplayRole:
return None
column = index.column()
# Skip first value "Attribute"
column = index.column() + 1
row = index.row()
return self.model.row(row)[column]
ignored_fields = ["Dupe Count"]
if (self.model.row(row)[0] in ignored_fields
or self.model.row(row)[1] == "---"
or self.model.row(row)[2] == "---"):
if role != Qt.DisplayRole:
return None
return self.model.row(row)[column]
if role == Qt.DisplayRole:
return self.model.row(row)[column]
if role == Qt.ForegroundRole and self.model.row(row)[1] != self.model.row(row)[2]:
return QBrush(QColor(250, 20, 20)) # red
if role == Qt.FontRole and self.model.row(row)[1] != self.model.row(row)[2]:
font = QFont(self.model.view.font()) # or simply QFont()
font.setBold(True)
return font
return None # QVariant()
def headerData(self, section, orientation, role):
if (
@ -40,6 +57,13 @@ class DetailsModel(QAbstractTableModel):
and section < len(HEADER)
):
return HEADER[section]
elif (
orientation == Qt.Vertical
and role == Qt.DisplayRole
and section < self.model.row_count()
):
# Read "Attribute" cell for horizontal header
return self.model.row(section)[0]
return None
def rowCount(self, parent):
@ -51,8 +75,10 @@ class DetailsTable(QTableView):
QTableView.__init__(self, *args)
self.setAlternatingRowColors(True)
self.setSelectionBehavior(QTableView.SelectRows)
self.setSelectionMode(QTableView.NoSelection)
self.setShowGrid(False)
self.setWordWrap(False)
self.setCornerButtonEnabled(False)
def setModel(self, model):
QTableView.setModel(self, model)
@ -61,9 +87,12 @@ class DetailsTable(QTableView):
hheader.setHighlightSections(False)
hheader.setStretchLastSection(False)
hheader.resizeSection(0, 100)
hheader.setSectionResizeMode(0, QHeaderView.Fixed)
hheader.setSectionResizeMode(0, QHeaderView.Stretch)
hheader.setSectionResizeMode(1, QHeaderView.Stretch)
hheader.setSectionResizeMode(2, QHeaderView.Stretch)
vheader = self.verticalHeader()
vheader.setVisible(False)
vheader.setVisible(True)
vheader.setDefaultSectionSize(18)
# hardcoded value above is not ideal, perhaps resize to contents first?
# vheader.setSectionResizeMode(QHeaderView.ResizeToContents)
vheader.setSectionResizeMode(QHeaderView.Fixed)
vheader.setSectionsMovable(True)