def save_views(self):
# save the current color
self.__optiondb['RED'] = self.__red
self.__optiondb['GREEN'] = self.__green
self.__optiondb['BLUE'] = self.__blue
for v in self.__views:
if hasattr(v, 'save_options'):
v.save_options(self.__optiondb)
# save the name of the file used for the color database. we'll try to
# load this first.
self.__optiondb['DBFILE'] = self.__colordb.filename()
fp = None
try:
try:
fp = open(self.__initfile, 'w')
except IOError:
print >> sys.stderr, 'Cannot write options to file:', \
self.__initfile
else:
marshal.dump(self.__optiondb, fp)
finally:
if fp:
fp.close()
评论列表
文章目录