本文整理汇总了Python中history.History.set_values方法的典型用法代码示例。如果您正苦于以下问题:Python History.set_values方法的具体用法?Python History.set_values怎么用?Python History.set_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类history.History
的用法示例。
在下文中一共展示了History.set_values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Addon
# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import set_values [as 别名]
class Addon(AddonCore):
""""""
def __init__(self, parent, *args, **kwargs):
""""""
AddonCore.__init__(self)
self.name = _("History")
self.event_id = events.connect(cons.EVENT_DL_COMPLETE, self.trigger)
self.parent = parent
self.config = conf
self.history = History()
self.history_tab = HistoryContainer(self.history, self.parent)
def get_menu_item(self):
pass
#WIDGET, TITLE, CALLBACK, SENSITIVE = range(4)
#return (gtk.MenuItem(), _("History"), self.on_history) #can toggle
def get_tab(self):
return self.history_tab
#def on_history(self, widget):
#HistoryDlg(self.history, self.parent)
def trigger(self, download_item, *args, **kwargs):
""""""
link = download_item.link if download_item.can_copy_link else None
self.history.set_values(download_item.name, link, download_item.size, download_item.size_complete, download_item.path)
#remove from the list.
model = self.parent.downloads_list_gui.treeView.get_model()
row = self.parent.downloads_list_gui.rows_buffer[download_item.id]
model.remove(row.iter)
del self.parent.downloads_list_gui.rows_buffer[download_item.id]
del api.complete_downloads[download_item.id]
示例2: Addon
# 需要导入模块: from history import History [as 别名]
# 或者: from history.History import set_values [as 别名]
class Addon(AddonCore):
""""""
def __init__(self, parent, *args, **kwargs):
""""""
AddonCore.__init__(self)
self.name = _("History")
self.event_id = None
self.parent = parent
self.config = conf
self.history = History()
self.history_tab = HistoryTab(self.history)
def get_tab(self):
return self.history_tab
def set_menu_item(self):
self.action = self.parent.menu.addAction(self.name, self.on_toggle) #can toggle
self.action.setCheckable(True)
if conf.get_addon_option(OPTION_HISTORY_ACTIVE, default=True, is_bool=True):
self.action.setChecked(True)
self.connect()
def on_toggle(self):
if self.action.isChecked(): #se activo
conf.set_addon_option(OPTION_HISTORY_ACTIVE, "True")
self.connect()
else:
conf.set_addon_option(OPTION_HISTORY_ACTIVE, "False")
events.disconnect(cons.EVENT_DL_COMPLETE, self.event_id)
def connect(self):
""""""
self.event_id = events.connect(cons.EVENT_DL_COMPLETE, self.trigger)
#def on_history(self, widget):
#HistoryDlg(self.history, self.parent)
def trigger(self, download_item, *args, **kwargs):
""""""
link = download_item.link if download_item.can_copy_link else None
self.history.set_values(download_item.name, link, download_item.size, download_item.size_complete, download_item.path)
#remove from the list.
self.parent.downloads.remove_row(download_item.id)
del api.complete_downloads[download_item.id]