cola: include GitPython to make installation simpler for users
[git-cola.git] / cola / settings.py
blobb1a92d132be46467fd0a612842b78463d7370bca
1 #!/usr/bin/env python
2 HAS_SIMPLEJSON = False
3 try:
4 import simplejson
5 HAS_SIMPLEJSON = True
6 except ImportError:
7 pass
9 import os
10 import user
11 from cola.model import Model
13 class SettingsModel(Model):
15 def init(self):
16 self.create( bookmarks = [] )
17 if not HAS_SIMPLEJSON:
18 return
19 settings = self.path()
20 if os.path.exists(settings):
21 self.load(settings)
23 def path(self):
24 return os.path.join(user.home, '.cola')
26 def save_all_settings(self):
27 if not HAS_SIMPLEJSON:
28 return
29 self.save(self.path())