• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python qtutils.deserialize函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中qutebrowser.utils.qtutils.deserialize函数的典型用法代码示例。如果您正苦于以下问题:Python deserialize函数的具体用法?Python deserialize怎么用?Python deserialize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了deserialize函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: undo

    def undo(self):
        """Undo removing of a tab."""
        # Remove unused tab which may be created after the last tab is closed
        last_close = config.get('tabs', 'last-close')
        use_current_tab = False
        if last_close in ['blank', 'startpage', 'default-page']:
            only_one_tab_open = self.count() == 1
            no_history = self.widget(0).history().count() == 1
            urls = {
                'blank': QUrl('about:blank'),
                'startpage': QUrl(config.get('general', 'startpage')[0]),
                'default-page': config.get('general', 'default-page'),
            }
            first_tab_url = self.widget(0).page().mainFrame().requestedUrl()
            last_close_urlstr = urls[last_close].toString().rstrip('/')
            first_tab_urlstr = first_tab_url.toString().rstrip('/')
            last_close_url_used = first_tab_urlstr == last_close_urlstr
            use_current_tab = (only_one_tab_open and no_history and
                               last_close_url_used)

        url, history_data = self._undo_stack.pop()

        if use_current_tab:
            self.openurl(url, newtab=False)
            newtab = self.widget(0)
        else:
            newtab = self.tabopen(url, background=False)

        qtutils.deserialize(history_data, newtab.history())
开发者ID:djfinlay,项目名称:qutebrowser,代码行数:29,代码来源:tabbedbrowser.py


示例2: tab_clone

    def tab_clone(self, bg=False, window=False):
        """Duplicate the current tab.

        Args:
            bg: Open in a background tab.
            window: Open in a new window.

        Return:
            The new QWebView.
        """
        if bg and window:
            raise cmdexc.CommandError("Only one of -b/-w can be given!")
        cur_tabbed_browser = self._tabbed_browser()
        curtab = self._current_widget()
        cur_title = cur_tabbed_browser.page_title(self._current_index())
        # The new tab could be in a new tabbed_browser (e.g. because of
        # tabs-are-windows being set)
        new_tabbed_browser = self._tabbed_browser(window)
        newtab = new_tabbed_browser.tabopen(background=bg, explicit=True)
        new_tabbed_browser = objreg.get('tabbed-browser', scope='window',
                                        window=newtab.win_id)
        idx = new_tabbed_browser.indexOf(newtab)
        new_tabbed_browser.set_page_title(idx, cur_title)
        new_tabbed_browser.setTabIcon(idx, curtab.icon())
        newtab.keep_icon = True
        newtab.setZoomFactor(curtab.zoomFactor())
        history = qtutils.serialize(curtab.history())
        qtutils.deserialize(history, newtab.history())
        return newtab
开发者ID:JIVS,项目名称:qutebrowser,代码行数:29,代码来源:commands.py


示例3: undo

    def undo(self):
        """Undo removing of a tab."""
        # Remove unused tab which may be created after the last tab is closed
        last_close = config.get("tabs", "last-close")
        use_current_tab = False
        if last_close in ["blank", "startpage", "default-page"]:
            only_one_tab_open = self.count() == 1
            no_history = self.widget(0).history().count() == 1
            urls = {
                "blank": QUrl("about:blank"),
                "startpage": QUrl(config.get("general", "startpage")[0]),
                "default-page": config.get("general", "default-page"),
            }
            first_tab_url = self.widget(0).page().mainFrame().requestedUrl()
            last_close_urlstr = urls[last_close].toString().rstrip("/")
            first_tab_urlstr = first_tab_url.toString().rstrip("/")
            last_close_url_used = first_tab_urlstr == last_close_urlstr
            use_current_tab = only_one_tab_open and no_history and last_close_url_used

        url, history_data = self._undo_stack.pop()

        if use_current_tab:
            self.openurl(url, newtab=False)
            newtab = self.widget(0)
        else:
            newtab = self.tabopen(url, background=False)

        qtutils.deserialize(history_data, newtab.history())
开发者ID:rumpelsepp,项目名称:qutebrowser,代码行数:28,代码来源:tabbedbrowser.py


示例4: test_serialize

def test_serialize(obj):
    """Test a serialize/deserialize round trip.

    Args:
        obj: The object to test with.
    """
    new_obj = type(obj)()
    qtutils.deserialize(qtutils.serialize(obj), new_obj)
    assert new_obj == obj
开发者ID:t-wissmann,项目名称:qutebrowser,代码行数:9,代码来源:test_qtutils.py


示例5: tab_clone

    def tab_clone(self, bg=False):
        """Duplicate the current tab.

        Args:
            bg: Open in a background tab.

        Return:
            The new QWebView.
        """
        curtab = self._current_widget()
        tabbed_browser = objreg.get('tabbed-browser')
        newtab = tabbed_browser.tabopen(background=bg, explicit=True)
        history = qtutils.serialize(curtab.history())
        qtutils.deserialize(history, newtab.history())
        return newtab
开发者ID:har5ha,项目名称:qutebrowser,代码行数:15,代码来源:commands.py


示例6: tab_clone

    def tab_clone(self, bg=False, window=False):
        """Duplicate the current tab.

        Args:
            bg: Open in a background tab.
            window: Open in a new window.

        Return:
            The new QWebView.
        """
        if bg and window:
            raise cmdexc.CommandError("Only one of -b/-w can be given!")
        curtab = self._current_widget()
        tabbed_browser = self._tabbed_browser(window)
        newtab = tabbed_browser.tabopen(background=bg, explicit=True)
        history = qtutils.serialize(curtab.history())
        qtutils.deserialize(history, newtab.history())
        return newtab
开发者ID:helenst,项目名称:qutebrowser,代码行数:18,代码来源:commands.py


示例7: deserialize

 def deserialize(self, data):
     return qtutils.deserialize(data, self._history)
开发者ID:swalladge,项目名称:qutebrowser,代码行数:2,代码来源:webkittab.py


示例8: undo

 def undo(self):
     """Undo removing of a tab."""
     url, history_data = self._undo_stack.pop()
     newtab = self.tabopen(url)
     qtutils.deserialize(history_data, newtab.history())
开发者ID:HalosGhost,项目名称:qutebrowser,代码行数:5,代码来源:tabbedbrowser.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python qtutils.deserialize_stream函数代码示例发布时间:2022-05-26
下一篇:
Python qtutils.check_overflow函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap