Beispiel #1
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name):
        '''set the theme name and change all the paths to reflect the change'''
        self.image_name = image_name
        self.emote_name = emote_name
        self.sound_name = sound_name
        # conv_name is the name of the selected adium conversation theme
        self.conv_name = conv_name

        self.theme_path = os.path.join("themes", "images", self.image_name)
        self.conv_themes_path = os.path.join(os.getcwd(), "themes/conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        for elem in self.conv_themes.list():
            if conv_name in elem:
                self.adium_theme_path = elem

        self.conv_theme = self.conv_themes.get(self.adium_theme_path)[1]

        self.sound_theme_path = os.path.join("themes", "sounds",
                self.sound_name)

        self.user = os.path.join(self.theme_path, "user.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.png")

        self.sound_alert = os.path.join(self.sound_theme_path, "alert.wav")
        self.sound_nudge = os.path.join(self.sound_theme_path, "nudge.wav")
        self.sound_offline = os.path.join(self.sound_theme_path, "offline.wav")
        self.sound_online = os.path.join(self.sound_theme_path, "online.wav")
        self.sound_send = os.path.join(self.sound_theme_path, "send.wav")
        self.sound_type = os.path.join(self.sound_theme_path, "type.wav")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = \
            os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = \
            os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = \
            os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = \
            os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = \
            os.path.join(self.theme_path, "idle.png")

        self.emote_path = os.path.join('themes', 'emotes', self.emote_name)
Beispiel #2
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name):
        '''set the theme name and change all the paths to reflect the change'''
        self.image_name = image_name
        self.emote_name = emote_name
        self.sound_name = sound_name
        # conv_name is the name of the selected adium conversation theme
        self.conv_name = conv_name

        self.theme_path = os.path.join("themes", "images", self.image_name)
        self.conv_themes_path = os.path.join(os.getcwd(), "themes/conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        for elem in self.conv_themes.list():
            if conv_name in elem:
                self.adium_theme_path = elem

        self.conv_theme = self.conv_themes.get(self.adium_theme_path)[1]

        self.sound_theme_path = os.path.join("themes", "sounds",
                self.sound_name)

        self.user = os.path.join(self.theme_path, "user.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.png")

        self.sound_alert = os.path.join(self.sound_theme_path, "alert.wav")
        self.sound_nudge = os.path.join(self.sound_theme_path, "nudge.wav")
        self.sound_offline = os.path.join(self.sound_theme_path, "offline.wav")
        self.sound_online = os.path.join(self.sound_theme_path, "online.wav")
        self.sound_send = os.path.join(self.sound_theme_path, "send.wav")
        self.sound_type = os.path.join(self.sound_theme_path, "type.wav")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = \
            os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = \
            os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = \
            os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = \
            os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = \
            os.path.join(self.theme_path, "idle.png")

        self.emote_path = os.path.join('themes', 'emotes', self.emote_name)
Beispiel #3
0
    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]:
                theme = theme.replace('.AdiumMessageStyle', '')
                themes.append(theme)

        return themes
Beispiel #4
0
    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)
Beispiel #5
0
    def __init__(self, image_name="default", emote_name="default",
            sound_name="default", conv_name='renkoo.AdiumMessageStyle', conv_variant = ''):
        '''class constructor'''
        self.emote_theme = None
        self.config_dir = ConfigDir.ConfigDir('emesene2')
        self.config_path = self.config_dir.join('')

        #check for themes in .config dir
        self.config_themes_path = os.path.join(self.config_path, "themes")
        self.ensure_dir_path(self.config_themes_path)

        self.config_conv_themes_path = os.path.join(self.config_themes_path, "conversations")
        self.ensure_dir_path(self.config_conv_themes_path)

        self.conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)
        self.conv_themes.add_themes_path(self.config_conv_themes_path)


        self.config_sound_themes_path = os.path.join(self.config_themes_path, "sounds")
        self.ensure_dir_path(self.config_sound_themes_path)

        self.sound_theme_path = os.path.join("themes", "sounds")
        self.sound_themes = SoundThemes.get_instance()
        self.sound_themes.add_themes_path(self.sound_theme_path)
        self.sound_themes.add_themes_path(self.config_sound_themes_path)

        self.config_emotes_themes_path = os.path.join(self.config_themes_path, "emotes")
        self.ensure_dir_path(self.config_emotes_themes_path)

        self.emotes_themes_path = os.path.join(os.getcwd(), "themes", "emotes")
        self.emotes_themes = AdiumEmoteThemes.get_instance()
        self.emotes_themes.add_themes_path(self.emotes_themes_path)
        self.emotes_themes.add_themes_path(self.config_emotes_themes_path)

        self.config_images_themes_path = os.path.join(self.config_themes_path, "images")
        self.ensure_dir_path(self.config_images_themes_path)

        self.image_path = os.path.join(os.getcwd(),"themes", "images")
        self.image_themes = ImagesThemes.get_instance()
        self.image_themes.add_themes_path(self.image_path)
        self.image_themes.add_themes_path(self.config_images_themes_path)

        self.set_theme(image_name, emote_name, sound_name, conv_name, conv_variant)
Beispiel #6
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name):
        """set the theme name and change all the paths to reflect the change"""
        self.image_name = image_name
        self.emote_name = emote_name
        self.sound_name = sound_name
        # conv_name is the name of the selected adium conversation theme
        self.conv_name = conv_name

        self.theme_path = os.path.join(os.getcwd(), "themes", "images", self.image_name)
        self.conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        for elem in self.conv_themes.list():
            if conv_name in elem:
                self.adium_theme_path = elem

        self.conv_theme = self.conv_themes.get(self.adium_theme_path)[1]

        self.sound_theme_path = os.path.join("themes", "sounds", self.sound_name)

        self.av = os.path.join(self.theme_path, "audiovideo.png")
        self.video = os.path.join(self.theme_path, "video.png")
        self.call = os.path.join(self.theme_path, "call.png")
        self.user = os.path.join(self.theme_path, "user.png")
        self.user_def_image = os.path.join(self.theme_path, "user_def_image.png")
        self.user_def_imagetool = os.path.join(self.theme_path, "user_def_imagetool.png")
        self.email = os.path.join(self.theme_path, "email.png")
        self.mailbox = os.path.join(self.theme_path, "mailbox.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.gif")
        self.blocked_overlay = os.path.join(self.theme_path, "blocked-overlay.png")
        self.blocked_overlay_big = os.path.join(self.theme_path, "blocked-overlay-big.png")
        self.transfer_success = os.path.join(self.theme_path, "transfer_success.png")
        self.transfer_unsuccess = os.path.join(self.theme_path, "transfer_unsuccess.png")

        self.sound_alert = os.path.join(self.sound_theme_path, "alert.wav")
        self.sound_nudge = os.path.join(self.sound_theme_path, "nudge.wav")
        self.sound_offline = os.path.join(self.sound_theme_path, "offline.wav")
        self.sound_online = os.path.join(self.sound_theme_path, "online.wav")
        self.sound_send = os.path.join(self.sound_theme_path, "send.wav")
        self.sound_type = os.path.join(self.sound_theme_path, "type.wav")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = os.path.join(self.theme_path, "idle.png")

        self.status_icons_panel = {}
        self.panel_path = self.theme_path
        # allow different icons for indicators/tray icons
        # note: a panel subdirectory requires six pics:
        # logo.png, online.png, offline.png, busy.png, away.png, idle.png
        panel_path = os.path.join(self.theme_path, "panel")
        if os.path.exists(panel_path):
            self.panel_path = panel_path
            self.status_icons_panel[status.ONLINE] = os.path.join(self.panel_path, "online.png")
            self.status_icons_panel[status.OFFLINE] = os.path.join(self.panel_path, "offline.png")
            self.status_icons_panel[status.BUSY] = os.path.join(self.panel_path, "busy.png")
            self.status_icons_panel[status.AWAY] = os.path.join(self.panel_path, "away.png")
            self.status_icons_panel[status.IDLE] = os.path.join(self.panel_path, "idle.png")
        else:
            self.status_icons_panel = self.status_icons.copy()

        # allow theme-specific toolbar icons
        self.tool_font = None
        self.tool_font_color = None
        self.tool_emotes = None
        self.tool_nudge = None
        self.tool_invite = None
        self.tool_clean = None
        self.tool_file_transfer = None

        self.toolbar_path = None
        toolbar_path = os.path.join(self.theme_path, "toolbar")
        if os.path.exists(toolbar_path):
            self.toolbar_path = toolbar_path
            self.tool_font = os.path.join(self.toolbar_path, "font.png")
            self.tool_font_color = os.path.join(self.toolbar_path, "font-color.png")
            self.tool_emotes = os.path.join(self.toolbar_path, "emotes.png")
            self.tool_nudge = os.path.join(self.toolbar_path, "nudge.png")
            self.tool_invite = os.path.join(self.toolbar_path, "invite.png")
            self.tool_clean = os.path.join(self.toolbar_path, "clean-chat.png")
            self.tool_file_transfer = os.path.join(self.toolbar_path, "file-transfer.png")
            self.tool_ublock = os.path.join(self.toolbar_path, "ublock.png")

        self.emote_path = os.path.join("themes", "emotes", self.emote_name)
Beispiel #7
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name, conv_variant=''):
        '''set the theme name and change all the paths to reflect the change'''
        self.image_name = image_name
        self.emote_name = emote_name
        self.sound_name = sound_name
        # conv_name is the name of the selected adium conversation theme
        self.conv_name = conv_name
        self.adium_theme_variant= conv_variant

        self.theme_path = os.path.join(os.getcwd(),"themes", "images", self.image_name)
        self.conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        for elem in self.conv_themes.list():
            if conv_name in elem:
                self.adium_theme_path = elem

        self.conv_theme = self.conv_themes.get(self.adium_theme_path, variant=self.adium_theme_variant)[1]

        self.sound_theme_path = os.path.join("themes", "sounds",
                self.sound_name)

        self.av = os.path.join(self.theme_path, "audiovideo.png")
        self.video = os.path.join(self.theme_path, "video.png")
        self.call = os.path.join(self.theme_path, "call.png")
        self.user = os.path.join(self.theme_path, "user.png")
        self.user_def_image = os.path.join(self.theme_path, "user_def_image.png")
        self.user_def_imagetool = os.path.join(self.theme_path, "user_def_imagetool.png")
        self.email = os.path.join(self.theme_path, "email.png")
        self.mailbox = os.path.join(self.theme_path, "mailbox.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.logo16 = os.path.join(self.theme_path, "logo16.png")
        self.logo32 = os.path.join(self.theme_path, "logo32.png")
        self.logo48 = os.path.join(self.theme_path, "logo48.png")
        self.logo96 = self.logo
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.gif")
        self.blocked_overlay = os.path.join(self.theme_path, "blocked-overlay.png")
        self.blocked_overlay_big = os.path.join(self.theme_path, "blocked-overlay-big.png")
        self.transfer_success = os.path.join(self.theme_path, "transfer_success.png")
        self.transfer_unsuccess = os.path.join(self.theme_path, "transfer_unsuccess.png")
        self.service_msn = os.path.join(self.theme_path, "msn.png")
        self.service_facebook = os.path.join(self.theme_path, "facebook.png")
        self.service_gtalk = os.path.join(self.theme_path, "gtalk.png")
        self.service_dummy = os.path.join(self.theme_path, "dummy.png")
        self.favorite = os.path.join(self.theme_path, "favorite.png")

        self.sound_alert = os.path.join(self.sound_theme_path, "alert.wav")
        self.sound_nudge = os.path.join(self.sound_theme_path, "nudge.wav")
        self.sound_offline = os.path.join(self.sound_theme_path, "offline.wav")
        self.sound_online = os.path.join(self.sound_theme_path, "online.wav")
        self.sound_send = os.path.join(self.sound_theme_path, "send.wav")
        self.sound_type = os.path.join(self.sound_theme_path, "type.wav")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = \
            os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = \
            os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = \
            os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = \
            os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = \
            os.path.join(self.theme_path, "idle.png")

        self.status_icons_panel = {}
        self.panel_path = self.theme_path
        # allow different icons for indicators/tray icons
        # note: a panel subdirectory requires six pics: 
        #logo.png, online.png, offline.png, busy.png, away.png, idle.png
        panel_path = os.path.join(self.theme_path, "panel")        
        if os.path.exists(panel_path):
            self.panel_path = panel_path
            self.status_icons_panel[status.ONLINE] = \
                os.path.join(self.panel_path, "online.png")
            self.status_icons_panel[status.OFFLINE] = \
                os.path.join(self.panel_path, "offline.png")
            self.status_icons_panel[status.BUSY] = \
                os.path.join(self.panel_path, "busy.png")
            self.status_icons_panel[status.AWAY] = \
                os.path.join(self.panel_path, "away.png")
            self.status_icons_panel[status.IDLE] = \
                os.path.join(self.panel_path, "idle.png")
        else:
            self.status_icons_panel = self.status_icons.copy()

        # allow theme-specific toolbar icons
        self.tool_font = None
        self.tool_font_color = None
        self.tool_emotes = None
        self.tool_nudge = None
        self.tool_invite = None
        self.tool_clean = None
        self.tool_file_transfer = None

        self.toolbar_path = None
        toolbar_path = os.path.join(self.theme_path, "toolbar")        
        if os.path.exists(toolbar_path):
            self.toolbar_path = toolbar_path
            self.tool_font = os.path.join(self.toolbar_path, "font.png")
            self.tool_font_color = os.path.join(self.toolbar_path, "font-color.png")
            self.tool_emotes = os.path.join(self.toolbar_path, "emotes.png")
            self.tool_nudge = os.path.join(self.toolbar_path, "nudge.png")
            self.tool_invite = os.path.join(self.toolbar_path, "invite.png")
            self.tool_clean = os.path.join(self.toolbar_path, "clean-chat.png")
            self.tool_file_transfer = os.path.join(self.toolbar_path, "file-transfer.png")
            self.tool_ublock = os.path.join(self.toolbar_path, "ublock.png")

        self.emote_path = os.path.join('themes', 'emotes', self.emote_name)
        self.emote_config_file = os.path.join(self.emote_path, "Emoticons.plist")

        if os.path.isfile(self.emote_config_file):
            emote_data=plistlib.readPlist(file(self.emote_config_file))
            for key, val in emote_data['Emoticons'].iteritems():
                Theme.EMOTE_FILES.append(key)
                pointer_name = val['Name']
                pointer_key = val['Equivalents'][0]
                Theme.EMOTES[pointer_key] = pointer_name
                for v in val['Equivalents'][1:]:
                    if v != "":
                        Theme.EMOTES[v] = Theme.EMOTES[pointer_key]
            for key2 in Theme.EMOTES:
                Theme.EMOTE_REGEX_STR += re.escape(key2) + "|"
            Theme.EMOTE_REGEX = re.compile("("+Theme.EMOTE_REGEX_STR+")")
Beispiel #8
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name):
        '''set the theme name and change all the paths to reflect the change'''
        self.image_name = image_name
        self.emote_name = emote_name
        self.sound_name = sound_name
        # conv_name is the name of the selected adium conversation theme
        self.conv_name = conv_name

        self.theme_path = os.path.join(os.getcwd(),"themes", "images", self.image_name)
        self.conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        for elem in self.conv_themes.list():
            if conv_name in elem:
                self.adium_theme_path = elem

        self.conv_theme = self.conv_themes.get(self.adium_theme_path)[1]

        self.sound_theme_path = os.path.join("themes", "sounds",
                self.sound_name)

        self.av = os.path.join(self.theme_path, "audiovideo.png")
        self.video = os.path.join(self.theme_path, "video.png")
        self.call = os.path.join(self.theme_path, "call.png")
        self.user = os.path.join(self.theme_path, "user.png")
        self.user_def_image = os.path.join(self.theme_path, "user_def_image.png")
        self.user_def_imagetool = os.path.join(self.theme_path, "user_def_imagetool.png")
        self.email = os.path.join(self.theme_path, "email.png")
        self.mailbox = os.path.join(self.theme_path, "mailbox.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.logo16 = os.path.join(self.theme_path, "logo16.png")
        self.logo32 = os.path.join(self.theme_path, "logo32.png")
        self.logo48 = os.path.join(self.theme_path, "logo48.png")
        self.logo96 = self.logo
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.gif")
        self.blocked_overlay = os.path.join(self.theme_path, "blocked-overlay.png")
        self.blocked_overlay_big = os.path.join(self.theme_path, "blocked-overlay-big.png")
        self.transfer_success = os.path.join(self.theme_path, "transfer_success.png")
        self.transfer_unsuccess = os.path.join(self.theme_path, "transfer_unsuccess.png")
        self.service_msn = os.path.join(self.theme_path, "msn.png")
        self.service_facebook = os.path.join(self.theme_path, "facebook.png")
        self.service_gtalk = os.path.join(self.theme_path, "gtalk.png")
        self.service_dummy = os.path.join(self.theme_path, "dummy.png")
        self.favorite = os.path.join(self.theme_path, "favorite.png")

        self.sound_alert = os.path.join(self.sound_theme_path, "alert.wav")
        self.sound_nudge = os.path.join(self.sound_theme_path, "nudge.wav")
        self.sound_offline = os.path.join(self.sound_theme_path, "offline.wav")
        self.sound_online = os.path.join(self.sound_theme_path, "online.wav")
        self.sound_send = os.path.join(self.sound_theme_path, "send.wav")
        self.sound_type = os.path.join(self.sound_theme_path, "type.wav")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = \
            os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = \
            os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = \
            os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = \
            os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = \
            os.path.join(self.theme_path, "idle.png")

        self.status_icons_panel = {}
        self.panel_path = self.theme_path
        # allow different icons for indicators/tray icons
        # note: a panel subdirectory requires six pics: 
        #logo.png, online.png, offline.png, busy.png, away.png, idle.png
        panel_path = os.path.join(self.theme_path, "panel")        
        if os.path.exists(panel_path):
            self.panel_path = panel_path
            self.status_icons_panel[status.ONLINE] = \
                os.path.join(self.panel_path, "online.png")
            self.status_icons_panel[status.OFFLINE] = \
                os.path.join(self.panel_path, "offline.png")
            self.status_icons_panel[status.BUSY] = \
                os.path.join(self.panel_path, "busy.png")
            self.status_icons_panel[status.AWAY] = \
                os.path.join(self.panel_path, "away.png")
            self.status_icons_panel[status.IDLE] = \
                os.path.join(self.panel_path, "idle.png")
        else:
            self.status_icons_panel = self.status_icons.copy()

        # allow theme-specific toolbar icons
        self.tool_font = None
        self.tool_font_color = None
        self.tool_emotes = None
        self.tool_nudge = None
        self.tool_invite = None
        self.tool_clean = None
        self.tool_file_transfer = None

        self.toolbar_path = None
        toolbar_path = os.path.join(self.theme_path, "toolbar")        
        if os.path.exists(toolbar_path):
            self.toolbar_path = toolbar_path
            self.tool_font = os.path.join(self.toolbar_path, "font.png")
            self.tool_font_color = os.path.join(self.toolbar_path, "font-color.png")
            self.tool_emotes = os.path.join(self.toolbar_path, "emotes.png")
            self.tool_nudge = os.path.join(self.toolbar_path, "nudge.png")
            self.tool_invite = os.path.join(self.toolbar_path, "invite.png")
            self.tool_clean = os.path.join(self.toolbar_path, "clean-chat.png")
            self.tool_file_transfer = os.path.join(self.toolbar_path, "file-transfer.png")
            self.tool_ublock = os.path.join(self.toolbar_path, "ublock.png")

        self.emote_path = os.path.join('themes', 'emotes', self.emote_name)
        display = self.display.get_text()
        alias = self.alias.get_text()
        image_path = self.image_path.get_text()
        status_path = self.status_path.get_text()
        status = self.status.get_text()
        msg = self.message.get_text()

        message = Message.Message(not self.local, True, account, display, alias, image_path, status_path, msg, status)
        self.callback(message)


if __name__ == "__main__":
    dir_path = os.path.dirname(os.path.abspath(__file__))
    themes_path = os.path.join(dir_path, "../test/themes")

    themes = AdiumThemes.get_instance()
    themes.add_themes_path(themes_path)

    for (index, path) in enumerate(themes.list()):
        print index, path

    option = int(raw_input("option: "))
    path = themes.list()[option]

    status, theme = themes.get(path)

    if not status:
        print theme
        sys.exit(-1)

    gtk.gdk.threads_init()
Beispiel #10
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name):
        '''set the theme name and change all the paths to reflect the change'''
        self.image_name = image_name
        self.emote_name = emote_name
        self.sound_name = sound_name
        # conv_name is the name of the selected adium conversation theme
        self.conv_name = conv_name

        self.theme_path = os.path.join("themes", "images", self.image_name)
        self.conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        for elem in self.conv_themes.list():
            if conv_name in elem:
                self.adium_theme_path = elem

        self.conv_theme = self.conv_themes.get(self.adium_theme_path)[1]

        self.sound_theme_path = os.path.join("themes", "sounds",
                self.sound_name)

        self.user = os.path.join(self.theme_path, "user.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.png")

        self.sound_alert = os.path.join(self.sound_theme_path, "alert.wav")
        self.sound_nudge = os.path.join(self.sound_theme_path, "nudge.wav")
        self.sound_offline = os.path.join(self.sound_theme_path, "offline.wav")
        self.sound_online = os.path.join(self.sound_theme_path, "online.wav")
        self.sound_send = os.path.join(self.sound_theme_path, "send.wav")
        self.sound_type = os.path.join(self.sound_theme_path, "type.wav")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = \
            os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = \
            os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = \
            os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = \
            os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = \
            os.path.join(self.theme_path, "idle.png")

        self.status_icons_panel = {}
        self.panel_path = self.theme_path
        # allow different icons for indicators/tray icons
        # note: a panel subdirectory requires six pics: 
        #logo.png, online.png, offline.png, busy.png, away.png, idle.png
        panel_path = os.path.join(self.theme_path, "panel")        
        if os.path.exists(panel_path):
            self.panel_path = panel_path
            self.status_icons_panel[status.ONLINE] = \
                os.path.join(self.panel_path, "online.png")
            self.status_icons_panel[status.OFFLINE] = \
                os.path.join(self.panel_path, "offline.png")
            self.status_icons_panel[status.BUSY] = \
                os.path.join(self.panel_path, "busy.png")
            self.status_icons_panel[status.AWAY] = \
                os.path.join(self.panel_path, "away.png")
            self.status_icons_panel[status.IDLE] = \
                os.path.join(self.panel_path, "idle.png")
        else:
            self.status_icons_panel = self.status_icons.copy()
            
        self.emote_path = os.path.join('themes', 'emotes', self.emote_name)
Beispiel #11
0
    def set_theme(self, image_name, emote_name, sound_name, conv_name, conv_variant=''):
        '''set the theme name and change all the paths to reflect the change'''
        self.conv_themes_path = os.path.join(os.getcwd(), "themes", "conversations")
        self.conv_themes = AdiumThemes.get_instance()
        self.conv_themes.add_themes_path(self.conv_themes_path)

        # conv_name is the name of the selected adium conversation theme
        self.conv_theme = self.conv_themes.get_conv_theme (conv_name, conv_variant)

        self.sound_theme_path = os.path.join("themes", "sounds")
        self.sound_themes = SoundThemes.get_instance()
        self.sound_themes.add_themes_path(self.sound_theme_path)

        self.sound_theme = self.sound_themes.get_sound_theme (sound_name)

        self.image_name = image_name
        self.theme_path = os.path.join(os.getcwd(),"themes", "images", self.image_name)

        self.av = os.path.join(self.theme_path, "audiovideo.png")
        self.video = os.path.join(self.theme_path, "video.png")
        self.call = os.path.join(self.theme_path, "call.png")
        self.user = os.path.join(self.theme_path, "user.png")
        self.user_def_image = os.path.join(self.theme_path, "user_def_image.png")
        self.user_def_imagetool = os.path.join(self.theme_path, "user_def_imagetool.png")
        self.email = os.path.join(self.theme_path, "email.png")
        self.mailbox = os.path.join(self.theme_path, "mailbox.png")
        self.users = os.path.join(self.theme_path, "users.png")
        self.password = os.path.join(self.theme_path, "password.png")
        self.logo = os.path.join(self.theme_path, "logo.png")
        self.logo16 = os.path.join(self.theme_path, "logo16.png")
        self.logo32 = os.path.join(self.theme_path, "logo32.png")
        self.logo48 = os.path.join(self.theme_path, "logo48.png")
        self.logo96 = self.logo
        self.throbber = os.path.join(self.theme_path, "throbber.gif")
        self.connect = os.path.join(self.theme_path, "connect.png")
        self.chat = os.path.join(self.theme_path, "chat.png")
        self.group_chat = os.path.join(self.theme_path, "group-chat.png")
        self.typing = os.path.join(self.theme_path, "typing.png")
        self.new_message = os.path.join(self.theme_path, "new-message.gif")
        self.blocked_overlay = os.path.join(self.theme_path, "blocked-overlay.png")
        self.blocked_overlay_big = os.path.join(self.theme_path, "blocked-overlay-big.png")
        self.transfer_success = os.path.join(self.theme_path, "transfer_success.png")
        self.transfer_unsuccess = os.path.join(self.theme_path, "transfer_unsuccess.png")
        self.service_msn = os.path.join(self.theme_path, "msn.png")
        self.service_facebook = os.path.join(self.theme_path, "facebook.png")
        self.service_gtalk = os.path.join(self.theme_path, "gtalk.png")
        self.service_dummy = os.path.join(self.theme_path, "dummy.png")
        self.favorite = os.path.join(self.theme_path, "favorite.png")

        self.status_icons = {}
        self.status_icons[status.ONLINE] = \
            os.path.join(self.theme_path, "online.png")
        self.status_icons[status.OFFLINE] = \
            os.path.join(self.theme_path, "offline.png")
        self.status_icons[status.BUSY] = \
            os.path.join(self.theme_path, "busy.png")
        self.status_icons[status.AWAY] = \
            os.path.join(self.theme_path, "away.png")
        self.status_icons[status.IDLE] = \
            os.path.join(self.theme_path, "idle.png")

        self.status_icons_panel = {}
        self.panel_path = self.theme_path
        # allow different icons for indicators/tray icons
        # note: a panel subdirectory requires six pics: 
        #logo.png, online.png, offline.png, busy.png, away.png, idle.png
        panel_path = os.path.join(self.theme_path, "panel")        
        if os.path.exists(panel_path):
            self.panel_path = panel_path
            self.status_icons_panel[status.ONLINE] = \
                os.path.join(self.panel_path, "online.png")
            self.status_icons_panel[status.OFFLINE] = \
                os.path.join(self.panel_path, "offline.png")
            self.status_icons_panel[status.BUSY] = \
                os.path.join(self.panel_path, "busy.png")
            self.status_icons_panel[status.AWAY] = \
                os.path.join(self.panel_path, "away.png")
            self.status_icons_panel[status.IDLE] = \
                os.path.join(self.panel_path, "idle.png")
        else:
            self.status_icons_panel = self.status_icons.copy()

        # allow theme-specific toolbar icons
        self.tool_font = None
        self.tool_font_color = None
        self.tool_emotes = None
        self.tool_nudge = None
        self.tool_invite = None
        self.tool_clean = None
        self.tool_file_transfer = None

        self.toolbar_path = None
        toolbar_path = os.path.join(self.theme_path, "toolbar")        
        if os.path.exists(toolbar_path):
            self.toolbar_path = toolbar_path
            self.tool_font = os.path.join(self.toolbar_path, "font.png")
            self.tool_font_color = os.path.join(self.toolbar_path, "font-color.png")
            self.tool_emotes = os.path.join(self.toolbar_path, "emotes.png")
            self.tool_nudge = os.path.join(self.toolbar_path, "nudge.png")
            self.tool_invite = os.path.join(self.toolbar_path, "invite.png")
            self.tool_clean = os.path.join(self.toolbar_path, "clean-chat.png")
            self.tool_file_transfer = os.path.join(self.toolbar_path, "file-transfer.png")
            self.tool_ublock = os.path.join(self.toolbar_path, "ublock.png")

        self.emotes_themes_path = os.path.join(os.getcwd(), "themes", "emotes")
        self.emotes_themes = AdiumEmoteThemes.get_instance()
        self.emotes_themes.add_themes_path(self.emotes_themes_path)

        self.emote_theme = self.emotes_themes.get_emote_theme (emote_name)