4 # Copyright (C) 2010 Stefanos Harhalakis
6 # This file is part of mydays.
8 # mydays is free software: you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation, either version 3 of the License, or
11 # (at your option) any later version.
13 # mydays is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with mydays. If not, see <http://www.gnu.org/licenses/>.
21 # $Id: 0.py 2265 2010-02-21 19:16:26Z v13 $
23 __version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
32 home=os.environ['HOME']
36 fn="%s/.maegirls" % (home, )
46 'ver': 1, # Configuration version
47 'girls': { # List of configured girls
50 'cur': "default", # Current girl
66 def sanitize_before_store(cfg0):
69 'cur': str(cfg0['cur']),
73 if cfg0.has_key('girls'):
74 for i in cfg0['girls']:
75 cfg['girls'][str(i)]=cfg0['girls'][i]
79 def storeConfig(cfg0):
81 cfg=sanitize_before_store(cfg0)
88 def storeGirl(name, dt):
93 if not cfg.has_key('girls'):
107 storeGirl(name, defaults)
120 if all.has_key(name):
127 def girlExists(name):
129 if all.has_key(name):
135 def setCurrentGirl(name):
140 def getCurrentGirl():
149 def removeGirl(name):
151 if cfg['girls'].has_key(name):
152 cfg['girls'].pop(name)
157 if not girlExists(cur):
158 storeConfig(defaultcfg)
160 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: