mirror of
https://github.com/arsenetar/dupeguru.git
synced 2024-11-16 12:19:03 +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.
|
// but after a lot of fussing around, believe it or not, it actually is.
|
||||||
NSInteger matchesTag = _powerMode ? 2 : 0;
|
NSInteger matchesTag = _powerMode ? 2 : 0;
|
||||||
NSInteger startLen = [[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count];
|
NSInteger startLen = [[py getOutlineView:matchesTag childCountsForPath:[NSArray array]] count];
|
||||||
[self performPySelection:[self getSelectedPaths:YES]];
|
|
||||||
[py makeSelectedReference];
|
[py makeSelectedReference];
|
||||||
[self performPySelection:[self getSelectedPaths:NO]];
|
[self performPySelection:[self getSelectedPaths:NO]];
|
||||||
// In some cases (when in a filtered view in Power Marker mode, it's possible that the demoted
|
// 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')
|
p = op.join(self.appdata, 'ignore_list.xml')
|
||||||
self.scanner.ignore_list.load_from_xml(p)
|
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()
|
changed_groups = set()
|
||||||
for dupe in duplicates:
|
for dupe in dupes:
|
||||||
g = self.results.get_group_of_duplicate(dupe)
|
g = self.results.get_group_of_duplicate(dupe)
|
||||||
if g not in changed_groups:
|
if g not in changed_groups:
|
||||||
self.results.make_ref(dupe)
|
self.results.make_ref(dupe)
|
||||||
|
@ -93,9 +93,6 @@ class DupeGuru(app.DupeGuru):
|
|||||||
copy_or_move_marked = demo_method(app.DupeGuru.copy_or_move_marked)
|
copy_or_move_marked = demo_method(app.DupeGuru.copy_or_move_marked)
|
||||||
delete_marked = demo_method(app.DupeGuru.delete_marked)
|
delete_marked = demo_method(app.DupeGuru.delete_marked)
|
||||||
|
|
||||||
def MakeSelectedReference(self):
|
|
||||||
self.make_reference(self.selected_dupes)
|
|
||||||
|
|
||||||
def OpenSelected(self):
|
def OpenSelected(self):
|
||||||
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
# local import because first appkit import takes a lot of memory. we want to avoid it.
|
||||||
if self.selected_dupes:
|
if self.selected_dupes:
|
||||||
|
@ -94,7 +94,7 @@ class PyDupeGuruBase(PyApp):
|
|||||||
self.app.apply_filter(filter)
|
self.app.apply_filter(filter)
|
||||||
|
|
||||||
def makeSelectedReference(self):
|
def makeSelectedReference(self):
|
||||||
self.app.MakeSelectedReference()
|
self.app.make_selected_reference()
|
||||||
|
|
||||||
def copyOrMove_markedTo_recreatePath_(self, copy, destination, recreate_path):
|
def copyOrMove_markedTo_recreatePath_(self, copy, destination, recreate_path):
|
||||||
self.app.copy_or_move_marked(copy, destination, recreate_path)
|
self.app.copy_or_move_marked(copy, destination, recreate_path)
|
||||||
|
@ -264,9 +264,9 @@ class TCDupeGuru(TestCase):
|
|||||||
objects = self.objects
|
objects = self.objects
|
||||||
groups = self.groups
|
groups = self.groups
|
||||||
app.SelectPowerMarkerNodePaths(r2np([0,2]))
|
app.SelectPowerMarkerNodePaths(r2np([0,2]))
|
||||||
app.MakeSelectedReference()
|
app.make_selected_reference()
|
||||||
self.assert_(groups[0].ref is objects[1])
|
assert groups[0].ref is objects[1]
|
||||||
self.assert_(groups[1].ref is objects[4])
|
assert groups[1].ref is objects[4]
|
||||||
|
|
||||||
def test_makeSelectedReference_by_selecting_two_dupes_in_the_same_group(self):
|
def test_makeSelectedReference_by_selecting_two_dupes_in_the_same_group(self):
|
||||||
app = self.app
|
app = self.app
|
||||||
@ -274,9 +274,9 @@ class TCDupeGuru(TestCase):
|
|||||||
groups = self.groups
|
groups = self.groups
|
||||||
app.SelectPowerMarkerNodePaths(r2np([0,1,2]))
|
app.SelectPowerMarkerNodePaths(r2np([0,1,2]))
|
||||||
#Only 0 and 2 must go ref, not 1 because it is a part of the same group
|
#Only 0 and 2 must go ref, not 1 because it is a part of the same group
|
||||||
app.MakeSelectedReference()
|
app.make_selected_reference()
|
||||||
self.assert_(groups[0].ref is objects[1])
|
assert groups[0].ref is objects[1]
|
||||||
self.assert_(groups[1].ref is objects[4])
|
assert groups[1].ref is objects[4]
|
||||||
|
|
||||||
def test_removeSelected(self):
|
def test_removeSelected(self):
|
||||||
app = self.app
|
app = self.app
|
||||||
|
@ -156,8 +156,8 @@ class DupeGuru(DupeGuruBase, QObject):
|
|||||||
|
|
||||||
delete_marked = demo_method(DupeGuruBase.delete_marked)
|
delete_marked = demo_method(DupeGuruBase.delete_marked)
|
||||||
|
|
||||||
def make_reference(self, duplicates):
|
def make_selected_reference(self):
|
||||||
DupeGuruBase.make_reference(self, duplicates)
|
DupeGuruBase.make_selected_reference(self)
|
||||||
self.emit(SIGNAL('resultsChanged()'))
|
self.emit(SIGNAL('resultsChanged()'))
|
||||||
|
|
||||||
def remove_duplicates(self, duplicates):
|
def remove_duplicates(self, duplicates):
|
||||||
|
@ -205,7 +205,7 @@ class MainWindow(QMainWindow, Ui_MainWindow):
|
|||||||
QDesktopServices.openUrl(url)
|
QDesktopServices.openUrl(url)
|
||||||
|
|
||||||
def makeReferenceTriggered(self):
|
def makeReferenceTriggered(self):
|
||||||
self.app.make_reference(self.resultsView.selectedDupes())
|
self.app.make_selected_reference()
|
||||||
|
|
||||||
def markAllTriggered(self):
|
def markAllTriggered(self):
|
||||||
self.app.mark_all()
|
self.app.mark_all()
|
||||||
|
Loading…
Reference in New Issue
Block a user