mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
[#138] Added a prompt label and a remove button to the reprioritization dialog (Qt).
This commit is contained in:
@@ -23,6 +23,9 @@ class PrioritizationList(GUISelectableList):
|
||||
self.dialog = dialog
|
||||
GUISelectableList.__init__(self)
|
||||
|
||||
def _refresh_contents(self):
|
||||
self[:] = [crit.display for crit in self.dialog.prioritizations]
|
||||
|
||||
def move_indexes(self, indexes, dest_index):
|
||||
indexes.sort()
|
||||
prilist = self.dialog.prioritizations
|
||||
@@ -30,7 +33,13 @@ class PrioritizationList(GUISelectableList):
|
||||
for i in reversed(indexes):
|
||||
del prilist[i]
|
||||
prilist[dest_index:dest_index] = selected
|
||||
self[:] = [crit.display for crit in prilist]
|
||||
self._refresh_contents()
|
||||
|
||||
def remove_selected(self):
|
||||
prilist = self.dialog.prioritizations
|
||||
for i in sorted(self.selected_indexes, reverse=True):
|
||||
del prilist[i]
|
||||
self._refresh_contents()
|
||||
|
||||
class PrioritizeDialog:
|
||||
def __init__(self, view, app):
|
||||
@@ -57,5 +66,8 @@ class PrioritizeDialog:
|
||||
self.prioritizations.append(crit)
|
||||
self.prioritization_list[:] = [crit.display for crit in self.prioritizations]
|
||||
|
||||
def remove_selected(self):
|
||||
self.prioritization_list.remove_selected()
|
||||
|
||||
def perform_reprioritization(self):
|
||||
self.app.reprioritize_groups(self._sort_key)
|
||||
|
||||
@@ -111,6 +111,17 @@ def test_reorder_prioritizations(app):
|
||||
]
|
||||
eq_(app.pdialog.prioritization_list[:], expected)
|
||||
|
||||
@with_app(app_normal_results)
|
||||
def test_remove_crit_from_list(app):
|
||||
app.add_pri_criterion("Kind", 0)
|
||||
app.add_pri_criterion("Kind", 1)
|
||||
app.pdialog.prioritization_list.select(0)
|
||||
app.pdialog.remove_selected()
|
||||
expected = [
|
||||
"Kind (ext2)",
|
||||
]
|
||||
eq_(app.pdialog.prioritization_list[:], expected)
|
||||
|
||||
#---
|
||||
def app_one_name_ends_with_number():
|
||||
dupes = [
|
||||
|
||||
Reference in New Issue
Block a user