* src/TextDoc.py: Added name property to style sheets

* src/StyleEditor.py: Add name property to edited style sheets
* src/RelLib.py: Fix for witness event under ZODB
* src/docgen/OpenDrawDoc.py: change name to OpenOffice.org
* src/docgen/OpenOfficeDoc.py: change name to OpenOffice.org


svn: r1677
This commit is contained in:
Don Allingham 2003-06-09 18:04:04 +00:00
parent 17a7288371
commit ea94d9a4fa
5 changed files with 17 additions and 7 deletions

View File

@ -1360,13 +1360,13 @@ class Event(DataObj):
self.description = source.description self.description = source.description
self.name = source.name self.name = source.name
self.cause = source.cause self.cause = source.cause
if source.witness: # old ZODB database may not have this element
# old ZODB database may not have this element try:
try: if source.witness:
self.witness = source.witness[:] self.witness = source.witness[:]
except: else:
self.witness = None self.witness = None
else: except:
self.witness = None self.witness = None
else: else:
self.place = None self.place = None

View File

@ -289,6 +289,7 @@ class StyleEditor:
name = self.top.get_widget("style_name").get_text() name = self.top.get_widget("style_name").get_text()
self.save_paragraph(p) self.save_paragraph(p)
self.style.set_name(name)
self.parent.sheetlist.set_style_sheet(name,self.style) self.parent.sheetlist.set_style_sheet(name,self.style)
self.parent.redraw() self.parent.redraw()
Utils.destroy_passed_object(obj) Utils.destroy_passed_object(obj)

View File

@ -709,6 +709,7 @@ class StyleSheetList:
file - XML file that contains style definitions file - XML file that contains style definitions
defstyle - default style defstyle - default style
""" """
defstyle.set_name('default')
self.map = { "default" : defstyle } self.map = { "default" : defstyle }
self.file = os.path.expanduser("~/.gramps/" + file) self.file = os.path.expanduser("~/.gramps/" + file)
self.parse() self.parse()
@ -748,6 +749,7 @@ class StyleSheetList:
name - name assocated with the StyleSheet to add or replace. name - name assocated with the StyleSheet to add or replace.
style - definition of the StyleSheet style - definition of the StyleSheet
""" """
style.set_name(name)
if name != "default": if name != "default":
self.map[name] = style self.map[name] = style
@ -822,11 +824,18 @@ class StyleSheet:
obj, instead of creating an empty StyleSheet obj, instead of creating an empty StyleSheet
""" """
self.style_list = {} self.style_list = {}
self.name = ""
if obj != None: if obj != None:
for style_name in obj.style_list.keys(): for style_name in obj.style_list.keys():
style = obj.style_list[style_name] style = obj.style_list[style_name]
self.style_list[style_name] = ParagraphStyle(style) self.style_list[style_name] = ParagraphStyle(style)
def set_name(self,name):
self.name = name
def get_name(self):
return self.name
def clear(self): def clear(self):
"Removes all paragraph styles from the StyleSheet" "Removes all paragraph styles from the StyleSheet"
self.style_list = {} self.style_list = {}

View File

@ -560,4 +560,4 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
# Register document generator # Register document generator
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
Plugins.register_draw_doc(_("OpenOffice/StarOffice 6"),OpenDrawDoc,1,1,".sxd"); Plugins.register_draw_doc(_("OpenOffice.org/StarOffice 6"),OpenDrawDoc,1,1,".sxd");

View File

@ -595,4 +595,4 @@ class OpenOfficeDoc(TextDoc.TextDoc):
self.f.write('</office:document-meta>\n') self.f.write('</office:document-meta>\n')
self.f.close() self.f.close()
Plugins.register_text_doc(_("OpenOffice/StarOffice 6"),OpenOfficeDoc,1,1,1,".sxw") Plugins.register_text_doc(_("OpenOffice.org/StarOffice 6"),OpenOfficeDoc,1,1,1,".sxw")