当前位置: 首页>>代码示例>>Python>>正文


Python History.set_values方法代码示例

本文整理汇总了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]
开发者ID:yckart,项目名称:ochDownloader,代码行数:35,代码来源:addon_gui.py

示例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]
开发者ID:yckart,项目名称:ochDownloader,代码行数:46,代码来源:addon_gui.py


注:本文中的history.History.set_values方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。