This commit is contained in:
unknown 2011-11-28 23:11:42 -06:00
commit b8efdf4d8c
6 changed files with 34 additions and 18 deletions

View file

@ -39,7 +39,7 @@ CHANGELOG
* New smilies - Kiooeht [evacipatedBox] * New smilies - Kiooeht [evacipatedBox]
* Refresh theme in options - Kiooeht [evacipatedBox] * Refresh theme in options - Kiooeht [evacipatedBox]
* Separate tabbed/untabbed windows for conversaions and memos - Kiooeht [evacipatedBox] * Separate tabbed/untabbed windows for conversaions and memos - Kiooeht [evacipatedBox]
* Manually rearrange chumroll - Kiooeht [evacipatedBox] (Idea: [turntableAbbess (aka. TA or SGRILL)]) * Manually rearrange chumroll - Kiooeht [evacipatedBox] (Idea: [turntableAbbess (aka. TA of SGRILL)])
* Bug fixes * Bug fixes
* Don't delete random chum when blocking someone not on chumroll - Kiooeht [evacipatedBox] * Don't delete random chum when blocking someone not on chumroll - Kiooeht [evacipatedBox]
* Openning global userlist doesn't reset OP status of memo users - Kiooeht [evacipatedBox] * Openning global userlist doesn't reset OP status of memo users - Kiooeht [evacipatedBox]

View file

@ -125,10 +125,7 @@ class PesterLogUserSelect(QtGui.QDialog):
@QtCore.pyqtSlot() @QtCore.pyqtSlot()
def openDir(self): def openDir(self):
if ostools.isOSX():
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(_datadir, "logs"), QtCore.QUrl.TolerantMode)) QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(_datadir, "logs"), QtCore.QUrl.TolerantMode))
else:
QtGui.QDesktopServices.openUrl(QtCore.QUrl("file:///" + os.path.join(os.getcwd(), "logs"), QtCore.QUrl.TolerantMode))
class PesterLogViewer(QtGui.QDialog): class PesterLogViewer(QtGui.QDialog):
def __init__(self, chum, config, theme, parent): def __init__(self, chum, config, theme, parent):

View file

@ -29,5 +29,7 @@ def osVer():
def getDataDir(): def getDataDir():
if isOSX(): if isOSX():
return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/") return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "Pesterchum/")
elif isLinux():
return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.HomeLocation)), ".pesterchum/")
else: else:
return '' return os.path.join(str(QDesktopServices.storageLocation(QDesktopServices.DataLocation)), "pesterchum/")

View file

@ -1,5 +1,5 @@
# pesterchum # pesterchum
import os, sys, getopt import os, shutil, sys, getopt
if os.path.dirname(sys.argv[0]): if os.path.dirname(sys.argv[0]):
os.chdir(os.path.dirname(sys.argv[0])) os.chdir(os.path.dirname(sys.argv[0]))
import version import version
@ -47,8 +47,21 @@ if not ((major > 4) or (major == 4 and minor >= 6)):
_datadir = ostools.getDataDir() _datadir = ostools.getDataDir()
# See, what I've done here is that _datadir is '' if we're not on OSX, so the # See, what I've done here is that _datadir is '' if we're not on OSX, so the
# concatination is the same as if it wasn't there. # concatination is the same as if it wasn't there.
if _datadir and not os.path.exists(_datadir): # UPDATE 2011-11-28 <Kiooeht>:
os.mkdir(_datadir) # Now using data directory as defined by QDesktopServices on all platforms
# (on Linux, same as using xdg). To stay safe with older versions, copy any
# data (profiles, logs, etc) from old location to new data directory.
if _datadir:
if not os.path.exists(_datadir):
os.makedirs(_datadir)
if not os.path.exists(_datadir+"profiles/") and os.path.exists("profiles/"):
shutil.move("profiles/", _datadir+"profiles/")
if not os.path.exists(_datadir+"pesterchum.js") and os.path.exists("pesterchum.js"):
shutil.move("pesterchum.js", _datadir+"pesterchum.js")
if not os.path.exists(_datadir+"logs/") and os.path.exists("logs/"):
shutil.move("logs/", _datadir+"logs/")
if not os.path.exists(_datadir+"profiles"): if not os.path.exists(_datadir+"profiles"):
os.mkdir(_datadir+"profiles") os.mkdir(_datadir+"profiles")
if not os.path.exists(_datadir+"pesterchum.js"): if not os.path.exists(_datadir+"pesterchum.js"):

View file

@ -321,8 +321,8 @@ class userConfig(object):
for dirname, dirnames, filenames in os.walk(_datadir+'themes'): for dirname, dirnames, filenames in os.walk(_datadir+'themes'):
for d in dirnames: for d in dirnames:
themes.append(d) themes.append(d)
# For OSX, also load embedded themes. # Also load embedded themes.
if ostools.isOSX(): if _datadir:
for dirname, dirnames, filenames in os.walk('themes'): for dirname, dirnames, filenames in os.walk('themes'):
for d in dirnames: for d in dirnames:
if d not in themes: if d not in themes:
@ -440,7 +440,7 @@ class userProfile(object):
fp.close() fp.close()
@staticmethod @staticmethod
def newUserProfile(chatprofile): def newUserProfile(chatprofile):
if os.path.exists("profiles/%s.js" % (chatprofile.handle)): if os.path.exists("%s/%s.js" % (_datadir+"profiles", chatprofile.handle)):
newprofile = userProfile(chatprofile.handle) newprofile = userProfile(chatprofile.handle)
else: else:
newprofile = userProfile(chatprofile) newprofile = userProfile(chatprofile)
@ -529,11 +529,15 @@ class PesterProfileDB(dict):
class pesterTheme(dict): class pesterTheme(dict):
def __init__(self, name, default=False): def __init__(self, name, default=False):
self.path = _datadir+"themes/%s" % (name) possiblepaths = (_datadir+"themes/%s" % (name),
if not os.path.exists(self.path): "themes/%s" % (name),
self.path = "themes/%s" % (name) _datadir+"themes/pesterchum",
if not os.path.exists(self.path): "themes/pesterchum")
self.path = "themes/pesterchum" self.path = "themes/pesterchum"
for p in possiblepaths:
if os.path.exists(p):
self.path = p
break
self.name = name self.name = name
try: try:

View file

@ -18,7 +18,7 @@ class PythonQuirks(object):
for fn in os.listdir(os.path.join(self.home, 'quirks')): for fn in os.listdir(os.path.join(self.home, 'quirks')):
if fn.endswith('.py') and not fn.startswith('_'): if fn.endswith('.py') and not fn.startswith('_'):
filenames.append(os.path.join(self.home, 'quirks', fn)) filenames.append(os.path.join(self.home, 'quirks', fn))
if ostools.isOSX(): if self._datadir:
if not os.path.exists(os.path.join(self._datadir, 'quirks')): if not os.path.exists(os.path.join(self._datadir, 'quirks')):
os.mkdir(os.path.join(self._datadir, 'quirks')) os.mkdir(os.path.join(self._datadir, 'quirks'))
for fn in os.listdir(os.path.join(self._datadir, 'quirks')): for fn in os.listdir(os.path.join(self._datadir, 'quirks')):