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