/usr/share/bibus/FormatEditor.py is in bibus 1.5.2-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | import StyleEditor.FormatEditor
class FormatEditor(StyleEditor.FormatEditor.FormatEditor):
def Save(self,evt):
"""Save the Format.Converter and exit"""
self.__Save()
try:
f = open(self.filename,'wb')
cPickle.dump(self.conv,f,False) # we save the style file. ascii mode for readibility
f.flush()
f.close()
BIB.FORMAT_DICO = self.conv # we keep the current format
BIB.FORMAT_CONV = Format.Converter.Converter(self.conv['fields']) # we update the Format.Converter
self.Close()
except IOError:
self.SaveAs(evt)
def SaveAs(self,evt):
self.filename = wxFileSelector(_('Where to save the style file?'))
#print "%r"%self.filename
if self.filename:
self.Save(evt)
if os.path.dirname(self.filename) != os.path.join(BIB.SOURCEDIR,'Format','Styles'):
BIB.CONFIG.writeStyle(self.filename)
if self.filename not in BIB.STYLES.values(): # not already in style menu
self.GetParent().addUserStyle(self.filename)
else:
self.Close() # the user clicked cancel in the file dialog => we cancel everything
|