diff --git a/cocoa/base/PyDupeGuru.h b/cocoa/base/PyDupeGuru.h index 4d79e3c3..96af479f 100644 --- a/cocoa/base/PyDupeGuru.h +++ b/cocoa/base/PyDupeGuru.h @@ -23,11 +23,6 @@ http://www.hardcoded.net/licenses/hs_license - (NSNumber *)doScan; -- (NSArray *)selectedPowerMarkerNodePaths; -- (void)selectPowerMarkerNodePaths:(NSArray *)aIndexPaths; -- (NSArray *)selectedResultNodePaths; -- (void)selectResultNodePaths:(NSArray *)aIndexPaths; - - (void)toggleSelectedMark; - (void)markAll; - (void)markInvert; diff --git a/cocoa/base/ResultOutline.m b/cocoa/base/ResultOutline.m index 63932382..2b90d265 100644 --- a/cocoa/base/ResultOutline.m +++ b/cocoa/base/ResultOutline.m @@ -80,7 +80,7 @@ http://www.hardcoded.net/licenses/hs_license { NSIndexPath *path = item; NSString *identifier = [column identifier]; - if ([identifier isEqual:@"mark"]) { + if ([identifier isEqual:@"marked"]) { return b2n([self boolProperty:@"marked" valueAtPath:path]); } NSInteger columnId = [identifier integerValue]; @@ -89,17 +89,20 @@ http://www.hardcoded.net/licenses/hs_license - (void)outlineView:(NSOutlineView *)aOutlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { - if (![[tableColumn identifier] isEqual:@"0"]) - return; //We only want to cover renames. - NSIndexPath *path = item; - NSString *oldName = [[self py] valueForPath:p2a(path) column:0]; - NSString *newName = object; - if (![newName isEqual:oldName]) { - BOOL renamed = [[self py] renameSelected:newName]; - if (!renamed) { - [Dialogs showMessage:[NSString stringWithFormat:@"The name '%@' already exists.", newName]]; + if ([[tableColumn identifier] isEqual:@"0"]) { + NSIndexPath *path = item; + NSString *oldName = [[self py] valueForPath:p2a(path) column:0]; + NSString *newName = object; + if (![newName isEqual:oldName]) { + BOOL renamed = [[self py] renameSelected:newName]; + if (!renamed) { + [Dialogs showMessage:[NSString stringWithFormat:@"The name '%@' already exists.", newName]]; + } } } + else { + [super outlineView:aOutlineView setObjectValue:object forTableColumn:tableColumn byItem:item]; + } } /* Delegate */ @@ -115,7 +118,7 @@ http://www.hardcoded.net/licenses/hs_license { NSIndexPath *path = item; BOOL isMarkable = [self boolProperty:@"markable" valueAtPath:path]; - if ([[tableColumn identifier] isEqual:@"mark"]) { + if ([[tableColumn identifier] isEqual:@"marked"]) { [cell setEnabled:isMarkable]; } if ([cell isKindOfClass:[NSTextFieldCell class]]) { diff --git a/cocoa/base/ResultWindow.h b/cocoa/base/ResultWindow.h index 5586d8fd..7db623e4 100644 --- a/cocoa/base/ResultWindow.h +++ b/cocoa/base/ResultWindow.h @@ -40,7 +40,6 @@ http://www.hardcoded.net/licenses/hs_license - (NSDictionary *)getColumnsWidth; - (NSArray *)getSelectedPaths:(BOOL)aDupesOnly; - (void)initResultColumns; -- (void)performPySelection:(NSArray *)aIndexPaths; - (void)restoreColumnsPosition:(NSArray *)aColumnsOrder widths:(NSDictionary *)aColumnsWidth; /* Actions */ @@ -56,7 +55,6 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)markInvert:(id)sender; - (IBAction)markNone:(id)sender; - (IBAction)markSelected:(id)sender; -- (IBAction)markToggle:(id)sender; - (IBAction)moveMarked:(id)sender; - (IBAction)openClicked:(id)sender; - (IBAction)openSelected:(id)sender; diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index dbe9750f..fd628a7a 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -139,7 +139,7 @@ http://www.hardcoded.net/licenses/hs_license } //Add columns and set widths for (NSString *colId in aColumnsOrder) { - if ([colId isEqual:@"mark"]) { + if ([colId isEqual:@"marked"]) { continue; } NSTableColumn *col = [_resultColumns objectAtIndex:[colId intValue]]; @@ -152,28 +152,6 @@ http://www.hardcoded.net/licenses/hs_license } } -// - (void)updatePySelection -// { -// NSArray *selection; -// if (_powerMode) { -// selection = [py selectedPowerMarkerNodePaths]; -// } -// else { -// selection = [py selectedResultNodePaths]; -// } -// [matches selectNodePaths:selection]; -// } - -- (void)performPySelection:(NSArray *)aIndexPaths -{ - if ([outline powerMarkerMode]) { - [py selectPowerMarkerNodePaths:aIndexPaths]; - } - else { - [py selectResultNodePaths:aIndexPaths]; - } -} - /* Actions */ - (IBAction)clearIgnoreList:(id)sender { @@ -268,14 +246,6 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)markSelected:(id)sender { - [self performPySelection:[self getSelectedPaths:YES]]; - [py toggleSelectedMark]; -} - -- (IBAction)markToggle:(id)sender -{ - NSIndexPath *path = [matches itemAtRow:[matches clickedRow]]; - [self performPySelection:[NSArray arrayWithObject:p2a(path)]]; [py toggleSelectedMark]; } @@ -310,7 +280,6 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)openSelected:(id)sender { - [self performPySelection:[self getSelectedPaths:NO]]; [py openSelected]; } @@ -331,7 +300,6 @@ http://www.hardcoded.net/licenses/hs_license return; if ([Dialogs askYesNo:[NSString stringWithFormat:@"You are about to remove %d files from results. Continue?",[pathList count]]] == NSAlertSecondButtonReturn) // NO return; - [self performPySelection:[self getSelectedPaths:YES]]; [py removeSelected]; } @@ -349,7 +317,6 @@ http://www.hardcoded.net/licenses/hs_license - (IBAction)revealSelected:(id)sender { - [self performPySelection:[self getSelectedPaths:NO]]; [py revealSelected]; } @@ -469,11 +436,6 @@ http://www.hardcoded.net/licenses/hs_license [Dialogs showMessage:msg]; } -- (void)outlineViewSelectionDidChange:(NSNotification *)notification -{ - [self performPySelection:[self getSelectedPaths:NO]]; -} - - (BOOL)validateToolbarItem:(NSToolbarItem *)theItem { return ![[ProgressController mainProgressController] isShown]; diff --git a/cocoa/base/xib/MainMenu.xib b/cocoa/base/xib/MainMenu.xib index 627b5be2..3186594d 100644 --- a/cocoa/base/xib/MainMenu.xib +++ b/cocoa/base/xib/MainMenu.xib @@ -12,8 +12,8 @@ YES + - YES @@ -710,7 +710,7 @@ YES - mark + marked 47 16 1000 @@ -752,6 +752,7 @@ 400 75 + YES @@ -1691,14 +1692,6 @@ 410 - - - markToggle: - - - - 414 - stats diff --git a/core/app.py b/core/app.py index da1f3319..c1883592 100644 --- a/core/app.py +++ b/core/app.py @@ -253,6 +253,13 @@ class DupeGuru(RegistrableApplication, Broadcaster): self.results.mark_invert() self.notify('marking_changed') + def mark_dupe(self, dupe, marked): + if marked: + self.results.mark(dupe) + else: + self.results.unmark(dupe) + self.notify('marking_changed') + def open_selected(self): if self.selected_dupes: self._open_path(self.selected_dupes[0].path) diff --git a/core/app_cocoa.py b/core/app_cocoa.py index d9082d3c..c4ab27bc 100644 --- a/core/app_cocoa.py +++ b/core/app_cocoa.py @@ -74,18 +74,6 @@ class DupeGuru(app.DupeGuru): ud = {'desc': JOBID2TITLE[jobid], 'jobid':jobid} NSNotificationCenter.defaultCenter().postNotificationName_object_userInfo_('JobStarted', self, ud) - #---Helpers - def GetObjects(self,node_path): - #returns a tuple g,d - try: - g = self.results.groups[node_path[0]] - if len(node_path) == 2: - return (g,self.results.groups[node_path[0]].dupes[node_path[1]]) - else: - return (g,None) - except IndexError: - return (None,None) - #---Public copy_or_move_marked = demo_method(app.DupeGuru.copy_or_move_marked) delete_marked = demo_method(app.DupeGuru.delete_marked) @@ -112,46 +100,3 @@ class DupeGuru(app.DupeGuru): except app.AllFilesAreRefError: return 1 - def selected_result_node_paths(self): - def get_path(dupe): - try: - group = self.results.get_group_of_duplicate(dupe) - groupindex = self.results.groups.index(group) - if dupe is group.ref: - return [groupindex] - dupeindex = group.dupes.index(dupe) - return [groupindex, dupeindex] - except ValueError: # dupe not in there - return None - - dupes = self.selected_dupes - return stripnone(get_path(dupe) for dupe in dupes) - - def selected_powermarker_node_paths(self): - def get_path(dupe): - try: - dupeindex = self.results.dupes.index(dupe) - return [dupeindex] - except ValueError: # dupe not in there - return None - - dupes = self.selected_dupes - return stripnone(get_path(dupe) for dupe in dupes) - - def SelectResultNodePaths(self,node_paths): - def extract_dupe(t): - g,d = t - if d is not None: - return d - else: - if g is not None: - return g.ref - - selected = [extract_dupe(self.GetObjects(p)) for p in node_paths] - self._select_dupes([dupe for dupe in selected if dupe is not None]) - - def SelectPowerMarkerNodePaths(self,node_paths): - rows = [p[0] for p in node_paths] - dupes = [self.results.dupes[row] for row in rows if row in xrange(len(self.results.dupes))] - self._select_dupes(dupes) - diff --git a/core/app_cocoa_inter.py b/core/app_cocoa_inter.py index cb22591a..714590bb 100644 --- a/core/app_cocoa_inter.py +++ b/core/app_cocoa_inter.py @@ -65,18 +65,6 @@ class PyDupeGuruBase(PyRegistrable): def saveResults(self): self.py.save() - def selectedResultNodePaths(self): - return self.py.selected_result_node_paths() - - def selectResultNodePaths_(self,node_paths): - self.py.SelectResultNodePaths(node_paths) - - def selectedPowerMarkerNodePaths(self): - return self.py.selected_powermarker_node_paths() - - def selectPowerMarkerNodePaths_(self,node_paths): - self.py.SelectPowerMarkerNodePaths(node_paths) - #---Actions def addSelectedToIgnoreList(self): self.py.add_selected_to_ignore_list() diff --git a/core/gui/result_tree.py b/core/gui/result_tree.py index a5dd59a9..e726aeb9 100644 --- a/core/gui/result_tree.py +++ b/core/gui/result_tree.py @@ -42,6 +42,10 @@ class DupeNode(Node): def marked(self): return self._app.results.is_marked(self._dupe) + @marked.setter + def marked(self, value): + self._app.mark_dupe(self._dupe, value) + class ResultTree(GUIObject, Tree): def __init__(self, view, app): diff --git a/core/tests/app_cocoa_test.py b/core/tests/app_cocoa_test.py index 3898f1ec..60be02ff 100644 --- a/core/tests/app_cocoa_test.py +++ b/core/tests/app_cocoa_test.py @@ -28,6 +28,7 @@ except ImportError: raise SkipTest("These tests can only be run on OS X") from ..gui.details_panel import DetailsPanel from ..gui.directory_tree import DirectoryTree +from ..gui.result_tree import ResultTree class DupeGuru(DupeGuruBase): def __init__(self): @@ -60,12 +61,14 @@ class CallLogger(object): class TCDupeGuru(TestCase): def setUp(self): self.app = DupeGuru() + self.objects,self.matches,self.groups = GetTestGroups() + self.app.results.groups = self.groups self.dpanel_gui = CallLogger() self.dpanel = DetailsPanel(self.dpanel_gui, self.app) self.dtree_gui = CallLogger() self.dtree = DirectoryTree(self.dtree_gui, self.app) - self.objects,self.matches,self.groups = GetTestGroups() - self.app.results.groups = self.groups + self.rtree_gui = CallLogger() + self.rtree = ResultTree(self.rtree_gui, self.app) tmppath = self.tmppath() io.mkdir(tmppath + 'foo') io.mkdir(tmppath + 'bar') @@ -110,142 +113,117 @@ class TCDupeGuru(TestCase): gui.clear_calls() def test_GetObjects(self): - app = self.app objects = self.objects groups = self.groups - g,d = app.GetObjects([0]) - self.assert_(g is groups[0]) - self.assert_(d is None) - g,d = app.GetObjects([0,0]) - self.assert_(g is groups[0]) - self.assert_(d is objects[1]) - g,d = app.GetObjects([1,0]) - self.assert_(g is groups[1]) - self.assert_(d is objects[4]) + n = self.rtree.get_node([0]) + assert n._group is groups[0] + assert n._dupe is objects[0] + n = self.rtree.get_node([0, 0]) + assert n._group is groups[0] + assert n._dupe is objects[1] + n = self.rtree.get_node([1, 0]) + assert n._group is groups[1] + assert n._dupe is objects[4] def test_GetObjects_after_sort(self): - app = self.app objects = self.objects - groups = self.groups[:] #To keep the old order in memory - app.sort_groups(0,False) #0 = Filename - #Now, the group order is supposed to be reversed - g,d = app.GetObjects([0,0]) - self.assert_(g is groups[1]) - self.assert_(d is objects[4]) - - def test_GetObjects_out_of_range(self): - app = self.app - self.assertEqual((None,None),app.GetObjects([2])) - self.assertEqual((None,None),app.GetObjects([])) - self.assertEqual((None,None),app.GetObjects([1,2])) + groups = self.groups[:] # we need an un-sorted reference + self.rtree.sort(0, False) #0 = Filename + n = self.rtree.get_node([0, 0]) + assert n._group is groups[1] + assert n._dupe is objects[4] def test_selected_result_node_paths(self): # app.selected_dupes is correctly converted into node paths - app = self.app - objects = self.objects paths = [[0, 0], [0, 1], [1]] - app.SelectResultNodePaths(paths) - eq_(app.selected_result_node_paths(), paths) + self.rtree.selected_paths = paths + eq_(self.rtree.selected_paths, paths) def test_selected_result_node_paths_after_deletion(self): # cases where the selected dupes aren't there are correctly handled - app = self.app - objects = self.objects paths = [[0, 0], [0, 1], [1]] - app.SelectResultNodePaths(paths) - app.remove_selected() + self.rtree.selected_paths = paths + self.app.remove_selected() # The first 2 dupes have been removed. The 3rd one is a ref. it stays there, in first pos. - eq_(app.selected_result_node_paths(), [[0]]) # no exception + eq_(self.rtree.selected_paths, [[0]]) # no exception def test_selectResultNodePaths(self): app = self.app objects = self.objects - app.SelectResultNodePaths([[0,0],[0,1]]) - self.assertEqual(2,len(app.selected_dupes)) - self.assert_(app.selected_dupes[0] is objects[1]) - self.assert_(app.selected_dupes[1] is objects[2]) + self.rtree.selected_paths = [[0, 0], [0, 1]] + eq_(len(app.selected_dupes), 2) + assert app.selected_dupes[0] is objects[1] + assert app.selected_dupes[1] is objects[2] def test_selectResultNodePaths_with_ref(self): app = self.app objects = self.objects - app.SelectResultNodePaths([[0,0],[0,1],[1]]) - self.assertEqual(3,len(app.selected_dupes)) - self.assert_(app.selected_dupes[0] is objects[1]) - self.assert_(app.selected_dupes[1] is objects[2]) - self.assert_(app.selected_dupes[2] is self.groups[1].ref) - - def test_selectResultNodePaths_empty(self): - self.app.SelectResultNodePaths([]) - self.assertEqual(0,len(self.app.selected_dupes)) + self.rtree.selected_paths = [[0, 0], [0, 1], [1]] + eq_(len(app.selected_dupes), 3) + assert app.selected_dupes[0] is objects[1] + assert app.selected_dupes[1] is objects[2] + assert app.selected_dupes[2] is self.groups[1].ref def test_selectResultNodePaths_after_sort(self): app = self.app objects = self.objects groups = self.groups[:] #To keep the old order in memory - app.sort_groups(0,False) #0 = Filename + self.rtree.sort(0, False) #0 = Filename #Now, the group order is supposed to be reversed - app.SelectResultNodePaths([[0,0],[1],[1,0]]) - self.assertEqual(3,len(app.selected_dupes)) - self.assert_(app.selected_dupes[0] is objects[4]) - self.assert_(app.selected_dupes[1] is groups[0].ref) - self.assert_(app.selected_dupes[2] is objects[1]) - - def test_selectResultNodePaths_out_of_range(self): - app = self.app - app.SelectResultNodePaths([[0,0],[0,1],[1],[1,1],[2]]) - self.assertEqual(3,len(app.selected_dupes)) + self.rtree.selected_paths = [[0, 0], [1], [1, 0]] + eq_(len(app.selected_dupes), 3) + assert app.selected_dupes[0] is objects[4] + assert app.selected_dupes[1] is groups[0].ref + assert app.selected_dupes[2] is objects[1] def test_selected_powermarker_node_paths(self): # app.selected_dupes is correctly converted into paths app = self.app objects = self.objects - paths = r2np([0, 1, 2]) - app.SelectPowerMarkerNodePaths(paths) - eq_(app.selected_powermarker_node_paths(), paths) + self.rtree.power_marker = True + self.rtree.selected_paths = [[0], [1], [2]] + self.rtree.power_marker = False + eq_(self.rtree.selected_paths, [[0, 0], [0, 1], [1, 0]]) def test_selected_powermarker_node_paths_after_deletion(self): # cases where the selected dupes aren't there are correctly handled app = self.app objects = self.objects - paths = r2np([0, 1, 2]) - app.SelectPowerMarkerNodePaths(paths) + self.rtree.power_marker = True + self.rtree.selected_paths = [[0], [1], [2]] app.remove_selected() - eq_(app.selected_powermarker_node_paths(), []) # no exception + eq_(self.rtree.selected_paths, []) # no exception def test_selectPowerMarkerRows(self): app = self.app objects = self.objects - app.SelectPowerMarkerNodePaths(r2np([0,1,2])) - self.assertEqual(3,len(app.selected_dupes)) - self.assert_(app.selected_dupes[0] is objects[1]) - self.assert_(app.selected_dupes[1] is objects[2]) - self.assert_(app.selected_dupes[2] is objects[4]) + self.rtree.selected_paths = [[0, 0], [0, 1], [1, 0]] + eq_(len(app.selected_dupes), 3) + assert app.selected_dupes[0] is objects[1] + assert app.selected_dupes[1] is objects[2] + assert app.selected_dupes[2] is objects[4] def test_selectPowerMarkerRows_empty(self): - self.app.SelectPowerMarkerNodePaths([]) - self.assertEqual(0,len(self.app.selected_dupes)) + self.rtree.selected_paths = [] + eq_(len(self.app.selected_dupes), 0) def test_selectPowerMarkerRows_after_sort(self): app = self.app objects = self.objects - app.sort_dupes(0,False) #0 = Filename - app.SelectPowerMarkerNodePaths(r2np([0,1,2])) - self.assertEqual(3,len(app.selected_dupes)) - self.assert_(app.selected_dupes[0] is objects[4]) - self.assert_(app.selected_dupes[1] is objects[2]) - self.assert_(app.selected_dupes[2] is objects[1]) - - def test_selectPowerMarkerRows_out_of_range(self): - app = self.app - app.SelectPowerMarkerNodePaths(r2np([0,1,2,3])) - self.assertEqual(3,len(app.selected_dupes)) + self.rtree.power_marker = True + self.rtree.sort(0, False) #0 = Filename + self.rtree.selected_paths = [[0], [1], [2]] + eq_(len(app.selected_dupes), 3) + assert app.selected_dupes[0] is objects[4] + assert app.selected_dupes[1] is objects[2] + assert app.selected_dupes[2] is objects[1] def test_toggleSelectedMark(self): app = self.app objects = self.objects app.toggle_selected_mark_state() eq_(app.results.mark_count, 0) - app.SelectPowerMarkerNodePaths(r2np([0,2])) + self.rtree.selected_paths = [[0, 0], [1, 0]] app.toggle_selected_mark_state() eq_(app.results.mark_count, 2) assert not app.results.is_marked(objects[0]) @@ -255,10 +233,10 @@ class TCDupeGuru(TestCase): assert app.results.is_marked(objects[4]) def test_refreshDetailsWithSelected(self): - self.app.SelectPowerMarkerNodePaths(r2np([0,2])) + self.rtree.selected_paths = [[0, 0], [1, 0]] eq_(self.dpanel.row(0), ('Filename', 'bar bleh', 'foo bar')) self.check_gui_calls(self.dpanel_gui, ['refresh']) - self.app.SelectPowerMarkerNodePaths([]) + self.rtree.selected_paths = [] eq_(self.dpanel.row(0), ('Filename', '---', '---')) self.check_gui_calls(self.dpanel_gui, ['refresh']) @@ -266,7 +244,7 @@ class TCDupeGuru(TestCase): app = self.app objects = self.objects groups = self.groups - app.SelectPowerMarkerNodePaths(r2np([0,2])) + self.rtree.selected_paths = [[0, 0], [1, 0]] app.make_selected_reference() assert groups[0].ref is objects[1] assert groups[1].ref is objects[4] @@ -275,20 +253,20 @@ class TCDupeGuru(TestCase): app = self.app objects = self.objects 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 + self.rtree.selected_paths = [[0, 0], [0, 1], [1, 0]] + #Only [0, 0] and [1, 0] must go ref, not [0, 1] because it is a part of the same group 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 - app.SelectPowerMarkerNodePaths(r2np([0,2])) + self.rtree.selected_paths = [[0, 0], [1, 0]] app.remove_selected() eq_(len(app.results.dupes), 1) app.remove_selected() eq_(len(app.results.dupes), 1) - app.SelectPowerMarkerNodePaths(r2np([0,2])) + self.rtree.selected_path = [0, 0] app.remove_selected() eq_(len(app.results.dupes), 0) @@ -309,13 +287,13 @@ class TCDupeGuru(TestCase): def test_ignore(self): app = self.app - app.SelectPowerMarkerNodePaths(r2np([2])) #The dupe of the second, 2 sized group + self.rtree.selected_path = [1, 0] #The dupe of the second, 2 sized group app.add_selected_to_ignore_list() - self.assertEqual(1,len(app.scanner.ignore_list)) - app.SelectPowerMarkerNodePaths(r2np([0])) #first dupe of the 3 dupes group + eq_(len(app.scanner.ignore_list), 1) + self.rtree.selected_path = [0, 0] #first dupe of the 3 dupes group app.add_selected_to_ignore_list() #BOTH the ref and the other dupe should have been added - self.assertEqual(3,len(app.scanner.ignore_list)) + eq_(len(app.scanner.ignore_list), 3) def test_purgeIgnoreList(self): app = self.app @@ -339,7 +317,7 @@ class TCDupeGuru(TestCase): app = self.app app.scanner.ignore_list.Ignore = FakeIgnore - app.SelectPowerMarkerNodePaths(r2np([2])) #The dupe of the second, 2 sized group + self.rtree.selected_path = [1, 0] app.add_selected_to_ignore_list() @@ -363,11 +341,13 @@ class TCDupeGuru_renameSelected(TestCase): self.groups = groups self.p = p self.files = files + self.rtree_gui = CallLogger() + self.rtree = ResultTree(self.rtree_gui, self.app) def test_simple(self): app = self.app g = self.groups[0] - app.SelectPowerMarkerNodePaths(r2np([0])) + self.rtree.selected_path = [0, 0] assert app.RenameSelected('renamed') names = io.listdir(self.p) assert 'renamed' in names @@ -377,7 +357,7 @@ class TCDupeGuru_renameSelected(TestCase): def test_none_selected(self): app = self.app g = self.groups[0] - app.SelectPowerMarkerNodePaths([]) + self.rtree.selected_paths = [] self.mock(logging, 'warning', log_calls(lambda msg: None)) assert not app.RenameSelected('renamed') msg = logging.warning.calls[0]['msg'] @@ -390,7 +370,7 @@ class TCDupeGuru_renameSelected(TestCase): def test_name_already_exists(self): app = self.app g = self.groups[0] - app.SelectPowerMarkerNodePaths(r2np([0])) + self.rtree.selected_path = [0, 0] self.mock(logging, 'warning', log_calls(lambda msg: None)) assert not app.RenameSelected('foo bar 1') msg = logging.warning.calls[0]['msg']