def get_adium_themes(self): '''return a list of validated adium themes''' themes = [] AdiumThemesM = AdiumThemes.AdiumThemes() path_conv = os.path.join('themes', 'conversations') for theme in self.get_child_dirs(path_conv): if AdiumThemesM.validate( os.path.join(os.path.abspath(path_conv), theme))[0]: themes.append(theme) return themes
def __init__(self, image_name="default", emote_name="default", sound_name="default", conv_name='renkoo.AdiumMessageStyle', conv_variant=''): '''class constructor''' self.emote_theme = None config_dir = ConfigDir.ConfigDir() config_path = config_dir.join('') #check for themes in .config dir config_themes_path = os.path.join(config_path, "themes") ensure_dir_path(config_themes_path) config_conv_themes_path = os.path.join(config_themes_path, "conversations") ensure_dir_path(config_conv_themes_path) conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations") self.conv_themes = AdiumThemes.AdiumThemes() self.conv_themes.add_themes_path(conv_themes_path) self.conv_themes.add_themes_path(config_conv_themes_path) config_sound_themes_path = os.path.join(config_themes_path, "sounds") ensure_dir_path(config_sound_themes_path) sound_theme_path = os.path.join(os.getcwd(), "themes", "sounds") self.sound_themes = SoundThemes.SoundThemes() self.sound_themes.add_themes_path(sound_theme_path) self.sound_themes.add_themes_path(config_sound_themes_path) config_emote_themes_path = os.path.join(config_themes_path, "emotes") ensure_dir_path(config_emote_themes_path) emote_themes_path = os.path.join(os.getcwd(), "themes", "emotes") self.emote_themes = AdiumEmoteThemes.AdiumEmoteThemes() self.emote_themes.add_themes_path(emote_themes_path) self.emote_themes.add_themes_path(config_emote_themes_path) config_images_themes_path = os.path.join(config_themes_path, "images") ensure_dir_path(config_images_themes_path) image_path = os.path.join(os.getcwd(), "themes", "images") self.image_themes = ImagesThemes.ImagesThemes() self.image_themes.add_themes_path(image_path) self.image_themes.add_themes_path(config_images_themes_path) self.set_theme(image_name, emote_name, sound_name, conv_name, conv_variant)