2010-02-05 19:10:54 +00:00
|
|
|
# Created By: Virgil Dupras
|
|
|
|
# Created On: 2010-02-05
|
2015-01-03 21:30:57 +00:00
|
|
|
# Copyright 2015 Hardcoded Software (http://www.hardcoded.net)
|
2010-02-05 19:10:54 +00:00
|
|
|
#
|
2015-01-03 21:33:16 +00:00
|
|
|
# This software is licensed under the "GPLv3" 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
|
2015-01-03 21:33:16 +00:00
|
|
|
# http://www.gnu.org/licenses/gpl-3.0.html
|
2010-02-05 19:10:54 +00:00
|
|
|
|
2012-03-13 18:27:08 +00:00
|
|
|
from hscommon.gui.base import GUIObject
|
|
|
|
from .base import DupeGuruGUIObject
|
2010-02-05 19:10:54 +00:00
|
|
|
|
2012-03-13 18:27:08 +00:00
|
|
|
class DetailsPanel(GUIObject, DupeGuruGUIObject):
|
2012-01-13 21:14:06 +00:00
|
|
|
def __init__(self, app):
|
2012-03-13 18:27:08 +00:00
|
|
|
GUIObject.__init__(self)
|
|
|
|
DupeGuruGUIObject.__init__(self, app)
|
2010-02-05 19:10:54 +00:00
|
|
|
self._table = []
|
2010-02-12 14:39:29 +00:00
|
|
|
|
2012-03-13 18:27:08 +00:00
|
|
|
def _view_updated(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
|
2011-11-27 17:47:00 +00:00
|
|
|
data1 = self.app.get_display_info(dupe, group, False)
|
2010-02-05 19:10:54 +00:00
|
|
|
# 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
|
2011-11-27 17:47:00 +00:00
|
|
|
data2 = self.app.get_display_info(ref, group, False)
|
|
|
|
columns = self.app.result_table.COLUMNS[1:] # first column is the 'marked' column
|
|
|
|
self._table = [(c.display, data1[c.name], data2[c.name]) for c in columns]
|
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()
|
|
|
|
|