Made emotes work in OSX by specifying the absolute path.

This commit is contained in:
Lexi 2011-08-10 13:26:57 +01:00
parent 5afff509a6
commit 14c0999c71

View file

@ -1,5 +1,6 @@
import re
import random
from os.path import abspath
from copy import copy
from datetime import timedelta
from PyQt4 import QtGui
@ -21,6 +22,8 @@ quirkloader = PythonQuirks()
_functionre = re.compile(r"%s" % quirkloader.funcre())
_groupre = re.compile(r"\\([0-9]+)")
_path = abspath('.')
def reloadQuirkFunctions():
quirkloader.load()
global _functionre
@ -136,7 +139,7 @@ class smiley(object):
self.string = string
def convert(self, format):
if format == "html":
return "<img src='smilies/%s' alt='%s' title='%s' />" % (smiledict[self.string], self.string, self.string)
return "<img src='%s/smilies/%s' alt='%s' title='%s' />" % (_path, smiledict[self.string], self.string, self.string)
else:
return self.string
class mecmd(object):
@ -368,7 +371,7 @@ def img2smiley(string):
string = unicode(string)
def imagerep(mo):
return reverse_smiley[mo.group(1)]
string = re.sub(r'<img src="smilies/(\S+)" />', imagerep, string)
string = re.sub(r'<img src=".*/smilies/(\S+)" />', imagerep, string)
return string
smiledict = {