fixed chums bug...maybe?
This commit is contained in:
parent
a908935d47
commit
3e1dafc4fe
2 changed files with 23 additions and 6 deletions
8
INSTALL
8
INSTALL
|
@ -16,8 +16,12 @@ If you are building on Windows, the setup.py file has some
|
|||
commented-out lines that should give you a clue as to what you need to
|
||||
do. Talk to me if you reeeeally want to build on Windows.
|
||||
|
||||
If you are building on Linux, the setup.py file will do some of the
|
||||
work, but you'll need to copy necessary files manually.
|
||||
On Linux, you need to have the PyQt4 and pygame libraries installed:
|
||||
|
||||
Debian: apt-get install python-qt4 python-pgame
|
||||
Arch: pacman -S pyqt4 python-pygame
|
||||
|
||||
then run ./pesterchum (basically a shell script that runs python pesterchum.py)
|
||||
|
||||
The point of all this is that the only person besides myself that I
|
||||
expect to create builds are the awesome people that volunteer to help
|
||||
|
|
|
@ -108,6 +108,7 @@ class PesterLog(object):
|
|||
|
||||
class PesterProfileDB(dict):
|
||||
def __init__(self):
|
||||
self.filemutex = QtCore.QMutex()
|
||||
if sys.platform != "darwin":
|
||||
self.logpath = "logs"
|
||||
else:
|
||||
|
@ -122,14 +123,26 @@ class PesterProfileDB(dict):
|
|||
fp = open("%s/chums.js" % (self.logpath), 'w')
|
||||
json.dump(chumdict, fp)
|
||||
fp.close()
|
||||
except ValueError:
|
||||
chumdict = {}
|
||||
fp = open("%s/chums.js" % (self.logpath), 'w')
|
||||
json.dump(chumdict, fp)
|
||||
fp.close()
|
||||
|
||||
converted = dict([(handle, PesterProfile(handle, color=QtGui.QColor(c['color']), mood=Mood(c['mood']))) for (handle, c) in chumdict.iteritems()])
|
||||
self.update(converted)
|
||||
|
||||
def save(self):
|
||||
fp = open("%s/chums.js" % (self.logpath), 'w')
|
||||
chumdict = dict([p.plaindict() for p in self.itervalues()])
|
||||
json.dump(chumdict, fp)
|
||||
fp.close()
|
||||
self.filemutex.lock()
|
||||
try:
|
||||
fp = open("%s/chums.js" % (self.logpath), 'w')
|
||||
chumdict = dict([p.plaindict() for p in self.itervalues()])
|
||||
json.dump(chumdict, fp)
|
||||
fp.close()
|
||||
except Exception, e:
|
||||
self.filemutex.unlock()
|
||||
raise e
|
||||
self.filemutex.unlock()
|
||||
def getColor(self, handle, default=None):
|
||||
if not self.has_key(handle):
|
||||
return default
|
||||
|
|
Loading…
Reference in a new issue