label-plugin:re-enable sidebar popup

This commit is contained in:
Martijn Voncken 2008-08-25 21:28:21 +00:00
parent 3c183906d1
commit 39025191d7
5 changed files with 20 additions and 12 deletions

View File

@ -91,6 +91,10 @@ def CheckInput(cond, message):
class Core(CorePluginBase):
"""
self.labels = {label_id:label_options_dict}
self.torrent_labels = {torrent_id:label_id}
"""
def enable(self):
log.info("*** Start Label plugin ***")
@ -113,7 +117,7 @@ class Core(CorePluginBase):
self.plugin.register_hook("post_torrent_remove", self.post_torrent_remove)
#register tree:
component.get("FilterManager").register_tree_field("label")
component.get("FilterManager").register_tree_field("label", self.init_filter_dict)
log.debug("Label plugin enabled..")
@ -125,7 +129,12 @@ class Core(CorePluginBase):
def update(self):
pass
def init_filter_dict(self):
return dict( [(label, 0) for label in self.labels.keys()])
## Plugin hooks ##
def post_torrent_add(self, torrent_id):
log.debug("post_torrent_add")
torrent = self.torrents[torrent_id]

View File

@ -39,7 +39,7 @@ import ui
import gtk, gobject
from deluge.ui.client import aclient
import sidebar
import sidebar_menu
import label_config
import submenu
@ -58,7 +58,7 @@ class GtkUI(ui.UI):
ui.UI.__init__(self, plugin_api, plugin_name)
log.debug("Label GtkUI plugin initalized..")
self.labelcfg = None
self.sidebar = None
self.sidebar_menu = None
def enable(self):
self.load_interface()
@ -74,19 +74,18 @@ class GtkUI(ui.UI):
log.debug(1.2)
#disabled:
#self.sidebar.unload()
#self.sidebar_menu.unload()
log.debug(2)
def get_pixmap(self, fname):
"""Returns a pixmap file included with plugin"""
return pkg_resources.resource_filename("blocklist", os.path.join("data", fname))
def load_interface(self):
#sidebar
#disabled
#if not self.sidebar:
# self.sidebar = sidebar.LabelSideBar()
if not self.sidebar_menu:
self.sidebar_menu = sidebar_menu.LabelSidebarMenu()
#self.sidebar.load()
#menu:

View File

@ -22,7 +22,7 @@ sclient.label_add("test")
print "#set"
sclient.label_set_torrent(id,"test")
print scleint.get_torrents_status({"label":test},"name")
print sclient.get_torrents_status({"label":"test"},"name")
print "#set options"

View File

@ -245,7 +245,7 @@ class FilterTreeView(component.Component):
def set_menu_sensitivity(self):
#select-all/pause/resume
sensitive = (self.cat != "cat")
sensitive = (self.cat != "cat" and self.count <> 0)
for item in self.default_menu_items:
item.set_sensitive(sensitive)

View File

@ -7,7 +7,7 @@
<child>
<widget class="GtkImageMenuItem" id="select_all">
<property name="visible">True</property>
<property name="label" translatable="yes">Select All</property>
<property name="label" translatable="yes">_Select All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="select_all"/>
<child internal-child="image">
@ -23,7 +23,7 @@
<widget class="GtkImageMenuItem" id="menuitem_pause">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label">_Pause</property>
<property name="label">_Pause All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="pause_all"/>
<child internal-child="image">
@ -39,7 +39,7 @@
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="tooltip" translatable="yes">Resume selected torrents.</property>
<property name="label" translatable="yes">Resu_me</property>
<property name="label" translatable="yes">Resu_me All</property>
<property name="use_underline">True</property>
<signal name="activate" handler="resume_all"/>
<child internal-child="image">