Fixed HTML exporting.

This commit is contained in:
Virgil Dupras 2011-11-27 13:02:59 -05:00
parent 0571151c5f
commit fca66d5108
5 changed files with 9 additions and 24 deletions

View File

@ -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;

View File

@ -40,7 +40,6 @@ http://www.hardcoded.net/licenses/bsd_license
/* Helpers */
- (void)fillColumnsMenu;
- (NSArray *)getColumnsOrder;
- (void)sendMarkedToTrash:(BOOL)hardlinkDeleted;
- (void)updateOptionSegments;

View File

@ -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];
}

View File

@ -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()

View File

@ -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)