mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Merge branch 'master' into details_dialog_improvements
This commit is contained in:
commit
7dc9f25b06
@ -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
|
ref.dimensions # pre-read dimensions for display in results
|
||||||
other.dimensions
|
other.dimensions
|
||||||
result.append(get_match(ref, other, percentage))
|
result.append(get_match(ref, other, percentage))
|
||||||
|
pool.join()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
13
package.py
13
package.py
@ -43,6 +43,15 @@ def copy_files_to_package(destpath, packages, with_so):
|
|||||||
shutil.copy("run.py", op.join(destpath, "run.py"))
|
shutil.copy("run.py", op.join(destpath, "run.py"))
|
||||||
extra_ignores = ["*.so"] if not with_so else None
|
extra_ignores = ["*.so"] if not with_so else None
|
||||||
copy_packages(packages, destpath, extra_ignores=extra_ignores)
|
copy_packages(packages, destpath, extra_ignores=extra_ignores)
|
||||||
|
# include locale files if they are built otherwise exit as it will break
|
||||||
|
# the localization
|
||||||
|
if not op.exists("build/locale"):
|
||||||
|
print("Locale files are missing. Have you run \"build.py --loc\"? Exiting...")
|
||||||
|
return
|
||||||
|
# include help files if they are built otherwise exit as they should be included?
|
||||||
|
if not op.exists("build/help"):
|
||||||
|
print("Help files are missing. Have you run \"build.py --doc\"? Exiting...")
|
||||||
|
return
|
||||||
shutil.copytree(op.join("build", "help"), op.join(destpath, "help"))
|
shutil.copytree(op.join("build", "help"), op.join(destpath, "help"))
|
||||||
shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale"))
|
shutil.copytree(op.join("build", "locale"), op.join(destpath, "locale"))
|
||||||
compileall.compile_dir(destpath)
|
compileall.compile_dir(destpath)
|
||||||
@ -152,11 +161,11 @@ def package_windows():
|
|||||||
# include locale files if they are built otherwise exit as it will break
|
# include locale files if they are built otherwise exit as it will break
|
||||||
# the localization
|
# the localization
|
||||||
if not op.exists("build/locale"):
|
if not op.exists("build/locale"):
|
||||||
print("Locale files not built, exiting...")
|
print("Locale files are missing. Have you run \"build.py --loc\"? Exiting...")
|
||||||
return
|
return
|
||||||
# include help files if they are built otherwise exit as they should be included?
|
# include help files if they are built otherwise exit as they should be included?
|
||||||
if not op.exists("build/help"):
|
if not op.exists("build/help"):
|
||||||
print("Help files not built, exiting...")
|
print("Help files are missing. Have you run \"build.py --doc\"? Exiting...")
|
||||||
return
|
return
|
||||||
# create version information file from template
|
# create version information file from template
|
||||||
try:
|
try:
|
||||||
|
@ -286,6 +286,7 @@ class DupeGuru(QObject):
|
|||||||
self.resultWindow.close()
|
self.resultWindow.close()
|
||||||
self.resultWindow.setParent(None)
|
self.resultWindow.setParent(None)
|
||||||
self.resultWindow = ResultWindow(self.directories_dialog, self)
|
self.resultWindow = ResultWindow(self.directories_dialog, self)
|
||||||
|
self.directories_dialog._updateActionsState()
|
||||||
self.details_dialog = self._get_details_dialog_class()(self.resultWindow, self)
|
self.details_dialog = self._get_details_dialog_class()(self.resultWindow, self)
|
||||||
self.resultWindow.addDockWidget(
|
self.resultWindow.addDockWidget(
|
||||||
Qt.BottomDockWidgetArea, self.details_dialog)
|
Qt.BottomDockWidgetArea, self.details_dialog)
|
||||||
|
@ -8,12 +8,13 @@
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt, QAbstractTableModel
|
from PyQt5.QtCore import Qt, QAbstractTableModel
|
||||||
from PyQt5.QtWidgets import QHeaderView, QTableView
|
from PyQt5.QtWidgets import QHeaderView, QTableView
|
||||||
|
from PyQt5.QtGui import QFont, QBrush, QColor
|
||||||
|
|
||||||
from hscommon.trans import trget
|
from hscommon.trans import trget
|
||||||
|
|
||||||
tr = trget("ui")
|
tr = trget("ui")
|
||||||
|
|
||||||
HEADER = [tr("Attribute"), tr("Selected"), tr("Reference")]
|
HEADER = [tr("Selected"), tr("Reference")]
|
||||||
|
|
||||||
|
|
||||||
class DetailsModel(QAbstractTableModel):
|
class DetailsModel(QAbstractTableModel):
|
||||||
@ -27,11 +28,27 @@ class DetailsModel(QAbstractTableModel):
|
|||||||
def data(self, index, role):
|
def data(self, index, role):
|
||||||
if not index.isValid():
|
if not index.isValid():
|
||||||
return None
|
return None
|
||||||
if role != Qt.DisplayRole:
|
# Skip first value "Attribute"
|
||||||
return None
|
column = index.column() + 1
|
||||||
column = index.column()
|
|
||||||
row = index.row()
|
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):
|
def headerData(self, section, orientation, role):
|
||||||
if (
|
if (
|
||||||
@ -40,6 +57,13 @@ class DetailsModel(QAbstractTableModel):
|
|||||||
and section < len(HEADER)
|
and section < len(HEADER)
|
||||||
):
|
):
|
||||||
return HEADER[section]
|
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
|
return None
|
||||||
|
|
||||||
def rowCount(self, parent):
|
def rowCount(self, parent):
|
||||||
@ -51,9 +75,10 @@ class DetailsTable(QTableView):
|
|||||||
QTableView.__init__(self, *args)
|
QTableView.__init__(self, *args)
|
||||||
self.setAlternatingRowColors(True)
|
self.setAlternatingRowColors(True)
|
||||||
self.setSelectionBehavior(QTableView.SelectRows)
|
self.setSelectionBehavior(QTableView.SelectRows)
|
||||||
self.setSelectionMode(QTableView.SingleSelection)
|
self.setSelectionMode(QTableView.NoSelection)
|
||||||
self.setShowGrid(False)
|
self.setShowGrid(False)
|
||||||
self.setWordWrap(False)
|
self.setWordWrap(False)
|
||||||
|
self.setCornerButtonEnabled(False)
|
||||||
|
|
||||||
def setModel(self, model):
|
def setModel(self, model):
|
||||||
QTableView.setModel(self, model)
|
QTableView.setModel(self, model)
|
||||||
@ -62,9 +87,12 @@ class DetailsTable(QTableView):
|
|||||||
hheader.setHighlightSections(False)
|
hheader.setHighlightSections(False)
|
||||||
hheader.setStretchLastSection(False)
|
hheader.setStretchLastSection(False)
|
||||||
hheader.resizeSection(0, 100)
|
hheader.resizeSection(0, 100)
|
||||||
hheader.setSectionResizeMode(0, QHeaderView.Interactive)
|
hheader.setSectionResizeMode(0, QHeaderView.Stretch)
|
||||||
hheader.setSectionResizeMode(1, QHeaderView.Stretch)
|
hheader.setSectionResizeMode(1, QHeaderView.Stretch)
|
||||||
hheader.setSectionResizeMode(2, QHeaderView.Stretch)
|
|
||||||
vheader = self.verticalHeader()
|
vheader = self.verticalHeader()
|
||||||
vheader.setVisible(False)
|
vheader.setVisible(True)
|
||||||
vheader.setDefaultSectionSize(18)
|
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)
|
||||||
|
@ -48,6 +48,7 @@ class IgnoreListDialog(QDialog):
|
|||||||
self.tableView.verticalHeader().setDefaultSectionSize(18)
|
self.tableView.verticalHeader().setDefaultSectionSize(18)
|
||||||
self.tableView.verticalHeader().setHighlightSections(False)
|
self.tableView.verticalHeader().setHighlightSections(False)
|
||||||
self.tableView.verticalHeader().setVisible(False)
|
self.tableView.verticalHeader().setVisible(False)
|
||||||
|
self.tableView.setWordWrap(False)
|
||||||
self.verticalLayout.addWidget(self.tableView)
|
self.verticalLayout.addWidget(self.tableView)
|
||||||
self.removeSelectedButton = QPushButton(tr("Remove Selected"))
|
self.removeSelectedButton = QPushButton(tr("Remove Selected"))
|
||||||
self.clearButton = QPushButton(tr("Clear"))
|
self.clearButton = QPushButton(tr("Clear"))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user