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