mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Removed logic duplication across toolkit code in "Make Reference" action.
This commit is contained in:
parent
f7aaea79af
commit
9edee82fa1
@ -425,7 +425,6 @@ http://www.hardcoded.net/licenses/hs_license
|
||||
// but after a lot of fussing around, believe it or not, it actually is.
|
||||
NSInteger matchesTag = _powerMode ? 2 : 0;
|
||||
NSInteger startLen = [[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count];
|
||||
[self performPySelection:[self getSelectedPaths:YES]];
|
||||
[py makeSelectedReference];
|
||||
[self performPySelection:[self getSelectedPaths:NO]];
|
||||
// In some cases (when in a filtered view in Power Marker mode, it's possible that the demoted
|
||||
|
@ -215,9 +215,10 @@ class DupeGuru(RegistrableApplication, Broadcaster):
|
||||
p = op.join(self.appdata, 'ignore_list.xml')
|
||||
self.scanner.ignore_list.load_from_xml(p)
|
||||
|
||||
def make_reference(self, duplicates):
|
||||
def make_selected_reference(self):
|
||||
dupes = self.without_ref(self.selected_dupes)
|
||||
changed_groups = set()
|
||||
for dupe in duplicates:
|
||||
for dupe in dupes:
|
||||
g = self.results.get_group_of_duplicate(dupe)
|
||||
if g not in changed_groups:
|
||||
self.results.make_ref(dupe)
|
||||
|
@ -92,9 +92,6 @@ class DupeGuru(app.DupeGuru):
|
||||
#---Public
|
||||
copy_or_move_marked = demo_method(app.DupeGuru.copy_or_move_marked)
|
||||
delete_marked = demo_method(app.DupeGuru.delete_marked)
|
||||
|
||||
def MakeSelectedReference(self):
|
||||
self.make_reference(self.selected_dupes)
|
||||
|
||||
def OpenSelected(self):
|
||||
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||
|
@ -94,7 +94,7 @@ class PyDupeGuruBase(PyApp):
|
||||
self.app.apply_filter(filter)
|
||||
|
||||
def makeSelectedReference(self):
|
||||
self.app.MakeSelectedReference()
|
||||
self.app.make_selected_reference()
|
||||
|
||||
def copyOrMove_markedTo_recreatePath_(self, copy, destination, recreate_path):
|
||||
self.app.copy_or_move_marked(copy, destination, recreate_path)
|
||||
|
@ -264,9 +264,9 @@ class TCDupeGuru(TestCase):
|
||||
objects = self.objects
|
||||
groups = self.groups
|
||||
app.SelectPowerMarkerNodePaths(r2np([0,2]))
|
||||
app.MakeSelectedReference()
|
||||
self.assert_(groups[0].ref is objects[1])
|
||||
self.assert_(groups[1].ref is objects[4])
|
||||
app.make_selected_reference()
|
||||
assert groups[0].ref is objects[1]
|
||||
assert groups[1].ref is objects[4]
|
||||
|
||||
def test_makeSelectedReference_by_selecting_two_dupes_in_the_same_group(self):
|
||||
app = self.app
|
||||
@ -274,9 +274,9 @@ class TCDupeGuru(TestCase):
|
||||
groups = self.groups
|
||||
app.SelectPowerMarkerNodePaths(r2np([0,1,2]))
|
||||
#Only 0 and 2 must go ref, not 1 because it is a part of the same group
|
||||
app.MakeSelectedReference()
|
||||
self.assert_(groups[0].ref is objects[1])
|
||||
self.assert_(groups[1].ref is objects[4])
|
||||
app.make_selected_reference()
|
||||
assert groups[0].ref is objects[1]
|
||||
assert groups[1].ref is objects[4]
|
||||
|
||||
def test_removeSelected(self):
|
||||
app = self.app
|
||||
|
@ -156,8 +156,8 @@ class DupeGuru(DupeGuruBase, QObject):
|
||||
|
||||
delete_marked = demo_method(DupeGuruBase.delete_marked)
|
||||
|
||||
def make_reference(self, duplicates):
|
||||
DupeGuruBase.make_reference(self, duplicates)
|
||||
def make_selected_reference(self):
|
||||
DupeGuruBase.make_selected_reference(self)
|
||||
self.emit(SIGNAL('resultsChanged()'))
|
||||
|
||||
def remove_duplicates(self, duplicates):
|
||||
|
@ -205,7 +205,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
||||
QDesktopServices.openUrl(url)
|
||||
|
||||
def makeReferenceTriggered(self):
|
||||
self.app.make_reference(self.resultsView.selectedDupes())
|
||||
self.app.make_selected_reference()
|
||||
|
||||
def markAllTriggered(self):
|
||||
self.app.mark_all()
|
||||
|
Loading…
x
Reference in New Issue
Block a user