Ticket #2010: gtkui.title.patch

File gtkui.title.patch, 1.8 KB (added by phil, 13 years ago)

This patch changes the titlebar for GTKUI.

  • deluge/common.py

    diff -ruN deluge-1.3.3/deluge/common.py deluge-1.3.3-dev/deluge/common.py
    old new  
    319319    fspeed_gb = fspeed_mb / 1024.0
    320320    return "%.1f %s" % (fspeed_gb, _("GiB/s"))
    321321
     322def fspeedtitle(bps):
     323    fspeed_kb = bps / 1024.0
     324    if fspeed_kb < 1024:
     325        return "%.1f%s" % (fspeed_kb, _("K"))
     326    fspeed_mb = fspeed_kb / 1024.0
     327    if fspeed_mb < 1024:
     328        return "%.1f%s" % (fspeed_mb, _("M"))
     329    fspeed_gb = fspeed_mb / 1024.0
     330    return "%.1f%s" % (fspeed_gb, _("G"))
     331
    322332def fpeer(num_peers, total_peers):
    323333    """
    324334    Formats a string to show 'num_peers' ('total_peers')
  • deluge/ui/gtkui/mainwindow.py

    diff -ruN deluge-1.3.3/deluge/ui/gtkui/mainwindow.py deluge-1.3.3-dev/deluge/ui/gtkui/mainwindow.py
    old new  
    230230    def update(self):
    231231        # Update the window title
    232232        def _on_get_session_status(status):
    233             download_rate = deluge.common.fspeed(status["download_rate"])
    234             upload_rate = deluge.common.fspeed(status["upload_rate"])
    235             self.window.set_title("Deluge - %s %s %s %s" % (_("Down:"), download_rate, _("Up:"), upload_rate))
     233            download_rate = deluge.common.fspeedtitle(status["download_rate"])
     234            upload_rate = deluge.common.fspeedtitle(status["upload_rate"])
     235            self.window.set_title("%s%s %s%s - Deluge" % (_("D:"), download_rate, _("U:"), upload_rate))
    236236        if self.config["show_rate_in_title"]:
    237237            client.core.get_session_status(["download_rate", "upload_rate"]).addCallback(_on_get_session_status)
    238238