mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
[#138] Added a crude-but-functional reprioritization dialog in Qt.
This commit is contained in:
@@ -6,14 +6,14 @@
|
||||
# which should be included with this package. The terms are also available at
|
||||
# http://www.hardcoded.net/licenses/bsd_license
|
||||
|
||||
from hscommon.gui.selectable_list import SelectableList
|
||||
from hscommon.gui.selectable_list import GUISelectableList
|
||||
|
||||
from ..prioritize import all_categories
|
||||
|
||||
class CriterionCategoryList(SelectableList):
|
||||
class CriterionCategoryList(GUISelectableList):
|
||||
def __init__(self, dialog):
|
||||
self.dialog = dialog
|
||||
SelectableList.__init__(self, [c.NAME for c in dialog.categories])
|
||||
GUISelectableList.__init__(self, [c.NAME for c in dialog.categories])
|
||||
|
||||
def _update_selection(self):
|
||||
self.dialog.select_category(self.dialog.categories[self.selected_index])
|
||||
@@ -25,9 +25,9 @@ class PrioritizeDialog:
|
||||
self.categories = [cat(app.results) for cat in all_categories()]
|
||||
self.category_list = CriterionCategoryList(self)
|
||||
self.criteria = []
|
||||
self.criteria_list = SelectableList()
|
||||
self.criteria_list = GUISelectableList()
|
||||
self.prioritizations = []
|
||||
self.prioritization_list = SelectableList()
|
||||
self.prioritization_list = GUISelectableList()
|
||||
|
||||
#--- Private
|
||||
def _sort_key(self, dupe):
|
||||
|
||||
@@ -46,7 +46,7 @@ class Criterion:
|
||||
|
||||
@property
|
||||
def display(self):
|
||||
return "{} ({})".format(self.category.NAME, self.value)
|
||||
return "{} ({})".format(self.category.NAME, self.display_value)
|
||||
|
||||
|
||||
class KindCategory(CriterionCategory):
|
||||
|
||||
@@ -76,9 +76,13 @@ def test_prilist_display(app):
|
||||
app.select_pri_criterion("Folder")
|
||||
app.pdialog.criteria_list.select([1]) # folder2
|
||||
app.pdialog.add_selected()
|
||||
app.select_pri_criterion("Size")
|
||||
app.pdialog.criteria_list.select([1]) # Lowest
|
||||
app.pdialog.add_selected()
|
||||
expected = [
|
||||
"Kind (ext2)",
|
||||
"Folder (folder2)",
|
||||
"Size (Lowest)",
|
||||
]
|
||||
eq_(app.pdialog.prioritization_list[:], expected)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user