From 3767a9fd27ea531b9de6bc378bcec6f9c0f6b0ea Mon Sep 17 00:00:00 2001 From: bendikro Date: Mon, 31 Aug 2015 14:24:45 +0200 Subject: [PATCH] [GTKUI] Fix issue in torrentview where columns shared datafunc --- deluge/ui/gtkui/torrentview.py | 4 ++-- deluge/ui/gtkui/torrentview_data_funcs.py | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index e835c0745..82274984d 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -267,9 +267,9 @@ class TorrentView(ListView, component.Component): status_field=["ratio"], default=False) self.add_func_column(_("Avail"), funcs.cell_data_ratio_avail, [float], status_field=["distributed_copies"], default=False) - self.add_func_column(_("Added"), funcs.cell_data_date, [float], + self.add_func_column(_("Added"), funcs.cell_data_date_added, [float], status_field=["time_added"], default=False) - self.add_func_column(_("Completed"), funcs.cell_data_date, [float], + self.add_func_column(_("Completed"), funcs.cell_data_date_completed, [float], status_field=["completed_time"], default=False) self.add_func_column(_("Complete Seen"), funcs.cell_data_date_or_never, [float], status_field=["last_seen_complete"], default=False) diff --git a/deluge/ui/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py index 2872ec6b2..54e544932 100644 --- a/deluge/ui/gtkui/torrentview_data_funcs.py +++ b/deluge/ui/gtkui/torrentview_data_funcs.py @@ -10,6 +10,7 @@ from __future__ import print_function import warnings +from functools import partial import gobject import gtk @@ -47,7 +48,8 @@ func_last_value = {"cell_data_speed_down": None, "cell_data_ratio_seeds_peers": None, "cell_data_ratio_ratio": None, "cell_data_ratio_avail": None, - "cell_data_date": None, + "cell_data_date_added": None, + "cell_data_date_completed": None, "cell_data_date_or_never": None, "cell_data_speed_limit_down": None, "cell_data_speed_limit_up": None, @@ -259,17 +261,20 @@ def cell_data_ratio_avail(column, cell, model, row, data): cell_data_ratio(cell, model, row, data, "cell_data_ratio_avail") -def cell_data_date(column, cell, model, row, data): +def cell_data_date(column, cell, model, row, data, key): """Display value as date, eg 05/05/08""" date = model.get_value(row, data) - if func_last_value["cell_data_date"] == date: + if func_last_value[key] == date: return - func_last_value["cell_data_date"] = date + func_last_value[key] = date date_str = common.fdate(date) if date > 0.0 else "" cell.set_property('text', date_str) +cell_data_date_added = partial(cell_data_date, key="cell_data_date_added") +cell_data_date_completed = partial(cell_data_date, key="cell_data_date_completed") + def cell_data_date_or_never(column, cell, model, row, data): """Display value as date, eg 05/05/08 or Never"""