statusbar message
This commit is contained in:
parent
dacb1905a1
commit
9d92ab8b56
|
@ -61,7 +61,7 @@ else:
|
||||||
print "create proxy object"
|
print "create proxy object"
|
||||||
proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject')
|
proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject')
|
||||||
print "create iface"
|
print "create iface"
|
||||||
deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.DelugeInterface')
|
deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge')
|
||||||
print "send to iface"
|
print "send to iface"
|
||||||
for arg in args:
|
for arg in args:
|
||||||
apath = os.path.abspath(arg)
|
apath = os.path.abspath(arg)
|
||||||
|
|
|
@ -47,7 +47,7 @@ class DelugeDBus(dbus.service.Object):
|
||||||
dbus.service.Object.__init__(self, bus_name, object_path)
|
dbus.service.Object.__init__(self, bus_name, object_path)
|
||||||
|
|
||||||
## external_add_torrent should only be called from outside the class
|
## external_add_torrent should only be called from outside the class
|
||||||
@dbus.service.method('org.deluge_torrent.DelugeInterface')
|
@dbus.service.method('org.deluge_torrent.Deluge')
|
||||||
def external_add_torrent(self, torrent_file):
|
def external_add_torrent(self, torrent_file):
|
||||||
print "Ding!"
|
print "Ding!"
|
||||||
print "Got torrent externally:", os.path.basename(torrent_file)
|
print "Got torrent externally:", os.path.basename(torrent_file)
|
||||||
|
@ -98,7 +98,7 @@ class DelugeGTK:
|
||||||
self.window.connect("drag_data_received", self.on_drag_data)
|
self.window.connect("drag_data_received", self.on_drag_data)
|
||||||
self.window.set_title('%s %s'%(dcommon.PROGRAM_NAME, dcommon.PROGRAM_VERSION))
|
self.window.set_title('%s %s'%(dcommon.PROGRAM_NAME, dcommon.PROGRAM_VERSION))
|
||||||
self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png"))
|
self.window.set_icon_from_file(dcommon.get_pixmap("deluge32.png"))
|
||||||
|
self.statusbar = self.wtree.get_widget("statusbar")
|
||||||
|
|
||||||
|
|
||||||
## Construct the Interface
|
## Construct the Interface
|
||||||
|
@ -510,8 +510,7 @@ class DelugeGTK:
|
||||||
gtk.main()
|
gtk.main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
self.manager.quit()
|
self.manager.quit()
|
||||||
|
|
||||||
|
|
||||||
## Call via a timer to update the interface
|
## Call via a timer to update the interface
|
||||||
def update(self):
|
def update(self):
|
||||||
# Make sure that the interface still exists
|
# Make sure that the interface still exists
|
||||||
|
@ -519,8 +518,39 @@ class DelugeGTK:
|
||||||
tab = self.wtree.get_widget("torrent_info").get_current_page()
|
tab = self.wtree.get_widget("torrent_info").get_current_page()
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
# Update Statusbar and Tray Tips
|
||||||
|
print "###CORE STATE INFO###"
|
||||||
|
core_state = self.manager.get_state()
|
||||||
|
for k in core_state.keys():
|
||||||
|
print k, '=', core_state[k]
|
||||||
|
connections = core_state['num_peers']
|
||||||
|
dlrate = dcommon.frate(core_state['download_rate'])
|
||||||
|
ulrate = dcommon.frate(core_state['upload_rate'])
|
||||||
|
|
||||||
|
self.statusbar_temp_msg = '%s: %s %s: %s %s: %s'%(
|
||||||
|
_('Connections'), connections, _('Download'),
|
||||||
|
dlrate, _('Upload'), ulrate)
|
||||||
|
|
||||||
|
if 'DHT_nodes' in core_state.keys():
|
||||||
|
dht_peers = core_state['DHT_nodes']
|
||||||
|
if dht_peers == -1:
|
||||||
|
dht_peers = '?'
|
||||||
|
else:
|
||||||
|
dht_peers = str(dht_peers)
|
||||||
|
self.statusbar_temp_msg = self.statusbar_temp_msg + ' [DHT: %s]'%(dht_peers)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#Update any active plugins
|
||||||
self.plugins.update_active_plugins()
|
self.plugins.update_active_plugins()
|
||||||
|
|
||||||
|
# Put the generated message into the statusbar
|
||||||
|
# This gives plugins a chance to write to the
|
||||||
|
# statusbar if they want
|
||||||
|
self.statusbar.pop(1)
|
||||||
|
self.statusbar.push(1, self.statusbar_temp_msg)
|
||||||
|
|
||||||
# If no torrent is selected, select the first torrent:
|
# If no torrent is selected, select the first torrent:
|
||||||
(temp, selection) = self.torrent_view.get_selection().get_selected()
|
(temp, selection) = self.torrent_view.get_selection().get_selected()
|
||||||
|
|
Loading…
Reference in New Issue