diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py
index 55006cd65..863902128 100644
--- a/deluge/ui/gtkui/details_tab.py
+++ b/deluge/ui/gtkui/details_tab.py
@@ -17,8 +17,8 @@ from deluge.ui.gtkui.torrentdetails import Tab
log = logging.getLogger(__name__)
-def fpeer_size_second(first, second):
- return "%s (%s)" % (first, fsize(second))
+def fpieces_num_size(num_pieces, piece_size):
+ return "%s (%s)" % (num_pieces, fsize(piece_size, precision=0))
def fdate_or_dash(value):
@@ -57,7 +57,7 @@ class DetailsTab(Tab):
(builder.get_object("summary_comments"), str, ("comment",)),
(builder.get_object("summary_owner"), str, ("owner",)),
(builder.get_object("summary_shared"), str_yes_no, ("shared",)),
- (builder.get_object("summary_pieces"), fpeer_size_second, ("num_pieces", "piece_length")),
+ (builder.get_object("summary_pieces"), fpieces_num_size, ("num_pieces", "piece_length")),
]
self.status_keys = [status for widget in self.label_widgets for status in widget[2]]
diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py
index 439c5b734..d373ca954 100644
--- a/deluge/ui/gtkui/files_tab.py
+++ b/deluge/ui/gtkui/files_tab.py
@@ -433,7 +433,7 @@ class FilesTab(Tab):
# Catch the unusal error found when moving folders around
value = 0
self.treestore[parent][3] = value
- self.treestore[parent][2] = "%.2f%%" % value
+ self.treestore[parent][2] = "%i%%" % value
return completed_bytes
get_completed_bytes(self.treestore.iter_children(root))
@@ -464,7 +464,7 @@ class FilesTab(Tab):
continue
try:
- progress_string = "%.2f%%" % (status["file_progress"][index] * 100)
+ progress_string = "%i%%" % (status["file_progress"][index] * 100)
except IndexError:
continue
if row[2] != progress_string:
diff --git a/deluge/ui/gtkui/glade/main_window.tabs.ui b/deluge/ui/gtkui/glade/main_window.tabs.ui
index 17f144fd7..af2fa31ce 100644
--- a/deluge/ui/gtkui/glade/main_window.tabs.ui
+++ b/deluge/ui/gtkui/glade/main_window.tabs.ui
@@ -246,58 +246,11 @@
GTK_FILL
-
-
-
- 3
- 4
- GTK_FILL
-
-
-
-
- True
- False
- 5
-
-
- True
- False
- 0
- Downloaded:
-
-
-
-
-
-
-
- 2
- 3
- GTK_FILL
-
-
True
False
0
- 5
1
@@ -312,7 +265,6 @@
True
False
0
- 5
1
@@ -322,33 +274,11 @@
GTK_FILL
-
-
- True
- False
- 5
-
-
- True
- False
- 0
- Down Speed:
-
-
-
-
-
-
-
- GTK_FILL
-
-
True
False
0
- 5
1
@@ -356,35 +286,11 @@
GTK_FILL
-
-
- True
- False
- 5
-
-
- True
- False
- 0
- Up Speed:
-
-
-
-
-
-
-
- 1
- 2
- GTK_FILL
-
-
True
False
0
- 5
1
@@ -394,29 +300,6 @@
GTK_FILL
-
-
- True
- False
- 5
-
-
- True
- False
- 0
- ETA:
-
-
-
-
-
-
-
- 3
- 4
- GTK_FILL
-
-
True
@@ -527,38 +410,6 @@
GTK_FILL
-
-
- True
- False
- 0
- Share Ratio:
-
-
-
-
-
- 3
- 4
- 3
- 4
- GTK_FILL
-
-
-
-
- True
- False
- 0
-
-
- 4
- 5
- 3
- 4
- GTK_FILL
-
-
True
@@ -596,11 +447,138 @@
3
4
+ 3
+ 4
+ GTK_FILL
+
+
+
+
+ True
+ False
+ 0
+
+
+ 1
+ 2
4
5
GTK_FILL
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+ Downloaded:
+
+
+
+
+
+
+
+ 2
+ 3
+ GTK_FILL
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+ Down Speed:
+
+
+
+
+
+
+
+ GTK_FILL
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+ Up Speed:
+
+
+
+
+
+
+
+ 1
+ 2
+ GTK_FILL
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+ ETA:
+
+
+
+
+
+
+
+ 3
+ 4
+ GTK_FILL
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+ Uploaded:
+
+
+
+
+
+
+
+ 3
+ 4
+ GTK_FILL
+
+
True
@@ -610,6 +588,29 @@
4
5
+ 3
+ 4
+ GTK_FILL
+
+
+
+
+ True
+ False
+ 5
+
+
+ True
+ False
+ 0
+ Share Ratio:
+
+
+
+
+
+
+
4
5
GTK_FILL
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index 99d4d79c0..4f5ee726f 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -520,7 +520,7 @@ class ListView(object):
column.set_clickable(True)
column.set_resizable(True)
column.set_expand(False)
- column.set_min_width(10)
+ column.set_min_width(20)
column.set_reorderable(True)
column.set_visible(not hidden)
column.connect('button-press-event',
diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py
index cfe4aa046..cd2e1c137 100644
--- a/deluge/ui/gtkui/mainwindow.py
+++ b/deluge/ui/gtkui/mainwindow.py
@@ -300,9 +300,9 @@ class MainWindow(component.Component):
def update(self):
# Update the window title
def _on_get_session_status(status):
- download_rate = deluge.common.fsize_short(status["payload_download_rate"])
- upload_rate = deluge.common.fsize_short(status["payload_upload_rate"])
- self.window.set_title("%s%s %s%s - Deluge" % (_("D:"), download_rate, _("U:"), upload_rate))
+ download_rate = deluge.common.fspeed(status["payload_download_rate"], precision=0, shortform=True)
+ upload_rate = deluge.common.fspeed(status["payload_upload_rate"], precision=0, shortform=True)
+ self.window.set_title(_("D: %s U: %s - Deluge" % (download_rate, upload_rate)))
if self.config["show_rate_in_title"]:
client.core.get_session_status(["payload_download_rate",
"payload_upload_rate"]).addCallback(_on_get_session_status)
@@ -311,7 +311,7 @@ class MainWindow(component.Component):
if value:
self.update()
else:
- self.window.set_title("Deluge")
+ self.window.set_title(_("Deluge"))
def on_newversionavailable_event(self, new_version):
if self.config["show_new_releases"]:
diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py
index 82ea2e1bf..4954e3217 100644
--- a/deluge/ui/gtkui/peers_tab.py
+++ b/deluge/ui/gtkui/peers_tab.py
@@ -25,9 +25,9 @@ log = logging.getLogger(__name__)
def cell_data_progress(column, cell, model, row, data):
- value = model.get_value(row, data)
- cell.set_property("value", value * 100)
- cell.set_property("text", "%.2f%%" % (value * 100))
+ value = model.get_value(row, data) * 100
+ cell.set_property("value", value)
+ cell.set_property("text", "%i%%" % value)
class PeersTab(Tab):
diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py
index 7cf131c0f..5c55cd0bc 100644
--- a/deluge/ui/gtkui/status_tab.py
+++ b/deluge/ui/gtkui/status_tab.py
@@ -18,8 +18,8 @@ from deluge.ui.gtkui.torrentdetails import Tab
log = logging.getLogger(__name__)
-def fpeer_sized(first, second):
- return "%s (%s)" % (fsize(first), fsize(second))
+def ftotal_sized(first, second):
+ return "%s (%s)" % (fsize(first, shortform=True), fsize(second, shortform=True))
def fratio(value):
@@ -31,16 +31,18 @@ def fratio(value):
def fpcnt(value, state):
- if state:
- state = _(state) + " "
- return "%s%.2f%%" % (state, value)
+ textstr = _(state)
+ if state not in ("Error", "Seeding") and value < 100:
+ textstr = ('%s %.2f' % (textstr, value)).rstrip('0').rstrip('.') + '%'
+ return textstr
def fspeed_max(value, max_value=-1):
+ value = fspeed(value, shortform=True)
if max_value > -1:
- return "%s (%s %s)" % (fspeed(value), max_value, _("KiB/s"))
+ return "%s (%s %s)" % (value, max_value, _("K/s"))
else:
- return fspeed(value)
+ return value
def fdate_or_never(value):
@@ -59,6 +61,14 @@ def ftime_or_dash(value):
return "-"
+def fseed_rank_or_dash(seed_rank, seeding_time):
+ """Display value if seeding otherwise dash"""
+ if seeding_time > 0.0:
+ return str(seed_rank)
+ else:
+ return "-"
+
+
class StatusTab(Tab):
def __init__(self):
Tab.__init__(self)
@@ -74,9 +84,9 @@ class StatusTab(Tab):
self.label_widgets = [
(builder.get_object("summary_availability"), fratio, ("distributed_copies",)),
- (builder.get_object("summary_total_downloaded"), fpeer_sized, ("all_time_download",
- "total_payload_download")),
- (builder.get_object("summary_total_uploaded"), fpeer_sized, ("total_uploaded", "total_payload_upload")),
+ (builder.get_object("summary_total_downloaded"), ftotal_sized, ("all_time_download",
+ "total_payload_download")),
+ (builder.get_object("summary_total_uploaded"), ftotal_sized, ("total_uploaded", "total_payload_upload")),
(builder.get_object("summary_download_speed"), fspeed_max, ("download_payload_rate", "max_download_speed")),
(builder.get_object("summary_upload_speed"), fspeed_max, ("upload_payload_rate", "max_upload_speed")),
(builder.get_object("summary_seeds"), fpeer, ("num_seeds", "total_seeds")),
@@ -85,7 +95,7 @@ class StatusTab(Tab):
(builder.get_object("summary_share_ratio"), fratio, ("ratio",)),
(builder.get_object("summary_active_time"), ftime_or_dash, ("active_time",)),
(builder.get_object("summary_seed_time"), ftime_or_dash, ("seeding_time",)),
- (builder.get_object("summary_seed_rank"), str, ("seed_rank",)),
+ (builder.get_object("summary_seed_rank"), fseed_rank_or_dash, ("seed_rank", "seeding_time")),
(builder.get_object("progressbar"), fpcnt, ("progress", "state")),
(builder.get_object("summary_last_seen_complete"), fdate_or_never, ("last_seen_complete",)),
(builder.get_object("summary_torrent_status"), str, ("message",)),
diff --git a/deluge/ui/gtkui/statusbar.py b/deluge/ui/gtkui/statusbar.py
index c18f27236..f5182f450 100644
--- a/deluge/ui/gtkui/statusbar.py
+++ b/deluge/ui/gtkui/statusbar.py
@@ -12,8 +12,8 @@ import logging
import gobject
import gtk
-import deluge.common
import deluge.component as component
+from deluge.common import fsize, fspeed, get_pixmap
from deluge.configmanager import ConfigManager
from deluge.ui.client import client
from deluge.ui.gtkui import common, dialogs
@@ -22,7 +22,7 @@ log = logging.getLogger(__name__)
class StatusBarItem(object):
- def __init__(self, image=None, stock=None, text=None, callback=None, tooltip=None):
+ def __init__(self, image=None, stock=None, text=None, markup=False, callback=None, tooltip=None):
self._widgets = []
self._ebox = gtk.EventBox()
self._hbox = gtk.HBox()
@@ -41,7 +41,10 @@ class StatusBarItem(object):
self.set_image_from_stock(stock)
# Add text
- self.set_text(text)
+ if markup:
+ self.set_markup(text)
+ else:
+ self.set_text(text)
if callback is not None:
self.set_callback(callback)
@@ -149,25 +152,25 @@ class StatusBar(component.Component):
self.connections_item = self.add_item(
stock=gtk.STOCK_NETWORK,
callback=self._on_connection_item_clicked,
- tooltip=_("Connections"), pack_start=True)
+ tooltip=_("Connections (Limit)"), pack_start=True)
self.download_item = self.add_item(
- image=deluge.common.get_pixmap("downloading16.png"),
+ image=get_pixmap("downloading16.png"),
callback=self._on_download_item_clicked,
- tooltip=_("Download Speed"), pack_start=True)
+ tooltip=_("Download Speed (Limit)"), pack_start=True)
self.upload_item = self.add_item(
- image=deluge.common.get_pixmap("seeding16.png"),
+ image=get_pixmap("seeding16.png"),
callback=self._on_upload_item_clicked,
- tooltip=_("Upload Speed"), pack_start=True)
+ tooltip=_("Upload Speed (Limit)"), pack_start=True)
self.traffic_item = self.add_item(
- image=deluge.common.get_pixmap("traffic16.png"),
+ image=get_pixmap("traffic16.png"),
callback=self._on_traffic_item_clicked,
- tooltip=_("Protocol Traffic Download/Upload"), pack_start=True)
+ tooltip=_("Protocol Traffic (Down:Up)"), pack_start=True)
self.dht_item = StatusBarItem(
- image=deluge.common.get_pixmap("dht16.png"), tooltip=_("DHT Nodes"))
+ image=get_pixmap("dht16.png"), tooltip=_("DHT Nodes"))
self.diskspace_item = self.add_item(
stock=gtk.STOCK_HARDDISK,
@@ -176,8 +179,10 @@ class StatusBar(component.Component):
self.health_item = self.add_item(
stock=gtk.STOCK_DIALOG_ERROR,
- text=_("No Incoming Connections!"),
- callback=self._on_health_icon_clicked, pack_start=True)
+ text=_("Port Issue"),
+ markup=True,
+ tooltip=_("No incoming connections, check port forwarding"),
+ callback=self._on_health_icon_clicked)
self.external_ip_item = self.add_item(
tooltip=_("External IP Address"), pack_start=True)
@@ -221,10 +226,10 @@ class StatusBar(component.Component):
self.hbox.pack_start(
self.not_connected_item.get_eventbox(), expand=False, fill=False)
- def add_item(self, image=None, stock=None, text=None, callback=None, tooltip=None, pack_start=False):
+ def add_item(self, image=None, stock=None, text=None, markup=False, callback=None, tooltip=None, pack_start=False):
"""Adds an item to the status bar"""
# The return tuple.. we return whatever widgets we add
- item = StatusBarItem(image, stock, text, callback, tooltip)
+ item = StatusBarItem(image, stock, text, markup, callback, tooltip)
if pack_start:
self.hbox.pack_start(item.get_eventbox(), expand=False, fill=False)
else:
@@ -298,8 +303,8 @@ class StatusBar(component.Component):
self.remove_item(self.dht_item)
def _on_get_session_status(self, status):
- self.download_rate = deluge.common.fspeed(status["payload_download_rate"])
- self.upload_rate = deluge.common.fspeed(status["payload_upload_rate"])
+ self.download_rate = fspeed(status["payload_download_rate"], precision=0, shortform=True)
+ self.upload_rate = fspeed(status["payload_upload_rate"], precision=0, shortform=True)
self.download_protocol_rate = (status["download_rate"] - status["payload_download_rate"]) / 1024
self.upload_protocol_rate = (status["upload_rate"] - status["payload_upload_rate"]) / 1024
self.num_connections = status["num_peers"]
@@ -319,7 +324,7 @@ class StatusBar(component.Component):
def _on_get_free_space(self, space):
if space >= 0:
- self.diskspace_item.set_text(deluge.common.fsize(space))
+ self.diskspace_item.set_markup("%s" % fsize(space, shortform=True))
else:
self.diskspace_item.set_markup("" + _("Error") + "")
@@ -333,44 +338,44 @@ class StatusBar(component.Component):
def _on_get_external_ip(self, external_ip):
ip = external_ip if external_ip else _("n/a")
- self.external_ip_item.set_markup(_("IP %s") % ip)
+ self.external_ip_item.set_markup(_("IP %s") % ip)
def update_connections_label(self):
# Set the max connections label
if self.max_connections_global < 0:
label_string = "%s" % self.num_connections
else:
- label_string = "%s (%s)" % (self.num_connections, self.max_connections_global)
+ label_string = "%s (%s)" % (self.num_connections, self.max_connections_global)
- self.connections_item.set_text(label_string)
+ self.connections_item.set_markup(label_string)
def update_dht_label(self):
# Set the max connections label
- self.dht_item.set_text("%s" % (self.dht_nodes))
+ self.dht_item.set_markup("%s" % (self.dht_nodes))
def update_download_label(self):
# Set the download speed label
if self.max_download_speed <= 0:
label_string = self.download_rate
else:
- label_string = "%s (%s %s)" % (
- self.download_rate, self.max_download_speed, _("KiB/s"))
+ label_string = "%s (%i %s)" % (
+ self.download_rate, self.max_download_speed, _("K/s"))
- self.download_item.set_text(label_string)
+ self.download_item.set_markup(label_string)
def update_upload_label(self):
# Set the upload speed label
if self.max_upload_speed <= 0:
label_string = self.upload_rate
else:
- label_string = "%s (%s %s)" % (
- self.upload_rate, self.max_upload_speed, _("KiB/s"))
+ label_string = "%s (%i %s)" % (
+ self.upload_rate, self.max_upload_speed, _("K/s"))
- self.upload_item.set_text(label_string)
+ self.upload_item.set_markup(label_string)
def update_traffic_label(self):
- label_string = "%i/%i %s" % (self.download_protocol_rate, self.upload_protocol_rate, _("KiB/s"))
- self.traffic_item.set_text(label_string)
+ label_string = "%i:%i %s" % (self.download_protocol_rate, self.upload_protocol_rate, _("K/s"))
+ self.traffic_item.set_markup(label_string)
def update(self):
self.send_status_request()
@@ -379,9 +384,9 @@ class StatusBar(component.Component):
log.debug("_on_set_unlimit_other %s", core_key)
other_dialog_info = {
"max_download_speed": (_("Download Speed Limit"), _("Set the maximum download speed"),
- _("KiB/s"), "downloading.svg", self.max_download_speed),
+ _("K/s"), "downloading.svg", self.max_download_speed),
"max_upload_speed": (_("Upload Speed Limit"), _("Set the maximum upload speed"),
- _("KiB/s"), "seeding.svg", self.max_upload_speed),
+ _("K/s"), "seeding.svg", self.max_upload_speed),
"max_connections_global": (_("Incoming Connections"), _("Set the maximum incoming connections"),
"", gtk.STOCK_NETWORK, self.max_connections_global)
}
@@ -413,7 +418,7 @@ class StatusBar(component.Component):
self.config["tray_download_speed_list"],
self._on_set_download_speed,
self.max_download_speed,
- _("KiB/s"), show_notset=True, show_other=True)
+ _("K/s"), show_notset=True, show_other=True)
menu.show_all()
menu.popup(None, None, None, event.button, event.time)
@@ -426,7 +431,7 @@ class StatusBar(component.Component):
self.config["tray_upload_speed_list"],
self._on_set_upload_speed,
self.max_upload_speed,
- _("KiB/s"), show_notset=True, show_other=True)
+ _("K/s"), show_notset=True, show_other=True)
menu.show_all()
menu.popup(None, None, None, event.button, event.time)
diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py
index 17e050eb5..215bad354 100644
--- a/deluge/ui/gtkui/systemtray.py
+++ b/deluge/ui/gtkui/systemtray.py
@@ -14,6 +14,7 @@ import gtk
import deluge.common
import deluge.component as component
+from deluge.common import fspeed
from deluge.configmanager import ConfigManager
from deluge.ui.client import client
from deluge.ui.gtkui import dialogs
@@ -192,8 +193,8 @@ class SystemTray(component.Component):
self.build_tray_bwsetsubmenu()
def _on_get_session_status(self, status):
- self.download_rate = deluge.common.fsize(status["payload_download_rate"])
- self.upload_rate = deluge.common.fsize(status["payload_upload_rate"])
+ self.download_rate = fspeed(status["payload_download_rate"], shortform=True)
+ self.upload_rate = fspeed(status["payload_upload_rate"], shortform=True)
def update(self):
if not self.config["enable_system_tray"]:
@@ -214,11 +215,11 @@ class SystemTray(component.Component):
if max_download_speed == -1:
max_download_speed = _("Unlimited")
else:
- max_download_speed = "%s %s" % (max_download_speed, _("KiB/s"))
+ max_download_speed = "%s %s" % (max_download_speed, _("K/s"))
if max_upload_speed == -1:
max_upload_speed = _("Unlimited")
else:
- max_upload_speed = "%s %s" % (max_upload_speed, _("KiB/s"))
+ max_upload_speed = "%s %s" % (max_upload_speed, _("K/s"))
msg = '%s\n%s: %s (%s)\n%s: %s (%s)' % (
_("Deluge"), _("Down"), self.download_rate,
@@ -235,14 +236,14 @@ class SystemTray(component.Component):
submenu_bwdownset = build_menu_radio_list(
self.config["tray_download_speed_list"], self.on_tray_setbwdown,
self.max_download_speed,
- _("KiB/s"), show_notset=True, show_other=True
+ _("K/s"), show_notset=True, show_other=True
)
# Create the Upload speed list sub-menu
submenu_bwupset = build_menu_radio_list(
self.config["tray_upload_speed_list"], self.on_tray_setbwup,
self.max_upload_speed,
- _("KiB/s"), show_notset=True, show_other=True
+ _("K/s"), show_notset=True, show_other=True
)
# Add the sub-menus to the tray menu
self.builder.get_object("menuitem_download_limit").set_submenu(
@@ -393,7 +394,7 @@ class SystemTray(component.Component):
if widget.get_name() == "unlimited":
set_value(-1)
elif widget.get_name() == "other":
- dialog = dialogs.OtherDialog(header, text, _("KiB/s"), image, default)
+ dialog = dialogs.OtherDialog(header, text, _("K/s"), image, default)
dialog.run().addCallback(set_value)
else:
set_value(widget.get_children()[0].get_text().split(" ")[0])
diff --git a/deluge/ui/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py
index f31c444e5..55d36f644 100644
--- a/deluge/ui/gtkui/torrentview_data_funcs.py
+++ b/deluge/ui/gtkui/torrentview_data_funcs.py
@@ -140,7 +140,7 @@ def cell_data_progress(column, cell, model, row, data):
# Marked for translate states text are in filtertreeview
textstr = _(state_str)
if state_str not in ("Error", "Seeding") and value < 100:
- textstr = "%s %.2f%%" % (textstr, value)
+ textstr = "%s %i%%" % (textstr, value)
if func_last_value["cell_data_progress"][1] != textstr:
func_last_value["cell_data_progress"][1] = textstr
@@ -172,10 +172,11 @@ def cell_data_speed(cell, model, row, data, cache_key):
return
func_last_value[cache_key] = speed
- speed_str = ""
if speed > 0:
- speed_str = common.fspeed(speed)
- cell.set_property('text', speed_str)
+ speed_str = common.fspeed(speed, shortform=True)
+ cell.set_property("markup", "{0} {1}".format(*tuple(speed_str.split())))
+ else:
+ cell.set_property("text", "")
def cell_data_speed_down(column, cell, model, row, data):
@@ -196,10 +197,11 @@ def cell_data_speed_limit(cell, model, row, data, cache_key):
return
func_last_value[cache_key] = speed
- speed_str = ""
if speed > 0:
- speed_str = common.fspeed(speed * 1024)
- cell.set_property('text', speed_str)
+ speed_str = common.fspeed(speed * 1024, shortform=True)
+ cell.set_property("markup", "{0} {1}".format(*tuple(speed_str.split())))
+ else:
+ cell.set_property("text", "")
def cell_data_speed_limit_down(column, cell, model, row, data):
@@ -213,7 +215,7 @@ def cell_data_speed_limit_up(column, cell, model, row, data):
def cell_data_size(column, cell, model, row, data):
"""Display value in terms of size, eg. 2 MB"""
size = model.get_value(row, data)
- cell.set_property('text', common.fsize(size))
+ cell.set_property('text', common.fsize(size, shortform=True))
def cell_data_peer(column, cell, model, row, data):
@@ -241,13 +243,13 @@ def cell_data_time(column, cell, model, row, data):
def cell_data_ratio(cell, model, row, data, cache_key):
- """Display value as a ratio with a precision of 3."""
+ """Display value as a ratio with a precision of 2."""
ratio = model.get_value(row, data)
# Previous value in cell is the same as for this value, so ignore
if func_last_value[cache_key] == ratio:
return
func_last_value[cache_key] = ratio
- cell.set_property('text', "∞" if ratio < 0 else "%.3f" % ratio)
+ cell.set_property("text", "∞" if ratio < 0 else ("%.1f" % ratio).rstrip("0").rstrip("."))
def cell_data_ratio_seeds_peers(column, cell, model, row, data):
@@ -270,7 +272,7 @@ def cell_data_date(column, cell, model, row, data, key):
return
func_last_value[key] = date
- date_str = common.fdate(date) if date > 0 else ""
+ date_str = common.fdate(date, date_only=True) if date > 0 else ""
cell.set_property('text', date_str)
cell_data_date_added = partial(cell_data_date, key="cell_data_date_added")
@@ -285,5 +287,5 @@ def cell_data_date_or_never(column, cell, model, row, data):
return
func_last_value["cell_data_date_or_never"] = value
- date_str = common.fdate(value) if value > 0 else _("Never")
+ date_str = common.fdate(value, date_only=True) if value > 0 else _("Never")
cell.set_property('text', date_str)