2010-02-05 19:10:54 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2010-02-05
|
2011-04-12 08:04:01 +00:00
|
|
|
# Copyright 2011 Hardcoded Software (http://www.hardcoded.net)
|
2010-02-05 19:10:54 +00:00
|
|
|
#
|
2010-09-30 10:17:41 +00:00
|
|
|
# This software is licensed under the "BSD" License as described in the "LICENSE" file,
|
2010-02-05 19:10:54 +00:00
|
|
|
# which should be included with this package. The terms are also available at
|
2010-09-30 10:17:41 +00:00
|
|
|
# http://www.hardcoded.net/licenses/bsd_license
|
2010-02-05 19:10:54 +00:00
|
|
|
|
2010-02-07 14:26:50 +00:00
|
|
|
from .base import GUIObject
|
2010-02-05 19:10:54 +00:00
|
|
|
|
2010-02-07 14:26:50 +00:00
|
|
|
class DetailsPanel(GUIObject):
|
2010-02-05 19:10:54 +00:00
|
|
|
def __init__(self, view, app):
|
2010-02-07 14:26:50 +00:00
|
|
|
GUIObject.__init__(self, view, app)
|
2010-02-05 19:10:54 +00:00
|
|
|
self._table = []
|
2010-02-12 14:39:29 +00:00
|
|
|
|
|
|
|
def connect(self):
|
|
|
|
GUIObject.connect(self)
|
2010-02-05 19:10:54 +00:00
|
|
|
self._refresh()
|
2010-02-12 14:39:29 +00:00
|
|
|
self.view.refresh()
|
2010-02-05 19:10:54 +00:00
|
|
|
|
|
|
|
#--- 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)
|
2011-01-29 10:07:33 +00:00
|
|
|
names = [c.display for c in self.app.data.COLUMNS]
|
2010-08-11 14:39:06 +00:00
|
|
|
self._table = list(zip(names, l1, l2))
|
2010-02-05 19:10:54 +00:00
|
|
|
|
|
|
|
#--- Public
|
|
|
|
def row_count(self):
|
|
|
|
return len(self._table)
|
|
|
|
|
|
|
|
def row(self, row_index):
|
|
|
|
return self._table[row_index]
|
|
|
|
|
|
|
|
#--- Event Handlers
|
2010-02-05 19:32:57 +00:00
|
|
|
def dupes_selected(self):
|
2010-02-05 19:10:54 +00:00
|
|
|
self._refresh()
|
|
|
|
self.view.refresh()
|
|
|
|
|