fix typo
svn: r6291
This commit is contained in:
parent
790de99bf9
commit
a96333aa24
123
src/BaseDoc.py
123
src/BaseDoc.py
@ -58,7 +58,7 @@ interfaces should be derived from the core classes.
|
||||
"""
|
||||
|
||||
__author__ = "Donald N. Allingham"
|
||||
__version__ = "Revision:$Id$"
|
||||
__revision__ = "Revision:$Id$"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -104,29 +104,37 @@ FONT_SANS_SERIF = 0
|
||||
FONT_SERIF = 1
|
||||
FONT_MONOSPACE = 2
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Page orientation
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
PAPER_PORTRAIT = 0
|
||||
PAPER_LANDSCAPE = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Paragraph alignment
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
PARA_ALIGN_CENTER = 0
|
||||
PARA_ALIGN_LEFT = 1
|
||||
PARA_ALIGN_RIGHT = 2
|
||||
PARA_ALIGN_JUSTIFY = 3
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Text vs. Graphics mode
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
TEXT_MODE = 0
|
||||
GRAPHICS_MODE = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Line style
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
SOLID = 0
|
||||
DASHED = 1
|
||||
|
||||
@ -140,10 +148,7 @@ def cnv2color(text):
|
||||
converts a hex value in the form of #XXXXXX into a tuple of integers
|
||||
representing the RGB values
|
||||
"""
|
||||
c0 = int(text[1:3], 16)
|
||||
c1 = int(text[3:5], 16)
|
||||
c2 = int(text[5:7], 16)
|
||||
return (c0, c1, c2)
|
||||
return (int(text[1:3], 16), int(text[3:5], 16), int(text[5:7], 16))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -552,9 +557,15 @@ class ParagraphStyle:
|
||||
self.description = ""
|
||||
|
||||
def set_description(self, text):
|
||||
"""
|
||||
Sets the desciption of the paragraph
|
||||
"""
|
||||
self.description = text
|
||||
|
||||
def get_description(self):
|
||||
"""
|
||||
Returns the desciption of the paragraph
|
||||
"""
|
||||
return self.description
|
||||
|
||||
def set(self, rmargin=None, lmargin=None, first_indent=None,
|
||||
@ -846,48 +857,49 @@ class StyleSheetList:
|
||||
"""
|
||||
Saves the current StyleSheet definitions to the associated file.
|
||||
"""
|
||||
f = open(self.file,"w")
|
||||
f.write("<?xml version=\"1.0\"?>\n")
|
||||
f.write('<stylelist>\n')
|
||||
xml_file = open(self.file,"w")
|
||||
xml_file.write("<?xml version=\"1.0\"?>\n")
|
||||
xml_file.write('<stylelist>\n')
|
||||
for name in self.map.keys():
|
||||
if name == "default":
|
||||
continue
|
||||
sheet = self.map[name]
|
||||
f.write('<sheet name="%s">\n' % name)
|
||||
xml_file.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_underline())
|
||||
f.write('color="#%02x%02x%02x"/>\n' % font.get_color())
|
||||
f.write('<para ')
|
||||
rm = float(p.get_right_margin())
|
||||
lm = float(p.get_left_margin())
|
||||
fi = float(p.get_first_indent())
|
||||
tm = float(p.get_top_margin())
|
||||
bm = float(p.get_bottom_margin())
|
||||
pa = float(p.get_padding())
|
||||
f.write('rmargin="%s" ' % Utils.gformat(rm))
|
||||
f.write('lmargin="%s" ' % Utils.gformat(lm))
|
||||
f.write('first="%s" ' % Utils.gformat(fi))
|
||||
f.write('tmargin="%s" ' % Utils.gformat(tm))
|
||||
f.write('bmargin="%s" ' % Utils.gformat(bm))
|
||||
f.write('pad="%s" ' % Utils.gformat(pa))
|
||||
f.write('bgcolor="#%02x%02x%02x" ' % p.get_background_color())
|
||||
f.write('level="%d" ' % p.get_header_level())
|
||||
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()
|
||||
para = sheet.get_style(p_name)
|
||||
xml_file.write('<style name="%s">\n' % p_name)
|
||||
font = para.get_font()
|
||||
xml_file.write('<font face="%d" ' % font.get_type_face())
|
||||
xml_file.write('size="%d" ' % font.get_size())
|
||||
xml_file.write('italic="%d" ' % font.get_italic())
|
||||
xml_file.write('bold="%d" ' % font.get_bold())
|
||||
xml_file.write('underline="%d" ' % font.get_underline())
|
||||
xml_file.write('color="#%02x%02x%02x"/>\n' % font.get_color())
|
||||
xml_file.write('<para ')
|
||||
rmargin = float(para.get_right_margin())
|
||||
lmargin = float(para.get_left_margin())
|
||||
findent = float(para.get_first_indent())
|
||||
tmargin = float(para.get_top_margin())
|
||||
bmargin = float(para.get_bottom_margin())
|
||||
padding = float(para.get_padding())
|
||||
xml_file.write('rmargin="%s" ' % Utils.gformat(rmargin))
|
||||
xml_file.write('lmargin="%s" ' % Utils.gformat(lmargin))
|
||||
xml_file.write('first="%s" ' % Utils.gformat(findent))
|
||||
xml_file.write('tmargin="%s" ' % Utils.gformat(tmargin))
|
||||
xml_file.write('bmargin="%s" ' % Utils.gformat(bmargin))
|
||||
xml_file.write('pad="%s" ' % Utils.gformat(padding))
|
||||
bg_color = para.get_background_color()
|
||||
xml_file.write('bgcolor="#%02x%02x%02x" ' % bg_color)
|
||||
xml_file.write('level="%d" ' % para.get_header_level())
|
||||
xml_file.write('align="%d" ' % para.get_alignment())
|
||||
xml_file.write('tborder="%d" ' % para.get_top_border())
|
||||
xml_file.write('lborder="%d" ' % para.get_left_border())
|
||||
xml_file.write('rborder="%d" ' % para.get_right_border())
|
||||
xml_file.write('bborder="%d"/>\n' % para.get_bottom_border())
|
||||
xml_file.write('</style>\n')
|
||||
xml_file.write('</sheet>\n')
|
||||
xml_file.write('</stylelist>\n')
|
||||
xml_file.close()
|
||||
|
||||
def parse(self):
|
||||
"""
|
||||
@ -895,9 +907,9 @@ class StyleSheetList:
|
||||
"""
|
||||
try:
|
||||
if os.path.isfile(self.file):
|
||||
p = make_parser()
|
||||
p.setContentHandler(SheetParser(self))
|
||||
p.parse(self.file)
|
||||
parser = make_parser()
|
||||
parser.setContentHandler(SheetParser(self))
|
||||
parser.parse(self.file)
|
||||
except (IOError,OSError,SAXParseException):
|
||||
pass
|
||||
|
||||
@ -926,9 +938,15 @@ class StyleSheet:
|
||||
self.style_list[style_name] = ParagraphStyle(style)
|
||||
|
||||
def set_name(self, name):
|
||||
"""
|
||||
Sets the name of the StyleSheet
|
||||
"""
|
||||
self.name = name
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Returns the name of the StyleSheet
|
||||
"""
|
||||
return self.name
|
||||
|
||||
def clear(self):
|
||||
@ -1037,7 +1055,16 @@ class SheetParser(handler.ContentHandler):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class GraphicsStyle:
|
||||
"""
|
||||
Defines the properties of graphics objects, such as line width,
|
||||
color, fill, ect.
|
||||
"""
|
||||
def __init__(self, obj=None):
|
||||
"""
|
||||
Initialize the object with default values, unless a source
|
||||
object is specified. In that case, make a copy of the source
|
||||
object.
|
||||
"""
|
||||
if obj:
|
||||
self.height = obj.height
|
||||
self.width = obj.width
|
||||
@ -1060,9 +1087,15 @@ class GraphicsStyle:
|
||||
self.lstyle = SOLID
|
||||
|
||||
def set_line_width(self, val):
|
||||
"""
|
||||
sets the line width
|
||||
"""
|
||||
self.lwidth = val
|
||||
|
||||
def get_line_width(self):
|
||||
"""
|
||||
Returns the name of the StyleSheet
|
||||
"""
|
||||
return self.lwidth
|
||||
|
||||
def get_line_style(self):
|
||||
|
@ -63,7 +63,7 @@ import GrampsWidgets
|
||||
|
||||
from _EditPrimary import EditPrimary
|
||||
from QuestionDialog import WarningDialog, ErrorDialog, QuestionDialog2
|
||||
from DisplayTabs import NoteTab, GalleryTab, WebEmbedList, LdsEmbedList
|
||||
from DisplayTabs import *
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -207,7 +207,6 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
return self.iter2path.has_key(handle)
|
||||
|
||||
def on_get_column_type(self, index):
|
||||
# return column data-type, from table
|
||||
return COLUMN_DEFS[index][COLUMN_DEF_TYPE]
|
||||
|
||||
def on_get_iter(self,path):
|
||||
@ -240,7 +239,8 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
if node != self.prev_handle:
|
||||
self.prev_data = self.db.get_raw_person_data(str(node))
|
||||
self.prev_handle = node
|
||||
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,self.prev_data,node)
|
||||
return COLUMN_DEFS[col][COLUMN_DEF_LIST](self,
|
||||
self.prev_data, node)
|
||||
except:
|
||||
if col == _MARKER_COL:
|
||||
return None
|
||||
@ -309,7 +309,8 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
handle = data[0]
|
||||
for family_handle in data[_FAMILY_COL]:
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
for spouse_id in [family.get_father_handle(), family.get_mother_handle()]:
|
||||
for spouse_id in [family.get_father_handle(),
|
||||
family.get_mother_handle()]:
|
||||
if not spouse_id:
|
||||
continue
|
||||
if spouse_id == handle:
|
||||
@ -393,7 +394,8 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
if event:
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
place_title = self.db.get_place_from_handle(place_handle).get_title()
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
place_title = place.get_title()
|
||||
if place_title != "":
|
||||
return cgi.escape(place_title)
|
||||
|
||||
@ -405,7 +407,8 @@ class PeopleModel(gtk.GenericTreeModel):
|
||||
if etype in [Event.BAPTISM,Event.CHRISTEN]:
|
||||
place_handle = event.get_place_handle()
|
||||
if place_handle:
|
||||
place_title = self.db.get_place_from_handle(place_handle).get_title()
|
||||
place = self.db.get_place_from_handle(place_handle)
|
||||
place_title = place.get_title()
|
||||
if place_title != "":
|
||||
return "<i>" + cgi.escape(place_title) + "</i>"
|
||||
|
||||
@ -499,7 +502,6 @@ COLUMN_DEFS = [
|
||||
|
||||
# these columns are hidden,and must always be last in the list
|
||||
(PeopleModel.column_tooltip, None, object),
|
||||
# (PeopleModel.column_sort_name, None, str),
|
||||
(PeopleModel.column_int_id, None, str),
|
||||
]
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user