Support user defined styles
svn: r92
This commit is contained in:
parent
db9bb2246e
commit
8cf0cc6ddd
@ -35,8 +35,8 @@ except:
|
||||
|
||||
class AbiWordDoc(TextDoc):
|
||||
|
||||
def __init__(self,type,orientation):
|
||||
TextDoc.__init__(self,type,orientation)
|
||||
def __init__(self,styles,type,orientation):
|
||||
TextDoc.__init__(self,styles,type,orientation)
|
||||
self.f = None
|
||||
self.level = 0
|
||||
self.new_page = 0
|
||||
|
@ -24,6 +24,7 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from TextDoc import *
|
||||
from DrawDoc import *
|
||||
import gtk
|
||||
import Config
|
||||
import intl
|
||||
@ -51,6 +52,7 @@ _template = 0
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
_textdoc = []
|
||||
_drawdoc = []
|
||||
|
||||
try:
|
||||
import OpenOfficeDoc
|
||||
@ -58,6 +60,12 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
import OpenDrawDoc
|
||||
_drawdoc.append(_OpenOffice)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
import AbiWordDoc
|
||||
_textdoc.append((_AbiWord, _no_tables, _paper))
|
||||
@ -70,6 +78,12 @@ try:
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
import PdfDrawDoc
|
||||
_drawdoc.append(_PDF)
|
||||
except:
|
||||
pass
|
||||
|
||||
try:
|
||||
import HtmlDoc
|
||||
_textdoc.append((_HTML, _has_tables, _template))
|
||||
@ -108,13 +122,50 @@ def get_text_doc_menu(main_menu,tables,callback,obj=None):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def make_text_doc(name,paper,orien,template):
|
||||
if name == _OpenOffice:
|
||||
return OpenOfficeDoc.OpenOfficeDoc(paper,orien)
|
||||
elif name == _AbiWord:
|
||||
return AbiWordDoc.AbiWordDoc(paper,orien)
|
||||
elif name == _PDF:
|
||||
return PdfDoc.PdfDoc(paper,orien)
|
||||
else:
|
||||
return HtmlDoc.HtmlDoc(template)
|
||||
def get_draw_doc_menu(main_menu,callback,obj=None):
|
||||
|
||||
index = 0
|
||||
myMenu = gtk.GtkMenu()
|
||||
for item in _textdoc:
|
||||
if tables and item[1] == 0:
|
||||
continue
|
||||
name = item[0]
|
||||
menuitem = gtk.GtkMenuItem(name)
|
||||
menuitem.set_data("name",name)
|
||||
menuitem.set_data("obj",obj)
|
||||
if callback:
|
||||
menuitem.connect("activate",callback)
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
if name == Config.output_preference:
|
||||
myMenu.set_active(index)
|
||||
callback(menuitem)
|
||||
index = index + 1
|
||||
main_menu.set_menu(myMenu)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def make_text_doc(styles,name,paper,orien,template):
|
||||
if name == _OpenOffice:
|
||||
return OpenOfficeDoc.OpenOfficeDoc(styles,paper,orien)
|
||||
elif name == _AbiWord:
|
||||
return AbiWordDoc.AbiWordDoc(styles,paper,orien)
|
||||
elif name == _PDF:
|
||||
return PdfDoc.PdfDoc(styles,paper,orien)
|
||||
else:
|
||||
return HtmlDoc.HtmlDoc(styles,template)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def make_draw_doc(name,paper,orien):
|
||||
if name == _OpenOffice:
|
||||
return OpenDrawDoc.OpenDrawDoc(paper,orien)
|
||||
else:
|
||||
return PdfDrawDoc.PdfDrawDoc(paper,orien)
|
||||
|
||||
|
@ -56,8 +56,8 @@ _bottom = [
|
||||
|
||||
class HtmlDoc(TextDoc):
|
||||
|
||||
def __init__(self,template):
|
||||
TextDoc.__init__(self,PaperStyle("",0,0),None)
|
||||
def __init__(self,styles,template):
|
||||
TextDoc.__init__(self,styles,PaperStyle("",0,0),None)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.template = template
|
||||
|
@ -40,8 +40,8 @@ except:
|
||||
|
||||
class OpenOfficeDoc(TextDoc):
|
||||
|
||||
def __init__(self,type,orientation):
|
||||
TextDoc.__init__(self,type,orientation)
|
||||
def __init__(self,styles,type,orientation):
|
||||
TextDoc.__init__(self,styles,type,orientation)
|
||||
self.f = None
|
||||
self.filename = None
|
||||
self.level = 0
|
||||
|
237
gramps/src/StyleEditor.py
Normal file
237
gramps/src/StyleEditor.py
Normal file
@ -0,0 +1,237 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import libglade
|
||||
import gtk
|
||||
import utils
|
||||
import ListColors
|
||||
import const
|
||||
|
||||
from TextDoc import *
|
||||
|
||||
class StyleListDisplay:
|
||||
def __init__(self,stylesheetlist,callback,object):
|
||||
self.object = object
|
||||
self.callback = callback
|
||||
|
||||
self.sheetlist = stylesheetlist
|
||||
self.top = libglade.GladeXML(const.stylesFile,"styles")
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_list_select_row" : on_list_select_row,
|
||||
"on_ok_clicked" : on_ok_clicked,
|
||||
"on_add_clicked" : on_add_clicked,
|
||||
"on_edit_clicked" : on_edit_clicked
|
||||
})
|
||||
self.list = self.top.get_widget("list")
|
||||
self.dialog = self.top.get_widget("styles")
|
||||
self.dialog.set_data("o",self)
|
||||
self.redraw()
|
||||
|
||||
def redraw(self):
|
||||
self.list.clear()
|
||||
|
||||
self.list.set_data("i",0)
|
||||
box = ListColors.ColorList(self.list,1)
|
||||
box.add_with_data(["default"],("default",self.sheetlist.get_style_sheet("default")))
|
||||
|
||||
for style in self.sheetlist.get_style_names():
|
||||
if style == "default":
|
||||
continue
|
||||
box.add_with_data([style],(style,self.sheetlist.get_style_sheet(style)))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_add_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
|
||||
style = top.sheetlist.get_style_sheet("default")
|
||||
x = StyleEditor("New Style",style,top)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
|
||||
top.callback(top.object)
|
||||
top.sheetlist.save()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_list_select_row(obj,row,a,b):
|
||||
list = obj.get_data("o").list
|
||||
list.set_data("i",row)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_edit_clicked(obj):
|
||||
top = obj.get_data("o")
|
||||
|
||||
index = top.list.get_data("i")
|
||||
(name,style) = top.list.get_row_data(index)
|
||||
x = StyleEditor(name,style,top)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StyleEditor:
|
||||
def __init__(self,name,style,parent):
|
||||
self.original_style = style
|
||||
self.style = StyleSheet(style)
|
||||
self.parent = parent
|
||||
self.top = libglade.GladeXML(const.stylesFile,"editor")
|
||||
self.current_p = None
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"on_save_style_clicked" : on_save_style_clicked,
|
||||
"destroy_passed_object" : utils.destroy_passed_object
|
||||
})
|
||||
|
||||
self.window = self.top.get_widget("editor")
|
||||
self.window.set_data("obj",self)
|
||||
self.pnames = self.top.get_widget("name")
|
||||
|
||||
self.top.get_widget("style_name").set_text(name)
|
||||
myMenu = gtk.GtkMenu()
|
||||
first = 0
|
||||
for p_name in self.style.get_names():
|
||||
p = self.style.get_style(p_name)
|
||||
if first == 0:
|
||||
self.draw(p)
|
||||
first = 1
|
||||
menuitem = gtk.GtkMenuItem(p_name)
|
||||
menuitem.set_data("o",p)
|
||||
menuitem.set_data("t",self)
|
||||
menuitem.connect("activate",change_display)
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
self.pnames.set_menu(myMenu)
|
||||
|
||||
def draw(self,p):
|
||||
self.current_p = p
|
||||
font = p.get_font()
|
||||
self.top.get_widget("size").set_value(font.get_size())
|
||||
if font.get_type_face() == FONT_SANS_SERIF:
|
||||
self.top.get_widget("roman").set_active(1)
|
||||
else:
|
||||
self.top.get_widget("swiss").set_active(1)
|
||||
self.top.get_widget("bold").set_active(font.get_bold())
|
||||
self.top.get_widget("italic").set_active(font.get_italic())
|
||||
self.top.get_widget("underline").set_active(font.get_underline())
|
||||
if p.get_alignment() == PARA_ALIGN_LEFT:
|
||||
self.top.get_widget("lalign").set_active(1)
|
||||
elif p.get_alignment() == PARA_ALIGN_RIGHT:
|
||||
self.top.get_widget("ralign").set_active(1)
|
||||
elif p.get_alignment() == PARA_ALIGN_CENTER:
|
||||
self.top.get_widget("calign").set_active(1)
|
||||
else:
|
||||
self.top.get_widget("jalign").set_active(1)
|
||||
self.top.get_widget("rmargin").set_text(str(p.get_right_margin()))
|
||||
self.top.get_widget("lmargin").set_text(str(p.get_left_margin()))
|
||||
self.top.get_widget("pad").set_text(str(p.get_padding()))
|
||||
self.top.get_widget("tborder").set_active(p.get_top_border())
|
||||
self.top.get_widget("lborder").set_active(p.get_left_border())
|
||||
self.top.get_widget("rborder").set_active(p.get_right_border())
|
||||
self.top.get_widget("bborder").set_active(p.get_bottom_border())
|
||||
c = font.get_color()
|
||||
self.top.get_widget("color").set_i8(c[0],c[1],c[2],0)
|
||||
c = p.get_background_color()
|
||||
self.top.get_widget("bgcolor").set_i8(c[0],c[1],c[2],0)
|
||||
|
||||
def save_paragraph(self,p):
|
||||
font = p.get_font()
|
||||
font.set_size(int(self.top.get_widget("size").get_value()))
|
||||
|
||||
if self.top.get_widget("roman").get_active():
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
else:
|
||||
font.set_type_face(FONT_SERIF)
|
||||
|
||||
font.set_bold(self.top.get_widget("bold").get_active())
|
||||
font.set_italic(self.top.get_widget("italic").get_active())
|
||||
font.set_underline(self.top.get_widget("underline").get_active())
|
||||
if self.top.get_widget("lalign").get_active():
|
||||
p.set_alignment(PARA_ALIGN_LEFT)
|
||||
elif self.top.get_widget("ralign").get_active():
|
||||
p.set_alignment(PARA_ALIGN_RIGHT)
|
||||
elif self.top.get_widget("calign").get_active():
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
else:
|
||||
p.set_alignment(PARA_ALIGN_JUSTIFY)
|
||||
|
||||
p.set_right_margin(float(self.top.get_widget("rmargin").get_text()))
|
||||
p.set_left_margin(float(self.top.get_widget("lmargin").get_text()))
|
||||
p.set_padding(float(self.top.get_widget("pad").get_text()))
|
||||
p.set_top_border(self.top.get_widget("tborder").get_active())
|
||||
p.set_left_border(self.top.get_widget("lborder").get_active())
|
||||
p.set_right_border(self.top.get_widget("rborder").get_active())
|
||||
p.set_bottom_border(self.top.get_widget("bborder").get_active())
|
||||
|
||||
c = self.top.get_widget("color").get_i8()
|
||||
font.set_color((c[0],c[1],c[2]))
|
||||
c = self.top.get_widget("bgcolor").get_i8()
|
||||
p.set_background_color((c[0],c[1],c[2]))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def change_display(obj):
|
||||
top = obj.get_data("t")
|
||||
style = obj.get_data("o")
|
||||
p = top.current_p
|
||||
|
||||
top.save_paragraph(p)
|
||||
top.draw(style)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_save_style_clicked(obj):
|
||||
top = obj.get_data("obj")
|
||||
p = top.current_p
|
||||
name = top.top.get_widget("style_name").get_text()
|
||||
|
||||
top.save_paragraph(p)
|
||||
top.parent.sheetlist.set_style_sheet(name,top.style)
|
||||
top.parent.redraw()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
|
||||
|
@ -18,6 +18,23 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
import string
|
||||
import os
|
||||
import xml.sax
|
||||
import xml.sax.saxutils
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Try to abstract SAX1 from SAX2
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
try:
|
||||
import xml.sax.saxexts
|
||||
sax = 1
|
||||
except:
|
||||
sax = 2
|
||||
|
||||
|
||||
FONT_SANS_SERIF = 0
|
||||
FONT_SERIF = 1
|
||||
|
||||
@ -29,6 +46,12 @@ PARA_ALIGN_LEFT = 1
|
||||
PARA_ALIGN_RIGHT = 2
|
||||
PARA_ALIGN_JUSTIFY= 3
|
||||
|
||||
def cnv2color(text):
|
||||
c0 = string.atoi(text[1:3],16)
|
||||
c1 = string.atoi(text[3:5],16)
|
||||
c2 = string.atoi(text[5:7],16)
|
||||
return (c0,c1,c2)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -78,6 +101,20 @@ class FontStyle:
|
||||
self.color = (0,0,0)
|
||||
self.under = 0
|
||||
|
||||
def set(self,face=None,size=None,italic=None,bold=None,underline=None,color=None):
|
||||
if face != None:
|
||||
self.set_type_face(face)
|
||||
if size != None:
|
||||
self.set_size(size)
|
||||
if italic != None:
|
||||
self.set_italic(italic)
|
||||
if bold != None:
|
||||
self.set_bold(bold)
|
||||
if underline != None:
|
||||
self.set_underline(underline)
|
||||
if color != None:
|
||||
self.set_color(color)
|
||||
|
||||
def set_italic(self,val):
|
||||
"0 disables italics, 1 enables italics"
|
||||
self.italic = val
|
||||
@ -245,6 +282,30 @@ class ParagraphStyle:
|
||||
self.pad = 0
|
||||
self.bgcolor = (255,255,255)
|
||||
|
||||
def set(self,rmargin=None,lmargin=None,first_indent=None,align=None,\
|
||||
tborder=None,bborder=None,rborder=None,lborder=None,pad=None,
|
||||
bgcolor=None):
|
||||
if pad != None:
|
||||
self.set_padding(pad)
|
||||
if tborder != None:
|
||||
self.set_top_border(tborder)
|
||||
if bborder != None:
|
||||
self.set_bottom_border(bborder)
|
||||
if rborder != None:
|
||||
self.set_right_border(rborder)
|
||||
if lborder != None:
|
||||
self.set_left_border(lborder)
|
||||
if bgcolor != None:
|
||||
self.set_background_color(bgcolor)
|
||||
if align != None:
|
||||
self.set_alignment(align)
|
||||
if rmargin != None:
|
||||
self.set_right_margin(rmargin)
|
||||
if lmargin != None:
|
||||
self.set_left_margin(lmargin)
|
||||
if first_indent != None:
|
||||
self.set_first_indent(first_indent)
|
||||
|
||||
def set_header_level(self,level):
|
||||
self.level = level
|
||||
|
||||
@ -255,7 +316,7 @@ class ParagraphStyle:
|
||||
self.font = FontStyle(font)
|
||||
|
||||
def get_font(self):
|
||||
return FontStyle(self.font)
|
||||
return self.font
|
||||
|
||||
def set_padding(self,val):
|
||||
self.pad = val
|
||||
@ -323,13 +384,174 @@ class ParagraphStyle:
|
||||
"returns the first indent margin in centimeters"
|
||||
return self.first_indent
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StyleSheetList:
|
||||
def __init__(self,file,default):
|
||||
self.map = { "default" : default }
|
||||
self.file = os.path.expanduser("~/.gramps/" + file)
|
||||
self.parse()
|
||||
|
||||
def get_style_sheet(self,name):
|
||||
return self.map[name]
|
||||
|
||||
def get_style_names(self):
|
||||
return self.map.keys()
|
||||
|
||||
def set_style_sheet(self,name,style):
|
||||
if name != "default":
|
||||
self.map[name] = style
|
||||
|
||||
def save(self):
|
||||
f = open(self.file,"w")
|
||||
f.write("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
|
||||
f.write('<stylelist>\n')
|
||||
for name in self.map.keys():
|
||||
if name == "default":
|
||||
continue
|
||||
sheet = self.map[name]
|
||||
f.write('<sheet name="%s">\n' % name)
|
||||
for p_name in sheet.get_names():
|
||||
p = sheet.get_style(p_name)
|
||||
f.write('<style name="%s">\n' % p_name)
|
||||
font = p.get_font()
|
||||
f.write('<font face="%d" ' % font.get_type_face())
|
||||
f.write('size="%d" ' % font.get_size())
|
||||
f.write('italic="%d" ' % font.get_italic())
|
||||
f.write('bold="%d" ' % font.get_bold())
|
||||
f.write('underline="%d" ' % font.get_bold())
|
||||
f.write('color="#%02x%02x%02x"/>\n' % font.get_color())
|
||||
f.write('<para rmargin="%.3f" ' % p.get_right_margin())
|
||||
f.write('lmargin="%.3f" ' % p.get_left_margin())
|
||||
f.write('first="%.3f" ' % p.get_first_indent())
|
||||
f.write('pad="%.3f" ' % p.get_padding())
|
||||
f.write('bgcolor="#%02x%02x%02x" ' % p.get_background_color())
|
||||
f.write('align="%d" ' % p.get_alignment())
|
||||
f.write('tborder="%d" ' % p.get_top_border())
|
||||
f.write('lborder="%d" ' % p.get_left_border())
|
||||
f.write('rborder="%d" ' % p.get_right_border())
|
||||
f.write('bborder="%d"/>\n' % p.get_bottom_border())
|
||||
f.write('</style>\n')
|
||||
f.write('</sheet>\n')
|
||||
f.write('</stylelist>\n')
|
||||
f.close()
|
||||
|
||||
|
||||
def parse(self):
|
||||
try:
|
||||
f = open(self.file,"r")
|
||||
except:
|
||||
return
|
||||
|
||||
if sax == 1:
|
||||
parser = xml.sax.saxexts.make_parser()
|
||||
parser.setDocumentHandler(SheetParser(self))
|
||||
parser.setErrorHandler(xml.sax.saxutils.ErrorRaiser())
|
||||
parser.parseFile(f)
|
||||
else:
|
||||
parser = xml.sax.make_parser()
|
||||
parser.setContentHandler(SheetParser(self))
|
||||
parser.parse(f)
|
||||
|
||||
f.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StyleSheet:
|
||||
def __init__(self,obj=None):
|
||||
self.style_list = {}
|
||||
if obj != None:
|
||||
for style_name in obj.style_list.keys():
|
||||
style = obj.style_list[style_name]
|
||||
self.style_list[style_name] = ParagraphStyle(style)
|
||||
|
||||
def clear(self):
|
||||
self.style_list = {}
|
||||
|
||||
def add_style(self,name,style):
|
||||
self.style_list[name] = ParagraphStyle(style)
|
||||
|
||||
def get_names(self):
|
||||
return self.style_list.keys()
|
||||
|
||||
def get_styles(self):
|
||||
return self.style_list
|
||||
|
||||
def get_style(self,name):
|
||||
return self.style_list[name]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SheetParser(xml.sax.handler.ContentHandler):
|
||||
def __init__(self,sheetlist):
|
||||
xml.sax.handler.ContentHandler.__init__(self)
|
||||
self.sheetlist = sheetlist
|
||||
self.f = None
|
||||
self.p = None
|
||||
self.s = None
|
||||
self.sname = None
|
||||
self.pname = None
|
||||
|
||||
def setDocumentLocator(self,locator):
|
||||
self.locator = locator
|
||||
|
||||
def startElement(self,tag,attrs):
|
||||
if tag == "sheet":
|
||||
self.s = StyleSheet()
|
||||
self.sname = attrs['name']
|
||||
elif tag == "font":
|
||||
self.f = FontStyle()
|
||||
self.f.set_type_face(int(attrs['face']))
|
||||
self.f.set_size(int(attrs['size']))
|
||||
self.f.set_italic(int(attrs['italic']))
|
||||
self.f.set_bold(int(attrs['bold']))
|
||||
self.f.set_underline(int(attrs['underline']))
|
||||
self.f.set_color(cnv2color(attrs['color']))
|
||||
elif tag == "para":
|
||||
self.p.set_right_margin(float(attrs['rmargin']))
|
||||
self.p.set_left_margin(float(attrs['lmargin']))
|
||||
self.p.set_first_indent(float(attrs['first']))
|
||||
self.p.set_padding(float(attrs['pad']))
|
||||
self.p.set_alignment(int(attrs['align']))
|
||||
self.p.set_right_border(int(attrs['rborder']))
|
||||
self.p.set_left_border(int(attrs['lborder']))
|
||||
self.p.set_top_border(int(attrs['tborder']))
|
||||
self.p.set_bottom_border(int(attrs['bborder']))
|
||||
self.p.set_background_color(cnv2color(attrs['bgcolor']))
|
||||
elif tag == "style":
|
||||
self.p = ParagraphStyle()
|
||||
self.pname = attrs['name']
|
||||
|
||||
def endElement(self,tag):
|
||||
if tag == "style":
|
||||
self.p.set_font(self.f)
|
||||
self.s.add_style(self.pname,self.p)
|
||||
elif tag == "sheet":
|
||||
self.sheetlist.set_style_sheet(self.sname,self.s)
|
||||
|
||||
if sax == 1:
|
||||
def characters(self, data, offset, length):
|
||||
pass
|
||||
else:
|
||||
def characters(self, data):
|
||||
pass
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TextDoc:
|
||||
def __init__(self,type,orientation=PAPER_PORTRAIT):
|
||||
def __init__(self,styles,type,orientation=PAPER_PORTRAIT):
|
||||
self.orientation = orientation
|
||||
if orientation == PAPER_PORTRAIT:
|
||||
self.width = type.get_width()
|
||||
@ -344,7 +566,7 @@ class TextDoc:
|
||||
self.rmargin = 2.54
|
||||
|
||||
self.font = FontStyle()
|
||||
self.style_list = {}
|
||||
self.style_list = styles.get_styles()
|
||||
self.table_styles = {}
|
||||
self.cell_styles = {}
|
||||
self.name = ""
|
||||
@ -362,9 +584,6 @@ class TextDoc:
|
||||
def creator(self,name):
|
||||
self.name = name
|
||||
|
||||
def add_style(self,name,style):
|
||||
self.style_list[name] = ParagraphStyle(style)
|
||||
|
||||
def add_table_style(self,name,style):
|
||||
self.table_styles[name] = TableStyle(style)
|
||||
|
||||
@ -415,3 +634,4 @@ class TextDoc:
|
||||
|
||||
def write_text(self,text):
|
||||
pass
|
||||
|
||||
|
@ -56,6 +56,7 @@ bookFile = rootDir + os.sep + "bookmarks.glade"
|
||||
pluginsFile = rootDir + os.sep + "plugins.glade"
|
||||
editnoteFile = rootDir + os.sep + "editnote.glade"
|
||||
configFile = rootDir + os.sep + "config.glade"
|
||||
stylesFile = rootDir + os.sep + "styles.glade"
|
||||
pluginsDir = rootDir + os.sep + "plugins"
|
||||
filtersDir = rootDir + os.sep + "filters"
|
||||
dataDir = rootDir + os.sep + "data"
|
||||
|
@ -32,6 +32,8 @@ import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from TextDoc import *
|
||||
from StyleEditor import *
|
||||
|
||||
import FindDoc
|
||||
|
||||
from gtk import *
|
||||
@ -45,6 +47,8 @@ from libglade import *
|
||||
#------------------------------------------------------------------------
|
||||
active_person = None
|
||||
db = None
|
||||
styles = StyleSheet()
|
||||
style_sheet_list = None
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -97,36 +101,7 @@ class AncestorReport:
|
||||
self.max_generations = max
|
||||
self.pgbrk = pgbrk
|
||||
self.doc = doc
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(1)
|
||||
para.set_top_border(0.2)
|
||||
para.set_bottom_border(0.2)
|
||||
para.set_padding(1)
|
||||
self.doc.add_style("Title",para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(14)
|
||||
font.set_bold(1)
|
||||
font.set_italic(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(2)
|
||||
para.set_top_border(0.15)
|
||||
para.set_bottom_border(0.15)
|
||||
para.set_padding(1)
|
||||
self.doc.add_style("Header",para)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set_first_indent(-0.75)
|
||||
para.set_left_margin(1.0)
|
||||
para.set_padding(1)
|
||||
self.doc.add_style("ListEntry",para)
|
||||
try:
|
||||
self.doc.open(output)
|
||||
except IOError,msg:
|
||||
@ -171,13 +146,13 @@ class AncestorReport:
|
||||
if generation == 0 or key >= 2**generation:
|
||||
if self.pgbrk and generation > 0:
|
||||
self.doc.page_break()
|
||||
self.doc.start_paragraph("Header")
|
||||
self.doc.start_paragraph("Generation")
|
||||
t = _("%s Generation") % AncestorReport.gen[generation+1]
|
||||
self.doc.write_text(t)
|
||||
self.doc.end_paragraph()
|
||||
generation = generation + 1
|
||||
|
||||
self.doc.start_paragraph("ListEntry")
|
||||
self.doc.start_paragraph("Entry")
|
||||
person = self.map[key]
|
||||
name = person.getPrimaryName().getRegularName()
|
||||
|
||||
@ -307,6 +282,7 @@ def report(database,person):
|
||||
global topDialog
|
||||
global glade_file
|
||||
global db
|
||||
global style_sheet_list
|
||||
|
||||
active_person = person
|
||||
db = database
|
||||
@ -321,12 +297,54 @@ def report(database,person):
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
FindDoc.get_text_doc_menu(topDialog.get_widget("format"),0,option_switch)
|
||||
|
||||
styles.clear()
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=16,bold=1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(1)
|
||||
para.set(tborder=0.2,bborder=0.2,pad=1)
|
||||
styles.add_style("Title",para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=14,italic=1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_header_level(2)
|
||||
para.set_top_border(0.15)
|
||||
para.set(tborder=0.15,pad=1)
|
||||
styles.add_style("Generation",para)
|
||||
|
||||
para = ParagraphStyle()
|
||||
para.set(first_indent=-0.75,lmargin=1.0,pad=1)
|
||||
styles.add_style("Entry",para)
|
||||
|
||||
style_sheet_list = StyleSheetList("ancestor_report",styles)
|
||||
build_menu(None)
|
||||
|
||||
topDialog.get_widget("labelTitle").set_text("Ahnentafel Report for " + name)
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_style_edit_clicked" : on_style_edit_clicked,
|
||||
"on_save_clicked" : on_save_clicked
|
||||
})
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def build_menu(object):
|
||||
menu = topDialog.get_widget("style_menu")
|
||||
|
||||
myMenu = GtkMenu()
|
||||
for style in style_sheet_list.get_style_names():
|
||||
menuitem = GtkMenuItem(style)
|
||||
menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
menu.set_menu(myMenu)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -339,6 +357,14 @@ def option_switch(obj):
|
||||
notebook.set_page(0)
|
||||
else:
|
||||
notebook.set_page(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_style_edit_clicked(obj):
|
||||
StyleListDisplay(style_sheet_list,build_menu,None)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -363,8 +389,10 @@ def on_save_clicked(obj):
|
||||
|
||||
item = topDialog.get_widget("format").get_menu().get_active()
|
||||
format = item.get_data("name")
|
||||
|
||||
styles = topDialog.get_widget("style_menu").get_menu().get_active().get_data("d")
|
||||
|
||||
doc = FindDoc.make_text_doc(format,paper,orien,template)
|
||||
doc = FindDoc.make_text_doc(styles,format,paper,orien,template)
|
||||
|
||||
MyReport = AncestorReport(db,active_person,outputName,max_gen,pgbrk,doc)
|
||||
MyReport.write_report()
|
||||
@ -442,10 +470,3 @@ def get_xpm_image():
|
||||
" ",
|
||||
" ",
|
||||
" "]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -33,6 +33,7 @@ import const
|
||||
import utils
|
||||
import const
|
||||
from TextDoc import *
|
||||
from StyleEditor import *
|
||||
import FindDoc
|
||||
|
||||
from gtk import *
|
||||
@ -63,23 +64,6 @@ class DescendantReport:
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
|
||||
f = FontStyle()
|
||||
f.set_size(14)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_bold(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
|
||||
self.doc.add_style("Title",p)
|
||||
|
||||
f = FontStyle()
|
||||
for i in range(1,10):
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
p.set_left_margin(float(i-1))
|
||||
self.doc.add_style("Level" + str(i),p)
|
||||
|
||||
self.doc.open(self.name)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
@ -144,7 +128,7 @@ class DesReportWindow:
|
||||
self.top = GladeXML(glade_file,"dialog1")
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_html_toggled": on_html_toggled,
|
||||
"on_style_edit_clicked" : on_style_edit_clicked,
|
||||
"on_save_clicked": on_save_clicked
|
||||
})
|
||||
|
||||
@ -156,9 +140,46 @@ class DesReportWindow:
|
||||
|
||||
mytop = self.top.get_widget("dialog1")
|
||||
|
||||
f = FontStyle()
|
||||
f.set_size(14)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_bold(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
|
||||
sheet = StyleSheet()
|
||||
sheet.add_style("Title",p)
|
||||
|
||||
f = FontStyle()
|
||||
for i in range(1,10):
|
||||
p = ParagraphStyle()
|
||||
p.set_font(f)
|
||||
p.set_left_margin(float(i-1))
|
||||
sheet.add_style("Level" + str(i),p)
|
||||
|
||||
self.style_sheet_list = StyleSheetList("descend_report",sheet)
|
||||
build_menu(self)
|
||||
|
||||
mytop.set_data("o",self)
|
||||
mytop.set_data("d",db)
|
||||
mytop.show()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def build_menu(object):
|
||||
|
||||
myMenu = GtkMenu()
|
||||
|
||||
for style in object.style_sheet_list.get_style_names():
|
||||
menuitem = GtkMenuItem(style)
|
||||
menuitem.set_data("d",object.style_sheet_list.get_style_sheet(style))
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
|
||||
object.top.get_widget("style_menu").set_menu(myMenu)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -181,6 +202,15 @@ def option_switch(obj):
|
||||
def report(database,person):
|
||||
report = DesReportWindow(person,database)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_style_edit_clicked(obj):
|
||||
myobj = obj.get_data("o")
|
||||
StyleListDisplay(myobj.style_sheet_list,build_menu,myobj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -205,7 +235,8 @@ def on_save_clicked(obj):
|
||||
item = myobj.top.get_widget("format").get_menu().get_active()
|
||||
format = item.get_data("name")
|
||||
|
||||
doc = FindDoc.make_text_doc(format,paper,orien,template)
|
||||
styles = myobj.top.get_widget("style_menu").get_menu().get_active().get_data("d")
|
||||
doc = FindDoc.make_text_doc(styles,format,paper,orien,template)
|
||||
|
||||
report = DescendantReport(file,myobj.person,db,doc)
|
||||
report.setup()
|
||||
@ -214,22 +245,6 @@ def on_save_clicked(obj):
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_html_toggled(obj):
|
||||
myobj = obj.get_data("o")
|
||||
if myobj.top.get_widget("html").get_active():
|
||||
myobj.top.get_widget("htmltemplate").set_sensitive(1)
|
||||
myobj.top.get_widget("papersize").set_sensitive(0)
|
||||
myobj.top.get_widget("orientation").set_sensitive(0)
|
||||
else:
|
||||
myobj.top.get_widget("htmltemplate").set_sensitive(0)
|
||||
myobj.top.get_widget("papersize").set_sensitive(1)
|
||||
myobj.top.get_widget("orientation").set_sensitive(1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -238,6 +253,11 @@ def on_html_toggled(obj):
|
||||
def get_description():
|
||||
return _("Generates a list of descendants of the active person")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Generate files/Descendant Report")
|
||||
|
||||
|
@ -29,9 +29,10 @@ import string
|
||||
import FindDoc
|
||||
import utils
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from TextDoc import *
|
||||
_ = intl.gettext
|
||||
from StyleEditor import *
|
||||
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
@ -44,6 +45,8 @@ from libglade import *
|
||||
#------------------------------------------------------------------------
|
||||
active_person = None
|
||||
db = None
|
||||
styles = StyleSheet()
|
||||
style_sheet_list = None
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -58,43 +61,6 @@ class FamilyGroup:
|
||||
self.output = output
|
||||
self.doc = doc
|
||||
|
||||
para = ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(4)
|
||||
para.set_font(font)
|
||||
self.doc.add_style('blank',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('Title',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(0)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('Normal',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('ChildText',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
self.doc.add_style('ParentName',para)
|
||||
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
@ -383,6 +349,7 @@ def report(database,person):
|
||||
global topDialog
|
||||
global glade_file
|
||||
global db
|
||||
global style_sheet_list
|
||||
|
||||
active_person = person
|
||||
db = database
|
||||
@ -398,12 +365,54 @@ def report(database,person):
|
||||
label.set_text(_("Family Group Report for %s") % name)
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_style_edit_clicked" : on_style_edit_clicked,
|
||||
"on_save_clicked" : on_save_clicked
|
||||
})
|
||||
|
||||
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
FindDoc.get_text_doc_menu(topDialog.get_widget("format"),1,option_switch)
|
||||
styles.clear()
|
||||
|
||||
para = ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(4)
|
||||
para.set_font(font)
|
||||
styles.add_style('blank',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
styles.add_style('Title',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(0)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
styles.add_style('Normal',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
styles.add_style('ChildText',para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_bold(1)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
styles.add_style('ParentName',para)
|
||||
style_sheet_list = StyleSheetList("family_group",styles)
|
||||
build_menu(None)
|
||||
|
||||
frame = topDialog.get_widget("spouse")
|
||||
option_menu = topDialog.get_widget("spouse_menu")
|
||||
@ -425,6 +434,30 @@ def report(database,person):
|
||||
my_menu.append(item)
|
||||
option_menu.set_menu(my_menu)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_style_edit_clicked(obj):
|
||||
StyleListDisplay(style_sheet_list,build_menu,None)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def build_menu(object):
|
||||
menu = topDialog.get_widget("style_menu")
|
||||
|
||||
myMenu = GtkMenu()
|
||||
for style in style_sheet_list.get_style_names():
|
||||
menuitem = GtkMenuItem(style)
|
||||
menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
menu.set_menu(myMenu)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
|
@ -32,6 +32,7 @@ import intl
|
||||
_ = intl.gettext
|
||||
|
||||
from TextDoc import *
|
||||
from StyleEditor import *
|
||||
import FindDoc
|
||||
|
||||
from gtk import *
|
||||
@ -45,6 +46,8 @@ from libglade import *
|
||||
#------------------------------------------------------------------------
|
||||
active_person = None
|
||||
db = None
|
||||
styles = StyleSheet()
|
||||
style_sheet_list = None
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -74,38 +77,6 @@ class IndivSummary:
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def setup(self):
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
p = ParagraphStyle()
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p.set_font(font)
|
||||
self.d.add_style("Title",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_italic(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("TableTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("Spouse",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
self.d.add_style("Normal",p)
|
||||
|
||||
tbl = TableStyle()
|
||||
tbl.set_width(100)
|
||||
tbl.set_columns(2)
|
||||
@ -361,6 +332,7 @@ def report(database,person):
|
||||
global topDialog
|
||||
global glade_file
|
||||
global db
|
||||
global style_sheet_list
|
||||
|
||||
active_person = person
|
||||
db = database
|
||||
@ -376,13 +348,73 @@ def report(database,person):
|
||||
|
||||
PaperMenu.make_paper_menu(topDialog.get_widget("papersize"))
|
||||
PaperMenu.make_orientation_menu(topDialog.get_widget("orientation"))
|
||||
FindDoc.get_text_doc_menu(topDialog.get_widget("format"),0,option_switch)
|
||||
FindDoc.get_text_doc_menu(topDialog.get_widget("format"),1,option_switch)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
p = ParagraphStyle()
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p.set_font(font)
|
||||
styles.add_style("Title",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_italic(1)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
styles.add_style("TableTitle",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_bold(1)
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
styles.add_style("Spouse",p)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_size(12)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
styles.add_style("Normal",p)
|
||||
|
||||
style_sheet_list = StyleSheetList("individual_summary",styles)
|
||||
build_menu(None)
|
||||
|
||||
topDialog.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_style_edit_clicked" : on_style_edit_clicked,
|
||||
"on_save_clicked" : on_save_clicked
|
||||
})
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def build_menu(object):
|
||||
menu = topDialog.get_widget("style_menu")
|
||||
|
||||
myMenu = GtkMenu()
|
||||
for style in style_sheet_list.get_style_names():
|
||||
menuitem = GtkMenuItem(style)
|
||||
menuitem.set_data("d",style_sheet_list.get_style_sheet(style))
|
||||
menuitem.show()
|
||||
myMenu.append(menuitem)
|
||||
menu.set_menu(myMenu)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def on_style_edit_clicked(obj):
|
||||
StyleListDisplay(style_sheet_list,build_menu,None)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -418,7 +450,9 @@ def on_save_clicked(obj):
|
||||
item = topDialog.get_widget("format").get_menu().get_active()
|
||||
format = item.get_data("name")
|
||||
|
||||
doc = FindDoc.make_text_doc(format,paper,orien,template)
|
||||
styles = topDialog.get_widget("style_menu").get_menu().get_active().get_data("d")
|
||||
|
||||
doc = FindDoc.make_text_doc(styles,format,paper,orien,template)
|
||||
|
||||
MyReport = IndivSummary(db,active_person,outputName,doc)
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
<class>GnomeDialog</class>
|
||||
<name>dialog1</name>
|
||||
<title>Gramps - Ahnentafel Report</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
@ -201,6 +201,62 @@
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame3</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Styles</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox4</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>style_menu</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<items>default
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>style_edit</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_style_edit_clicked</handler>
|
||||
<object>dialog1</object>
|
||||
<last_modification_time>Tue, 05 Jun 2001 14:39:29 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Style Editor</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
|
@ -15,6 +15,7 @@
|
||||
<widget>
|
||||
<class>GnomeDialog</class>
|
||||
<name>dialog1</name>
|
||||
<title>Gramps - Descendant Report</title>
|
||||
<type>GTK_WINDOW_DIALOG</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>False</modal>
|
||||
@ -179,6 +180,7 @@
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame1</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Format</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
@ -211,9 +213,66 @@
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame3</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Styles</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>style_menu</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<items>default
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button17</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_style_edit_clicked</handler>
|
||||
<object>dialog1</object>
|
||||
<last_modification_time>Tue, 05 Jun 2001 14:39:29 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Style Editor</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
@ -392,7 +451,6 @@
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>htmltemplate</name>
|
||||
<sensitive>False</sensitive>
|
||||
<history_id>HtmlTemplate</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>Choose the HTML template</title>
|
||||
|
@ -180,6 +180,7 @@
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>spouse</name>
|
||||
<border_width>5</border_width>
|
||||
<visible>False</visible>
|
||||
<label>Choose Spouse</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
@ -204,6 +205,7 @@
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame1</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Format</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
@ -236,9 +238,66 @@
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame3</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Styles</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>style_menu</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<items>default
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button17</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_style_edit_clicked</handler>
|
||||
<object>dialog1</object>
|
||||
<last_modification_time>Tue, 05 Jun 2001 14:39:29 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Style Editor</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
|
@ -180,6 +180,7 @@
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame1</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Format</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
@ -212,9 +213,66 @@
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame3</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Styles</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
|
||||
<widget>
|
||||
<class>GtkHBox</class>
|
||||
<name>hbox3</name>
|
||||
<homogeneous>False</homogeneous>
|
||||
<spacing>0</spacing>
|
||||
|
||||
<widget>
|
||||
<class>GtkOptionMenu</class>
|
||||
<name>style_menu</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<items>default
|
||||
</items>
|
||||
<initial_choice>0</initial_choice>
|
||||
<child>
|
||||
<padding>0</padding>
|
||||
<expand>True</expand>
|
||||
<fill>True</fill>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button17</name>
|
||||
<border_width>10</border_width>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_style_edit_clicked</handler>
|
||||
<object>dialog1</object>
|
||||
<last_modification_time>Tue, 05 Jun 2001 14:39:29 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Style Editor</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
<child>
|
||||
<padding>5</padding>
|
||||
<expand>False</expand>
|
||||
<fill>False</fill>
|
||||
</child>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<border_width>5</border_width>
|
||||
<label>Options</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||
@ -393,7 +451,6 @@
|
||||
<widget>
|
||||
<class>GnomeFileEntry</class>
|
||||
<name>htmltemplate</name>
|
||||
<sensitive>False</sensitive>
|
||||
<history_id>HtmlTemplate</history_id>
|
||||
<max_saved>10</max_saved>
|
||||
<title>Choose the HTML template</title>
|
||||
|
1383
gramps/src/styles.glade
Normal file
1383
gramps/src/styles.glade
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user