views: add a BranchCompareView class
[git-cola.git] / cola / settings.py
blobd12090c12f5b64a0400e36e84c8773240c17be27
1 #!/usr/bin/env python
2 # Copyright (c) 2008 David Aguilar
3 HAS_SIMPLEJSON = False
4 try:
5 import simplejson
6 HAS_SIMPLEJSON = True
7 except ImportError:
8 pass
10 import os
11 import user
12 from cola.model import Model
14 class SettingsModel(Model):
16 def init(self):
17 self.create( bookmarks = [] )
18 if not HAS_SIMPLEJSON:
19 return
20 settings = self.path()
21 if os.path.exists(settings):
22 self.load(settings)
24 def path(self):
25 return os.path.join(user.home, '.cola')
27 def save_all_settings(self):
28 if not HAS_SIMPLEJSON:
29 return
30 self.save(self.path())