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


Python Util.collapseuser方法代码示例

本文整理汇总了Python中variety.Util.Util.collapseuser方法的典型用法代码示例。如果您正苦于以下问题:Python Util.collapseuser方法的具体用法?Python Util.collapseuser怎么用?Python Util.collapseuser使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在variety.Util.Util的用法示例。


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

示例1: test_collapseuser

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import collapseuser [as 别名]
 def test_collapseuser(self):
     self.assertEquals("~/.config/variety", Util.collapseuser("/home/peter/.config/variety"))
     self.assertEquals("/home/peteraaa/.config/variety", Util.collapseuser("/home/peteraaa/.config/variety"))
     self.assertEquals("/media/.config/variety", Util.collapseuser("/media/.config/variety"))
开发者ID:GLolol,项目名称:variety-deb,代码行数:6,代码来源:TestUtil.py

示例2: write

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import collapseuser [as 别名]
    def write(self):
        try:
            config = ConfigObj(self.configfile, encoding='utf8', default_encoding='utf8')
        except Exception:
            config = ConfigObj(encoding='utf8', default_encoding='utf8')
            config.filename = self.configfile

        try:
            config["change_enabled"] = str(self.change_enabled)
            config["change_on_start"] = str(self.change_on_start)
            config["change_interval"] = str(self.change_interval)
            config["safe_mode"] = str(self.safe_mode)

            config["download_enabled"] = str(self.download_enabled)
            config["download_interval"] = str(self.download_interval)
            config["download_folder"] = Util.collapseuser(self.download_folder)

            config["quota_enabled"] = str(self.quota_enabled)
            config["quota_size"] = str(self.quota_size)

            config["favorites_folder"] = Util.collapseuser(self.favorites_folder)
            config["favorites_operations"] = ';'.join(':'.join(x) for x in self.favorites_operations)

            config["fetched_folder"] = Util.collapseuser(self.fetched_folder)
            config["clipboard_enabled"] = str(self.clipboard_enabled)
            config["clipboard_use_whitelist"] = str(self.clipboard_use_whitelist)
            config["clipboard_hosts"] = ','.join(self.clipboard_hosts)

            config["icon"] = self.icon

            config["desired_color_enabled"] = str(self.desired_color_enabled)
            config["desired_color"] = " ".join(map(str, self.desired_color)) if self.desired_color else "None"
            config["min_size_enabled"] = str(self.min_size_enabled)
            config["min_size"] = str(self.min_size)
            config["use_landscape_enabled"] = str(self.use_landscape_enabled)
            config["lightness_enabled"] = str(self.lightness_enabled)
            config["lightness_mode"] = str(self.lightness_mode)
            config["min_rating_enabled"] = str(self.min_rating_enabled)
            config["min_rating"] = str(self.min_rating)

            config["smart_notice_shown"] = str(self.smart_notice_shown)
            config["smart_register_shown"] = str(self.smart_register_shown)
            config["stats_notice_shown"] = str(self.stats_notice_shown)

            config["smart_enabled"] = str(self.smart_enabled)
            config["sync_enabled"] = str(self.sync_enabled)
            config["stats_enabled"] = str(self.stats_enabled)

            config["facebook_show_dialog"] = str(self.facebook_show_dialog)
            config["facebook_message"] = self.facebook_message

            config["copyto_enabled"] = str(self.copyto_enabled)
            config["copyto_folder"] = Util.collapseuser(self.copyto_folder)

            config["clock_enabled"] = str(self.clock_enabled)
            config["clock_filter"] = self.clock_filter
            config["clock_font"] = self.clock_font
            config["clock_date_font"] = self.clock_date_font

            config["quotes_enabled"] = str(self.quotes_enabled)
            config["quotes_font"] = self.quotes_font
            config["quotes_text_color"] = " ".join(map(str, self.quotes_text_color))
            config["quotes_bg_color"] = " ".join(map(str, self.quotes_bg_color))
            config["quotes_bg_opacity"] = str(self.quotes_bg_opacity)
            config["quotes_text_shadow"] = str(self.quotes_text_shadow)
            config["quotes_disabled_sources"] = '|'.join(self.quotes_disabled_sources)
            config["quotes_tags"] = self.quotes_tags
            config["quotes_authors"] = self.quotes_authors
            config["quotes_change_enabled"] = str(self.quotes_change_enabled)
            config["quotes_change_interval"] = str(self.quotes_change_interval)
            config["quotes_width"] = str(self.quotes_width)
            config["quotes_hpos"] = str(self.quotes_hpos)
            config["quotes_vpos"] = str(self.quotes_vpos)
            config["quotes_favorites_file"] = Util.collapseuser(self.quotes_favorites_file)

            config["slideshow_sources_enabled"] = str(self.slideshow_sources_enabled)
            config["slideshow_favorites_enabled"] = str(self.slideshow_favorites_enabled)
            config["slideshow_downloads_enabled"] = str(self.slideshow_downloads_enabled)
            config["slideshow_custom_enabled"] = str(self.slideshow_custom_enabled)
            config["slideshow_custom_folder"] = Util.collapseuser(self.slideshow_custom_folder)
            config["slideshow_sort_order"] = self.slideshow_sort_order
            config["slideshow_monitor"] = self.slideshow_monitor
            config["slideshow_mode"] = self.slideshow_mode
            config["slideshow_seconds"] = str(self.slideshow_seconds)
            config["slideshow_fade"] = str(self.slideshow_fade)
            config["slideshow_zoom"] = str(self.slideshow_zoom)
            config["slideshow_pan"] = str(self.slideshow_pan)

            config["sources"] = {}
            for i, s in enumerate(self.sources):
                config["sources"]["src" + str(i + 1)] = str(s[0]) + "|" + str(Options.type_to_str(s[1])) + "|" + s[2]

            config["filters"] = {}
            for i, f in enumerate(self.filters):
                config["filters"]["filter" + str(i + 1)] = str(f[0]) + "|" + f[1] + "|" + f[2]

            config.write()

        except Exception:
            logger.exception(lambda: "Could not write configuration:")
开发者ID:GLolol,项目名称:variety-deb,代码行数:102,代码来源:Options.py

示例3: set_folder

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import collapseuser [as 别名]
 def set_folder(self, folder):
     self.folder = os.path.normpath(folder)
     self.image.set_from_icon_name(Util.get_file_icon_name(self.folder), Gtk.IconSize.MENU)
     self.label.set_text(Util.collapseuser(self.folder))
     self.button.set_tooltip_text(self.folder)
开发者ID:GLolol,项目名称:variety-deb,代码行数:7,代码来源:FolderChooser.py


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