mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +00:00 
			
		
		
		
	Made marking changes much faster and also made data fetching lazy in dupe nodes.
This commit is contained in:
		
							parent
							
								
									9b82e1478f
								
							
						
					
					
						commit
						a4bf1c8be6
					
				| @ -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 | ||||
| @ -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] | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -21,6 +21,9 @@ class GUIObject(Listener): | ||||
|     def dupes_selected(self): | ||||
|         pass | ||||
|      | ||||
|     def marking_changed(self): | ||||
|         pass | ||||
|      | ||||
|     def results_changed(self): | ||||
|         pass | ||||
|      | ||||
|  | ||||
| @ -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() | ||||
|  | ||||
| @ -21,4 +21,4 @@ class StatsLabel(GUIObject): | ||||
|      | ||||
|     def results_changed(self): | ||||
|         self.view.refresh() | ||||
|      | ||||
|     marking_changed = results_changed | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user