notif AVATAR_PATH

This commit is contained in:
Nikos Kouremenos 2006-01-17 11:20:55 +00:00
parent f816dcf307
commit b020492de6
4 changed files with 13 additions and 13 deletions

View file

@ -74,7 +74,7 @@ def create_log_db():
def check_and_possibly_create_paths(): def check_and_possibly_create_paths():
LOG_DB_PATH = logger.LOG_DB_PATH LOG_DB_PATH = logger.LOG_DB_PATH
VCARDPATH = gajim.VCARDPATH VCARDPATH = gajim.VCARDPATH
AVATARPATH = gajim.AVATARPATH AVATAR_PATH = gajim.AVATARPATH
dot_gajim = os.path.dirname(VCARDPATH) dot_gajim = os.path.dirname(VCARDPATH)
if os.path.isfile(dot_gajim): if os.path.isfile(dot_gajim):
print _('%s is file but it should be a directory') % dot_gajim print _('%s is file but it should be a directory') % dot_gajim
@ -93,11 +93,11 @@ def check_and_possibly_create_paths():
print _('Gajim will now exit') print _('Gajim will now exit')
sys.exit() sys.exit()
if not os.path.exists(AVATARPATH): if not os.path.exists(AVATAR_PATH):
print _('creating %s directory') % AVATARPATH print _('creating %s directory') % AVATAR_PATH
os.mkdir(AVATARPATH, 0700) os.mkdir(AVATAR_PATH, 0700)
elif os.path.isfile(AVATARPATH): elif os.path.isfile(AVATAR_PATH):
print _('%s is file but it should be a directory') % AVATARPATH print _('%s is file but it should be a directory') % AVATAR_PATH
print _('Gajim will now exit') print _('Gajim will now exit')
sys.exit() sys.exit()

View file

@ -53,25 +53,25 @@ if os.name == 'nt':
LOGPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Logs') # deprecated LOGPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Logs') # deprecated
VCARDPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Vcards') VCARDPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Vcards')
TMP = os.path.join(os.environ['tmp'], 'Gajim') TMP = os.path.join(os.environ['tmp'], 'Gajim')
AVATARPATH = os.path.join(os.environ['appdata'], 'Gajim', 'Avatars') AVATAR_PATH = os.path.join(os.environ['appdata'], 'Gajim', 'Avatars')
except KeyError: except KeyError:
# win9x, in cwd # win9x, in cwd
LOGPATH = 'Logs' # deprecated LOGPATH = 'Logs' # deprecated
VCARDPATH = 'Vcards' VCARDPATH = 'Vcards'
TMP = 'temporary files' TMP = 'temporary files'
AVATARPATH = 'Avatars' AVATAR_PATH = 'Avatars'
else: # Unices else: # Unices
DATA_DIR = '../data' DATA_DIR = '../data'
LOGPATH = os.path.expanduser('~/.gajim/logs') # deprecated LOGPATH = os.path.expanduser('~/.gajim/logs') # deprecated
VCARDPATH = os.path.expanduser('~/.gajim/vcards') VCARDPATH = os.path.expanduser('~/.gajim/vcards')
TMP = '/tmp' TMP = '/tmp'
AVATARPATH = os.path.expanduser('~/.gajim/avatars') AVATAR_PATH = os.path.expanduser('~/.gajim/avatars')
try: try:
LOGPATH = LOGPATH.decode(sys.getfilesystemencoding()) LOGPATH = LOGPATH.decode(sys.getfilesystemencoding())
VCARDPATH = VCARDPATH.decode(sys.getfilesystemencoding()) VCARDPATH = VCARDPATH.decode(sys.getfilesystemencoding())
TMP = TMP.decode(sys.getfilesystemencoding()) TMP = TMP.decode(sys.getfilesystemencoding())
AVATARPATH = AVATARPATH.decode(sys.getfilesystemencoding()) AVATAR_PATH = AVATARPATH.decode(sys.getfilesystemencoding())
except: except:
pass pass

View file

@ -840,7 +840,7 @@ class Interface:
def save_avatar_files(self, jid, photo_decoded): def save_avatar_files(self, jid, photo_decoded):
'''Save the decoded avatar to a separate file, and generate files for dbus notifications''' '''Save the decoded avatar to a separate file, and generate files for dbus notifications'''
path_to_file = os.path.join(gajim.AVATARPATH, jid) path_to_file = os.path.join(gajim.AVATAR_PATH, jid)
pixbuf, typ = gtkgui_helpers.get_pixbuf_from_data(photo_decoded, pixbuf, typ = gtkgui_helpers.get_pixbuf_from_data(photo_decoded,
want_type = True) want_type = True)
if typ in ('jpeg', 'png'): if typ in ('jpeg', 'png'):

View file

@ -123,14 +123,14 @@ class DesktopNotification:
prefix = 'jabber' prefix = 'jabber'
if event_type == _('Contact Signed In'): if event_type == _('Contact Signed In'):
path_to_file = os.path.join(gajim.AVATARPATH, jid) + '_notf_size_colored.png' path_to_file = os.path.join(gajim.AVATAR_PATH, jid) + '_notif_size_colored.png'
if not os.path.exists(path_to_file): if not os.path.exists(path_to_file):
img = prefix + '_online.png' img = prefix + '_online.png'
else: else:
img = path_to_file img = path_to_file
ntype = 'presence.online' ntype = 'presence.online'
elif event_type == _('Contact Signed Out'): elif event_type == _('Contact Signed Out'):
path_to_file = os.path.join(gajim.AVATARPATH, jid) + '_notf_size_bw.png' path_to_file = os.path.join(gajim.AVATAR_PATH, jid) + '_notif_size_bw.png'
if not os.path.exists(path_to_file): if not os.path.exists(path_to_file):
img = prefix + '_offline.png' img = prefix + '_offline.png'
else: else: