[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 <calumlind+deluge@gmail.com>
This commit is contained in:
kbdserver 2018-09-28 14:48:49 +01:00 committed by Calum Lind
parent 55aee2b00f
commit 7d896599b8
1 changed files with 4 additions and 15 deletions

View File

@ -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
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):