diff --git a/deluge/core/core.py b/deluge/core/core.py index 7ccf7cb17..96ba1f951 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -55,7 +55,6 @@ from deluge.core.pluginmanager import PluginManager from deluge.core.alertmanager import AlertManager from deluge.core.signalmanager import SignalManager from deluge.core.filtermanager import FilterManager -from deluge.core.statusbarmanager import StatusBarManager from deluge.core.preferencesmanager import PreferencesManager from deluge.core.autoadd import AutoAdd from deluge.log import LOG as log @@ -203,9 +202,6 @@ class Core( # Start the FilterManager self.filtermanager = FilterManager(self) - # Start the StatusBarManager - self.statusbarmanager = StatusBarManager(self) - # Create the AutoAdd component self.autoadd = AutoAdd() @@ -503,12 +499,6 @@ class Core( """ return self.filtermanager.get_filter_tree() - def export_get_statusbar(self, include_defaults = True): - """ - prototype. api may and will change. - """ - return self.statusbarmanager.get_statusbar(include_defaults) - def export_get_session_state(self): """Returns a list of torrent_ids in the session.""" # Get the torrent list from the TorrentManager diff --git a/deluge/core/statusbarmanager.py b/deluge/core/statusbarmanager.py deleted file mode 100644 index 9fed7f302..000000000 --- a/deluge/core/statusbarmanager.py +++ /dev/null @@ -1,92 +0,0 @@ -# -# core.py -# -# Copyright (C) 2008 Martijn Voncken -# -# Deluge is free software. -# -# You may redistribute it and/or modify it under the terms of the -# GNU General Public License, as published by the Free Software -# Foundation; either version 3 of the License, or (at your option) -# any later version. -# -# deluge is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. -# -# In addition, as a special exception, the copyright holders give -# permission to link the code of portions of this program with the OpenSSL -# library. -# You must obey the GNU General Public License in all respects for all of -# the code used other than OpenSSL. If you modify file(s) with this -# exception, you may extend this exception to your version of the file(s), -# but you are not obligated to do so. If you do not wish to do so, delete -# this exception statement from your version. If you delete this exception -# statement from all source files in the program, then also delete it here. - -import deluge.component as component -from deluge.log import LOG as log -from deluge.common import fspeed, fsize - -class StatusBarManager(component.Component): - """StatusBarManager - """ - def __init__(self, core): - component.Component.__init__(self, "StatusBarManager") - log.debug("StatusBarManager init..") - self.core = core - self.torrents = core.torrents - self.icon_order = [] - self.registered_icons = {} - self.stats = {} - - def register_icon(self, id, icon_func): - self.icon_order.append(id) - self.registered_icons[id] = icon_func - - def deregister_icon(self, id): - self.icon_order.remove(id) - del self.registered_icons[id] - - def get_statusbar(self , include_defaults = True): - stats = self.core.export_get_stats() - #self.stats = stats - statusbar = [] - if include_defaults: - """hardcoded part first..""" - statusbar.append(("num_connections" , "connections16.png",_("Connections"),"%(num_connections)s (%(max_num_connections)s)" % stats)) - - txt = "%s KiB/s" % fspeed(stats["download_rate"]) - if stats["max_download"]: - txt += " (%s KiB/s)" % stats["max_download"] - statusbar.append(("downloading","downloading16.png",_("Downloading"),txt)) - - txt = "%s KiB/s" % fspeed(stats["upload_rate"]) - if stats["max_download"]: - txt += " (%s KiB/s)" % stats["max_upload"] - statusbar.append(("uploading", "seeding16.png",_("Uploading"),txt)) - - statusbar.append(("free_space", None ,_("Free Space"), fsize(stats["free_space"]))) - - if not stats["has_incoming_connections"]: - statusbar.append(("network_health", "alert16.png","",_("No Incoming Connections!"))) - - statusbar.append(("dht", "dht16.png",_("DHT Nodes"),"%(dht_nodes)s" % stats )) - - - for id in self.icon_order: - item = self.registered_icons[id]() #function call. - statusbar.append(item) - return statusbar - - - - -