Beispiel #1
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 #2
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.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', 'default.AdiumEmoticonset')

        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)

        for elem in self.emotes_themes.list():
            if emote_name in elem:
                self.emote_path = elem

        self.emote_theme = self.emotes_themes.get(self.emote_path)[1]