Fix place selecton on LDS ords
svn: r6273
This commit is contained in:
parent
a6acc06720
commit
455bedf69f
@ -1,4 +1,7 @@
|
||||
2006-04-05 Don Allingham <don@gramps-project.org>
|
||||
* src/Editors/_EditLdsOrd.py: save place information
|
||||
* src/GrampsWidgets.py: select default value in menu
|
||||
* src/BaseDoc.py: pylint
|
||||
* src/DisplayTabs.py: handle temple not set for LdsOrd
|
||||
* src/RelLib/_LdsOrd.py: unserialize returns self
|
||||
* src/RelLib/_LdsOrdBase.py: variable name change
|
||||
|
@ -91,9 +91,9 @@ log = logging.getLogger(".BaseDoc")
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
try:
|
||||
from xml.sax import make_parser,handler,SAXParseException
|
||||
from xml.sax import make_parser, handler, SAXParseException
|
||||
except:
|
||||
from _xmlplus.sax import make_parser,handler,SAXParseException
|
||||
from _xmlplus.sax import make_parser, handler, SAXParseException
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -140,10 +140,10 @@ 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)
|
||||
c0 = int(text[1:3], 16)
|
||||
c1 = int(text[3:5], 16)
|
||||
c2 = int(text[5:7], 16)
|
||||
return (c0, c1, c2)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -155,7 +155,7 @@ class PaperStyle:
|
||||
Defines the dimensions of a sheet of paper. All dimensions are in
|
||||
centimeters.
|
||||
"""
|
||||
def __init__(self,name,height,width):
|
||||
def __init__(self, name, height, width):
|
||||
"""
|
||||
Creates a new paper style with.
|
||||
|
||||
@ -176,7 +176,7 @@ class PaperStyle:
|
||||
"Returns the page orientation (PAPER_PORTRAIT or PAPER_LANDSCAPE)"
|
||||
return self.orientation
|
||||
|
||||
def set_orientation(self,val):
|
||||
def set_orientation(self, val):
|
||||
"""
|
||||
Sets the page orientation.
|
||||
|
||||
@ -189,7 +189,7 @@ class PaperStyle:
|
||||
"Returns the page height in cm"
|
||||
return self.height
|
||||
|
||||
def set_height(self,height):
|
||||
def set_height(self, height):
|
||||
"Sets the page height in cm"
|
||||
self.height = height
|
||||
|
||||
@ -197,7 +197,7 @@ class PaperStyle:
|
||||
"Returns the page width in cm"
|
||||
return self.width
|
||||
|
||||
def set_width(self,width):
|
||||
def set_width(self, width):
|
||||
"Sets the page width in cm"
|
||||
self.width = width
|
||||
|
||||
@ -245,10 +245,11 @@ class FontStyle:
|
||||
self.size = 12
|
||||
self.italic = 0
|
||||
self.bold = 0
|
||||
self.color = (0,0,0)
|
||||
self.color = (0, 0, 0)
|
||||
self.under = 0
|
||||
|
||||
def set(self,face=None,size=None,italic=None,bold=None,underline=None,color=None):
|
||||
def set(self, face=None, size=None, italic=None, bold=None,
|
||||
underline=None, color=None):
|
||||
"""
|
||||
Sets font characteristics.
|
||||
|
||||
@ -274,7 +275,7 @@ class FontStyle:
|
||||
if color != None:
|
||||
self.set_color(color)
|
||||
|
||||
def set_italic(self,val):
|
||||
def set_italic(self, val):
|
||||
"0 disables italics, 1 enables italics"
|
||||
self.italic = val
|
||||
|
||||
@ -282,7 +283,7 @@ class FontStyle:
|
||||
"1 indicates use italics"
|
||||
return self.italic
|
||||
|
||||
def set_bold(self,val):
|
||||
def set_bold(self, val):
|
||||
"0 disables bold face, 1 enables bold face"
|
||||
self.bold = val
|
||||
|
||||
@ -290,7 +291,7 @@ class FontStyle:
|
||||
"1 indicates use bold face"
|
||||
return self.bold
|
||||
|
||||
def set_color(self,val):
|
||||
def set_color(self, val):
|
||||
"sets the color using an RGB color tuple"
|
||||
self.color = val
|
||||
|
||||
@ -298,7 +299,7 @@ class FontStyle:
|
||||
"Returns an RGB color tuple"
|
||||
return self.color
|
||||
|
||||
def set_size(self,val):
|
||||
def set_size(self, val):
|
||||
"sets font size in points"
|
||||
self.size = val
|
||||
|
||||
@ -306,7 +307,7 @@ class FontStyle:
|
||||
"returns font size in points"
|
||||
return self.size
|
||||
|
||||
def set_type_face(self,val):
|
||||
def set_type_face(self, val):
|
||||
"sets the font face type"
|
||||
self.face = val
|
||||
|
||||
@ -314,7 +315,7 @@ class FontStyle:
|
||||
"returns the font face type"
|
||||
return self.face
|
||||
|
||||
def set_underline(self,val):
|
||||
def set_underline(self, val):
|
||||
"1 enables underlining"
|
||||
self.under = val
|
||||
|
||||
@ -334,7 +335,7 @@ class TableStyle:
|
||||
number of columns, and the width of each column as a percentage of the
|
||||
width of the table.
|
||||
"""
|
||||
def __init__(self,obj=None):
|
||||
def __init__(self, obj=None):
|
||||
"""
|
||||
Creates a new TableStyle object, with the values initialized to
|
||||
empty, with allocating space for up to 100 columns.
|
||||
@ -351,7 +352,7 @@ class TableStyle:
|
||||
self.columns = 0
|
||||
self.colwid = [ 0 ] * 100
|
||||
|
||||
def set_width(self,width):
|
||||
def set_width(self, width):
|
||||
"""
|
||||
Sets the width of the table in terms of percent of the available
|
||||
width
|
||||
@ -364,7 +365,7 @@ class TableStyle:
|
||||
"""
|
||||
return self.width
|
||||
|
||||
def set_columns(self,columns):
|
||||
def set_columns(self, columns):
|
||||
"""
|
||||
Sets the number of columns.
|
||||
|
||||
@ -378,16 +379,16 @@ class TableStyle:
|
||||
"""
|
||||
return self.columns
|
||||
|
||||
def set_column_widths(self, list):
|
||||
def set_column_widths(self, clist):
|
||||
"""
|
||||
Sets the width of all the columns at once, taking the percentages
|
||||
from the passed list.
|
||||
"""
|
||||
self.columns = len(list)
|
||||
self.columns = len(clist)
|
||||
for i in range(self.columns):
|
||||
self.colwid[i] = list[i]
|
||||
self.colwid[i] = clist[i]
|
||||
|
||||
def set_column_width(self,index,width):
|
||||
def set_column_width(self, index, width):
|
||||
"""
|
||||
Sets the width of a specified column to the specified width.
|
||||
|
||||
@ -396,7 +397,7 @@ class TableStyle:
|
||||
"""
|
||||
self.colwid[index] = width
|
||||
|
||||
def get_column_width(self,index):
|
||||
def get_column_width(self, index):
|
||||
"""
|
||||
Returns the column width of the specified column as a percentage of
|
||||
the entire table width.
|
||||
@ -415,7 +416,7 @@ class TableCellStyle:
|
||||
Defines the style of a particular table cell. Characteristics are:
|
||||
right border, left border, top border, bottom border, and padding.
|
||||
"""
|
||||
def __init__(self,obj=None):
|
||||
def __init__(self, obj=None):
|
||||
"""
|
||||
Creates a new TableCellStyle instance.
|
||||
|
||||
@ -437,11 +438,11 @@ class TableCellStyle:
|
||||
self.padding = 0
|
||||
self.longlist = 0
|
||||
|
||||
def set_padding(self,val):
|
||||
def set_padding(self, val):
|
||||
"Returns the cell padding in centimeters"
|
||||
self.padding = val
|
||||
|
||||
def set_right_border(self,val):
|
||||
def set_right_border(self, val):
|
||||
"""
|
||||
Defines if a right border in used
|
||||
|
||||
@ -449,7 +450,7 @@ class TableCellStyle:
|
||||
"""
|
||||
self.rborder = val
|
||||
|
||||
def set_left_border(self,val):
|
||||
def set_left_border(self, val):
|
||||
"""
|
||||
Defines if a left border in used
|
||||
|
||||
@ -457,7 +458,7 @@ class TableCellStyle:
|
||||
"""
|
||||
self.lborder = val
|
||||
|
||||
def set_top_border(self,val):
|
||||
def set_top_border(self, val):
|
||||
"""
|
||||
Defines if a top border in used
|
||||
|
||||
@ -465,7 +466,7 @@ class TableCellStyle:
|
||||
"""
|
||||
self.tborder = val
|
||||
|
||||
def set_bottom_border(self,val):
|
||||
def set_bottom_border(self, val):
|
||||
"""
|
||||
Defines if a bottom border in used
|
||||
|
||||
@ -473,7 +474,7 @@ class TableCellStyle:
|
||||
"""
|
||||
self.bborder = val
|
||||
|
||||
def set_longlist(self,val):
|
||||
def set_longlist(self, val):
|
||||
self.longlist = val
|
||||
|
||||
def get_padding(self):
|
||||
@ -512,7 +513,7 @@ class ParagraphStyle:
|
||||
right border, left border, padding, and background color.
|
||||
|
||||
"""
|
||||
def __init__(self,source=None):
|
||||
def __init__(self, source=None):
|
||||
"""
|
||||
@param source: if not None, then the ParagraphStyle is created
|
||||
using the values of the source instead of the default values.
|
||||
@ -550,16 +551,16 @@ class ParagraphStyle:
|
||||
self.bgcolor = (255,255,255)
|
||||
self.description = ""
|
||||
|
||||
def set_description(self,text):
|
||||
def set_description(self, text):
|
||||
self.description = text
|
||||
|
||||
def get_description(self):
|
||||
return self.description
|
||||
|
||||
def set(self,rmargin=None,lmargin=None,first_indent=None,
|
||||
tmargin=None,bmargin=None,align=None,
|
||||
tborder=None,bborder=None,rborder=None,lborder=None,pad=None,
|
||||
bgcolor=None,font=None):
|
||||
def set(self, rmargin=None, lmargin=None, first_indent=None,
|
||||
tmargin=None, bmargin=None, align=None,
|
||||
tborder=None, bborder=None, rborder=None, lborder=None,
|
||||
pad=None, bgcolor=None, font=None):
|
||||
"""
|
||||
Allows the values of the object to be set.
|
||||
|
||||
@ -604,7 +605,7 @@ class ParagraphStyle:
|
||||
if bmargin != None:
|
||||
self.set_bottom_margin(bmargin)
|
||||
|
||||
def set_header_level(self,level):
|
||||
def set_header_level(self, level):
|
||||
"""
|
||||
Sets the header level for the paragraph. This is useful for
|
||||
numbered paragraphs. A value of 1 indicates a header level
|
||||
@ -617,7 +618,7 @@ class ParagraphStyle:
|
||||
"Returns the header level of the paragraph"
|
||||
return self.level
|
||||
|
||||
def set_font(self,font):
|
||||
def set_font(self, font):
|
||||
"""
|
||||
Sets the font style of the paragraph.
|
||||
|
||||
@ -629,7 +630,7 @@ class ParagraphStyle:
|
||||
"Returns the FontStyle of the paragraph"
|
||||
return self.font
|
||||
|
||||
def set_padding(self,val):
|
||||
def set_padding(self, val):
|
||||
"""
|
||||
Sets the paragraph padding in centimeters
|
||||
|
||||
@ -641,7 +642,7 @@ class ParagraphStyle:
|
||||
"""Returns a the padding of the paragraph"""
|
||||
return self.pad
|
||||
|
||||
def set_top_border(self,val):
|
||||
def set_top_border(self, val):
|
||||
"""
|
||||
Sets the presence or absence of top border.
|
||||
|
||||
@ -654,7 +655,7 @@ class ParagraphStyle:
|
||||
"Returns 1 if a top border is specified"
|
||||
return self.top_border
|
||||
|
||||
def set_bottom_border(self,val):
|
||||
def set_bottom_border(self, val):
|
||||
"""
|
||||
Sets the presence or absence of bottom border.
|
||||
|
||||
@ -667,7 +668,7 @@ class ParagraphStyle:
|
||||
"Returns 1 if a bottom border is specified"
|
||||
return self.bottom_border
|
||||
|
||||
def set_left_border(self,val):
|
||||
def set_left_border(self, val):
|
||||
"""
|
||||
Sets the presence or absence of left border.
|
||||
|
||||
@ -680,7 +681,7 @@ class ParagraphStyle:
|
||||
"Returns 1 if a left border is specified"
|
||||
return self.left_border
|
||||
|
||||
def set_right_border(self,val):
|
||||
def set_right_border(self ,val):
|
||||
"""
|
||||
Sets the presence or absence of rigth border.
|
||||
|
||||
@ -700,7 +701,7 @@ class ParagraphStyle:
|
||||
"""
|
||||
return self.bgcolor
|
||||
|
||||
def set_background_color(self,color):
|
||||
def set_background_color(self, color):
|
||||
"""
|
||||
Sets the background color of the paragraph.
|
||||
|
||||
@ -709,7 +710,7 @@ class ParagraphStyle:
|
||||
"""
|
||||
self.bgcolor = color
|
||||
|
||||
def set_alignment(self,align):
|
||||
def set_alignment(self, align):
|
||||
"""
|
||||
Sets the paragraph alignment.
|
||||
|
||||
@ -737,23 +738,23 @@ class ParagraphStyle:
|
||||
return "justify"
|
||||
return "unknown"
|
||||
|
||||
def set_left_margin(self,value):
|
||||
def set_left_margin(self, value):
|
||||
"sets the left indent in centimeters"
|
||||
self.lmargin = value
|
||||
|
||||
def set_right_margin(self,value):
|
||||
def set_right_margin(self, value):
|
||||
"sets the right indent in centimeters"
|
||||
self.rmargin = value
|
||||
|
||||
def set_first_indent(self,value):
|
||||
def set_first_indent(self, value):
|
||||
"sets the first line indent in centimeters"
|
||||
self.first_indent = value
|
||||
|
||||
def set_top_margin(self,value):
|
||||
def set_top_margin(self, value):
|
||||
"sets the space above paragraph in centimeters"
|
||||
self.tmargin = value
|
||||
|
||||
def set_bottom_margin(self,value):
|
||||
def set_bottom_margin(self, value):
|
||||
"sets the space below paragraph in centimeters"
|
||||
self.bmargin = value
|
||||
|
||||
@ -789,7 +790,7 @@ class StyleSheetList:
|
||||
styles are loaded from a specified XML file if it exists.
|
||||
"""
|
||||
|
||||
def __init__(self,file,defstyle):
|
||||
def __init__(self, filename, defstyle):
|
||||
"""
|
||||
Creates a new StyleSheetList from the specified default style and
|
||||
any other styles that may be defined in the specified file.
|
||||
@ -799,10 +800,10 @@ class StyleSheetList:
|
||||
"""
|
||||
defstyle.set_name('default')
|
||||
self.map = { "default" : defstyle }
|
||||
self.file = os.path.join(const.home_dir,file)
|
||||
self.file = os.path.join(const.home_dir,filename)
|
||||
self.parse()
|
||||
|
||||
def delete_style_sheet(self,name):
|
||||
def delete_style_sheet(self, name):
|
||||
"""
|
||||
Removes a style from the list. Since each style must have a
|
||||
unique name, the name is used to delete the stylesheet.
|
||||
@ -817,7 +818,7 @@ class StyleSheetList:
|
||||
"""
|
||||
return self.map
|
||||
|
||||
def get_style_sheet(self,name):
|
||||
def get_style_sheet(self, name):
|
||||
"""
|
||||
Returns the StyleSheet associated with the name
|
||||
|
||||
@ -829,7 +830,7 @@ class StyleSheetList:
|
||||
"Returns a list of all the style names in the StyleSheetList"
|
||||
return self.map.keys()
|
||||
|
||||
def set_style_sheet(self,name,style):
|
||||
def set_style_sheet(self, name, style):
|
||||
"""
|
||||
Adds or replaces a StyleSheet in the StyleSheetList. The
|
||||
default style may not be replaced.
|
||||
@ -924,7 +925,7 @@ class StyleSheet:
|
||||
style = obj.style_list[style_name]
|
||||
self.style_list[style_name] = ParagraphStyle(style)
|
||||
|
||||
def set_name(self,name):
|
||||
def set_name(self, name):
|
||||
self.name = name
|
||||
|
||||
def get_name(self):
|
||||
@ -934,7 +935,7 @@ class StyleSheet:
|
||||
"Removes all paragraph styles from the StyleSheet"
|
||||
self.style_list = {}
|
||||
|
||||
def add_style(self,name,style):
|
||||
def add_style(self, name, style):
|
||||
"""
|
||||
Adds a paragraph style to the style sheet.
|
||||
|
||||
@ -951,7 +952,7 @@ class StyleSheet:
|
||||
"Returns the paragraph name/ParagraphStyle map"
|
||||
return self.style_list
|
||||
|
||||
def get_style(self,name):
|
||||
def get_style(self, name):
|
||||
"""
|
||||
Returns the ParagraphStyle associated with the name
|
||||
|
||||
@ -969,7 +970,7 @@ class SheetParser(handler.ContentHandler):
|
||||
SAX parsing class for the StyleSheetList XML file.
|
||||
"""
|
||||
|
||||
def __init__(self,sheetlist):
|
||||
def __init__(self, sheetlist):
|
||||
"""
|
||||
Creates a SheetParser class that populates the passed StyleSheetList
|
||||
class.
|
||||
@ -984,7 +985,7 @@ class SheetParser(handler.ContentHandler):
|
||||
self.sname = None
|
||||
self.pname = None
|
||||
|
||||
def startElement(self,tag,attrs):
|
||||
def startElement(self, tag, attrs):
|
||||
"""
|
||||
Overridden class that handles the start of a XML element
|
||||
"""
|
||||
@ -1022,7 +1023,7 @@ class SheetParser(handler.ContentHandler):
|
||||
self.p = ParagraphStyle()
|
||||
self.pname = attrs['name']
|
||||
|
||||
def endElement(self,tag):
|
||||
def endElement(self, tag):
|
||||
"Overridden class that handles the start of a XML element"
|
||||
if tag == "style":
|
||||
self.p.set_font(self.f)
|
||||
@ -1036,7 +1037,7 @@ class SheetParser(handler.ContentHandler):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class GraphicsStyle:
|
||||
def __init__(self,obj=None):
|
||||
def __init__(self, obj=None):
|
||||
if obj:
|
||||
self.height = obj.height
|
||||
self.width = obj.width
|
||||
@ -1058,7 +1059,7 @@ class GraphicsStyle:
|
||||
self.fill_color = (255,255,255)
|
||||
self.lstyle = SOLID
|
||||
|
||||
def set_line_width(self,val):
|
||||
def set_line_width(self, val):
|
||||
self.lwidth = val
|
||||
|
||||
def get_line_width(self):
|
||||
@ -1067,29 +1068,29 @@ class GraphicsStyle:
|
||||
def get_line_style(self):
|
||||
return self.lstyle
|
||||
|
||||
def set_line_style(self,val):
|
||||
def set_line_style(self, val):
|
||||
self.lstyle = val
|
||||
|
||||
def set_height(self,val):
|
||||
def set_height(self, val):
|
||||
self.height = val
|
||||
|
||||
def set_width(self,val):
|
||||
def set_width(self, val):
|
||||
self.width = val
|
||||
|
||||
def set_paragraph_style(self,val):
|
||||
def set_paragraph_style(self, val):
|
||||
self.para_name = val
|
||||
|
||||
def set_shadow(self,val,space=0.2):
|
||||
def set_shadow(self, val, space=0.2):
|
||||
self.shadow = val
|
||||
self.shadow_space = space
|
||||
|
||||
def get_shadow_space(self):
|
||||
return self.shadow_space
|
||||
|
||||
def set_color(self,val):
|
||||
def set_color(self, val):
|
||||
self.color = val
|
||||
|
||||
def set_fill_color(self,val):
|
||||
def set_fill_color(self, val):
|
||||
self.fill_color = val
|
||||
|
||||
def get_height(self):
|
||||
@ -1121,7 +1122,8 @@ class BaseDoc:
|
||||
such as OpenOffice, AbiWord, and LaTeX are derived from this base
|
||||
class, providing a common interface to all document generators.
|
||||
"""
|
||||
def __init__(self,styles,paper_type,template,orientation=PAPER_PORTRAIT):
|
||||
def __init__(self, styles, paper_type ,template,
|
||||
orientation=PAPER_PORTRAIT):
|
||||
"""
|
||||
Creates a BaseDoc instance, which provides a document generation
|
||||
interface. This class should never be instantiated directly, but
|
||||
@ -1175,7 +1177,7 @@ class BaseDoc:
|
||||
def end_page(self):
|
||||
pass
|
||||
|
||||
def print_requested (self):
|
||||
def print_requested(self):
|
||||
self.print_req = 1
|
||||
|
||||
def set_owner(self,owner):
|
||||
@ -1186,7 +1188,7 @@ class BaseDoc:
|
||||
"""
|
||||
self.owner = owner
|
||||
|
||||
def add_media_object(self,name,align,w_cm,h_cm):
|
||||
def add_media_object(self, name, align, w_cm, h_cm):
|
||||
"""
|
||||
Adds a photo of the specified width (in centimeters)
|
||||
|
||||
@ -1228,7 +1230,7 @@ class BaseDoc:
|
||||
"Returns the owner name"
|
||||
self.name = name
|
||||
|
||||
def set_title(self,name):
|
||||
def set_title(self, name):
|
||||
"""
|
||||
Sets the title of the document.
|
||||
|
||||
@ -1236,16 +1238,16 @@ class BaseDoc:
|
||||
"""
|
||||
self.title = name
|
||||
|
||||
def add_draw_style(self,name,style):
|
||||
def add_draw_style(self, name, style):
|
||||
self.draw_styles[name] = GraphicsStyle(style)
|
||||
|
||||
def get_draw_style(self,name):
|
||||
def get_draw_style(self, name):
|
||||
return self.draw_styles[name]
|
||||
|
||||
def get_style(self,name):
|
||||
def get_style(self, name):
|
||||
return self.style_list[name]
|
||||
|
||||
def add_table_style(self,name,style):
|
||||
def add_table_style(self, name, style):
|
||||
"""
|
||||
Adds the TableStyle with the specfied name.
|
||||
|
||||
@ -1254,7 +1256,7 @@ class BaseDoc:
|
||||
"""
|
||||
self.table_styles[name] = TableStyle(style)
|
||||
|
||||
def add_cell_style(self,name,style):
|
||||
def add_cell_style(self, name, style):
|
||||
"""
|
||||
Adds the TableCellStyle with the specfied name.
|
||||
|
||||
@ -1263,7 +1265,7 @@ class BaseDoc:
|
||||
"""
|
||||
self.cell_styles[name] = TableCellStyle(style)
|
||||
|
||||
def open(self,filename):
|
||||
def open(self, filename):
|
||||
"""
|
||||
Opens the document.
|
||||
|
||||
@ -1275,7 +1277,7 @@ class BaseDoc:
|
||||
"Closes the document"
|
||||
pass
|
||||
|
||||
def string_width(self,fontstyle,text):
|
||||
def string_width(self, fontstyle, text):
|
||||
"Determine the width need for text in given font"
|
||||
return FontScale.string_width(fontstyle,text)
|
||||
|
||||
@ -1299,7 +1301,7 @@ class BaseDoc:
|
||||
def end_superscript(self):
|
||||
pass
|
||||
|
||||
def start_listing(self,style_name):
|
||||
def start_listing(self, style_name):
|
||||
"""
|
||||
Starts a new listing block, using the specified style name.
|
||||
|
||||
@ -1310,7 +1312,7 @@ class BaseDoc:
|
||||
def end_listing(self):
|
||||
pass
|
||||
|
||||
def start_paragraph(self,style_name,leader=None):
|
||||
def start_paragraph(self, style_name, leader=None):
|
||||
"""
|
||||
Starts a new paragraph, using the specified style name.
|
||||
|
||||
@ -1325,7 +1327,7 @@ class BaseDoc:
|
||||
"Ends the current parsgraph"
|
||||
pass
|
||||
|
||||
def start_table(self,name,style_name):
|
||||
def start_table(self, name, style_name):
|
||||
"""
|
||||
Starts a new table.
|
||||
|
||||
@ -1346,7 +1348,7 @@ class BaseDoc:
|
||||
"Ends the current row on the current table"
|
||||
pass
|
||||
|
||||
def start_cell(self,style_name,span=1):
|
||||
def start_cell(self, style_name, span=1):
|
||||
"""
|
||||
Starts a new table cell, using the paragraph style specified.
|
||||
|
||||
@ -1363,7 +1365,7 @@ class BaseDoc:
|
||||
"Creates a horizontal line"
|
||||
pass
|
||||
|
||||
def write_note(self,text,format,style_name):
|
||||
def write_note(self, text, format, style_name):
|
||||
"""
|
||||
Writes the note's text and take care of paragraphs,
|
||||
depending on the format.
|
||||
@ -1374,7 +1376,7 @@ class BaseDoc:
|
||||
"""
|
||||
pass
|
||||
|
||||
def write_text(self,text):
|
||||
def write_text(self, text):
|
||||
"""
|
||||
Writes the text in the current paragraph. Should only be used after a
|
||||
start_paragraph and before an end_paragraph.
|
||||
@ -1383,7 +1385,7 @@ class BaseDoc:
|
||||
"""
|
||||
pass
|
||||
|
||||
def write_cmdstr(self,text):
|
||||
def write_cmdstr(self, text):
|
||||
"""
|
||||
Writes the text in the current paragraph. Should only be used after a
|
||||
start_paragraph and before an end_paragraph.
|
||||
@ -1392,35 +1394,35 @@ class BaseDoc:
|
||||
"""
|
||||
pass
|
||||
|
||||
def draw_arc(self,style,x1,y1,x2,y2,angle,extent):
|
||||
def draw_arc(self, style, x1, y1, x2, y2, angle, extent):
|
||||
pass
|
||||
|
||||
def draw_path(self,style,path):
|
||||
def draw_path(self, style, path):
|
||||
pass
|
||||
|
||||
def draw_box(self,style,text,x,y):
|
||||
def draw_box(self, style, text, x, y):
|
||||
pass
|
||||
|
||||
def write_at(self,style,text,x,y):
|
||||
def write_at(self, style, text, x, y):
|
||||
pass
|
||||
|
||||
def draw_bar(self,style,x1,y1,x2,y2):
|
||||
def draw_bar(self, style, x1, y1, x2, y2):
|
||||
pass
|
||||
|
||||
def draw_text(self,style,text,x1,y1):
|
||||
def draw_text(self, style, text, x1, y1):
|
||||
pass
|
||||
|
||||
def center_text(self,style,text,x1,y1):
|
||||
def center_text(self, style, text, x1, y1):
|
||||
pass
|
||||
|
||||
def rotate_text(self,style,text,x,y,angle):
|
||||
def rotate_text(self, style, text, x, y, angle):
|
||||
pass
|
||||
|
||||
def draw_line(self,style,x1,y1,x2,y2):
|
||||
def draw_line(self, style, x1, y1, x2, y2):
|
||||
pass
|
||||
|
||||
def draw_wedge(self, style, centerx, centery, radius, start_angle,
|
||||
end_angle, short_radius=0):
|
||||
def draw_wedge(self, style, centerx, centery, radius, start_angle,
|
||||
end_angle, short_radius=0):
|
||||
|
||||
assert(self.init_called)
|
||||
while end_angle < start_angle:
|
||||
@ -1437,7 +1439,7 @@ class BaseDoc:
|
||||
angle = sangle
|
||||
|
||||
if short_radius == 0:
|
||||
p.append((centerx,centery))
|
||||
p.append((centerx, centery))
|
||||
else:
|
||||
origx = (centerx + cos(angle)*short_radius)
|
||||
origy = (centery + sin(angle)*short_radius)
|
||||
@ -1446,24 +1448,24 @@ class BaseDoc:
|
||||
while angle<eangle:
|
||||
x = centerx + cos(angle)*radius
|
||||
y = centery + sin(angle)*radius
|
||||
p.append((x,y))
|
||||
p.append((x, y))
|
||||
angle = angle+radiansdelta
|
||||
x = centerx + cos(eangle)*radius
|
||||
y = centery + sin(eangle)*radius
|
||||
p.append((x,y))
|
||||
p.append((x, y))
|
||||
|
||||
if short_radius:
|
||||
x = centerx + cos(eangle)*short_radius
|
||||
y = centery + sin(eangle)*short_radius
|
||||
p.append((x,y))
|
||||
p.append((x, y))
|
||||
|
||||
angle = eangle
|
||||
while angle>=sangle:
|
||||
x = centerx + cos(angle)*short_radius
|
||||
y = centery + sin(angle)*short_radius
|
||||
p.append((x,y))
|
||||
p.append((x, y))
|
||||
angle = angle-radiansdelta
|
||||
self.draw_path(style,p)
|
||||
self.draw_path(style, p)
|
||||
|
||||
delta = (eangle - sangle)/2.0
|
||||
rad = short_radius + (radius-short_radius)/2.0
|
||||
@ -1471,13 +1473,13 @@ class BaseDoc:
|
||||
return ( (centerx + cos(sangle+delta) * rad),
|
||||
(centery + sin(sangle+delta) * rad))
|
||||
|
||||
def start_path(self,style,x,y):
|
||||
def start_path(self, style, x, y):
|
||||
pass
|
||||
|
||||
def line_to(self,x,y):
|
||||
def line_to(self, x, y):
|
||||
pass
|
||||
|
||||
def arc_to(self,x,y,angle,extent):
|
||||
def arc_to(self, x, y, angle, extent):
|
||||
pass
|
||||
|
||||
def end_path(self):
|
||||
|
@ -215,6 +215,19 @@ class EditLdsOrd(EditSecondary):
|
||||
Called when the OK button is pressed. Gets data from the
|
||||
form and updates the Attribute data structure.
|
||||
"""
|
||||
|
||||
(need_new, handle) = self.place_field.get_place_info()
|
||||
if need_new:
|
||||
place_obj = RelLib.Place()
|
||||
place_obj.set_title(handle)
|
||||
trans = self.db.transaction_begin()
|
||||
self.db.add_place(place_obj,trans)
|
||||
self.db.transaction_commit(trans,_("Add Place"))
|
||||
self.obj.set_place_handle(place_obj.get_handle())
|
||||
else:
|
||||
self.obj.set_place_handle(handle)
|
||||
|
||||
print self.obj.get_place_handle()
|
||||
if self.callback:
|
||||
self.callback(self.obj)
|
||||
self.close_window(obj)
|
||||
|
@ -38,12 +38,12 @@ import DateHandler
|
||||
import DateEdit
|
||||
import const
|
||||
|
||||
_lock_path = os.path.join(const.image_dir,'stock_lock.png')
|
||||
_lock_open_path = os.path.join(const.image_dir,'stock_lock-open.png')
|
||||
_lock_path = os.path.join(const.image_dir, 'stock_lock.png')
|
||||
_lock_open_path = os.path.join(const.image_dir, 'stock_lock-open.png')
|
||||
|
||||
class LinkLabel(gtk.EventBox):
|
||||
|
||||
def __init__(self,label,func,handle):
|
||||
def __init__(self, label, func, handle):
|
||||
gtk.EventBox.__init__(self)
|
||||
self.orig_text = cgi.escape(label[0])
|
||||
self.gender = label[1]
|
||||
@ -53,23 +53,23 @@ class LinkLabel(gtk.EventBox):
|
||||
|
||||
self.label = gtk.Label(text)
|
||||
self.label.set_use_markup(True)
|
||||
self.label.set_alignment(0,0.5)
|
||||
self.label.set_alignment(0, 0.5)
|
||||
|
||||
self.add(self.label)
|
||||
self.set_visible_window(False)
|
||||
|
||||
self.connect('button-press-event',func,handle)
|
||||
self.connect('enter-notify-event',self.enter_text,handle)
|
||||
self.connect('leave-notify-event',self.leave_text,handle)
|
||||
self.connect('button-press-event', func, handle)
|
||||
self.connect('enter-notify-event', self.enter_text, handle)
|
||||
self.connect('leave-notify-event', self.leave_text, handle)
|
||||
|
||||
def enter_text(self,obj,event,handle):
|
||||
def enter_text(self, obj, event, handle):
|
||||
text = '<span foreground="blue" underline="single">%s</span>' % self.orig_text
|
||||
if self.gender:
|
||||
text += u" %s" % self.gender
|
||||
self.label.set_text(text)
|
||||
self.label.set_use_markup(True)
|
||||
|
||||
def leave_text(self,obj,event,handle):
|
||||
def leave_text(self, obj, event, handle):
|
||||
text = '<span underline="single">%s</span>' % self.orig_text
|
||||
if self.gender:
|
||||
text += u" %s" % self.gender
|
||||
@ -78,16 +78,16 @@ class LinkLabel(gtk.EventBox):
|
||||
|
||||
class IconButton(gtk.EventBox):
|
||||
|
||||
def __init__(self,func,handle,icon=gtk.STOCK_EDIT,size=gtk.ICON_SIZE_MENU):
|
||||
def __init__(self, func, handle, icon=gtk.STOCK_EDIT, size=gtk.ICON_SIZE_MENU):
|
||||
gtk.EventBox.__init__(self)
|
||||
image = gtk.Image()
|
||||
image.set_from_stock(icon,size)
|
||||
image.set_from_stock(icon, size)
|
||||
image.show()
|
||||
self.add(image)
|
||||
self.show()
|
||||
|
||||
if func:
|
||||
self.connect('button-press-event',func,handle)
|
||||
self.connect('button-press-event', func, handle)
|
||||
|
||||
class WarnButton(gtk.EventBox):
|
||||
def __init__(self):
|
||||
@ -96,9 +96,9 @@ class WarnButton(gtk.EventBox):
|
||||
|
||||
# Some versions of FreeBSD don't seem to have STOCK_INFO
|
||||
try:
|
||||
image.set_from_stock(gtk.STOCK_INFO,gtk.ICON_SIZE_MENU)
|
||||
image.set_from_stock(gtk.STOCK_INFO, gtk.ICON_SIZE_MENU)
|
||||
except:
|
||||
image.set_from_stock(gtk.STOCK_DIALOG_INFO,gtk.ICON_SIZE_MENU)
|
||||
image.set_from_stock(gtk.STOCK_DIALOG_INFO, gtk.ICON_SIZE_MENU)
|
||||
|
||||
image.show()
|
||||
self.add(image)
|
||||
@ -106,57 +106,57 @@ class WarnButton(gtk.EventBox):
|
||||
self.func = None
|
||||
self.hide()
|
||||
|
||||
def on_clicked(self,func):
|
||||
self.connect('button-press-event',self._button_press)
|
||||
def on_clicked(self, func):
|
||||
self.connect('button-press-event', self._button_press)
|
||||
self.func = func
|
||||
|
||||
def _button_press(self,obj,event):
|
||||
def _button_press(self, obj, event):
|
||||
if event.type == gtk.gdk.BUTTON_PRESS and event.button == 1:
|
||||
self.func(obj)
|
||||
|
||||
class SimpleButton(gtk.Button):
|
||||
|
||||
def __init__(self,image,func):
|
||||
def __init__(self, image, func):
|
||||
gtk.Button.__init__(self)
|
||||
self.set_relief(gtk.RELIEF_NONE)
|
||||
self.add(gtk.image_new_from_stock(image,gtk.ICON_SIZE_BUTTON))
|
||||
self.connect('clicked',func)
|
||||
self.add(gtk.image_new_from_stock(image, gtk.ICON_SIZE_BUTTON))
|
||||
self.connect('clicked', func)
|
||||
self.show()
|
||||
|
||||
class LinkBox(gtk.HBox):
|
||||
|
||||
def __init__(self,link,button):
|
||||
def __init__(self, link, button):
|
||||
gtk.HBox.__init__(self)
|
||||
self.set_spacing(6)
|
||||
self.pack_start(link,False)
|
||||
self.pack_start(button,False)
|
||||
self.pack_start(link, False)
|
||||
self.pack_start(button, False)
|
||||
self.show()
|
||||
|
||||
class EditLabel(gtk.HBox):
|
||||
def __init__(self,text):
|
||||
def __init__(self, text):
|
||||
gtk.HBox.__init__(self)
|
||||
label = BasicLabel(text)
|
||||
self.pack_start(label,False)
|
||||
self.pack_start(gtk.image_new_from_stock(gtk.STOCK_EDIT,
|
||||
gtk.ICON_SIZE_MENU),False)
|
||||
self.pack_start(label, False)
|
||||
self.pack_start(gtk.image_new_from_stock(gtk.STOCK_EDIT,
|
||||
gtk.ICON_SIZE_MENU), False)
|
||||
self.set_spacing(4)
|
||||
# self.tooltip = gtk.Tooltips()
|
||||
# self.tooltip.set_tip(label,_('Click in the cell to change the value'))
|
||||
# self.tooltip.set_tip(label, _('Click in the cell to change the value'))
|
||||
# self.tooltip.enable()
|
||||
self.show_all()
|
||||
|
||||
class BasicLabel(gtk.Label):
|
||||
|
||||
def __init__(self,text):
|
||||
gtk.Label.__init__(self,text)
|
||||
self.set_alignment(0,0.5)
|
||||
def __init__(self, text):
|
||||
gtk.Label.__init__(self, text)
|
||||
self.set_alignment(0, 0.5)
|
||||
self.show()
|
||||
|
||||
class MarkupLabel(gtk.Label):
|
||||
|
||||
def __init__(self,text):
|
||||
gtk.Label.__init__(self,text)
|
||||
self.set_alignment(0,0.5)
|
||||
def __init__(self, text):
|
||||
gtk.Label.__init__(self, text)
|
||||
self.set_alignment(0, 0.5)
|
||||
self.set_use_markup(True)
|
||||
self.show()
|
||||
|
||||
@ -192,73 +192,73 @@ class IntEdit(gtk.Entry):
|
||||
|
||||
class TypeCellRenderer(gtk.CellRendererCombo):
|
||||
|
||||
def __init__(self,values):
|
||||
def __init__(self, values):
|
||||
gtk.CellRendererCombo.__init__(self)
|
||||
|
||||
model = gtk.ListStore(str,int)
|
||||
model = gtk.ListStore(str, int)
|
||||
for key in values:
|
||||
model.append(row=[values[key],key])
|
||||
self.set_property('editable',True)
|
||||
self.set_property('model',model)
|
||||
self.set_property('text-column',0)
|
||||
model.append(row=[values[key], key])
|
||||
self.set_property('editable', True)
|
||||
self.set_property('model', model)
|
||||
self.set_property('text-column', 0)
|
||||
|
||||
class PrivacyButton:
|
||||
|
||||
def __init__(self,button,obj,readonly=False):
|
||||
def __init__(self, button, obj, readonly=False):
|
||||
self.button = button
|
||||
self.button.connect('toggled',self._on_toggle)
|
||||
self.button.connect('toggled', self._on_toggle)
|
||||
self.tooltips = gtk.Tooltips()
|
||||
self.obj = obj
|
||||
self.set_active(obj.get_privacy())
|
||||
self.button.set_sensitive(not readonly)
|
||||
|
||||
def set_sensitive(self,val):
|
||||
def set_sensitive(self, val):
|
||||
self.button.set_sensitive(val)
|
||||
|
||||
def set_active(self,val):
|
||||
def set_active(self, val):
|
||||
self.button.set_active(val)
|
||||
self._on_toggle(self.button)
|
||||
|
||||
def get_active(self):
|
||||
return self.button.get_active()
|
||||
|
||||
def _on_toggle(self,obj):
|
||||
def _on_toggle(self, obj):
|
||||
child = obj.child
|
||||
if child:
|
||||
obj.remove(child)
|
||||
image = gtk.Image()
|
||||
if obj.get_active():
|
||||
# image.set_from_icon_name('stock_lock',gtk.ICON_SIZE_MENU)
|
||||
# image.set_from_icon_name('stock_lock', gtk.ICON_SIZE_MENU)
|
||||
image.set_from_file(_lock_path)
|
||||
self.tooltips.set_tip(obj,_('Record is private'))
|
||||
self.tooltips.set_tip(obj, _('Record is private'))
|
||||
self.obj.set_privacy(True)
|
||||
else:
|
||||
# image.set_from_icon_name('stock_lock-open',gtk.ICON_SIZE_MENU)
|
||||
# image.set_from_icon_name('stock_lock-open', gtk.ICON_SIZE_MENU)
|
||||
image.set_from_file(_lock_open_path)
|
||||
self.tooltips.set_tip(obj,_('Record is public'))
|
||||
self.tooltips.set_tip(obj, _('Record is public'))
|
||||
self.obj.set_privacy(False)
|
||||
image.show()
|
||||
obj.add(image)
|
||||
|
||||
class MonitoredCheckbox:
|
||||
|
||||
def __init__(self,obj,button,set_val,get_val,on_toggle=None):
|
||||
def __init__(self, obj, button, set_val, get_val, on_toggle=None):
|
||||
self.button = button
|
||||
self.button.connect('toggled',self._on_toggle)
|
||||
self.button.connect('toggled', self._on_toggle)
|
||||
self.on_toggle = on_toggle
|
||||
self.obj = obj
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
self.obj.set_active(get_val())
|
||||
|
||||
def _on_toggle(self,obj):
|
||||
def _on_toggle(self, obj):
|
||||
self.set_val(obj.get_active())
|
||||
if self.on_toggle:
|
||||
self.on_toggle(self.get_val())
|
||||
|
||||
class MonitoredEntry:
|
||||
|
||||
def __init__(self,obj,set_val,get_val,read_only=False,
|
||||
def __init__(self, obj, set_val, get_val, read_only=False,
|
||||
autolist=None, changed=None):
|
||||
self.obj = obj
|
||||
self.set_val = set_val
|
||||
@ -273,21 +273,21 @@ class MonitoredEntry:
|
||||
if autolist:
|
||||
AutoComp.fill_entry(obj,autolist)
|
||||
|
||||
def connect(self,signal,callback):
|
||||
self.obj.connect(signal,callback)
|
||||
def connect(self, signal, callback):
|
||||
self.obj.connect(signal, callback)
|
||||
|
||||
def _on_change(self,obj):
|
||||
def _on_change(self, obj):
|
||||
self.set_val(unicode(obj.get_text()))
|
||||
if self.changed:
|
||||
self.changed(obj)
|
||||
|
||||
def force_value(self,value):
|
||||
def force_value(self, value):
|
||||
self.obj.set_text(value)
|
||||
|
||||
def get_value(self,value):
|
||||
def get_value(self, value):
|
||||
return unicode(self.obj.get_text())
|
||||
|
||||
def enable(self,value):
|
||||
def enable(self, value):
|
||||
self.obj.set_sensitive(value)
|
||||
self.obj.set_editable(value)
|
||||
|
||||
@ -300,7 +300,7 @@ class MonitoredEntry:
|
||||
|
||||
class MonitoredText:
|
||||
|
||||
def __init__(self,obj,set_val,get_val,read_only=False):
|
||||
def __init__(self, obj, set_val, get_val, read_only=False):
|
||||
self.buf = obj.get_buffer()
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
@ -310,13 +310,13 @@ class MonitoredText:
|
||||
self.buf.connect('changed', self.on_change)
|
||||
obj.set_editable(not read_only)
|
||||
|
||||
def on_change(self,obj):
|
||||
s,e = self.buf.get_bounds()
|
||||
self.set_val(unicode(self.buf.get_text(s,e,False)))
|
||||
def on_change(self, obj):
|
||||
s, e = self.buf.get_bounds()
|
||||
self.set_val(unicode(self.buf.get_text(s, e, False)))
|
||||
|
||||
class MonitoredType:
|
||||
|
||||
def __init__(self,obj,set_val,get_val,mapping,custom,readonly=False,
|
||||
def __init__(self, obj, set_val, get_val, mapping, custom, readonly=False,
|
||||
custom_values=None):
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
@ -345,46 +345,46 @@ class MonitoredType:
|
||||
|
||||
class MonitoredMenu:
|
||||
|
||||
def __init__(self,obj,set_val,get_val,mapping,readonly=False,changed=None):
|
||||
def __init__(self, obj, set_val, get_val, mapping, readonly=False, changed=None):
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
|
||||
self.changed = changed
|
||||
self.obj = obj
|
||||
self.model = gtk.ListStore(str,int)
|
||||
self.model = gtk.ListStore(str, int)
|
||||
self.data = {}
|
||||
|
||||
index = 0
|
||||
for t,v in mapping:
|
||||
self.model.append(row=[t,v])
|
||||
for t, v in mapping:
|
||||
self.model.append(row=[t, v])
|
||||
self.data[v] = index
|
||||
index += 1
|
||||
|
||||
self.obj.set_model(self.model)
|
||||
self.obj.set_active(self.data[get_val()])
|
||||
self.obj.connect('changed',self.on_change)
|
||||
self.obj.connect('changed', self.on_change)
|
||||
self.obj.set_sensitive(not readonly)
|
||||
|
||||
def force(self,value):
|
||||
def force(self, value):
|
||||
self.obj.set_active(value)
|
||||
|
||||
def change_menu(self, mapping):
|
||||
self.model = gtk.ListStore(str,int)
|
||||
for t,v in mapping:
|
||||
self.model.append(row=[t,v])
|
||||
self.model = gtk.ListStore(str, int)
|
||||
for t, v in mapping:
|
||||
self.model.append(row=[t, v])
|
||||
self.obj.set_model(self.model)
|
||||
self.obj.set_active(0)
|
||||
|
||||
def on_change(self, obj):
|
||||
print "ON CHANGE"
|
||||
self.set_val(self.model.get_value(obj.get_active_iter(),1))
|
||||
self.set_val(self.model.get_value(obj.get_active_iter(), 1))
|
||||
if self.changed:
|
||||
print "CALL"
|
||||
self.changed()
|
||||
|
||||
class MonitoredStrMenu:
|
||||
|
||||
def __init__(self,obj,set_val,get_val,mapping,readonly=False):
|
||||
def __init__(self, obj, set_val, get_val, mapping, readonly=False):
|
||||
self.set_val = set_val
|
||||
self.get_val = get_val
|
||||
|
||||
@ -401,16 +401,16 @@ class MonitoredStrMenu:
|
||||
default = get_val()
|
||||
active = 0
|
||||
|
||||
for t,v in mapping:
|
||||
for t, v in mapping:
|
||||
self.model.append(row=[v])
|
||||
self.data.append(t)
|
||||
if v == default:
|
||||
active = index
|
||||
index += 1
|
||||
if t == default:
|
||||
active = index
|
||||
|
||||
self.obj.set_model(self.model)
|
||||
self.obj.set_active(active)
|
||||
self.obj.connect('changed',self.on_change)
|
||||
self.obj.connect('changed', self.on_change)
|
||||
self.obj.set_sensitive(not readonly)
|
||||
|
||||
def on_change(self, obj):
|
||||
@ -418,7 +418,7 @@ class MonitoredStrMenu:
|
||||
|
||||
class MonitoredDate:
|
||||
|
||||
def __init__(self,field,button,value,window, readonly=False):
|
||||
def __init__(self, field, button, value, window, readonly=False):
|
||||
self.date = value
|
||||
self.date_check = DateEdit.DateEdit(
|
||||
self.date, field, button, window)
|
||||
@ -445,7 +445,7 @@ class PlaceEntry:
|
||||
self.obj.set_editable(True)
|
||||
|
||||
store = gtk.ListStore(str)
|
||||
foo = [ (locale.strxfrm(self.places[v]),v) \
|
||||
foo = [ (locale.strxfrm(self.places[v]), v) \
|
||||
for v in self.places.keys()]
|
||||
foo.sort()
|
||||
for val in foo:
|
||||
@ -462,8 +462,8 @@ class PlaceEntry:
|
||||
if text:
|
||||
for key in self.places.keys():
|
||||
if text == self.places[key]:
|
||||
return (False,key)
|
||||
return (True,text)
|
||||
return (False, key)
|
||||
return (True, text)
|
||||
else:
|
||||
return (False,u"")
|
||||
return (False, u"")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user