コード例 #1
0
ファイル: __init__.py プロジェクト: kbernhagen/fah-control
def get_theme_dirs():
    if sys.platform == 'darwin':
        resources = quartz_application_get_resource_path()
        path = os.path.join(resources, 'themes')
        return [get_home_dir() + '/themes', path]
    return [
        get_home_dir() + '/themes',
        gtk.rc_get_theme_dir(), '/usr/share/themes'
    ]
コード例 #2
0
ファイル: PyTWF.py プロジェクト: Aurora-and-Equinox/PyTWF
	def get_themes(self):
		themes = [];

		# Home Themes
		themesdir = os.environ["HOME"]+"/.themes";
		for dir in os.listdir(themesdir):
			if self.is_themedir(themesdir+"/"+dir):
				themes.append(dir);

		# System-wide Themes
		sys_themes = gtk.rc_get_theme_dir();
		for dir in os.listdir(sys_themes):
			if self.is_themedir(sys_themes+"/"+dir):
				themes.append(dir);

		themes = list(set(themes));
		themes.sort(key=str.lower);

		return themes;
コード例 #3
0
    def on_run(self):
        from os import listdir
        from os.path import join
        theme_d = gtk.rc_get_theme_dir()
        theme_names = []
        theme_combo = self.xml.get_object('theme_combobox')
        theme_combo.handler_block(self._id)
        self.theme_liststore.clear()
        theme_combo.handler_unblock(self._id)
        for theme in listdir(theme_d):
            try:
                if "gtk-2.0" in listdir(join(theme_d, theme)):
                    theme_names.append(theme)
            except:
                pass

        theme_names = sorted(theme_names)
        for name in theme_names:
            self.theme_liststore.append((name, ))
コード例 #4
0
ファイル: theme_switcher.py プロジェクト: gajim/gajim-plugins
    def on_run(self):
        from os import listdir
        from os.path import join
        theme_d = gtk.rc_get_theme_dir()
        theme_names = []
        theme_combo = self.xml.get_object('theme_combobox')
        theme_combo.handler_block(self._id)
        self.theme_liststore.clear()
        theme_combo.handler_unblock(self._id)
        for theme in listdir(theme_d):
            try:
                if "gtk-2.0" in listdir(join(theme_d, theme)):
                    theme_names.append(theme)
            except:
                pass

        theme_names = sorted(theme_names)
        for name in theme_names:
            self.theme_liststore.append((name,))
コード例 #5
0
        rc_path = data
        #gtk.rc_parse(rc_path)
        theme_dir = os.path.dirname(os.path.dirname(rc_path))
        print theme_dir
        #settings.set_string_property('gtk-theme-name', theme_dir, '')
        settings.set_string_property('gtk-theme-name',
                os.path.basename(theme_dir), '')
        #gtk.rc_parse_string(open(rc_path, 'rt').read())
    
    
def main():
    gtk.main()
    return 0
    
if __name__ == "__main__":
    rc_path_list = glob.glob('/usr/share/themes/*/*/gtkrc')
    #for rc in rc_path_list:
    #    print rc
    
    #gtk.gdk.threads_init()
    
    settings = gtk.settings_get_default()
    settings.set_string_property('gtk-theme-name', 'Default', '')
    print(gtk.rc_get_theme_dir())
    #gtk.rc_parse_string(open(rc_path_list[0], 'rt').read())
    gtk.rc_parse_string(open('gtkrc', 'rt').read())

    ProgressBar(rc_path_list)
    main()

コード例 #6
0
def get_theme_dirs():
    return [
        get_home_dir() + '/themes',
        gtk.rc_get_theme_dir(), '/usr/share/themes'
    ]
コード例 #7
0
ファイル: __init__.py プロジェクト: FoldingAtHome/fah-control
def get_theme_dirs():
    return [get_home_dir() + '/themes', gtk.rc_get_theme_dir(),
            '/usr/share/themes']
コード例 #8
0
def setFixedFont(fontname):
    global fixedfont
    fixedfont = fontname


def getFixedFont():
    global fixedfont
    return fixedfont


switchboard.requestCallbackMain('change fixed font', setFixedFont)

##############################

themedirs = [
    gtk.rc_get_theme_dir(),
    os.path.join(os.path.expanduser("~"), ".themes")
]

themes = []
for dir in themedirs:
    try:
        themes += os.listdir(dir)
    except:
        pass

if themes:
    # This is ugly... We can't use an EnumParam for the theme, because the
    # theme names are only known when the GUI is loaded.  But it's easiest
    # to use a EnumParameter and a ParameterDialog to get the value.  So
    # we create an Enum and an EnumParameter just for the GUI, then pass
コード例 #9
0
ファイル: functions.py プロジェクト: hsbp/burnstation2
        if not os.path.isfile(os.path.join(home_pyjama, "eq_presets")):
            shutil.copy(os.path.join(install_dir(), "eq_presets"), os.path.join(home_pyjama, "eq_presets"))
        if not os.path.isfile(os.path.join(home_pyjama, "pyjama.cfg")):
            shutil.copy(os.path.join(install_dir(), "pyjama.cfg"), os.path.join(home_pyjama, "pyjama.cfg"))
            if not os.path.isfile(os.path.join(home_pyjama, "pyjama.cfg")):
                print "Error copying config file to user's pyjama directory"
                print "Please try to do so on your own"
        os.chmod(home_pyjama, 0777)
    return home_pyjama


#def get_pyjama_dir():
#    return os.path.join(os.getenv("HOME"), ".pyjama")

## List with some theme paths
theme_dirs = [os.path.join(preparedirs(),"themes"), gtk.rc_get_theme_dir(), os.path.join(install_dir(), "themes") ]

## Returns a list of available Themes
# @return A list of themes
def sorteddirlist():
    theme_list = []
    for t in theme_dirs:
        if os.path.exists(t):
            for theme in os.listdir(os.path.join(t)):
                theme_path = os.path.join(t, theme, "gtk-2.0", "gtkrc")
                if os.path.exists(theme_path) and not theme in theme_list:
                    theme_list.append(theme)
    return sorted(theme_list)
    

コード例 #10
0
ファイル: mainmenuGUI.py プロジェクト: anilkunwar/OOF2
fixedfont = "Mono 12"
mainmenu.OOF.Settings.Fonts.Fixed.add_gui_callback(setFont_gui)

def setFixedFont(fontname):
    global fixedfont
    fixedfont = fontname

def getFixedFont():
    global fixedfont
    return fixedfont

switchboard.requestCallbackMain('change fixed font', setFixedFont)

##############################

themedirs = [gtk.rc_get_theme_dir(),
             os.path.join(os.path.expanduser("~"), ".themes")]

themes = []
for dir in themedirs:
    try:
        themes += os.listdir(dir)
    except:
        pass

if themes:
    # This is ugly... We can't use an EnumParam for the theme, because the
    # theme names are only known when the GUI is loaded.  But it's easiest
    # to use a EnumParameter and a ParameterDialog to get the value.  So
    # we create an Enum and an EnumParameter just for the GUI, then pass
    # the string to the menuitem.