revert 664...i'll make the menu a glade file soon
This commit is contained in:
parent
af928cf83f
commit
9ec33795a9
|
@ -32,7 +32,8 @@
|
||||||
|
|
||||||
import sys, os, os.path, urllib
|
import sys, os, os.path, urllib
|
||||||
import core, common, dgtk, ipc_manager, dialogs
|
import core, common, dgtk, ipc_manager, dialogs
|
||||||
import plugins, pref, pygtk
|
import plugins, pref
|
||||||
|
import pygtk
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
import gtk, gtk.glade, gobject
|
import gtk, gtk.glade, gobject
|
||||||
import xdg, xdg.BaseDirectory
|
import xdg, xdg.BaseDirectory
|
||||||
|
@ -158,11 +159,7 @@ class DelugeGTK:
|
||||||
def build_tray_icon(self):
|
def build_tray_icon(self):
|
||||||
self.tray_icon = gtk.status_icon_new_from_file(common.get_pixmap("deluge32.png"))
|
self.tray_icon = gtk.status_icon_new_from_file(common.get_pixmap("deluge32.png"))
|
||||||
self.tray_menu = gtk.Menu()
|
self.tray_menu = gtk.Menu()
|
||||||
if self.window.get_property("visible"):
|
item_show = gtk.MenuItem(_("Show / Hide Window"))
|
||||||
if self.window.is_active():
|
|
||||||
item_show = gtk.MenuItem(_("Hide Window"))
|
|
||||||
else:
|
|
||||||
item_show = gtk.MenuItem(_("Show Window"))
|
|
||||||
item_add = gtk.ImageMenuItem(_("Add Torrent"))
|
item_add = gtk.ImageMenuItem(_("Add Torrent"))
|
||||||
item_clear = gtk.ImageMenuItem(_("Clear Finished"))
|
item_clear = gtk.ImageMenuItem(_("Clear Finished"))
|
||||||
item_pref = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
|
item_pref = gtk.ImageMenuItem(gtk.STOCK_PREFERENCES)
|
||||||
|
@ -179,7 +176,7 @@ class DelugeGTK:
|
||||||
item_pref.connect("activate", self.show_pref_dialog)
|
item_pref.connect("activate", self.show_pref_dialog)
|
||||||
item_plug.connect("activate", self.show_plugin_dialog)
|
item_plug.connect("activate", self.show_plugin_dialog)
|
||||||
item_quit.connect("activate", self.quit)
|
item_quit.connect("activate", self.quit)
|
||||||
|
|
||||||
self.tray_menu.append(item_show)
|
self.tray_menu.append(item_show)
|
||||||
self.tray_menu.append(item_add)
|
self.tray_menu.append(item_add)
|
||||||
self.tray_menu.append(item_clear)
|
self.tray_menu.append(item_clear)
|
||||||
|
@ -188,15 +185,13 @@ class DelugeGTK:
|
||||||
self.tray_menu.append(item_plug)
|
self.tray_menu.append(item_plug)
|
||||||
self.tray_menu.append(gtk.SeparatorMenuItem())
|
self.tray_menu.append(gtk.SeparatorMenuItem())
|
||||||
self.tray_menu.append(item_quit)
|
self.tray_menu.append(item_quit)
|
||||||
|
|
||||||
self.tray_menu.show_all()
|
self.tray_menu.show_all()
|
||||||
|
|
||||||
self.tray_icon.connect("activate", self.tray_clicked)
|
self.tray_icon.connect("activate", self.tray_clicked)
|
||||||
self.tray_icon.connect("popup-menu", self.tray_popup)
|
self.tray_icon.connect("popup-menu", self.tray_popup)
|
||||||
|
|
||||||
def tray_popup(self, status_icon, button, activate_time):
|
def tray_popup(self, status_icon, button, activate_time):
|
||||||
self.tray_icon.set_visible(False)
|
|
||||||
self.tray_icon = None
|
|
||||||
self.build_tray_icon()
|
|
||||||
self.tray_menu.popup(None, None, gtk.status_icon_position_menu,
|
self.tray_menu.popup(None, None, gtk.status_icon_position_menu,
|
||||||
button, activate_time, status_icon)
|
button, activate_time, status_icon)
|
||||||
|
|
||||||
|
@ -249,14 +244,12 @@ class DelugeGTK:
|
||||||
def force_show_hide(self, arg=None):
|
def force_show_hide(self, arg=None):
|
||||||
if self.window.get_property("visible"):
|
if self.window.get_property("visible"):
|
||||||
self.window.hide()
|
self.window.hide()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if self.config.get("lock_tray", bool, default=False) == True:
|
if self.config.get("lock_tray", bool, default=False) == True:
|
||||||
self.unlock_tray("mainwinshow")
|
self.unlock_tray("mainwinshow")
|
||||||
else:
|
else:
|
||||||
self.window.show()
|
self.window.show()
|
||||||
|
|
||||||
|
|
||||||
def build_torrent_table(self):
|
def build_torrent_table(self):
|
||||||
## Create the torrent listview
|
## Create the torrent listview
|
||||||
self.torrent_view = self.wtree.get_widget("torrent_view")
|
self.torrent_view = self.wtree.get_widget("torrent_view")
|
||||||
|
@ -745,7 +738,7 @@ class DelugeGTK:
|
||||||
_("Connections") + ": " + str(connections) + "\n" + _("Download") + ": " + \
|
_("Connections") + ": " + str(connections) + "\n" + _("Download") + ": " + \
|
||||||
dlrate + "\n" + _("Upload") + ": " + ulrate
|
dlrate + "\n" + _("Upload") + ": " + ulrate
|
||||||
|
|
||||||
self.tray_icon.set_tooltip(msg)
|
self.tray_icon.set_tooltip(msg)
|
||||||
|
|
||||||
#Update any active plugins
|
#Update any active plugins
|
||||||
self.plugins.update_active_plugins()
|
self.plugins.update_active_plugins()
|
||||||
|
@ -1222,3 +1215,4 @@ if __name__ == "__main__":
|
||||||
interface = DelugeGTK()
|
interface = DelugeGTK()
|
||||||
interface.start()
|
interface.start()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue