4 # Copyright (C) 2010 Stefanos Harhalakis
6 # This file is part of maegirls.
8 # maegirls 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 # maegirls 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 maegirls. 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 $"
34 home=os.environ['HOME']
38 fn="%s/.maegirls" % (home, )
48 'ver': 1, # Configuration version
49 'girls': { # List of configured girls
52 'cur': "default", # Current girl
68 def sanitize_before_store(cfg0):
71 'cur': str(cfg0['cur']),
75 if cfg0.has_key('girls'):
76 for i in cfg0['girls']:
77 cfg['girls'][str(i)]=cfg0['girls'][i]
81 def storeConfig(cfg0):
83 cfg=sanitize_before_store(cfg0)
90 def storeGirl(name, dt):
95 if not cfg.has_key('girls'):
100 'cycle': dt['cycle'],
109 storeGirl(name, defaults)
122 if all.has_key(name):
129 def girlExists(name):
131 if all.has_key(name):
137 def setCurrentGirl(name):
142 def getCurrentGirl():
151 def removeGirl(name):
153 if cfg['girls'].has_key(name):
154 cfg['girls'].pop(name)
159 if not girlExists(cur):
160 storeConfig(defaultcfg)
162 # vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: