make sure conf name set on create

This commit is contained in:
Damien Elmes 2011-11-14 23:33:05 +09:00
parent 47f4b271dc
commit 0dfcfd9171

View file

@ -43,6 +43,7 @@ defaultTopConf = {
# configuration available to all groups # configuration available to all groups
defaultConf = { defaultConf = {
'name': _("Default"),
'new': { 'new': {
'delays': [1, 10], 'delays': [1, 10],
'ints': [1, 4], 'ints': [1, 4],
@ -70,6 +71,7 @@ defaultConf = {
'ease4': 1.3, 'ease4': 1.3,
'fuzz': 0.05, 'fuzz': 0.05,
'minSpace': 1, 'minSpace': 1,
'fi': 0.1,
}, },
'maxTaken': 60, 'maxTaken': 60,
'mod': 0, 'mod': 0,
@ -229,16 +231,18 @@ class GroupManager(object):
if str(id) not in self.gconf: if str(id) not in self.gconf:
break break
c['id'] = id c['id'] = id
c['name'] = name
self.gconf[str(id)] = c self.gconf[str(id)] = c
self.save(c) self.save(c)
return id return id
def remConf(self, id): def remConf(self, id):
"Remove a configuration and update all groups using it." "Remove a configuration and update all groups using it."
assert int(id) != 1
self.deck.modSchema() self.deck.modSchema()
del self.gconf[str(id)] del self.gconf[str(id)]
for g in self.all(): for g in self.all():
if g['conf'] == id: if str(g['conf']) == str(id):
g['conf'] = 1 g['conf'] = 1
self.save(g) self.save(g)
@ -287,6 +291,9 @@ usn=?,mod=? where id in %s""" % ids2str(cids),
"The currently selected gid." "The currently selected gid."
return self.deck.conf['curGroup'] return self.deck.conf['curGroup']
def current(self):
return self.get(self.selected())
def select(self, gid): def select(self, gid):
"Select a new branch." "Select a new branch."
# save the top level group # save the top level group