mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-10 05:34:36 +00:00
Re-added the root children count optimization in the results outline.
This commit is contained in:
parent
a4bf1c8be6
commit
514426b980
@ -19,4 +19,5 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (BOOL)renameSelected:(NSString *)aNewName;
|
- (BOOL)renameSelected:(NSString *)aNewName;
|
||||||
- (void)sortBy:(NSInteger)aIdentifier ascending:(BOOL)aAscending;
|
- (void)sortBy:(NSInteger)aIdentifier ascending:(BOOL)aAscending;
|
||||||
- (void)markSelected;
|
- (void)markSelected;
|
||||||
|
- (NSArray *)rootChildrenCounts;
|
||||||
@end
|
@end
|
@ -13,6 +13,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
@interface ResultOutline : HSOutline
|
@interface ResultOutline : HSOutline
|
||||||
{
|
{
|
||||||
NSIndexSet *_deltaColumns;
|
NSIndexSet *_deltaColumns;
|
||||||
|
NSArray *_rootChildrenCounts;
|
||||||
}
|
}
|
||||||
- (PyResultTree *)py;
|
- (PyResultTree *)py;
|
||||||
- (BOOL)powerMarkerMode;
|
- (BOOL)powerMarkerMode;
|
||||||
|
@ -15,6 +15,7 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
- (id)initWithPyParent:(id)aPyParent view:(HSOutlineView *)aOutlineView
|
- (id)initWithPyParent:(id)aPyParent view:(HSOutlineView *)aOutlineView
|
||||||
{
|
{
|
||||||
self = [super initWithPyClassName:@"PyResultOutline" pyParent:aPyParent view:aOutlineView];
|
self = [super initWithPyClassName:@"PyResultOutline" pyParent:aPyParent view:aOutlineView];
|
||||||
|
_rootChildrenCounts = nil;
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -62,6 +63,19 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Datasource */
|
/* Datasource */
|
||||||
|
- (NSInteger)outlineView:(NSOutlineView *)aOutlineView numberOfChildrenOfItem:(id)item
|
||||||
|
{
|
||||||
|
NSIndexPath *path = item;
|
||||||
|
if ((path != nil) && ([path length] == 1)) {
|
||||||
|
if (_rootChildrenCounts == nil) {
|
||||||
|
_rootChildrenCounts = [[[self py] rootChildrenCounts] retain];
|
||||||
|
}
|
||||||
|
NSInteger index = [path indexAtPosition:0];
|
||||||
|
return n2i([_rootChildrenCounts objectAtIndex:index]);
|
||||||
|
}
|
||||||
|
return [super outlineView:aOutlineView numberOfChildrenOfItem:item];
|
||||||
|
}
|
||||||
|
|
||||||
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)column byItem:(id)item
|
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)column byItem:(id)item
|
||||||
{
|
{
|
||||||
NSIndexPath *path = item;
|
NSIndexPath *path = item;
|
||||||
@ -125,6 +139,8 @@ http://www.hardcoded.net/licenses/hs_license
|
|||||||
/* Python --> Cocoa */
|
/* Python --> Cocoa */
|
||||||
- (void)refresh /* Override */
|
- (void)refresh /* Override */
|
||||||
{
|
{
|
||||||
|
[_rootChildrenCounts release];
|
||||||
|
_rootChildrenCounts = nil;
|
||||||
[super refresh];
|
[super refresh];
|
||||||
[outlineView expandItem:nil expandChildren:YES];
|
[outlineView expandItem:nil expandChildren:YES];
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,9 @@ class PyResultOutline(PyOutline):
|
|||||||
def markSelected(self):
|
def markSelected(self):
|
||||||
self.py.app.toggle_selected_mark_state()
|
self.py.app.toggle_selected_mark_state()
|
||||||
|
|
||||||
|
def rootChildrenCounts(self):
|
||||||
|
return self.py.root_children_counts()
|
||||||
|
|
||||||
# python --> cocoa
|
# python --> cocoa
|
||||||
def invalidate_markings(self):
|
def invalidate_markings(self):
|
||||||
self.cocoa.invalidateMarkings()
|
self.cocoa.invalidateMarkings()
|
||||||
|
@ -88,6 +88,11 @@ class ResultTree(GUIObject, Tree):
|
|||||||
else:
|
else:
|
||||||
return node.data[column]
|
return node.data[column]
|
||||||
|
|
||||||
|
def root_children_counts(self):
|
||||||
|
# This is a speed optimization for cases where there's a lot of results so that there is
|
||||||
|
# not thousands of children_count queries when expandAll is called.
|
||||||
|
return [len(node) for node in self]
|
||||||
|
|
||||||
def sort(self, key, asc):
|
def sort(self, key, asc):
|
||||||
if self.power_marker:
|
if self.power_marker:
|
||||||
self.app.results.sort_dupes(key, asc, self.delta_values)
|
self.app.results.sort_dupes(key, asc, self.delta_values)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user