本文整理汇总了Python中preferences.Preferences.unload方法的典型用法代码示例。如果您正苦于以下问题:Python Preferences.unload方法的具体用法?Python Preferences.unload怎么用?Python Preferences.unload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类preferences.Preferences
的用法示例。
在下文中一共展示了Preferences.unload方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GtkUI
# 需要导入模块: from preferences import Preferences [as 别名]
# 或者: from preferences.Preferences import unload [as 别名]
#.........这里部分代码省略.........
path_info = widget.get_path_at_pos(int(x), int(y))
if not path_info:
if event.button == 3:
self._popup_jump_menu(widget, event)
else:
return
if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
if path_info[1] and path_info[1].get_title() == DISPLAY_NAME:
id = self.get_selected_torrent_label()
if (self.label_sidebar.page_selected() and
id == self.label_sidebar.get_selected_label()):
self._do_open_label_options(widget, event)
else:
self._do_go_to_label(widget)
def disable(self):
if self.initialized:
self.initialized = False
self._config.save()
deluge.configmanager.close(GTKUI_CONFIG)
self._remove_status_bar_item()
self.disable_dnd()
component.get("MenuBar").torrentmenu.remove(self.sep)
component.get("MenuBar").torrentmenu.remove(self.menu)
self._destroy_menu()
self.label_sidebar.unload()
del self.label_sidebar
self.preferences.unload()
self.add_torrent_ext.unload()
component.get("TorrentView").remove_column(DISPLAY_NAME)
def _create_context_menu(self):
menu = gtk.MenuItem(DISPLAY_NAME)
submenu = gtk.Menu()
jump_menu = self._create_jump_menu()
submenu.append(jump_menu)
set_label_menu = self._create_set_label_menu()
submenu.append(set_label_menu)
label_options_item = self._create_label_options_item()
submenu.append(label_options_item)
def on_activate(widget):
id = self.get_selected_torrent_label()
if id not in RESERVED_IDS and id in self.label_data:
label_options_item.show()
else:
label_options_item.hide()
示例2: GtkUI
# 需要导入模块: from preferences import Preferences [as 别名]
# 或者: from preferences.Preferences import unload [as 别名]
class GtkUI(GtkPluginBase):
def __init__(self, plugin_name):
super(GtkUI, self).__init__(plugin_name)
self.initialized = False
self.retries = 0
def enable(self):
self.timestamp = None
self.label_data = None
client.labelplus.is_initialized().addCallback(self.cb_check)
def cb_check(self, result):
if result == True:
client.labelplus.get_label_data(self.timestamp).addCallback(
self.cb_data_init)
elif self.retries < MAX_RETRIES:
reactor.callLater(WAIT_TIME, self.enable)
self.retries += 1
def cb_data_init(self, data):
self.timestamp = data[0]
self.label_data = data[1]
self.label_data[ID_ALL]["name"] = _(ID_ALL)
self.label_data[ID_NONE]["name"] = _(ID_NONE)
self._do_load()
def _do_load(self):
self._config = deluge.configmanager.ConfigManager(
GTKUI_CONFIG, defaults=GTKUI_DEFAULTS)
component.get("TorrentView").add_text_column(DISPLAY_NAME,
status_field=[STATUS_NAME])
self.label_selection_menu = LabelSelectionMenu()
self.sep = component.get("MenuBar").add_torrentmenu_separator()
component.get("MenuBar").torrentmenu.append(self.label_selection_menu)
self.label_sidebar = LabelSidebar()
self.preferences = Preferences()
self.add_torrent_ext = AddTorrentExt()
self.enable_dnd()
self.initialized = True
def disable(self):
self.retries = MAX_RETRIES
if self.initialized:
self.initialized = False
self._config.save()
deluge.configmanager.close(self._config)
self.disable_dnd()
component.get("MenuBar").torrentmenu.remove(self.sep)
component.get("MenuBar").torrentmenu.remove(self.label_selection_menu)
self.label_selection_menu.destroy()
del self.label_selection_menu
self.label_sidebar.unload()
del self.label_sidebar
self.preferences.unload()
self.add_torrent_ext.unload()
component.get("TorrentView").remove_column(DISPLAY_NAME)
def update(self):
if self.initialized:
client.labelplus.get_label_data(self.timestamp).addCallback(
self.cb_update_data)
def cb_update_data(self, data):
if data is not None:
self.timestamp = data[0]
#.........这里部分代码省略.........