[GTKUI] Fix issue in torrentview where columns shared datafunc
This commit is contained in:
parent
ff1f64d9bc
commit
3767a9fd27
|
@ -267,9 +267,9 @@ class TorrentView(ListView, component.Component):
|
||||||
status_field=["ratio"], default=False)
|
status_field=["ratio"], default=False)
|
||||||
self.add_func_column(_("Avail"), funcs.cell_data_ratio_avail, [float],
|
self.add_func_column(_("Avail"), funcs.cell_data_ratio_avail, [float],
|
||||||
status_field=["distributed_copies"], default=False)
|
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)
|
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)
|
status_field=["completed_time"], default=False)
|
||||||
self.add_func_column(_("Complete Seen"), funcs.cell_data_date_or_never, [float],
|
self.add_func_column(_("Complete Seen"), funcs.cell_data_date_or_never, [float],
|
||||||
status_field=["last_seen_complete"], default=False)
|
status_field=["last_seen_complete"], default=False)
|
||||||
|
|
|
@ -10,6 +10,7 @@
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import warnings
|
import warnings
|
||||||
|
from functools import partial
|
||||||
|
|
||||||
import gobject
|
import gobject
|
||||||
import gtk
|
import gtk
|
||||||
|
@ -47,7 +48,8 @@ func_last_value = {"cell_data_speed_down": None,
|
||||||
"cell_data_ratio_seeds_peers": None,
|
"cell_data_ratio_seeds_peers": None,
|
||||||
"cell_data_ratio_ratio": None,
|
"cell_data_ratio_ratio": None,
|
||||||
"cell_data_ratio_avail": 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_date_or_never": None,
|
||||||
"cell_data_speed_limit_down": None,
|
"cell_data_speed_limit_down": None,
|
||||||
"cell_data_speed_limit_up": 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")
|
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"""
|
"""Display value as date, eg 05/05/08"""
|
||||||
date = model.get_value(row, data)
|
date = model.get_value(row, data)
|
||||||
|
|
||||||
if func_last_value["cell_data_date"] == date:
|
if func_last_value[key] == date:
|
||||||
return
|
return
|
||||||
func_last_value["cell_data_date"] = date
|
func_last_value[key] = date
|
||||||
|
|
||||||
date_str = common.fdate(date) if date > 0.0 else ""
|
date_str = common.fdate(date) if date > 0.0 else ""
|
||||||
cell.set_property('text', date_str)
|
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):
|
def cell_data_date_or_never(column, cell, model, row, data):
|
||||||
"""Display value as date, eg 05/05/08 or Never"""
|
"""Display value as date, eg 05/05/08 or Never"""
|
||||||
|
|
Loading…
Reference in New Issue