1
0
mirror of https://github.com/arsenetar/dupeguru.git synced 2026-01-22 06:37:17 +00:00

Created gui.details_panel and moved all details panel related logic in there (cocoa only, for now).

This commit is contained in:
Virgil Dupras
2010-02-05 20:10:54 +01:00
parent cd9b7f2f11
commit 7ffefe6259
22 changed files with 273 additions and 182 deletions

0
core/gui/__init__.py Normal file
View File

47
core/gui/details_panel.py Normal file
View File

@@ -0,0 +1,47 @@
# -*- coding: utf-8 -*-
# Created By: Virgil Dupras
# Created On: 2010-02-05
# Copyright 2010 Hardcoded Software (http://www.hardcoded.net)
#
# This software is licensed under the "HS" License as described in the "LICENSE" file,
# which should be included with this package. The terms are also available at
# http://www.hardcoded.net/licenses/hs_license
from hsutil.notify import Listener
class DetailsPanel(Listener):
def __init__(self, view, app):
Listener.__init__(self, app)
self.app = app
self.view = view
self._table = []
self._refresh()
self.connect()
#--- Private
def _refresh(self):
if self.app.selected_dupes:
dupe = self.app.selected_dupes[0]
group = self.app.results.get_group_of_duplicate(dupe)
else:
dupe = None
group = None
l1 = self.app._get_display_info(dupe, group, False)
# we don't want the two sides of the table to display the stats for the same file
ref = group.ref if group is not None and group.ref is not dupe else None
l2 = self.app._get_display_info(ref, group, False)
names = [c['display'] for c in self.app.data.COLUMNS]
self._table = zip(names, l1, l2)
#--- Public
def row_count(self):
return len(self._table)
def row(self, row_index):
return self._table[row_index]
#--- Event Handlers
def details_table_changed(self):
self._refresh()
self.view.refresh()