mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-07 00:48:41 +00:00
Color-coded the statusbars
This commit is contained in:
parent
d2dc62f0b3
commit
ca6c647bd2
2 changed files with 51 additions and 8 deletions
|
@ -731,8 +731,18 @@ class AllTorrents(BaseMode, component.Component):
|
||||||
|
|
||||||
self.add_string(self.rows - 1, string)
|
self.add_string(self.rows - 1, string)
|
||||||
else:
|
else:
|
||||||
hstr = "%sPress [h] for help"%(" "*(self.cols - len(self.statusbars.bottombar) - 10))
|
#This will quite likely fail when switching modes because
|
||||||
self.add_string(self.rows - 1, "%s%s"%(self.statusbars.bottombar,hstr))
|
# of an arcane problem with twisted
|
||||||
|
try:
|
||||||
|
rf = format_utils.remove_formatting
|
||||||
|
string = self.statusbars.bottombar
|
||||||
|
hstr = "Press {!magenta,blue,bold!}[h]{!status!} for help"
|
||||||
|
|
||||||
|
string += " " * ( self.cols - len(rf(string)) - len(rf(hstr))) + hstr
|
||||||
|
|
||||||
|
self.add_string(self.rows - 1, string)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
# add all the torrents
|
# add all the torrents
|
||||||
if self.formatted_rows == []:
|
if self.formatted_rows == []:
|
||||||
|
|
|
@ -33,6 +33,8 @@
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from deluge.core.preferencesmanager import DEFAULT_PREFS
|
||||||
|
|
||||||
import deluge.component as component
|
import deluge.component as component
|
||||||
import deluge.common
|
import deluge.common
|
||||||
from deluge.ui.client import client
|
from deluge.ui.client import client
|
||||||
|
@ -81,27 +83,58 @@ class StatusBars(component.Component):
|
||||||
def update_statusbars(self):
|
def update_statusbars(self):
|
||||||
# Update the topbar string
|
# Update the topbar string
|
||||||
self.topbar = "{!status!}Deluge %s Console - " % deluge.common.get_version()
|
self.topbar = "{!status!}Deluge %s Console - " % deluge.common.get_version()
|
||||||
|
|
||||||
if client.connected():
|
if client.connected():
|
||||||
info = client.connection_info()
|
info = client.connection_info()
|
||||||
self.topbar += "%s@%s:%s" % (info[2], info[0], info[1])
|
connection_info = ""
|
||||||
|
|
||||||
|
#Client name
|
||||||
|
if info[2] == "localclient":
|
||||||
|
connection_info += "{!white,blue!}%s"
|
||||||
|
else:
|
||||||
|
connection_info += "{!green,blue,bold!}%s"
|
||||||
|
|
||||||
|
#Hostname
|
||||||
|
if info[0] == "127.0.0.1":
|
||||||
|
connection_info += "{!white,blue,bold!}@{!white,blue!}%s"
|
||||||
|
else:
|
||||||
|
connection_info += "{!white,blue,bold!}@{!red,blue,bold!}%s"
|
||||||
|
|
||||||
|
#Port
|
||||||
|
if info[1] == DEFAULT_PREFS["daemon_port"]:
|
||||||
|
connection_info += "{!white,blue!}:%s"
|
||||||
|
else:
|
||||||
|
connection_info += "{!status!}:%s"
|
||||||
|
|
||||||
|
#Change color back to normal, just in case
|
||||||
|
connection_info += "{!status!}"
|
||||||
|
|
||||||
|
self.topbar += connection_info % (info[2], info[0], info[1])
|
||||||
else:
|
else:
|
||||||
self.topbar += "Not Connected"
|
self.topbar += "Not Connected"
|
||||||
|
|
||||||
# Update the bottombar string
|
# Update the bottombar string
|
||||||
self.bottombar = "{!status!}C: %s" % self.connections
|
self.bottombar = "{!status!}C: {!white,blue!}%s{!status!}" % self.connections
|
||||||
|
|
||||||
if self.config["max_connections_global"] > -1:
|
if self.config["max_connections_global"] > -1:
|
||||||
self.bottombar += " (%s)" % self.config["max_connections_global"]
|
self.bottombar += " (%s)" % self.config["max_connections_global"]
|
||||||
|
|
||||||
self.bottombar += " D: %s" % self.download
|
if self.download != "0.0 KiB":
|
||||||
|
self.bottombar += " D: {!green,blue,bold!}%s{!status!}" % self.download
|
||||||
|
else:
|
||||||
|
self.bottombar += " D: {!white,blue!}%s{!status!}" % self.download
|
||||||
|
|
||||||
if self.config["max_download_speed"] > -1:
|
if self.config["max_download_speed"] > -1:
|
||||||
self.bottombar += " (%s " % self.config["max_download_speed"] + _("KiB/s") + ")"
|
self.bottombar += " (%s " % self.config["max_download_speed"] + _("KiB/s") + ")"
|
||||||
|
|
||||||
self.bottombar += " U: %s" % self.upload
|
if self.upload != "0.0 KiB":
|
||||||
|
self.bottombar += " U: {!red,blue,bold!}%s{!status!}" % self.upload
|
||||||
|
else:
|
||||||
|
self.bottombar += " U: {!white,blue!}%s{!status!}" % self.upload
|
||||||
|
|
||||||
|
|
||||||
if self.config["max_upload_speed"] > -1:
|
if self.config["max_upload_speed"] > -1:
|
||||||
self.bottombar += " (%s " % self.config["max_upload_speed"] + _("KiB/s") + ")"
|
self.bottombar += " (%s " % self.config["max_upload_speed"] + _("KiB/s") + ")"
|
||||||
|
|
||||||
if self.config["dht"]:
|
if self.config["dht"]:
|
||||||
self.bottombar += " " + _("DHT") + ": %s" % self.dht
|
self.bottombar += " " + _("DHT") + ": {!white,blue!}%s{!status!}" % self.dht
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue