From fca66d51080a173f068db13024bde5a65e01a499 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 27 Nov 2011 13:02:59 -0500 Subject: [PATCH] Fixed HTML exporting. --- cocoa/base/PyDupeGuru.h | 2 +- cocoa/base/ResultWindow.h | 1 - cocoa/base/ResultWindow.m | 14 +------------- cocoa/inter/app.py | 4 ++-- core/app.py | 12 +++++------- 5 files changed, 9 insertions(+), 24 deletions(-) diff --git a/cocoa/base/PyDupeGuru.h b/cocoa/base/PyDupeGuru.h index de664420..7455b729 100644 --- a/cocoa/base/PyDupeGuru.h +++ b/cocoa/base/PyDupeGuru.h @@ -22,7 +22,7 @@ http://www.hardcoded.net/licenses/bsd_license - (void)saveSession; - (void)clearIgnoreList; - (void)purgeIgnoreList; -- (NSString *)exportToXHTMLwithColumns:(NSArray *)aColIds; +- (NSString *)exportToXHTML; - (void)invokeCommand:(NSString *)cmd; - (void)doScan; diff --git a/cocoa/base/ResultWindow.h b/cocoa/base/ResultWindow.h index 8d4bf570..de7215c9 100644 --- a/cocoa/base/ResultWindow.h +++ b/cocoa/base/ResultWindow.h @@ -40,7 +40,6 @@ http://www.hardcoded.net/licenses/bsd_license /* Helpers */ - (void)fillColumnsMenu; -- (NSArray *)getColumnsOrder; - (void)sendMarkedToTrash:(BOOL)hardlinkDeleted; - (void)updateOptionSegments; diff --git a/cocoa/base/ResultWindow.m b/cocoa/base/ResultWindow.m index 3e47f1a2..f90967d5 100644 --- a/cocoa/base/ResultWindow.m +++ b/cocoa/base/ResultWindow.m @@ -75,17 +75,6 @@ http://www.hardcoded.net/licenses/bsd_license [mi setTarget:self]; } -//Returns an array of identifiers, in order. -- (NSArray *)getColumnsOrder -{ - NSMutableArray *result = [NSMutableArray array]; - for (NSTableColumn *col in [matches tableColumns]) { - NSString *colId = [col identifier]; - [result addObject:colId]; - } - return result; -} - - (void)sendMarkedToTrash:(BOOL)hardlinkDeleted { NSInteger mark_count = [[py getMarkCount] intValue]; @@ -172,8 +161,7 @@ http://www.hardcoded.net/licenses/bsd_license - (IBAction)exportToXHTML:(id)sender { - // XXX No need to get column order from GUI anymore. - NSString *exported = [py exportToXHTMLwithColumns:[self getColumnsOrder]]; + NSString *exported = [py exportToXHTML]; [[NSWorkspace sharedWorkspace] openFile:exported]; } diff --git a/cocoa/inter/app.py b/cocoa/inter/app.py index 94ab4f4d..f7816bba 100644 --- a/cocoa/inter/app.py +++ b/cocoa/inter/app.py @@ -48,8 +48,8 @@ class PyDupeGuruBase(PyFairware): def doScan(self): self.py.start_scanning() - def exportToXHTMLwithColumns_(self, column_ids): - return self.py.export_to_xhtml(column_ids) + def exportToXHTML(self): + return self.py.export_to_xhtml() def loadSession(self): self.py.load() diff --git a/core/app.py b/core/app.py index 3f5443e5..6e117106 100644 --- a/core/app.py +++ b/core/app.py @@ -12,7 +12,6 @@ import logging import subprocess import re import time -from collections import namedtuple from send2trash import send2trash from hscommon import io @@ -273,16 +272,15 @@ class DupeGuru(RegistrableApplication, Broadcaster): self.show_extra_fairware_reminder_if_needed() self.view.start_job(JobType.Delete, self._do_delete, args=[replace_with_hardlinks]) - def export_to_xhtml(self, column_ids): - column_ids = [colid for colid in column_ids if colid.isdigit()] - column_ids = list(map(int, column_ids)) - column_ids.sort() - colnames = [col.display for i, col in enumerate(self.result_table.COLUMNS) if i in column_ids] + def export_to_xhtml(self): + columns = [col for col in self.result_table.columns.ordered_columns + if col.visible and col.name != 'marked'] + colnames = [col.display for col in columns] rows = [] for group in self.results.groups: for dupe in group: data = self.get_display_info(dupe, group) - row = [data[colid] for colid in column_ids] + row = [data[col.name] for col in columns] row.insert(0, dupe is not group.ref) rows.append(row) return export.export_to_xhtml(colnames, rows)