we can now have emoticons themes in ~/.gajim/emoticons/ see #1182
This commit is contained in:
parent
3a6bb0bec9
commit
3b4f6e20fe
|
@ -54,16 +54,19 @@ if os.name == 'nt':
|
|||
LOGPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Logs') # deprecated
|
||||
VCARD_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Vcards')
|
||||
AVATAR_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Avatars')
|
||||
MY_EMOTS_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Emoticons')
|
||||
except KeyError:
|
||||
# win9x, in cwd
|
||||
LOGPATH = 'Logs' # deprecated
|
||||
VCARD_PATH = 'Vcards'
|
||||
AVATAR_PATH = 'Avatars'
|
||||
MY_EMOTS_PATH = 'Emoticons'
|
||||
else: # Unices
|
||||
DATA_DIR = '../data'
|
||||
LOGPATH = os.path.expanduser('~/.gajim/logs') # deprecated
|
||||
VCARD_PATH = os.path.expanduser('~/.gajim/vcards')
|
||||
AVATAR_PATH = os.path.expanduser('~/.gajim/avatars')
|
||||
MY_EMOTS_PATH = os.path.expanduser('~/.gajim/emoticons')
|
||||
|
||||
HOME_DIR = os.path.expanduser('~')
|
||||
TMP = tempfile.gettempdir()
|
||||
|
@ -73,6 +76,7 @@ try:
|
|||
VCARD_PATH = VCARD_PATH.decode(sys.getfilesystemencoding())
|
||||
TMP = TMP.decode(sys.getfilesystemencoding())
|
||||
AVATAR_PATH = AVATAR_PATH.decode(sys.getfilesystemencoding())
|
||||
MY_EMOTS_PATH = MY_EMOTS_PATH.decode(sys.getfilesystemencoding())
|
||||
except:
|
||||
pass
|
||||
|
||||
|
|
|
@ -115,23 +115,24 @@ class PreferencesWindow:
|
|||
# emoticons
|
||||
emoticons_combobox = self.xml.get_widget('emoticons_combobox')
|
||||
emoticons_list = os.listdir(os.path.join(gajim.DATA_DIR, 'emoticons'))
|
||||
# user themes
|
||||
if os.path.isdir(gajim.MY_EMOTS_PATH):
|
||||
emoticons_list += os.listdir(gajim.MY_EMOTS_PATH)
|
||||
renderer_text = gtk.CellRendererText()
|
||||
emoticons_combobox.pack_start(renderer_text, True)
|
||||
emoticons_combobox.add_attribute(renderer_text, 'text', 0)
|
||||
model = gtk.ListStore(str)
|
||||
emoticons_combobox.set_model(model)
|
||||
l = ['Disabled']
|
||||
for dir in emoticons_list:
|
||||
if dir != '.svn':
|
||||
l.append(dir)
|
||||
print l
|
||||
l.append('Disabled')
|
||||
for i in xrange(len(l)):
|
||||
print l[i]
|
||||
model.append([l[i]])
|
||||
if gajim.config.get('emoticons_theme') == l[i]:
|
||||
emoticons_combobox.set_active(i)
|
||||
if not gajim.config.get('emoticons_theme'):
|
||||
emoticons_combobox.set_active(0)
|
||||
emoticons_combobox.set_active(len(l))
|
||||
|
||||
#iconset
|
||||
iconsets_list = os.listdir(os.path.join(gajim.DATA_DIR, 'iconsets'))
|
||||
|
|
|
@ -1419,6 +1419,11 @@ class Interface:
|
|||
if not emot_theme:
|
||||
return
|
||||
path = os.path.join(gajim.DATA_DIR, 'emoticons', emot_theme)
|
||||
if not os.path.exists(path):
|
||||
# It's maybe a user theme
|
||||
path = os.path.join(gajim.MY_EMOTS_PATH, emot_theme)
|
||||
if not os.path.exists(path): # theme doesn't exists
|
||||
return
|
||||
sys.path.append(path)
|
||||
from emoticons import emoticons as emots
|
||||
for emot in emots:
|
||||
|
|
Loading…
Reference in New Issue