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


Python Util.get_xdg_pictures_folder方法代码示例

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


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

示例1: get_sanitized_config

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import get_xdg_pictures_folder [as 别名]
    def get_sanitized_config(parent):
        options = parent.options
        config = dict(options.__dict__)

        del config['configfile']

        # remove all references to local folders and files:
        config['favorites_folder'] = \
            'Default' if options.favorites_folder == os.path.expanduser(u"~/.config/variety/Favorites") else 'Changed'
        config['download_folder'] = \
            'Default' if options.download_folder == os.path.expanduser(u"~/.config/variety/Downloaded") else 'Changed'
        config['fetched_folder'] = \
            'Default' if options.fetched_folder == os.path.expanduser(u"~/.config/variety/Fetched") else 'Changed'
        config['copyto_folder'] = \
            'Default' if options.copyto_folder == 'Default' else 'Changed'
        config['quotes_favorites_file'] = \
            'Default' if options.quotes_favorites_file == os.path.expanduser(u"~/.config/variety/favorite_quotes.txt") else 'Changed'
        config['slideshow_custom_folder'] = \
            'Default' if options.slideshow_custom_folder == Util.get_xdg_pictures_folder() else 'Changed'

        config['sources'] = [s for s in options.sources if s[1] not in
                             (Options.SourceType.FOLDER, Options.SourceType.IMAGE)]
        config['favorites_operations'] = [
            ("custom_folder" if place not in ["/", "Downloaded", "Fetched", "Others"] else place, op)
            for (place, op) in options.favorites_operations]

        # add some general OS and desktop environment information
        config["platform"] = str(platform.platform())
        distro = platform.linux_distribution()
        config["linux_distribution"] = distro
        config["linux_distribution_distname"] = str(distro[0])
        config["linux_distribution_version"] = str(distro[1])
        config["linux_distribution_id"] = str(distro[2])
        config["desktop_session"] = str(os.getenv('DESKTOP_SESSION'))

        # add screen info - resolution, monitor count, etc.
        config["total_screen_width"] = Gdk.Screen.get_default().get_width()
        config["total_screen_height"] = Gdk.Screen.get_default().get_height()
        config["monitor_count"] = Gdk.Screen.get_default().get_n_monitors()

        try:
            rect = Gdk.Screen.get_default().get_monitor_geometry(Gdk.Screen.get_default().get_primary_monitor())
            config['primary_monitor_width'] = rect.width
            config['primary_monitor_height'] = rect.height
        except:
            pass

        # add some other Variety-specifics things:
        config["variety_version"] = varietyconfig.get_version()
        config["image_count"] = parent.image_count
        with open(os.path.join(parent.config_folder, ".firstrun"), 'r') as f:
            config["first_run_timestamp"] = f.read()

        # add a timestamp
        config["report_timestamp"] = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

        return config
开发者ID:GLolol,项目名称:variety-deb,代码行数:59,代码来源:Stats.py

示例2: set_defaults

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import get_xdg_pictures_folder [as 别名]
    def set_defaults(self):
        self.change_enabled = True
        self.change_on_start = False
        self.change_interval = 300
        self.safe_mode = False

        self.download_enabled = True
        self.download_interval = 600
        self.download_folder = os.path.expanduser(u"~/.config/variety/Downloaded")
        self.quota_enabled = True
        self.quota_size = 500

        self.favorites_folder = os.path.expanduser(u"~/.config/variety/Favorites")
        self.favorites_operations = [["Downloaded", "Copy"], ["Fetched", "Move"], ["Others", "Copy"]]

        self.fetched_folder = os.path.expanduser(u"~/.config/variety/Fetched")
        self.clipboard_enabled = False
        self.clipboard_use_whitelist = True
        self.clipboard_hosts = "alpha.wallhaven.cc,ns223506.ovh.net,wallpapers.net,flickr.com,imgur.com,deviantart.com,interfacelift.com,vladstudio.com".split(',')

        self.icon = "Light"

        self.desired_color_enabled = False
        self.desired_color = None
        self.min_size_enabled = False
        self.min_size = 80
        self.use_landscape_enabled = True
        self.lightness_enabled = False
        self.lightness_mode = Options.LightnessMode.DARK
        self.min_rating_enabled = False
        self.min_rating = 4

        self.smart_notice_shown = False
        self.smart_register_shown = False
        self.stats_notice_shown = False

        self.smart_enabled = True
        self.sync_enabled = True
        self.stats_enabled = True

        self.facebook_show_dialog = True
        self.facebook_message = ""

        self.copyto_enabled = False
        self.copyto_folder = "Default"

        self.clock_enabled = False
        self.clock_font = "Ubuntu Condensed, 70"
        self.clock_date_font = "Ubuntu Condensed, 30"
        self.clock_filter = "-density 100 -font `fc-match -f '%{file[0]}' '%CLOCK_FONT_NAME'` -pointsize %CLOCK_FONT_SIZE -gravity SouthEast -fill '#00000044' -annotate 0x0+[%HOFFSET+58]+[%VOFFSET+108] '%H:%M' -fill white -annotate 0x0+[%HOFFSET+60]+[%VOFFSET+110] '%H:%M' -font `fc-match -f '%{file[0]}' '%DATE_FONT_NAME'` -pointsize %DATE_FONT_SIZE -fill '#00000044' -annotate 0x0+[%HOFFSET+58]+[%VOFFSET+58] '%A, %B %d' -fill white -annotate 0x0+[%HOFFSET+60]+[%VOFFSET+60] '%A, %B %d'"

        self.quotes_enabled = False
        self.quotes_font = "Bitstream Charter 30"
        self.quotes_text_color = (255, 255, 255)
        self.quotes_bg_color = (80, 80, 80)
        self.quotes_bg_opacity = 55
        self.quotes_text_shadow = False
        self.quotes_disabled_sources = []
        self.quotes_tags = ""
        self.quotes_authors = ""
        self.quotes_change_enabled = False
        self.quotes_change_interval = 300
        self.quotes_width = 70
        self.quotes_hpos = 100
        self.quotes_vpos = 40
        self.quotes_favorites_file = os.path.expanduser(u"~/.config/variety/favorite_quotes.txt")

        self.slideshow_sources_enabled = True
        self.slideshow_favorites_enabled = True
        self.slideshow_downloads_enabled = False
        self.slideshow_custom_enabled = False
        self.slideshow_custom_folder = Util.get_xdg_pictures_folder()
        self.slideshow_sort_order = "Random"
        self.slideshow_monitor = "All"
        self.slideshow_mode = "Fullscreen"
        self.slideshow_seconds = 6
        self.slideshow_fade = 0.4
        self.slideshow_zoom = 0.2
        self.slideshow_pan = 0.05

        self.sources = [
            [True, Options.SourceType.FAVORITES, "The Favorites folder"],
            [True, Options.SourceType.FETCHED, "The Fetched folder"],
            [True, Options.SourceType.FOLDER, "/usr/share/backgrounds/"],
            [True, Options.SourceType.DESKTOPPR, "Random wallpapers from Desktoppr.co"],
            [True, Options.SourceType.BING, "Bing Photo of the Day"],
            [True, Options.SourceType.UNSPLASH, "High-resolution photos from Unsplash.com"],
            [False, Options.SourceType.APOD, "NASA's Astronomy Picture of the Day"],
            [True, Options.SourceType.FLICKR, "user:www.flickr.com/photos/peter-levi/;user_id:[email protected];"],
        ]

        self.filters = [
            [False, "Keep original", ""],
            [False, "Grayscale", "-type Grayscale"],
            [False, "Heavy blur", "-blur 120x40"],
            [False, "Oil painting", "-paint 6"],
            [False, "Charcoal painting", "-charcoal 3"],
            [False, "Pencil sketch", """-colorspace gray \( +clone -tile ~/.config/variety/pencil_tile.png -draw "color 0,0 reset" +clone +swap -compose color_dodge -composite \) -fx 'u*.2+v*.8'"""],
            [False, "Pointilism", "-spread 10 -noise 3"],
            [False, "Pixellate", "-scale 3% -scale 3333%"]
#.........这里部分代码省略.........
开发者ID:GLolol,项目名称:variety-deb,代码行数:103,代码来源:Options.py

示例3: read

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import get_xdg_pictures_folder [as 别名]

#.........这里部分代码省略.........
                self.quotes_vpos = int(float(config["quotes_vpos"]))
                self.quotes_vpos = max(0, min(100, self.quotes_vpos))
            except Exception:
                pass

            try:
                self.quotes_favorites_file = os.path.expanduser(config["quotes_favorites_file"])
            except Exception:
                pass

            try:
                self.slideshow_sources_enabled = config["slideshow_sources_enabled"].lower() in TRUTH_VALUES
            except Exception:
                pass

            try:
                self.slideshow_favorites_enabled = config["slideshow_favorites_enabled"].lower() in TRUTH_VALUES
            except Exception:
                pass

            try:
                self.slideshow_downloads_enabled = config["slideshow_downloads_enabled"].lower() in TRUTH_VALUES
            except Exception:
                pass

            try:
                self.slideshow_custom_enabled = config["slideshow_custom_enabled"].lower() in TRUTH_VALUES
            except Exception:
                pass

            try:
                custom_path = config["slideshow_custom_folder"]
                if custom_path in ('None', 'Default') or not os.path.isdir():
                    self.slideshow_custom_folder = Util.get_xdg_pictures_folder()
                else:
                    self.slideshow_custom_folder = custom_path
            except Exception:
                pass

            try:
                slideshow_sort_order = config["slideshow_sort_order"]
                if slideshow_sort_order in ["Random", "Name, asc", "Name, desc", "Date, asc", "Date, desc"]:
                    self.slideshow_sort_order = slideshow_sort_order
            except Exception:
                pass

            try:
                self.slideshow_monitor = config["slideshow_monitor"]
            except Exception:
                pass

            try:
                slideshow_mode = config["slideshow_mode"]
                if slideshow_mode in ["Fullscreen", "Desktop", "Maximized", "Window"]:
                    self.slideshow_mode = slideshow_mode
            except Exception:
                pass

            try:
                self.slideshow_seconds = float(config["slideshow_seconds"])
                self.slideshow_seconds = max(0.5, self.slideshow_seconds)
            except Exception:
                pass

            try:
                self.slideshow_fade = float(config["slideshow_fade"])
开发者ID:GLolol,项目名称:variety-deb,代码行数:70,代码来源:Options.py

示例4: test_get_xdg_pictures_folder

# 需要导入模块: from variety.Util import Util [as 别名]
# 或者: from variety.Util.Util import get_xdg_pictures_folder [as 别名]
 def test_get_xdg_pictures_folder(self):
     self.assertEquals(os.path.expanduser('~/Pictures'), Util.get_xdg_pictures_folder())
开发者ID:GLolol,项目名称:variety-deb,代码行数:4,代码来源:TestUtil.py


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