1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2025-03-10 05:34:36 +00:00

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)saveSession;
- (void)clearIgnoreList; - (void)clearIgnoreList;
- (void)purgeIgnoreList; - (void)purgeIgnoreList;
- (NSString *)exportToXHTMLwithColumns:(NSArray *)aColIds; - (NSString *)exportToXHTML;
- (void)invokeCommand:(NSString *)cmd; - (void)invokeCommand:(NSString *)cmd;
- (void)doScan; - (void)doScan;

View File

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

View File

@ -75,17 +75,6 @@ http://www.hardcoded.net/licenses/bsd_license
[mi setTarget:self]; [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 - (void)sendMarkedToTrash:(BOOL)hardlinkDeleted
{ {
NSInteger mark_count = [[py getMarkCount] intValue]; NSInteger mark_count = [[py getMarkCount] intValue];
@ -172,8 +161,7 @@ http://www.hardcoded.net/licenses/bsd_license
- (IBAction)exportToXHTML:(id)sender - (IBAction)exportToXHTML:(id)sender
{ {
// XXX No need to get column order from GUI anymore. NSString *exported = [py exportToXHTML];
NSString *exported = [py exportToXHTMLwithColumns:[self getColumnsOrder]];
[[NSWorkspace sharedWorkspace] openFile:exported]; [[NSWorkspace sharedWorkspace] openFile:exported];
} }

View File

@ -48,8 +48,8 @@ class PyDupeGuruBase(PyFairware):
def doScan(self): def doScan(self):
self.py.start_scanning() self.py.start_scanning()
def exportToXHTMLwithColumns_(self, column_ids): def exportToXHTML(self):
return self.py.export_to_xhtml(column_ids) return self.py.export_to_xhtml()
def loadSession(self): def loadSession(self):
self.py.load() self.py.load()

View File

@ -12,7 +12,6 @@ import logging
import subprocess import subprocess
import re import re
import time import time
from collections import namedtuple
from send2trash import send2trash from send2trash import send2trash
from hscommon import io from hscommon import io
@ -273,16 +272,15 @@ class DupeGuru(RegistrableApplication, Broadcaster):
self.show_extra_fairware_reminder_if_needed() self.show_extra_fairware_reminder_if_needed()
self.view.start_job(JobType.Delete, self._do_delete, args=[replace_with_hardlinks]) self.view.start_job(JobType.Delete, self._do_delete, args=[replace_with_hardlinks])
def export_to_xhtml(self, column_ids): def export_to_xhtml(self):
column_ids = [colid for colid in column_ids if colid.isdigit()] columns = [col for col in self.result_table.columns.ordered_columns
column_ids = list(map(int, column_ids)) if col.visible and col.name != 'marked']
column_ids.sort() colnames = [col.display for col in columns]
colnames = [col.display for i, col in enumerate(self.result_table.COLUMNS) if i in column_ids]
rows = [] rows = []
for group in self.results.groups: for group in self.results.groups:
for dupe in group: for dupe in group:
data = self.get_display_info(dupe, 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) row.insert(0, dupe is not group.ref)
rows.append(row) rows.append(row)
return export.export_to_xhtml(colnames, rows) return export.export_to_xhtml(colnames, rows)