diff --git a/cocoa/base/ResultOutline.m b/cocoa/base/ResultOutline.m index d0d3edb7..f1b691fe 100644 --- a/cocoa/base/ResultOutline.m +++ b/cocoa/base/ResultOutline.m @@ -29,13 +29,6 @@ http://www.hardcoded.net/licenses/hs_license return (PyResultTree *)py; } -/* Override */ -- (void)refresh -{ - [super refresh]; - [outlineView expandItem:nil expandChildren:YES]; -} - /* Public */ - (BOOL)powerMarkerMode { @@ -128,4 +121,19 @@ http://www.hardcoded.net/licenses/hs_license } } } + +/* Python --> Cocoa */ +- (void)refresh /* Override */ +{ + [super refresh]; + [outlineView expandItem:nil expandChildren:YES]; +} + +- (void)invalidateMarkings +{ + for (NSMutableDictionary *props in [itemData objectEnumerator]) { + [props removeObjectForKey:@"marked"]; + } + [outlineView setNeedsDisplay:YES]; +} @end \ No newline at end of file diff --git a/core/app.py b/core/app.py index 96091492..da1f3319 100644 --- a/core/app.py +++ b/core/app.py @@ -243,15 +243,15 @@ class DupeGuru(RegistrableApplication, Broadcaster): def mark_all(self): self.results.mark_all() - self.notify('results_changed') + self.notify('marking_changed') def mark_none(self): self.results.mark_none() - self.notify('results_changed') + self.notify('marking_changed') def mark_invert(self): self.results.mark_invert() - self.notify('results_changed') + self.notify('marking_changed') def open_selected(self): if self.selected_dupes: @@ -306,7 +306,7 @@ class DupeGuru(RegistrableApplication, Broadcaster): def toggle_selected_mark_state(self): for dupe in self.selected_dupes: self.results.mark_toggle(dupe) - self.notify('results_changed') + self.notify('marking_changed') def without_ref(self, dupes): return [dupe for dupe in dupes if self.results.get_group_of_duplicate(dupe).ref is not dupe] diff --git a/core/app_cocoa_inter.py b/core/app_cocoa_inter.py index ca8227a2..e3abf37a 100644 --- a/core/app_cocoa_inter.py +++ b/core/app_cocoa_inter.py @@ -194,6 +194,10 @@ class PyResultOutline(PyOutline): def markSelected(self): self.py.app.toggle_selected_mark_state() + # python --> cocoa + def invalidate_markings(self): + self.cocoa.invalidateMarkings() + class PyStatsLabel(PyGUIObject): py_class = StatsLabel diff --git a/core/gui/base.py b/core/gui/base.py index 47e28965..0b482519 100644 --- a/core/gui/base.py +++ b/core/gui/base.py @@ -21,6 +21,9 @@ class GUIObject(Listener): def dupes_selected(self): pass + def marking_changed(self): + pass + def results_changed(self): pass diff --git a/core/gui/result_tree.py b/core/gui/result_tree.py index c778f1ec..afb73e31 100644 --- a/core/gui/result_tree.py +++ b/core/gui/result_tree.py @@ -19,8 +19,20 @@ class DupeNode(Node): self._app = app self._group = group self._dupe = dupe - self.data = app._get_display_info(dupe, group, False) - self.data_delta = app._get_display_info(dupe, group, True) + self._data = None + self._data_delta = None + + @property + def data(self): + if self._data is None: + self._data = self._app._get_display_info(self._dupe, self._group, False) + return self._data + + @property + def data_delta(self): + if self._data_delta is None: + self._data_delta = self._app._get_display_info(self._dupe, self._group, True) + return self._data_delta @property def markable(self): @@ -113,6 +125,9 @@ class ResultTree(GUIObject, Tree): self.view.refresh() #--- Event Handlers + def marking_changed(self): + self.view.invalidate_markings() + def results_changed(self): self._refresh() self.view.refresh() diff --git a/core/gui/stats_label.py b/core/gui/stats_label.py index 1f7b9ec3..ed1bb232 100644 --- a/core/gui/stats_label.py +++ b/core/gui/stats_label.py @@ -21,4 +21,4 @@ class StatsLabel(GUIObject): def results_changed(self): self.view.refresh() - + marking_changed = results_changed