Commit e774644c authored by eric pellegrini's avatar eric pellegrini
Browse files

Bug fix when saving elements database

parent e41633ae
......@@ -259,9 +259,11 @@ class ElementsDatabase(object):
# Return a csv writer object.
databaseWriter = csv.DictWriter(f, propNames, delimiter=delimiter, lineterminator=lineterminator, restval=restval)
databaseWriter.writeheader()
default = {"id":"''"}
default.update(dict([(pname,repr(prop())) for pname,prop in self._properties.items()]))
databaseWriter.writerow(default)
rtypes = dict([(v,k) for k,v in ElementsDatabase._TYPES.items()])
ptypes = {'id':'type'}
ptypes.update(dict([(k,rtypes[v]) for k,v in self._properties.items()]))
databaseWriter.writerow(ptypes)
for ename, props in self._data.items():
p = {"id":ename}
p.update(dict([(pname,props.get(pname,prop())) for pname,prop in self._properties.items()]))
......
......@@ -216,9 +216,9 @@ class ElementsDatabaseEditor(wx.Frame):
menubar = wx.MenuBar()
fileMenu = wx.Menu()
saveItem = fileMenu.Append(wx.ID_ANY, '&Save database\tCtrl+S')
saveasItem = fileMenu.Append(wx.ID_ANY, '&Save database as ...\tCtrl+Shift+S')
menubar.Append(fileMenu, "File")
databaseMenu = wx.Menu()
addElementItem = databaseMenu.Append(wx.ID_ANY, 'New element')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment