From fc5a0d914b5d89f3f249d2401415b84412b96c5d Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 27 Nov 2011 13:10:35 -0500 Subject: [PATCH] Moved DELTA_COLUMNS from app to result_table. --- cocoa/base/PyDupeGuru.h | 1 - cocoa/base/PyResultTable.h | 1 + cocoa/base/ResultTable.h | 1 - cocoa/base/ResultTable.m | 7 +------ cocoa/base/ResultWindow.m | 1 - cocoa/inter/app.py | 3 --- cocoa/inter/result_table.py | 3 +++ core_me/app.py | 3 +-- core_me/result_table.py | 1 + core_pe/app.py | 3 +-- core_pe/result_table.py | 1 + core_se/app.py | 3 +-- core_se/result_table.py | 1 + 13 files changed, 11 insertions(+), 18 deletions(-) diff --git a/cocoa/base/PyDupeGuru.h b/cocoa/base/PyDupeGuru.h index 7455b729..55adf670 100644 --- a/cocoa/base/PyDupeGuru.h +++ b/cocoa/base/PyDupeGuru.h @@ -48,7 +48,6 @@ http://www.hardcoded.net/licenses/bsd_license - (NSNumber *)getMarkCount; - (BOOL)scanWasProblematic; - (BOOL)resultsAreModified; -- (NSArray *)deltaColumns; //Scanning options - (void)setScanType:(NSNumber *)scan_type; diff --git a/cocoa/base/PyResultTable.h b/cocoa/base/PyResultTable.h index 3ebc125d..76abfc3b 100644 --- a/cocoa/base/PyResultTable.h +++ b/cocoa/base/PyResultTable.h @@ -14,6 +14,7 @@ http://www.hardcoded.net/licenses/bsd_license - (void)setPowerMarkerMode:(BOOL)aPowerMarkerMode; - (BOOL)deltaValuesMode; - (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode; +- (NSArray *)deltaColumns; - (NSString *)valueForRow:(NSInteger)rowIndex column:(NSString *)aColumn; - (BOOL)renameSelected:(NSString *)aNewName; diff --git a/cocoa/base/ResultTable.h b/cocoa/base/ResultTable.h index f5abe5a2..c7c0a6d9 100644 --- a/cocoa/base/ResultTable.h +++ b/cocoa/base/ResultTable.h @@ -24,7 +24,6 @@ http://www.hardcoded.net/licenses/bsd_license - (void)setPowerMarkerMode:(BOOL)aPowerMarkerMode; - (BOOL)deltaValuesMode; - (void)setDeltaValuesMode:(BOOL)aDeltaValuesMode; -- (void)setDeltaColumns:(NSSet *)aDeltaColumns; - (NSInteger)selectedDupeCount; - (void)removeSelected; @end; \ No newline at end of file diff --git a/cocoa/base/ResultTable.m b/cocoa/base/ResultTable.m index 91f62342..15c63e55 100644 --- a/cocoa/base/ResultTable.m +++ b/cocoa/base/ResultTable.m @@ -22,6 +22,7 @@ http://www.hardcoded.net/licenses/bsd_license { self = [super initWithPy:aPy view:aTableView]; columns = [[HSColumns alloc] initWithPy:[[self py] columns] tableView:aTableView]; + _deltaColumns = [[NSSet setWithArray:[[self py] deltaColumns]] retain]; [self connect]; return self; } @@ -85,12 +86,6 @@ http://www.hardcoded.net/licenses/bsd_license [[self py] setDeltaValuesMode:aDeltaValuesMode]; } -- (void)setDeltaColumns:(NSSet *)aDeltaColumns -{ - [_deltaColumns release]; - _deltaColumns = [aDeltaColumns retain]; -} - - (NSInteger)selectedDupeCount { return [[self py] selectedDupeCount]; diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index f90967d5..2c3caee6 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -31,7 +31,6 @@ http://www.hardcoded.net/licenses/bsd_license [self fillColumnsMenu]; [matches setTarget:self]; [matches setDoubleAction:@selector(openClicked:)]; - [table setDeltaColumns:[NSSet setWithArray:[py deltaColumns]]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobCompleted:) name:JobCompletedNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jobStarted:) name:JobStarted object:nil]; diff --git a/cocoa/inter/app.py b/cocoa/inter/app.py index f7816bba..8b42a652 100644 --- a/cocoa/inter/app.py +++ b/cocoa/inter/app.py @@ -127,9 +127,6 @@ class PyDupeGuruBase(PyFairware): def resultsAreModified(self): return self.py.results.is_modified - def deltaColumns(self): - return list(self.py.DELTA_COLUMNS) - #---Properties @signature('v@:c') def setMixFileKind_(self, mix_file_kind): diff --git a/cocoa/inter/result_table.py b/cocoa/inter/result_table.py index 85aabf3c..620b25e9 100644 --- a/cocoa/inter/result_table.py +++ b/cocoa/inter/result_table.py @@ -17,6 +17,9 @@ class PyResultTable(PyTable): def setDeltaValuesMode_(self, value): self.py.delta_values = value + def deltaColumns(self): + return list(self.py.DELTA_COLUMNS) + @signature('@@:i@') def valueForRow_column_(self, row_index, column): return self.py.get_row_value(row_index, column) diff --git a/core_me/app.py b/core_me/app.py index e8319c8a..2189554b 100644 --- a/core_me/app.py +++ b/core_me/app.py @@ -16,7 +16,6 @@ from .result_table import ResultTable class DupeGuru(DupeGuruBase): NAME = __appname__ - DELTA_COLUMNS = {'size', 'duration', 'bitrate', 'samplerate', 'mtime'} METADATA_TO_READ = ['size', 'mtime', 'duration', 'bitrate', 'samplerate', 'title', 'artist', 'album', 'genre', 'year', 'track', 'comment'] @@ -74,7 +73,7 @@ class DupeGuru(DupeGuruBase): if key == 'dupe_count': return 0 r = cmp_value(dupe, key) - if delta and (key in self.DELTA_COLUMNS): + if delta and (key in self.result_table.DELTA_COLUMNS): r -= cmp_value(get_group().ref, key) return r diff --git a/core_me/result_table.py b/core_me/result_table.py index 6eb24ede..5dfd777d 100644 --- a/core_me/result_table.py +++ b/core_me/result_table.py @@ -34,3 +34,4 @@ class ResultTable(ResultTableBase): Column('words', coltr("Words Used"), visible=False, optional=True), Column('dupe_count', coltr("Dupe Count"), visible=False, optional=True), ] + DELTA_COLUMNS = {'size', 'duration', 'bitrate', 'samplerate', 'mtime'} diff --git a/core_pe/app.py b/core_pe/app.py index da430975..efee86d9 100644 --- a/core_pe/app.py +++ b/core_pe/app.py @@ -24,7 +24,6 @@ def get_delta_dimensions(value, ref_value): class DupeGuru(DupeGuruBase): NAME = __appname__ - DELTA_COLUMNS = {'size', 'dimensions', 'mtime'} METADATA_TO_READ = ['size', 'mtime', 'dimensions'] def __init__(self, view, appdata): @@ -71,7 +70,7 @@ class DupeGuru(DupeGuruBase): dupe_folder_path = getattr(dupe, 'display_folder_path', dupe.folder_path) return str(dupe_folder_path).lower() r = cmp_value(dupe, key) - if delta and (key in self.DELTA_COLUMNS): + if delta and (key in self.result_table.DELTA_COLUMNS): ref_value = cmp_value(get_group().ref, key) if key == 4: # dimensions r = get_delta_dimensions(r, ref_value) diff --git a/core_pe/result_table.py b/core_pe/result_table.py index b6be5a1a..1efda016 100644 --- a/core_pe/result_table.py +++ b/core_pe/result_table.py @@ -24,3 +24,4 @@ class ResultTable(ResultTableBase): Column('percentage', coltr("Match %"), optional=True), Column('dupe_count', coltr("Dupe Count"), visible=False, optional=True), ] + DELTA_COLUMNS = {'size', 'dimensions', 'mtime'} diff --git a/core_se/app.py b/core_se/app.py index 274f3c87..36c9c19e 100644 --- a/core_se/app.py +++ b/core_se/app.py @@ -15,7 +15,6 @@ from .result_table import ResultTable class DupeGuru(DupeGuruBase): NAME = __appname__ - DELTA_COLUMNS = {'size', 'mtime'} METADATA_TO_READ = ['size', 'mtime'] def __init__(self, view, appdata): @@ -54,7 +53,7 @@ class DupeGuru(DupeGuruBase): if key == 'dupe_count': return 0 r = cmp_value(dupe, key) - if delta and (key in self.DELTA_COLUMNS): + if delta and (key in self.result_table.DELTA_COLUMNS): r -= cmp_value(get_group().ref, key) return r diff --git a/core_se/result_table.py b/core_se/result_table.py index 3358099c..fa484cad 100644 --- a/core_se/result_table.py +++ b/core_se/result_table.py @@ -24,3 +24,4 @@ class ResultTable(ResultTableBase): Column('words', coltr("Words Used"), visible=False, optional=True), Column('dupe_count', coltr("Dupe Count"), visible=False, optional=True), ] + DELTA_COLUMNS = {'size', 'mtime'}