From 7d896599b835808eef8dd29f104e4f980a0b3e7f Mon Sep 17 00:00:00 2001 From: kbdserver Date: Fri, 28 Sep 2018 14:48:49 +0100 Subject: [PATCH] [GTK] Fix speed appearing in blanks cells In TorrentView and PeersTabView, when moving the mouse pointer through rows, the value in download and upload speed columns can be overwritten by value from previous row cell. The solution is to disable return by cached condition in function cell_data_speed. Discussion: https://github.com/deluge-torrent/deluge/pull/200#issuecomment-424907571 Removed debugging code. Co-authored-by: Calum Lind --- deluge/ui/gtkui/torrentview_data_funcs.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/deluge/ui/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py index db57355be..d4da75831 100644 --- a/deluge/ui/gtkui/torrentview_data_funcs.py +++ b/deluge/ui/gtkui/torrentview_data_funcs.py @@ -41,8 +41,6 @@ ICON_STATE = { # renderer. This is much cheaper than fetch the current value and test if # it's equal. func_last_value = { - 'cell_data_speed_down': None, - 'cell_data_speed_up': None, 'cell_data_time': None, 'cell_data_ratio_seeds_peers': None, 'cell_data_ratio_ratio': None, @@ -156,18 +154,9 @@ def cell_data_queue(column, cell, model, row, data): cell.set_property('text', str(value + 1)) -def cell_data_speed(cell, model, row, data, cache_key): +def cell_data_speed(cell, model, row, data): """Display value as a speed, eg. 2 KiB/s""" - try: - speed = model.get_value(row, data) - except AttributeError: - print('AttributeError') - import traceback - - traceback.print_exc() - if func_last_value[cache_key] == speed: - return - func_last_value[cache_key] = speed + speed = model.get_value(row, data) if speed > 0: speed_str = common.fspeed(speed, shortform=True) @@ -180,12 +169,12 @@ def cell_data_speed(cell, model, row, data, cache_key): def cell_data_speed_down(column, cell, model, row, data): """Display value as a speed, eg. 2 KiB/s""" - cell_data_speed(cell, model, row, data, 'cell_data_speed_down') + cell_data_speed(cell, model, row, data) def cell_data_speed_up(column, cell, model, row, data): """Display value as a speed, eg. 2 KiB/s""" - cell_data_speed(cell, model, row, data, 'cell_data_speed_up') + cell_data_speed(cell, model, row, data) def cell_data_speed_limit(cell, model, row, data, cache_key):