コード例 #1
0
    def theme(self):
        """Return Theme object set by --theme."""
        theme_obj = None

        theme = self._args.theme
        dark_theme = self._args.dark_theme
        light_theme = self._args.light_theme

        if theme:
            theme_obj = Theme(theme)
            Logger.debug("Arguments/Theme: {}".format(theme))
        elif dark_theme and light_theme:
            theme_obj = Theme.new_with_dark_light(dark_theme, light_theme)
            Logger.debug("Arguments/Dark Theme: {}".format(dark_theme))
            Logger.debug("Arguments/Light Theme: {}".format(light_theme))

        return theme_obj
コード例 #2
0
ファイル: arguments.py プロジェクト: kmyi/Hardcode-Tray
 def theme():
     """Return Theme object set by --theme."""
     if not ArgumentsConfig._theme:
         theme = ArgumentsConfig.args().theme
         dark_theme = ArgumentsConfig.args().dark_theme
         light_theme = ArgumentsConfig.args().light_theme
         if theme:
             ArgumentsConfig._theme = Theme(theme)
             Logger.debug("Arguments/Theme: {}".format(theme))
         elif dark_theme and light_theme:
             ArgumentsConfig._theme = {
                 "dark": Theme(dark_theme),
                 "light": Theme(light_theme)
             }
             Logger.debug("Arguments/Dark Theme: {}".format(dark_theme))
             Logger.debug("Arguments/Light Theme: {}".format(light_theme))
     return ArgumentsConfig._theme
コード例 #3
0
    def theme(self):
        """Return theme object set in the config file."""
        theme_obj = None
        if self.icons:
            theme = self.icons.get("theme", {})
            if isinstance(theme, dict):
                dark_theme = theme.get("dark")
                light_theme = theme.get("light")

            if isinstance(theme, str):
                theme_obj = Theme(theme)
                Logger.debug("Config/Theme: {}".format(theme))
            elif dark_theme and light_theme:
                theme_obj = Theme.new_with_dark_light(dark_theme, light_theme)

                Logger.debug("Config/Dark Theme: {}".format(dark_theme))
                Logger.debug("Config/Light Theme: {}".format(light_theme))
        return theme_obj
コード例 #4
0
 def theme():
     """Return a theme object."""
     theme_name = Gtk.Settings.get_default().get_property(
         "gtk-icon-theme-name")
     theme = None
     if theme_name:
         Logger.debug("System/Theme: {}".format(theme_name))
         theme = Theme(theme_name)
     else:
         Logger.error("System/Theme: Not detected.")
     return theme
コード例 #5
0
ファイル: cjson.py プロジェクト: kmyi/Hardcode-Tray
    def theme():
        """Return theme object set in the config file."""
        if not JSONConfig._theme:
            icons = JSONConfig.get_default().get("icons")
            if icons:
                theme = icons.get("theme", {})
                if isinstance(theme, dict):
                    dark_theme = theme.get("dark")
                    light_theme = theme.get("light")

                if isinstance(theme, str):
                    JSONConfig._theme = Theme(theme)
                    Logger.debug("Config/Theme: {}".format(theme))
                elif dark_theme and light_theme:
                    JSONConfig._theme = {
                        "dark": Theme(dark_theme),
                        "light": Theme(light_theme)
                    }
                    Logger.debug("Config/Dark Theme: {}".format(dark_theme))
                    Logger.debug("Config/Light Theme: {}".format(light_theme))
        return JSONConfig._theme
コード例 #6
0
 def theme():
     """Return a theme object."""
     if SystemConfig._theme is None:
         source = Gio.SettingsSchemaSource.get_default()
         if source.lookup("org.gnome.desktop.interface", True):
             gsettings = Gio.Settings.new("org.gnome.desktop.interface")
             theme_name = gsettings.get_string("icon-theme")
             SystemConfig._theme = Theme(theme_name)
             Logger.debug("System/Theme: {}".format(theme_name))
         else:
             Logger.error("System/Theme: Not detected.")
     return SystemConfig._theme
コード例 #7
0
 def theme():
     """Return a theme object."""
     theme = None
     theme_settings = path.join(USERHOME, ".config/gtk-3.0/settings.ini")
     if DESKTOP_ENV in ["budgie", "unity", "gnome", "elementary", "other"]:
         source = Gio.SettingsSchemaSource.get_default()
         if source.lookup("org.gnome.desktop.interface", True):
             gsettings = Gio.Settings.new("org.gnome.desktop.interface")
             theme_name = gsettings.get_string("icon-theme")
             Logger.debug("System/Theme/GSettings: {}".format(theme_name))
             theme = Theme(theme_name)
     elif path.exists(theme_settings):
         try:
             cnfg = ConfigParser()
             cnfg.read(theme_settings)
             theme_name = cnfg.get("Settings", "gtk-icon-theme-name")
             Logger.debug("System/Theme/Setting.ini: {}".format(theme_name))
             theme = Theme(theme_name)
         except KeyError as err:
             Logger.error("System/Theme/Settings.ini: {}".format(err))
             exit(err)
     else:
         Logger.error("System/Theme: Not detected.")
     return theme