Changeset 8451

Show
Ignore:
Timestamp:
08/06/07 00:57:04 (17 months ago)
Author:
asterix
Message:

[blarz] ability to load iconsets from ~/.gajim/iconsets. fixes #3339

Location:
trunk/src
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/configpaths.py

    r8435 r8451  
    7979 
    8080                # LOG is deprecated 
    81                 k = ( 'LOG',   'LOG_DB',   'VCARD',   'AVATAR',   'MY_EMOTS' ) 
    82                 v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons') 
     81                k = ( 'LOG',   'LOG_DB',   'VCARD',   'AVATAR',   'MY_EMOTS', 
     82                        'MY_ICONSETS' ) 
     83                v = (u'logs', u'logs.db', u'vcards', u'avatars', u'emoticons', 
     84                        u'iconsets') 
    8385 
    8486                if os.name == 'nt': 
  • trunk/src/common/gajim.py

    r8112 r8451  
    7272AVATAR_PATH = gajimpaths['AVATAR'] 
    7373MY_EMOTS_PATH = gajimpaths['MY_EMOTS'] 
     74MY_ICONSETS_PATH = gajimpaths['MY_ICONSETS'] 
    7475TMP = gajimpaths['TMP'] 
    7576DATA_DIR = gajimpaths['DATA'] 
  • trunk/src/common/helpers.py

    r8445 r8451  
    10451045        from time import strptime 
    10461046        return strptime(timestamp, '%Y%m%dT%H:%M:%S') 
     1047 
     1048def get_iconset_path(iconset): 
     1049        if os.path.isdir(os.path.join(gajim.DATA_DIR, 'iconsets', iconset)): 
     1050                return os.path.join(gajim.DATA_DIR, 'iconsets', iconset) 
     1051        elif os.path.isdir(os.path.join(gajim.MY_ICONSETS_PATH, iconset)): 
     1052                return os.path.join(gajim.MY_ICONSETS_PATH, iconset) 
  • trunk/src/config.py

    r8439 r8451  
    147147                # iconset 
    148148                iconsets_list = os.listdir(os.path.join(gajim.DATA_DIR, 'iconsets')) 
     149                if os.path.isdir(gajim.MY_ICONSETS_PATH): 
     150                        iconsets_list += os.listdir(gajim.MY_ICONSETS_PATH)  
    149151                # new model, image in 0, string in 1 
    150152                model = gtk.ListStore(gtk.Image, str) 
     
    159161                l = [] 
    160162                for dir in iconsets_list: 
    161                         if not os.path.isdir(os.path.join(gajim.DATA_DIR, 'iconsets', dir)): 
     163                        if not os.path.isdir(os.path.join(gajim.DATA_DIR, 'iconsets', dir)) \ 
     164                        and not os.path.isdir(os.path.join(gajim.MY_ICONSETS_PATH, dir)): 
    162165                                continue 
    163166                        if dir != '.svn' and dir != 'transports': 
     
    168171                        preview = gtk.Image() 
    169172                        files = [] 
    170                         files.append(os.path.join(gajim.DATA_DIR, 'iconsets', l[i], '16x16', 
     173                        files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16', 
    171174                                'online.png')) 
    172                         files.append(os.path.join(gajim.DATA_DIR, 'iconsets', l[i], '16x16', 
     175                        files.append(os.path.join(helpers.get_iconset_path(l[i]), '16x16', 
    173176                                'online.gif')) 
    174177                        for file in files: 
  • trunk/src/roster_window.py

    r8447 r8451  
    19841984 
    19851985                                iconset = gajim.config.get('iconset') 
    1986                                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     1986                                path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    19871987                                for c in contacts: 
    19881988                                        # icon MUST be different instance for every item 
     
    21712171                send_custom_status_menuitem.set_submenu(status_menuitems) 
    21722172                iconset = gajim.config.get('iconset') 
    2173                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     2173                path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    21742174                for s in ['online', 'chat', 'away', 'xa', 'dnd', 'offline']: 
    21752175                        # icon MUST be different instance for every item 
     
    21902190                                if not iconset: 
    21912191                                        iconset = gajim.config.DEFAULT_ICONSET 
    2192                                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     2192                                path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    21932193                                for c in contacts: 
    21942194                                        # icon MUST be different instance for every item 
     
    26692669                        send_custom_status_menuitem.set_submenu(status_menuitems) 
    26702670                        iconset = gajim.config.get('iconset') 
    2671                         path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     2671                        path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    26722672                        for s in ['online', 'chat', 'away', 'xa', 'dnd', 'offline']: 
    26732673                                # icon MUST be different instance for every item 
     
    28612861                # using self.jabber_status_images is poopoo 
    28622862                iconset = gajim.config.get('iconset') 
    2863                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     2863                path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    28642864                state_images = self.load_iconset(path) 
    28652865 
     
    30073007                        menu = gtk.Menu() 
    30083008                        iconset = gajim.config.get('iconset') 
    3009                         path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     3009                        path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    30103010                        accounts = [] # Put accounts in a list to sort them 
    30113011                        for account in gajim.connections: 
     
    36043604                        pass 
    36053605                iconset = gajim.config.get('iconset') 
    3606                 prefix = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32') 
     3606                prefix = os.path.join(helpers.get_iconset_path(iconset), '32x32') 
    36073607                if status in ('chat', 'away', 'xa', 'dnd', 'invisible', 'offline'): 
    36083608                        status = status + '.png' 
     
    43014301                '''load an icon from the iconset in 16x16''' 
    43024302                iconset = gajim.config.get('iconset') 
    4303                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16'+ '/') 
     4303                path = os.path.join(helpers.get_iconset_path(iconset), '16x16'+ '/') 
    43044304                icon_list = self._load_icon_list([icon_name], path) 
    43054305                return icon_list[icon_name] 
     
    43364336                iconset = gajim.config.get('iconset') 
    43374337                if iconset: 
    4338                         path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     4338                        path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    43394339                        if not os.path.exists(path): 
    43404340                                iconset = gajim.config.DEFAULT_ICONSET 
     
    43424342                        iconset = gajim.config.DEFAULT_ICONSET 
    43434343 
    4344                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32') 
     4344                path = os.path.join(helpers.get_iconset_path(iconset), '32x32') 
    43454345                self.jabber_state_images['32'] = self.load_iconset(path) 
    43464346 
    4347                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     4347                path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    43484348                self.jabber_state_images['16'] = self.load_iconset(path) 
    43494349                # try to find opened_meta.png file, else opened.png else nopixbuf merge 
  • trunk/src/systray.py

    r8393 r8451  
    146146                # We need our own set of status icons, let's make 'em! 
    147147                iconset = gajim.config.get('iconset') 
    148                 path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     148                path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    149149                state_images = gajim.interface.roster.load_iconset(path) 
    150150 
  • trunk/src/tooltips.py

    r8386 r8451  
    229229                if not iconset: 
    230230                        iconset = 'dcraven' 
    231                 file_path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16') 
     231                file_path = os.path.join(helpers.get_iconset_path(iconset), '16x16') 
    232232                for acct in accounts: 
    233233                        message = acct['message'] 
     
    442442                                if not iconset: 
    443443                                        iconset = 'dcraven' 
    444                                 file_path = os.path.join(gajim.DATA_DIR, 
    445                                         'iconsets', iconset, '16x16') 
     444                                file_path = os.path.join(helpers.get_iconset_path(iconsets), 
     445                                        '16x16') 
    446446 
    447447                        contact_keys = contacts_dict.keys()