mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
[#115 state:fixed] Re-factored the data columns (and delta columns) and made the Dimensions column a delta one.
This commit is contained in:
@@ -9,23 +9,24 @@
|
||||
from hscommon.util import format_size
|
||||
from hscommon.trans import tr as trbase
|
||||
from core.data import (format_path, format_timestamp, format_words, format_perc,
|
||||
format_dupe_count, cmp_value)
|
||||
format_dupe_count, cmp_value, Column)
|
||||
|
||||
tr = lambda s: trbase(s, 'columns')
|
||||
|
||||
COLUMNS = [
|
||||
{'attr':'name', 'display': tr("Filename")},
|
||||
{'attr':'path', 'display': tr("Folder")},
|
||||
{'attr':'size', 'display': tr("Size (KB)")},
|
||||
{'attr':'extension', 'display': tr("Kind")},
|
||||
{'attr':'mtime', 'display': tr("Modification")},
|
||||
{'attr':'percentage', 'display': tr("Match %")},
|
||||
{'attr':'words', 'display': tr("Words Used")},
|
||||
{'attr':'dupe_count', 'display': tr("Dupe Count")},
|
||||
Column('name', tr("Filename")),
|
||||
Column('path', tr("Folder")),
|
||||
Column('size', tr("Size (KB)")),
|
||||
Column('extension', tr("Kind")),
|
||||
Column('mtime', tr("Modification")),
|
||||
Column('percentage', tr("Match %")),
|
||||
Column('words', tr("Words Used")),
|
||||
Column('dupe_count', tr("Dupe Count")),
|
||||
]
|
||||
|
||||
MATCHPERC_COL = 5
|
||||
DUPECOUNT_COL = 7
|
||||
DELTA_COLUMNS = {2, 4}
|
||||
|
||||
METADATA_TO_READ = ['size', 'mtime']
|
||||
|
||||
@@ -60,9 +61,9 @@ def GetDupeSortKey(dupe, get_group, key, delta):
|
||||
return m.percentage
|
||||
if key == DUPECOUNT_COL:
|
||||
return 0
|
||||
r = cmp_value(getattr(dupe, COLUMNS[key]['attr'], ''))
|
||||
r = cmp_value(getattr(dupe, COLUMNS[key].attr, ''))
|
||||
if delta and (key in {2, 4}):
|
||||
r -= cmp_value(getattr(get_group().ref, COLUMNS[key]['attr'], ''))
|
||||
r -= cmp_value(getattr(get_group().ref, COLUMNS[key].attr, ''))
|
||||
return r
|
||||
|
||||
def GetGroupSortKey(group, key):
|
||||
@@ -70,4 +71,4 @@ def GetGroupSortKey(group, key):
|
||||
return group.percentage
|
||||
if key == DUPECOUNT_COL:
|
||||
return len(group)
|
||||
return cmp_value(getattr(group.ref, COLUMNS[key]['attr'], ''))
|
||||
return cmp_value(getattr(group.ref, COLUMNS[key].attr, ''))
|
||||
|
||||
Reference in New Issue
Block a user