diff --git a/core/pe/matchblock.py b/core/pe/matchblock.py index a13a15aa..953d39ab 100644 --- a/core/pe/matchblock.py +++ b/core/pe/matchblock.py @@ -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 diff --git a/package.py b/package.py index be949bce..aa876b36 100644 --- a/package.py +++ b/package.py @@ -43,6 +43,15 @@ def copy_files_to_package(destpath, packages, with_so): shutil.copy("run.py", op.join(destpath, "run.py")) extra_ignores = ["*.so"] if not with_so else None 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", "locale"), op.join(destpath, "locale")) compileall.compile_dir(destpath) @@ -152,11 +161,11 @@ def package_windows(): # include locale files if they are built otherwise exit as it will break # the localization 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 # include help files if they are built otherwise exit as they should be included? 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 # create version information file from template try: diff --git a/qt/details_table.py b/qt/details_table.py index 1e353f17..c42aa0a6 100644 --- a/qt/details_table.py +++ b/qt/details_table.py @@ -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) diff --git a/qt/ignore_list_dialog.py b/qt/ignore_list_dialog.py index 5643cc96..f9cd9649 100644 --- a/qt/ignore_list_dialog.py +++ b/qt/ignore_list_dialog.py @@ -50,6 +50,7 @@ class IgnoreListDialog(QDialog): self.tableView.verticalHeader().setDefaultSectionSize(18) self.tableView.verticalHeader().setHighlightSections(False) self.tableView.verticalHeader().setVisible(False) + self.tableView.setWordWrap(False) self.verticalLayout.addWidget(self.tableView) self.removeSelectedButton = QPushButton(tr("Remove Selected")) self.clearButton = QPushButton(tr("Clear"))