2008-02-22 Raphael Ackermann <raphael.ackermann@gmail.com>

* various (294 files)
	pep8 doc fixes & pylint fixes

svn: r10103
This commit is contained in:
Raphael Ackermann 2008-02-24 13:55:55 +00:00
parent 2180fa02cb
commit c962d5e6e1
294 changed files with 2925 additions and 2571 deletions

View File

@ -1,3 +1,7 @@
2008-02-22 Raphael Ackermann <raphael.ackermann@gmail.com>
* various (294 files)
pep8 doc fixes & pylint fixes
2008-02-23 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/gen/lib/date.py (Date.get_stop_date):
added new method Date.to_calendar; dates return None if error

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:Assistant.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -273,7 +273,7 @@ class Assistant(gtk.Object, ManagedWindow.ManagedWindow):
def add_page(self, title, child):
"""
Add page with the title and child widget.
Returns index number of the new page.
Return index number of the new page.
"""
self.title_text.append(_format % title)
return self.notebook.append_page(child)

View File

@ -18,10 +18,10 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:AutoComp.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Provides autocompletion functionality.
Provide autocompletion functionality.
"""
#-------------------------------------------------------------------------

View File

@ -23,7 +23,7 @@
# $Id$
"""
Provides base interface to text based documents. Specific document
Provide base interface to text based documents. Specific document
interfaces should be derived from the core classes.
"""
@ -143,7 +143,7 @@ class PaperSize:
"""
def __init__(self, name, height, width):
"""
Creates a new paper style with.
Create a new paper style with.
@param name: name of the new style
@param height: page height in centimeters
@ -154,31 +154,31 @@ class PaperSize:
self.width = width
def get_name(self):
"Returns the name of the paper style"
"Return the name of the paper style"
return self.name
def get_height(self):
"Returns the page height in cm"
"Return the page height in cm"
return self.height
def set_height(self, height):
"Sets the page height in cm"
"Set the page height in cm"
self.height = height
def get_width(self):
"Returns the page width in cm"
"Return the page width in cm"
return self.width
def set_width(self, width):
"Sets the page width in cm"
"Set the page width in cm"
self.width = width
def get_height_inches(self):
"Returns the page height in inches"
"Return the page height in inches"
return self.height / 2.54
def get_width_inches(self):
"Returns the page width in inches"
"Return the page width in inches"
return self.width / 2.54
#------------------------------------------------------------------------
@ -313,7 +313,7 @@ class FontStyle:
def __init__(self, style=None):
"""
Creates a new FontStyle object, accepting the default values.
Create a new FontStyle object, accepting the default values.
@param style: if specified, initializes the FontStyle from the passed
FontStyle instead of using the defaults.
@ -336,7 +336,7 @@ class FontStyle:
def set(self, face=None, size=None, italic=None, bold=None,
underline=None, color=None):
"""
Sets font characteristics.
Set font characteristics.
@param face: font type face, either FONT_SERIF or FONT_SANS_SERIF
@param size: type face size in points
@ -381,7 +381,7 @@ class FontStyle:
self.color = val
def get_color(self):
"Returns an RGB color tuple"
"Return an RGB color tuple"
return self.color
def set_size(self, val):
@ -422,7 +422,7 @@ class TableStyle:
"""
def __init__(self, obj=None):
"""
Creates a new TableStyle object, with the values initialized to
Create a new TableStyle object, with the values initialized to
empty, with allocating space for up to 100 columns.
@param obj: if not None, then the object created gets is attributes
@ -439,20 +439,20 @@ class TableStyle:
def set_width(self, width):
"""
Sets the width of the table in terms of percent of the available
Set the width of the table in terms of percent of the available
width
"""
self.width = width
def get_width(self):
"""
Returns the specified width as a percentage of the available space
Return the specified width as a percentage of the available space
"""
return self.width
def set_columns(self, columns):
"""
Sets the number of columns.
Set the number of columns.
@param columns: number of columns that should be used.
"""
@ -460,13 +460,13 @@ class TableStyle:
def get_columns(self):
"""
Returns the number of columns
Return the number of columns
"""
return self.columns
def set_column_widths(self, clist):
"""
Sets the width of all the columns at once, taking the percentages
Set the width of all the columns at once, taking the percentages
from the passed list.
"""
self.columns = len(clist)
@ -475,7 +475,7 @@ class TableStyle:
def set_column_width(self, index, width):
"""
Sets the width of a specified column to the specified width.
Set the width of a specified column to the specified width.
@param index: column being set (index starts at 0)
@param width: percentage of the table width assigned to the column
@ -484,7 +484,7 @@ class TableStyle:
def get_column_width(self, index):
"""
Returns the column width of the specified column as a percentage of
Return the column width of the specified column as a percentage of
the entire table width.
@param index: column to return (index starts at 0)
@ -503,7 +503,7 @@ class TableCellStyle:
"""
def __init__(self, obj=None):
"""
Creates a new TableCellStyle instance.
Create a new TableCellStyle instance.
@param obj: if not None, specifies that the values should be
copied from the passed object instead of being initialized to empty.
@ -524,7 +524,7 @@ class TableCellStyle:
self.longlist = 0
def set_padding(self, val):
"Returns the cell padding in centimeters"
"Return the cell padding in centimeters"
self.padding = val
def set_right_border(self, val):
@ -563,23 +563,23 @@ class TableCellStyle:
self.longlist = val
def get_padding(self):
"Returns the cell padding in centimeters"
"Return the cell padding in centimeters"
return self.padding
def get_right_border(self):
"Returns 1 if a right border is requested"
"Return 1 if a right border is requested"
return self.rborder
def get_left_border(self):
"Returns 1 if a left border is requested"
"Return 1 if a left border is requested"
return self.lborder
def get_top_border(self):
"Returns 1 if a top border is requested"
"Return 1 if a top border is requested"
return self.tborder
def get_bottom_border(self):
"Returns 1 if a bottom border is requested"
"Return 1 if a bottom border is requested"
return self.bborder
def get_longlist(self):
@ -640,13 +640,13 @@ class ParagraphStyle:
def set_description(self, text):
"""
Sets the desciption of the paragraph
Set the desciption of the paragraph
"""
self.description = text
def get_description(self):
"""
Returns the desciption of the paragraph
Return the desciption of the paragraph
"""
return self.description
@ -700,7 +700,7 @@ class ParagraphStyle:
def set_header_level(self, level):
"""
Sets the header level for the paragraph. This is useful for
Set the header level for the paragraph. This is useful for
numbered paragraphs. A value of 1 indicates a header level
format of X, a value of two implies X.X, etc. A value of zero
means no header level.
@ -708,36 +708,36 @@ class ParagraphStyle:
self.level = level
def get_header_level(self):
"Returns the header level of the paragraph"
"Return the header level of the paragraph"
return self.level
def set_font(self, font):
"""
Sets the font style of the paragraph.
Set the font style of the paragraph.
@param font: FontStyle object containing the font definition to use.
"""
self.font = FontStyle(font)
def get_font(self):
"Returns the FontStyle of the paragraph"
"Return the FontStyle of the paragraph"
return self.font
def set_padding(self, val):
"""
Sets the paragraph padding in centimeters
Set the paragraph padding in centimeters
@param val: floating point value indicating the padding in centimeters
"""
self.pad = val
def get_padding(self):
"""Returns a the padding of the paragraph"""
"""Return a the padding of the paragraph"""
return self.pad
def set_top_border(self, val):
"""
Sets the presence or absence of top border.
Set the presence or absence of top border.
@param val: True indicates a border should be used, False indicates
no border.
@ -745,12 +745,12 @@ class ParagraphStyle:
self.top_border = val
def get_top_border(self):
"Returns 1 if a top border is specified"
"Return 1 if a top border is specified"
return self.top_border
def set_bottom_border(self, val):
"""
Sets the presence or absence of bottom border.
Set the presence or absence of bottom border.
@param val: True indicates a border should be used, False
indicates no border.
@ -758,12 +758,12 @@ class ParagraphStyle:
self.bottom_border = val
def get_bottom_border(self):
"Returns 1 if a bottom border is specified"
"Return 1 if a bottom border is specified"
return self.bottom_border
def set_left_border(self, val):
"""
Sets the presence or absence of left border.
Set the presence or absence of left border.
@param val: True indicates a border should be used, False
indicates no border.
@ -771,12 +771,12 @@ class ParagraphStyle:
self.left_border = val
def get_left_border(self):
"Returns 1 if a left border is specified"
"Return 1 if a left border is specified"
return self.left_border
def set_right_border(self, val):
"""
Sets the presence or absence of rigth border.
Set the presence or absence of rigth border.
@param val: True indicates a border should be used, False
indicates no border.
@ -784,19 +784,19 @@ class ParagraphStyle:
self.right_border = val
def get_right_border(self):
"Returns 1 if a right border is specified"
"Return 1 if a right border is specified"
return self.right_border
def get_background_color(self):
"""
Returns a tuple indicating the RGB components of the background
Return a tuple indicating the RGB components of the background
color
"""
return self.bgcolor
def set_background_color(self, color):
"""
Sets the background color of the paragraph.
Set the background color of the paragraph.
@param color: tuple representing the RGB components of a color
(0,0,0) to (255,255,255)
@ -805,7 +805,7 @@ class ParagraphStyle:
def set_alignment(self, align):
"""
Sets the paragraph alignment.
Set the paragraph alignment.
@param align: PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER,
or PARA_ALIGN_JUSTIFY
@ -813,12 +813,12 @@ class ParagraphStyle:
self.align = align
def get_alignment(self):
"Returns the alignment of the paragraph"
"Return the alignment of the paragraph"
return self.align
def get_alignment_text(self):
"""
Returns a text string representing the alginment, either 'left',
Return a text string representing the alginment, either 'left',
'right', 'center', or 'justify'
"""
if self.align == PARA_ALIGN_LEFT:
@ -892,7 +892,7 @@ class StyleSheetList:
def __init__(self, filename, defstyle):
"""
Creates a new StyleSheetList from the specified default style and
Create a new StyleSheetList from the specified default style and
any other styles that may be defined in the specified file.
file - XML file that contains style definitions
@ -905,7 +905,7 @@ class StyleSheetList:
def delete_style_sheet(self, name):
"""
Removes a style from the list. Since each style must have a
Remove a style from the list. Since each style must have a
unique name, the name is used to delete the stylesheet.
name - Name of the style to delete
@ -914,25 +914,25 @@ class StyleSheetList:
def get_style_sheet_map(self):
"""
Returns the map of names to styles.
Return the map of names to styles.
"""
return self.map
def get_style_sheet(self, name):
"""
Returns the StyleSheet associated with the name
Return the StyleSheet associated with the name
name - name associated with the desired StyleSheet.
"""
return self.map[name]
def get_style_names(self):
"Returns a list of all the style names in the StyleSheetList"
"Return a list of all the style names in the StyleSheetList"
return self.map.keys()
def set_style_sheet(self, name, style):
"""
Adds or replaces a StyleSheet in the StyleSheetList. The
Add or replaces a StyleSheet in the StyleSheetList. The
default style may not be replaced.
name - name assocated with the StyleSheet to add or replace.
@ -1018,7 +1018,7 @@ class StyleSheet:
def __init__(self, obj=None):
"""
Creates a new empty StyleSheet.
Create a new empty StyleSheet.
@param obj: if not None, creates the StyleSheet from the values in
obj, instead of creating an empty StyleSheet
@ -1044,7 +1044,7 @@ class StyleSheet:
def set_name(self, name):
"""
Sets the name of the StyleSheet
Set the name of the StyleSheet
@param name: The name to be given to the StyleSheet
"""
@ -1052,12 +1052,12 @@ class StyleSheet:
def get_name(self):
"""
Returns the name of the StyleSheet
Return the name of the StyleSheet
"""
return self.name
def clear(self):
"Removes all styles from the StyleSheet"
"Remove all styles from the StyleSheet"
self.para_styles = {}
self.draw_styles = {}
self.table_styles = {}
@ -1076,7 +1076,7 @@ class StyleSheet:
def add_paragraph_style(self, name, style):
"""
Adds a paragraph style to the style sheet.
Add a paragraph style to the style sheet.
@param name: The name of the ParagraphStyle
@param style: ParagraphStyle instance to be added.
@ -1085,19 +1085,19 @@ class StyleSheet:
def get_paragraph_style(self, name):
"""
Returns the ParagraphStyle associated with the name
Return the ParagraphStyle associated with the name
@param name: name of the ParagraphStyle that is wanted
"""
return ParagraphStyle(self.para_styles[name])
def get_paragraph_style_names(self):
"Returns the the list of paragraph names in the StyleSheet"
"Return the the list of paragraph names in the StyleSheet"
return self.para_styles.keys()
def add_draw_style(self, name, style):
"""
Adds a draw style to the style sheet.
Add a draw style to the style sheet.
@param name: The name of the GraphicsStyle
@param style: GraphicsStyle instance to be added.
@ -1106,19 +1106,19 @@ class StyleSheet:
def get_draw_style(self, name):
"""
Returns the GraphicsStyle associated with the name
Return the GraphicsStyle associated with the name
@param name: name of the GraphicsStyle that is wanted
"""
return GraphicsStyle(self.draw_styles[name])
def get_draw_style_names(self):
"Returns the the list of draw style names in the StyleSheet"
"Return the the list of draw style names in the StyleSheet"
return self.draw_styles.keys()
def add_table_style(self, name, style):
"""
Adds a table style to the style sheet.
Add a table style to the style sheet.
@param name: The name of the TableStyle
@param style: TableStyle instance to be added.
@ -1127,19 +1127,19 @@ class StyleSheet:
def get_table_style(self, name):
"""
Returns the TableStyle associated with the name
Return the TableStyle associated with the name
@param name: name of the TableStyle that is wanted
"""
return TableStyle(self.table_styles[name])
def get_table_style_names(self):
"Returns the the list of table style names in the StyleSheet"
"Return the the list of table style names in the StyleSheet"
return self.table_styles.keys()
def add_cell_style(self, name, style):
"""
Adds a cell style to the style sheet.
Add a cell style to the style sheet.
@param name: The name of the TableCellStyle
@param style: TableCellStyle instance to be added.
@ -1148,14 +1148,14 @@ class StyleSheet:
def get_cell_style(self, name):
"""
Returns the TableCellStyle associated with the name
Return the TableCellStyle associated with the name
@param name: name of the TableCellStyle that is wanted
"""
return TableCellStyle(self.cell_styles[name])
def get_cell_style_names(self):
"Returns the the list of cell style names in the StyleSheet"
"Return the the list of cell style names in the StyleSheet"
return self.cell_styles.keys()
#-------------------------------------------------------------------------
@ -1170,7 +1170,7 @@ class SheetParser(handler.ContentHandler):
def __init__(self, sheetlist):
"""
Creates a SheetParser class that populates the passed StyleSheetList
Create a SheetParser class that populates the passed StyleSheetList
class.
sheetlist - StyleSheetList instance to be loaded from the file.
@ -1273,7 +1273,7 @@ class GraphicsStyle:
def get_line_width(self):
"""
Returns the name of the StyleSheet
Return the name of the StyleSheet
"""
return self.lwidth
@ -1341,7 +1341,7 @@ class BaseDoc:
"""
def __init__(self, styles, paper_style, template):
"""
Creates a BaseDoc instance, which provides a document generation
Create a BaseDoc instance, which provides a document generation
interface. This class should never be instantiated directly, but
only through a derived class.
@ -1367,22 +1367,22 @@ class BaseDoc:
self.print_req = 1
def set_creator(self, name):
"Sets the owner name"
"Set the owner name"
self._creator = name
def get_creator(self):
"Returns the owner name"
"Return the owner name"
return self._creator
def get_style_sheet(self):
"""
Returns the StyleSheet of the document.
Return the StyleSheet of the document.
"""
return StyleSheet(self._style_sheet)
def set_style_sheet(self, style_sheet):
"""
Sets the StyleSheet of the document.
Set the StyleSheet of the document.
@param style_sheet: The new style sheet for the document
@type style_sheet: StyleSheet
@ -1500,7 +1500,7 @@ class TextDoc:
def add_media_object(self, name, align, w_cm, h_cm):
"""
Adds a photo of the specified width (in centimeters)
Add a photo of the specified width (in centimeters)
@param name: filename of the image to add
@param align: alignment of the image. Valid values are 'left',
@ -1530,7 +1530,7 @@ class DrawDoc:
def get_usable_width(self):
"""
Returns the width of the text area in centimeters. The value is
Return the width of the text area in centimeters. The value is
the page width less the margins.
"""
width = self.paper.get_size().get_width()
@ -1540,7 +1540,7 @@ class DrawDoc:
def get_usable_height(self):
"""
Returns the height of the text area in centimeters. The value is
Return the height of the text area in centimeters. The value is
the page height less the margins.
"""
height = self.paper.get_size().get_height()

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_NameDisplay.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Class handling language-specific displaying of names.
@ -163,32 +163,32 @@ class NameDisplay:
Name.FN : self._raw_fn,
}
for (num,name,fmt_str,act) in formats:
for (num, name,fmt_str,act) in formats:
func = self._format_fn(fmt_str)
func_raw = raw_func_dict.get(num)
if func_raw == None:
func_raw = self._format_raw_fn(fmt_str)
self.name_formats[num] = (name,fmt_str,act,func,func_raw)
def add_name_format(self,name,fmt_str):
def add_name_format(self, name,fmt_str):
num = -1
while num in self.name_formats:
num -= 1
self.set_name_format([(num,name,fmt_str,_ACT)])
self.set_name_format([(num, name,fmt_str,_ACT)])
return num
def edit_name_format(self,num,name,fmt_str):
self.set_name_format([(num,name,fmt_str,_ACT)])
def edit_name_format(self, num, name,fmt_str):
self.set_name_format([(num, name,fmt_str,_ACT)])
if self.default_format == num:
self.set_default_format(num)
def del_name_format(self,num):
def del_name_format(self, num):
try:
del self.name_formats[num]
except:
pass
def set_default_format(self,num):
def set_default_format(self, num):
if num not in self.name_formats:
num = Name.LNFN
@ -203,7 +203,7 @@ class NameDisplay:
def get_default_format(self):
return self.default_format
def set_format_inactive(self,num):
def set_format_inactive(self, num):
try:
self.name_formats[num] = (self.name_formats[num][_F_NAME],
self.name_formats[num][_F_FMT],
@ -217,7 +217,7 @@ class NameDisplay:
only_custom=False,
only_active=True):
"""
Get a list of tuples (num,name,fmt_str,act)
Get a list of tuples (num, name,fmt_str,act)
"""
the_list = []
@ -240,7 +240,7 @@ class NameDisplay:
if y<0: return -x+y
else: return x-y
def _is_format_valid(self,num):
def _is_format_valid(self, num):
try:
if not self.name_formats[num][_F_ACT]:
num = 0
@ -331,7 +331,7 @@ class NameDisplay:
def _make_fn(self, format_str, d, args):
"""
Creates the name display function and handles dependent
Create the name display function and handles dependent
punctuation.
"""
# First, go through and do internationalization-based
@ -411,9 +411,9 @@ def fn(%s):
return fn
def format_str(self,name,format_str):
return self._format_str_base(name.first_name,name.surname,name.prefix,
name.suffix,name.patronymic,name.title,
def format_str(self, name,format_str):
return self._format_str_base(name.first_name, name.surname, name.prefix,
name.suffix, name.patronymic, name.title,
name.call,format_str)
def format_str_raw(self,raw_data,format_str):
@ -465,12 +465,12 @@ def fn(%s):
#-------------------------------------------------------------------------
def sort_string(self,name):
return u"%-25s%-30s%s" % (name.surname,name.first_name,name.suffix)
def sort_string(self, name):
return u"%-25s%-30s%s" % (name.surname, name.first_name, name.suffix)
def sorted(self,person):
"""
Returns a text string representing the L{gen.lib.Person} instance's
Return a text string representing the L{gen.lib.Person} instance's
L{Name} in a manner that should be used for displaying a sorted
name.
@ -484,9 +484,9 @@ def fn(%s):
name = person.get_primary_name()
return self.sorted_name(name)
def sorted_name(self,name):
def sorted_name(self, name):
"""
Returns a text string representing the L{Name} instance
Return a text string representing the L{Name} instance
in a manner that should be used for displaying a sorted
name.
@ -500,7 +500,7 @@ def fn(%s):
def raw_sorted_name(self,raw_data):
"""
Returns a text string representing the L{Name} instance
Return a text string representing the L{Name} instance
in a manner that should be used for displaying a sorted
name.
@ -514,7 +514,7 @@ def fn(%s):
def display(self,person):
"""
Returns a text string representing the L{gen.lib.Person} instance's
Return a text string representing the L{gen.lib.Person} instance's
L{Name} in a manner that should be used for normal displaying.
@param person: L{gen.lib.Person} instance that contains the
@ -529,7 +529,7 @@ def fn(%s):
def display_formal(self,person):
"""
Returns a text string representing the L{gen.lib.Person} instance's
Return a text string representing the L{gen.lib.Person} instance's
L{Name} in a manner that should be used for normal displaying.
@param person: L{gen.lib.Person} instance that contains the
@ -543,9 +543,9 @@ def fn(%s):
name = person.get_primary_name()
return self.display_name(name)
def display_name(self,name):
def display_name(self, name):
"""
Returns a text string representing the L{Name} instance
Return a text string representing the L{Name} instance
in a manner that should be used for normal displaying.
@param name: L{Name} instance that is to be displayed.

View File

@ -71,7 +71,7 @@ class Bookmarks :
def __init__(self, dbstate, uistate, bookmarks, callback=None):
"""
Creates a the bookmark editor.
Create a the bookmark editor.
bookmarks - list of People
menu - parent menu to attach users
@ -173,7 +173,7 @@ class Bookmarks :
def remove_handles(self, handle_list):
"""
Removes people from the list of bookmarked people.
Remove people from the list of bookmarked people.
This function is for use *outside* the bookmark editor
(removal when person is deleted or merged away).
@ -254,7 +254,7 @@ class Bookmarks :
self.top.destroy()
def delete_clicked(self, obj):
"""Removes the current selection from the list"""
"""Remove the current selection from the list"""
store, the_iter = self.namemodel.get_selected()
if not the_iter:
return

View File

@ -20,7 +20,7 @@
# $Id$
"""
Provides the event view.
Provide the event view.
"""
#-------------------------------------------------------------------------
@ -109,13 +109,13 @@ class EventView(PageView.ListView):
def get_bookmarks(self):
"""
Returns the bookmark object
Return the bookmark object
"""
return self.dbstate.db.get_event_bookmarks()
def drag_info(self):
"""
Indicates that the drag type is an EVENT
Indicate that the drag type is an EVENT
"""
return DdTargets.EVENT

View File

@ -622,7 +622,7 @@ class GrampletView(PageView.PageView):
def __init__(self, dbstate, uistate):
"""
Creates a GrampletView, with the current dbstate and uistate
Create a GrampletView, with the current dbstate and uistate
"""
PageView.PageView.__init__(self, _('Gramplets'), dbstate, uistate)
self._popup_xy = None
@ -1038,7 +1038,7 @@ class GrampletView(PageView.PageView):
def get_stock(self):
"""
Returns image associated with the view, which is used for the
Return image associated with the view, which is used for the
icon for the button.
"""
return 'gramps-gramplet'

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:MapView.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -142,7 +142,7 @@ class GuideMap(gtk.DrawingArea):
gtk.gdk.INTERP_BILINEAR)
gc.collect()
def map_to_screen( self, x,y,w=None,h=None):
def map_to_screen( self, x,y,w=None, h=None):
px = int((float(x) + 180.0) / 360.0 * self.backbuf.get_width())
py = int((90-float(y)) / 180.0 * self.backbuf.get_height())
if w and h:
@ -197,7 +197,7 @@ class MapTile:
print "Source-Map origin: %f x %f, %f, %f" % (self.map_x,self.map_y,self.map_width,self.map_height)
print "Source-Map pixels: %f x %f" % (self.map_pixel_width,self.map_pixel_height)
print "Source-Map scale: %f" % self.source_scale
print "Target origin: %f x %f, %f, %f" % (x,y,w,h)
print "Target origin: %f x %f, %f, %f" % (x,y,w, h)
print "Target scale: %f" % target_scale
print "Target crop: %f x %f, %f x %f" % (xoffset,yoffset,xmax,ymax)
print "Origin of crop: %f x %f" % (self.scaled_map_x,self.scaled_map_y)
@ -412,16 +412,16 @@ class ZoomMap( gtk.DrawingArea):
def motion_notify_event_cb(self,widget,event):
self.textlayout.set_text( "Position: %03.0f,%03.0f pixel" % (event.x,event.y))
(w,h) = self.textlayout.get_pixel_size()
(w, h) = self.textlayout.get_pixel_size()
self.gc.set_foreground( self.get_colormap().alloc_color("white"))
self.window.draw_rectangle( self.gc, True, 10,50,w,h)
self.window.draw_rectangle( self.gc, True, 10,50,w, h)
self.gc.set_foreground( self.get_colormap().alloc_color("red"))
self.window.draw_layout( self.gc, 10, 50, self.textlayout)
(lon,lat) = self.screen_to_map(event.x,event.y)
self.textlayout.set_text( "Position: %03.0f,%03.0f degree" % (lon,lat))
(w,h) = self.textlayout.get_pixel_size()
(w, h) = self.textlayout.get_pixel_size()
self.gc.set_foreground( self.get_colormap().alloc_color("white"))
self.window.draw_rectangle( self.gc, True, 10,70,w,h)
self.window.draw_rectangle( self.gc, True, 10,70,w, h)
self.gc.set_foreground( self.get_colormap().alloc_color("red"))
self.window.draw_layout( self.gc, 10, 70, self.textlayout)
@ -643,7 +643,7 @@ class MapView(PageView.PageView):
def get_stock(self):
"""
Returns the name of the stock icon to use for the display.
Return the name of the stock icon to use for the display.
This assumes that this icon has already been registered with
GNOME as a stock icon.
"""
@ -812,7 +812,7 @@ class MapView(PageView.PageView):
db.connect('place-rebuild',self.rebuild_places)
db.connect('place-update',self.rebuild_places)
def rebuild_places(self,handle_list=None):
def rebuild_places(self, handle_list=None):
d = glob_loc_data
try:
d = d + self.get_xearth_markers()
@ -831,14 +831,14 @@ class MapView(PageView.PageView):
model.get_value(iter,2))
break
def zoom_in_cb(self,obj):
def zoom_in_cb(self, obj):
self.zoom_map.zoom_in()
def zoom_out_cb(self,obj):
def zoom_out_cb(self, obj):
self.zoom_map.zoom_out()
def zoom_100_cb(self,obj):
def zoom_100_cb(self, obj):
self.zoom_map.zoom_normal()
def zoom_fit_cb(self,obj):
def zoom_fit_cb(self, obj):
self.zoom_map.zoom_fit()

View File

@ -69,7 +69,7 @@ from DdTargets import DdTargets
#-------------------------------------------------------------------------
class MediaView(PageView.ListView):
"""
Provides the Media View interface on the GRAMPS main window. This allows
Provide the Media View interface on the GRAMPS main window. This allows
people to manage all media items in their database. This is very similar
to the other list based views, with the exeception that it also has a
thumbnail image at the top of the view that must be updated when the
@ -118,7 +118,7 @@ class MediaView(PageView.ListView):
def _set_dnd(self):
"""
Sets up drag-n-drop. The source and destionation are set by calling .target()
Set up drag-n-drop. The source and destionation are set by calling .target()
on the _DND_TYPE. Obviously, this means that there must be a _DND_TYPE
variable defined that points to an entry in DdTargets.
"""
@ -155,7 +155,7 @@ class MediaView(PageView.ListView):
def drag_info(self):
"""
Returns the type of DND targetst that this view will accept. For Media
Return the type of DND targetst that this view will accept. For Media
View, we will accept media objects.
"""
return DdTargets.MEDIAOBJ
@ -198,7 +198,7 @@ class MediaView(PageView.ListView):
def get_bookmarks(self):
"""
Returns the booksmarks associated with this view
Return the booksmarks associated with this view
"""
return self.dbstate.db.get_media_bookmarks()
@ -259,7 +259,7 @@ class MediaView(PageView.ListView):
def column_order(self):
"""
Gets the column order from the database
Get the column order from the database
"""
return self.dbstate.db.get_media_column_order()
@ -333,7 +333,7 @@ class MediaView(PageView.ListView):
def ui_definition(self):
"""
Returns the UIManager XML description of the menus
Return the UIManager XML description of the menus
"""
return '''<ui>
<menubar name="MenuBar">
@ -384,7 +384,7 @@ class MediaView(PageView.ListView):
def remove(self, obj):
"""
Removes the selected object from the database after getting
Remove the selected object from the database after getting
user verification.
"""
handle = self.first_selected()

View File

@ -102,13 +102,13 @@ class NoteView(PageView.ListView):
def get_bookmarks(self):
"""
Returns the bookmark object
Return the bookmark object
"""
return self.dbstate.db.get_note_bookmarks()
def drag_info(self):
"""
Indicates that the drag type is an EVENT
Indicate that the drag type is an EVENT
"""
return DdTargets.NOTE_LINK

View File

@ -506,7 +506,7 @@ class PedigreeView(PageView.PersonNavView):
def get_stock(self):
"""
Returns the name of the stock icon to use for the display.
Return the name of the stock icon to use for the display.
This assumes that this icon has already been registered with
GNOME as a stock icon.
"""
@ -630,7 +630,7 @@ class PedigreeView(PageView.PersonNavView):
self.bookmarks.redraw()
self.build_tree()
def goto_active_person(self,handle=None):
def goto_active_person(self, handle=None):
self.dirty = True
if handle:
self.rebuild_trees(handle)
@ -1083,12 +1083,12 @@ class PedigreeView(PageView.PersonNavView):
area.window.draw_line(gc, alloc.width/2, alloc.height/2, alloc.width/2,alloc.height-gap)
area.window.draw_line(gc, alloc.width/2, alloc.height-gap, alloc.width,alloc.height-gap)
def home(self,obj):
def home(self, obj):
defperson = self.dbstate.db.get_default_person()
if defperson:
self.dbstate.change_active_person(defperson)
def edit_person_cb(self,obj,person_handle):
def edit_person_cb(self, obj,person_handle):
person = self.dbstate.db.get_person_from_handle(person_handle)
if person:
try:
@ -1098,7 +1098,7 @@ class PedigreeView(PageView.PersonNavView):
return True
return False
def edit_family_cb(self,obj,family_handle):
def edit_family_cb(self, obj,family_handle):
family = self.dbstate.db.get_family_from_handle(family_handle)
if family:
try:
@ -1108,7 +1108,7 @@ class PedigreeView(PageView.PersonNavView):
return True
return False
def add_parents_cb(self,obj,person_handle, family_handle):
def add_parents_cb(self, obj,person_handle, family_handle):
if family_handle: # one parent already exists -> Edit current family
family = self.dbstate.db.get_family_from_handle(family_handle)
else: # no parents -> create new family
@ -1121,7 +1121,7 @@ class PedigreeView(PageView.PersonNavView):
except Errors.WindowActiveError:
pass
def copy_person_to_clipboard_cb(self,obj,person_handle):
def copy_person_to_clipboard_cb(self, obj,person_handle):
"""Renders the person data into some lines of text and puts that into the clipboard"""
person = self.dbstate.db.get_person_from_handle(person_handle)
if person:
@ -1130,7 +1130,7 @@ class PedigreeView(PageView.PersonNavView):
return True
return False
def copy_family_to_clipboard_cb(self,obj,family_handle):
def copy_family_to_clipboard_cb(self, obj,family_handle):
"""Renders the family data into some lines of text and puts that into the clipboard"""
family = self.dbstate.db.get_family_from_handle(family_handle)
if family:
@ -1139,41 +1139,41 @@ class PedigreeView(PageView.PersonNavView):
return True
return False
def on_show_option_menu_cb(self,obj,data=None):
def on_show_option_menu_cb(self, obj,data=None):
myMenu = gtk.Menu()
self.add_nav_portion_to_menu(myMenu)
self.add_settings_to_menu(myMenu)
myMenu.popup(None,None,None,0,0)
return(True);
def bg_button_press_cb(self,obj,event):
def bg_button_press_cb(self, obj,event):
if event.button != 1:
self.on_show_option_menu_cb(obj)
return True
return False
def person_button_press_cb(self,obj,event,person_handle):
def person_button_press_cb(self, obj,event,person_handle):
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
self.edit_person_cb( obj, person_handle)
elif event.button!=1:
self.build_full_nav_menu_cb(obj,event,person_handle)
return True
def relation_button_press_cb(self,obj,event,family_handle):
def relation_button_press_cb(self, obj,event,family_handle):
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
self.edit_family_cb( obj, family_handle)
elif event.button!=1:
self.build_relation_nav_menu_cb(obj,event,family_handle)
return True
def missing_parent_button_press_cb(self,obj,event,person_handle,family_handle):
def missing_parent_button_press_cb(self, obj,event,person_handle,family_handle):
if event.button==1 and event.type == gtk.gdk._2BUTTON_PRESS:
self.add_parents_cb(obj,person_handle,family_handle)
elif event.button!=1:
self.build_missing_parent_nav_menu_cb(obj,event,person_handle,family_handle)
return True
def on_show_child_menu(self,obj):
def on_show_child_menu(self, obj):
"""User clicked button to move to child of active person"""
if self.dbstate.active:
@ -1210,7 +1210,7 @@ class PedigreeView(PageView.PersonNavView):
return 1
return 0
def on_childmenu_changed(self,obj,person_handle):
def on_childmenu_changed(self, obj,person_handle):
"""Callback for the pulldown menu selection, changing to the person
attached with menu item."""
self.dbstate.change_active_handle(person_handle)
@ -1390,7 +1390,7 @@ class PedigreeView(PageView.PersonNavView):
entry = gtk.ImageMenuItem(_("%d generations") % n)
if self.force_size == n:
entry.set_image(current_size_image)
entry.connect("activate", self.change_force_size_cb,n)
entry.connect("activate", self.change_force_size_cb, n)
entry.show()
size_menu.append(entry)
@ -1398,7 +1398,7 @@ class PedigreeView(PageView.PersonNavView):
item.show()
menu.append(item)
def build_missing_parent_nav_menu_cb(self,obj,event,person_handle,family_handle):
def build_missing_parent_nav_menu_cb(self, obj,event,person_handle,family_handle):
menu = gtk.Menu()
menu.set_title(_('People Menu'))
@ -1413,7 +1413,7 @@ class PedigreeView(PageView.PersonNavView):
menu.popup(None,None,None,event.button,event.time)
return 1
def build_full_nav_menu_cb(self,obj,event,person_handle):
def build_full_nav_menu_cb(self, obj,event,person_handle):
"""
Builds the full menu (including Siblings, Spouses, Children,
and Parents) with navigation.
@ -1645,7 +1645,7 @@ class PedigreeView(PageView.PersonNavView):
menu.popup(None,None,None,event.button,event.time)
return 1
def build_relation_nav_menu_cb(self,obj,event,family_handle):
def build_relation_nav_menu_cb(self, obj,event,family_handle):
"""
Builds the menu for a parents-child relation line.
"""
@ -1686,7 +1686,7 @@ class PedigreeView(PageView.PersonNavView):
#-------------------------------------------------------------------------
def find_children(db,p):
"""
Returns the list of all children's IDs for a person.
Return the list of all children's IDs for a person.
"""
childlist = []
for family_handle in p.get_family_handle_list():
@ -1702,7 +1702,7 @@ def find_children(db,p):
#-------------------------------------------------------------------------
def find_parents(db,p):
"""
Returns the unique list of all parents' IDs for a person.
Return the unique list of all parents' IDs for a person.
"""
parentlist = []
for f in p.get_parent_family_handle_list():

View File

@ -82,7 +82,7 @@ class PersonView(PageView.PersonNavView):
def __init__(self, dbstate, uistate):
"""
Creates the new PersonView interface, with the current dbstate and uistate
Create the new PersonView interface, with the current dbstate and uistate
"""
PageView.PersonNavView.__init__(self, _('People'), dbstate, uistate)
@ -247,7 +247,7 @@ class PersonView(PageView.PersonNavView):
def get_stock(self):
"""
Returns the name of the stock icon to use for the display.
Return the name of the stock icon to use for the display.
This assumes that this icon has already been registered with
GNOME as a stock icon.
"""
@ -514,7 +514,7 @@ class PersonView(PageView.PersonNavView):
def build_tree(self, skip=[]):
"""
Creates a new PeopleModel instance. Essentially creates a complete
Create a new PeopleModel instance. Essentially creates a complete
rebuild of the data. We need to temporarily store the active person,
since it can change when rows are unselected when the model is set.
"""

View File

@ -221,7 +221,7 @@ class RelationshipView(PageView.PersonNavView):
def get_stock(self):
"""
Returns the name of the stock icon to use for the display.
Return the name of the stock icon to use for the display.
This assumes that this icon has already been registered with
GNOME as a stock icon.
"""
@ -1017,7 +1017,7 @@ class RelationshipView(PageView.PersonNavView):
return value
def check_collapsed(self, person, handle):
""" Returns true if collapsed. """
""" Return true if collapsed. """
return (handle in self.collapsed_items.get(person.handle, []))
def expand_collapse_press(self, obj, event, pair):
@ -1436,7 +1436,7 @@ class RelationshipView(PageView.PersonNavView):
#-------------------------------------------------------------------------
def has_children(db,p):
"""
Returns if a person has children.
Return if a person has children.
"""
for family_handle in p.get_family_handle_list():
family = db.get_family_from_handle(family_handle)

View File

@ -57,6 +57,6 @@ except:
def get_views():
"""
Returns a list of PageView instances, in order
Return a list of PageView instances, in order
"""
return DATA_VIEWS

View File

@ -109,7 +109,7 @@ class DateEdit:
def __init__(self, date_obj, text_obj, button_obj, uistate, track):
"""
Creates a connection between the date_obj, text_obj and the pixmap_obj.
Create a connection between the date_obj, text_obj and the pixmap_obj.
Assigns callbacks to parse and change date when the text
in text_obj is changed, and to invoke Date Editor when the LED
button_obj is pressed.

View File

@ -135,7 +135,7 @@ class DateDisplay:
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()
@ -313,7 +313,7 @@ class DateDisplayEn(DateDisplay):
def __init__(self, format=None):
"""
Creates a DateDisplay class that converts a Date object to a string
Create a DateDisplay class that converts a Date object to a string
of the desired format. The format value must correspond to the format
list value (DateDisplay.format[]).
"""
@ -322,7 +322,7 @@ class DateDisplayEn(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -82,7 +82,7 @@ def gregorian_valid(date_tuple):
#-------------------------------------------------------------------------
class DateParser:
"""
Converts a text string into a Date object. If the date cannot be
Convert a text string into a Date object. If the date cannot be
converted, the text string is assigned.
"""
@ -285,7 +285,7 @@ class DateParser:
def _get_int(self, val):
"""
Converts the string to an integer if the value is not None. If the
Convert the string to an integer if the value is not None. If the
value is None, a zero is returned
"""
if val == None:
@ -360,7 +360,7 @@ class DateParser:
def _parse_subdate(self, text, subparser=None):
"""
Converts only the date portion of a date.
Convert only the date portion of a date.
"""
if subparser == None:
subparser = self._parse_greg_julian

View File

@ -114,7 +114,7 @@ class DateDisplayCZ(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_de.py 9912 2008-01-22 09:17:46Z acraphae $
"""
German-specific classes for parsing and displaying dates.
@ -205,7 +205,7 @@ class DateDisplayDE(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_es.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Spanish-specific classes for parsing and displaying dates.
@ -129,7 +129,7 @@ class DateDisplayES(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_fi.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Finnish-specific classes for parsing and displaying dates.
@ -130,7 +130,7 @@ class DateDisplayFI(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
qual = date.get_quality()

View File

@ -290,7 +290,7 @@ class DateDisplayFR(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_lt.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Lithuanian-specific classes for parsing and displaying dates.
@ -120,7 +120,7 @@ class DateDisplayLT(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -49,7 +49,7 @@ from _DateHandler import register_datehandler
#-------------------------------------------------------------------------
class DateParserNb(DateParser):
"""
Converts a text string into a Date object, expecting a date
Convert a text string into a Date object, expecting a date
notation in the Norwegian language. If the date cannot be converted,
the text string is assigned.
"""
@ -130,7 +130,7 @@ class DateDisplayNb(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_nl.py 9912 2008-01-22 09:17:46Z acraphae $
# Written by Benny Malengier
# Last change 2005/12/05:
@ -209,7 +209,7 @@ class DateDisplayNL(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -224,7 +224,7 @@ class DateDisplayPL(DateDisplay):
def display(self,date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -128,7 +128,7 @@ class DateDisplayPT(DateDisplay):
def display(self,date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_ru.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Russian-specific classes for parsing and displaying dates.
@ -272,7 +272,7 @@ class DateDisplayRU(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -116,7 +116,7 @@ class DateDisplaySK(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_Date_sv.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Swedish-specific classes for parsing and displaying dates.
@ -49,7 +49,7 @@ from _DateHandler import register_datehandler
#-------------------------------------------------------------------------
class DateParserSv(DateParser):
"""
Converts a text string into a Date object, expecting a date
Convert a text string into a Date object, expecting a date
notation in the swedish language. If the date cannot be converted,
the text string is assigned.
"""
@ -135,7 +135,7 @@ class DateDisplaySv(DateDisplay):
def display(self, date):
"""
Returns a text string representing the date.
Return a text string representing the date.
"""
mod = date.get_modifier()
cal = date.get_calendar()

View File

@ -19,7 +19,7 @@
#
"""
Provides the management of databases. This includes opening, renaming,
Provide the management of databases. This includes opening, renaming,
creating, and deleting of databases.
"""
@ -266,7 +266,7 @@ class DbManager(CLIDbManager):
def __init__(self, dbstate, parent=None):
"""
Creates the top level window from the glade description, and extracts
Create the top level window from the glade description, and extracts
the GTK widgets that are needed.
"""
CLIDbManager.__init__(self, dbstate)
@ -481,7 +481,7 @@ class DbManager(CLIDbManager):
def existing_name(self, name, skippath=None):
"""
Returns true if a name is present in the model already.
Return true if a name is present in the model already.
If skippath given, the name of skippath is not considered
"""
iter = self.model.get_iter_first()
@ -559,7 +559,7 @@ class DbManager(CLIDbManager):
def __change_name(self, renderer_sel, path, new_text):
"""
Changes the name of the database. This is a callback from the
Change the name of the database. This is a callback from the
column, which has been marked as editable.
If the new string is empty, do nothing. Otherwise, renaming the
@ -657,7 +657,7 @@ class DbManager(CLIDbManager):
def __checkout_copy(self, parent_name, name, revision, db_path):
"""
Creates a new database, then extracts a revision from RCS and
Create a new database, then extracts a revision from RCS and
imports it into the db
"""
new_path, newname = self._create_new_db("%s : %s" % (parent_name, name))
@ -802,7 +802,7 @@ class DbManager(CLIDbManager):
def __start_cursor(self, msg):
"""
Sets the cursor to the busy state, and displays the associated
Set the cursor to the busy state, and displays the associated
message
"""
self.msg.set_label(msg)
@ -812,7 +812,7 @@ class DbManager(CLIDbManager):
def __end_cursor(self):
"""
Sets the cursor back to normal and clears the message
Set the cursor back to normal and clears the message
"""
self.top.window.set_cursor(None)
self.msg.set_label("")
@ -910,7 +910,7 @@ def find_next_db_dir():
def make_dbdir(dbdir):
"""
Creates the default database directory, as defined by dbdir
Create the default database directory, as defined by dbdir
"""
try:
if not os.path.isdir(dbdir):

View File

@ -19,7 +19,7 @@
#
"""
Provides the database state class
Provide the database state class
"""
from gen.db import GrampsDbBase
@ -28,7 +28,7 @@ import Config
class DbState(Callback):
"""
Provides a class to encapsulate the state of the database..
Provide a class to encapsulate the state of the database..
"""
__signals__ = {
@ -50,7 +50,7 @@ class DbState(Callback):
def change_active_person(self, person):
"""
Changes the active person and emits a signal to notify those who
Change the active person and emits a signal to notify those who
are interested.
"""
self.active = person
@ -62,13 +62,13 @@ class DbState(Callback):
def change_active_handle(self, handle):
"""
Changes the active person based on the person's handle
Change the active person based on the person's handle
"""
self.change_active_person(self.db.get_person_from_handle(handle))
def get_active_person(self):
"""
Gets the current active person. Creates a new instance to make sure that
Get the current active person. Creates a new instance to make sure that
the data is active.
"""
if self.active:
@ -84,7 +84,7 @@ class DbState(Callback):
def change_database_noclose(self, database):
"""
Changes the current database. and resets the configuration prefixes.
Change the current database. and resets the configuration prefixes.
"""
self.db = database
self.db.set_prefixes(
@ -119,6 +119,6 @@ class DbState(Callback):
def get_database(self):
"""
Gets a reference to the current database.
Get a reference to the current database.
"""
return self.db

View File

@ -48,7 +48,7 @@ import Config
#-------------------------------------------------------------------------
class NodeMap:
"""
Provides the Path to Iter mappings for a TreeView model. The implementation
Provide the Path to Iter mappings for a TreeView model. The implementation
provides a list of nodes and a dictionary of handles. The datalist provides
the path (index) to iter (handle) mapping, while the the indexmap provides
the handle to index mappings
@ -81,14 +81,14 @@ class NodeMap:
def get_path(self, handle):
"""
Returns the path from the passed handle. This is accomplished by
Return the path from the passed handle. This is accomplished by
indexing into the index_map to get the index (path)
"""
return self.index_map.get(handle)
def get_handle(self, path):
"""
Returns the handle from the path. The path is assumed to be an integer.
Return the handle from the path. The path is assumed to be an integer.
This is accomplished by indexing into the data_list
"""
return self.data_list[path]
@ -119,13 +119,13 @@ class NodeMap:
def __len__(self):
"""
Returns the number of entries in the map.
Return the number of entries in the map.
"""
return len(self.data_list)
def get_first_handle(self):
"""
Returns the first handle in the map.
Return the first handle in the map.
"""
return self.data_list[0]
@ -260,13 +260,13 @@ class BaseModel(gtk.GenericTreeModel):
self.displayed = 0
self.node_map.clear_map()
def add_row_by_handle(self,handle):
def add_row_by_handle(self, handle):
if not self.search or \
(self.search and self.search.match(handle, self.db)):
data = self.map(handle)
key = locale.strxfrm(self.sort_func(data))
self.sort_data.append((key,handle))
self.sort_data.append((key, handle))
self.sort_data.sort(reverse=self.reverse)
self.node_map.set_path_map([ x[1] for x in self.sort_data ])
@ -275,7 +275,7 @@ class BaseModel(gtk.GenericTreeModel):
node = self.get_iter(index)
self.row_inserted(index, node)
def delete_row_by_handle(self,handle):
def delete_row_by_handle(self, handle):
index = self.node_map.get_path(handle)
# remove from sort array
@ -289,10 +289,10 @@ class BaseModel(gtk.GenericTreeModel):
self.node_map.delete_by_index(index)
self.row_deleted(index)
def update_row_by_handle(self,handle):
def update_row_by_handle(self, handle):
index = self.node_map.get_path(handle)
node = self.get_iter(index)
self.row_changed(index,node)
self.row_changed(index, node)
def on_get_flags(self):
"""returns the GtkTreeModelFlags for this particular type of model"""
@ -330,7 +330,7 @@ class BaseModel(gtk.GenericTreeModel):
"""returns the next node at this level of the tree"""
return self.node_map.find_next_handle(node)
def on_iter_children(self,node):
def on_iter_children(self, node):
"""Return the first child of the node"""
if node == None and len(self.node_map):
return self.node_map.get_first_handle()
@ -342,12 +342,12 @@ class BaseModel(gtk.GenericTreeModel):
return len(self.node_map) > 0
return False
def on_iter_n_children(self,node):
def on_iter_n_children(self, node):
if node == None:
return len(self.node_map)
return 0
def on_iter_nth_child(self,node,n):
def on_iter_nth_child(self, node, n):
if node == None:
return self.node_map.get_handle(n)
return None

View File

@ -53,7 +53,7 @@ class NoteModel(BaseModel):
HANDLE_COL = 4
_MARKER_COL = 6
def __init__(self,db,scol=0,order=gtk.SORT_ASCENDING,search=None,
def __init__(self,db,scol=0, order=gtk.SORT_ASCENDING,search=None,
skip=set(), sort_map=None):
self.gen_cursor = db.get_note_cursor
self.map = db.get_raw_note_data

View File

@ -378,7 +378,7 @@ class PeopleModel(gtk.GenericTreeModel):
def calculate_data(self, dfilter=None, skip=[]):
"""
Calculates the new path to node values for the model.
Calculate the new path to node values for the model.
"""
self.in_build = True
self.lru_data = LRU(_CACHE_SIZE)
@ -532,7 +532,7 @@ class PeopleModel(gtk.GenericTreeModel):
try:
value = self.lru_bdate[node]
except:
value = self._get_birth_data(data,node)
value = self._get_birth_data(data, node)
if not self.in_build:
self.lru_bdate[node] = value
return value
@ -568,7 +568,7 @@ class PeopleModel(gtk.GenericTreeModel):
try:
value = self.lru_ddate[node]
except:
value = self._get_death_data(data,node)
value = self._get_death_data(data, node)
if not self.in_build:
self.lru_ddate[node] = value
return value

View File

@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_PlaceModel.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -54,7 +54,7 @@ class PlaceModel(BaseModel):
HANDLE_COL = 12
def __init__(self,db,scol=0,order=gtk.SORT_ASCENDING,search=None,
def __init__(self,db,scol=0, order=gtk.SORT_ASCENDING,search=None,
skip=set(), sort_map=None):
self.gen_cursor = db.get_place_cursor
self.map = db.get_raw_place_data

View File

@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_SourceModel.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -52,7 +52,7 @@ from _BaseModel import BaseModel
#-------------------------------------------------------------------------
class SourceModel(BaseModel):
def __init__(self,db,scol=0,order=gtk.SORT_ASCENDING,search=None,
def __init__(self,db,scol=0, order=gtk.SORT_ASCENDING,search=None,
skip=set(), sort_map=None):
self.map = db.get_raw_source_data
self.gen_cursor = db.get_source_cursor
@ -74,7 +74,7 @@ class SourceModel(BaseModel):
self.column_pubinfo,
self.sort_change,
]
BaseModel.__init__(self,db,scol,order,tooltip_column=7,search=search,
BaseModel.__init__(self,db,scol, order,tooltip_column=7,search=search,
skip=skip, sort_map=sort_map)
def on_get_n_columns(self):

View File

@ -90,7 +90,7 @@ class History(gen.utils.Callback):
def remove(self, handle, old_id=None):
"""
Removes a handle from the history list
Remove a handle from the history list
"""
if old_id:
del_id = old_id

View File

@ -71,19 +71,19 @@ class AddrEmbedList(EmbeddedList):
def get_icon_name(self):
"""
Returns the stock-id icon name associated with the display tab
Return the stock-id icon name associated with the display tab
"""
return 'gramps-address'
def get_data(self):
"""
Returns the data associated with display tab
Return the data associated with display tab
"""
return self.data
def column_order(self):
"""
Returns the column order of the columns in the display tab.
Return the column order of the columns in the display tab.
"""
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4))

View File

@ -82,7 +82,7 @@ class BackRefList(EmbeddedList):
def create_buttons(self, share=False, move=False, jump=False):
"""
Creates a button box consisting of one button: Edit.
Create a button box consisting of one button: Edit.
This button box is then appended hbox (self).
Method has signature of, and overrides create_buttons from _ButtonTab.py
"""

View File

@ -102,7 +102,7 @@ class ButtonTab(GrampsTab):
def create_buttons(self, share_button, move_buttons, jump_button):
"""
Creates a button box consisting of three buttons, one for Add,
Create a button box consisting of three buttons, one for Add,
one for Edit, and one for Delete. This button box is then appended
hbox (self).
"""

View File

@ -63,7 +63,7 @@ class DataEmbedList(EmbeddedList):
# and connect renderers to the 'edited' signal
for colno in range(len(self.columns)):
for renderer in self.columns[colno].get_cell_renderers():
renderer.set_property('editable',not self.dbstate.db.readonly)
renderer.set_property('editable', not self.dbstate.db.readonly)
renderer.connect('edited',self.edit_inline,colno)
def get_data(self):
@ -100,18 +100,18 @@ class DataEmbedList(EmbeddedList):
start_editing=True)
def del_button_clicked(self, obj):
(model,node) = self.selection.get_selected()
(model, node) = self.selection.get_selected()
if node:
self.model.remove(node)
self.update()
def edit_inline(self, cell, path, new_text, data):
node = self.model.get_iter(path)
self.model.set_value(node,data,new_text)
self.model.set_value(node,data, new_text)
self.update()
def edit_button_clicked(self, obj):
(model,node) = self.selection.get_selected()
(model, node) = self.selection.get_selected()
if node:
path = self.model.get_path(node)
self.tree.set_cursor_on_cell(path,

View File

@ -62,7 +62,7 @@ class EmbeddedList(ButtonTab):
def __init__(self, dbstate, uistate, track, name, build_model,
share=False, move=False, jump=False):
"""
Creates a new list, using the passed build_model to
Create a new list, using the passed build_model to
populate the list.
"""
ButtonTab.__init__(self, dbstate, uistate, track, name, share, move, jump)
@ -163,7 +163,7 @@ class EmbeddedList(ButtonTab):
def _set_dnd(self):
"""
Sets up drag-n-drop. The source and destionation are set by calling .target()
Set up drag-n-drop. The source and destionation are set by calling .target()
on the _DND_TYPE. Obviously, this means that there must be a _DND_TYPE
variable defined that points to an entry in DdTargets.
"""
@ -364,14 +364,14 @@ class EmbeddedList(ButtonTab):
def is_empty(self):
"""
Returns True if the get_data returns a length greater than
Return True if the get_data returns a length greater than
0. Typically, get_data returns the list of associated data.
"""
return len(self.get_data()) == 0
def get_data(self):
"""
Returns the data associated with the list. This is typically
Return the data associated with the list. This is typically
a list of objects.
This should be overridden in the derrived classes.

View File

@ -340,7 +340,7 @@ class GalleryTab(ButtonTab):
def _set_dnd(self):
"""
Sets up drag-n-drop. The source and destionation are set by calling .target()
Set up drag-n-drop. The source and destionation are set by calling .target()
on the _DND_TYPE. Obviously, this means that there must be a _DND_TYPE
variable defined that points to an entry in DdTargets.
"""
@ -464,7 +464,7 @@ class GalleryTab(ButtonTab):
# import urllib
# u = urllib.URLopener()
# try:
# tfile,headers = u.retrieve(d)
# tfile, headers = u.retrieve(d)
# except (IOError,OSError), msg:
# t = _("Could not import %s") % d
# ErrorDialog(t,str(msg))

View File

@ -88,7 +88,7 @@ class GrampsTab(gtk.HBox):
def is_empty(self):
"""
Indicates if the tab contains any data. This is used to determine
Indicate if the tab contains any data. This is used to determine
how the label should be displayed.
"""
return True
@ -124,7 +124,7 @@ class GrampsTab(gtk.HBox):
def get_icon_name(self):
"""
Provides the name of the registered stock icon to be used as the
Provide the name of the registered stock icon to be used as the
icon in the label. This is typically overridden by the derrived
class to provide the new name.
@returns: stock icon name
@ -134,7 +134,7 @@ class GrampsTab(gtk.HBox):
def get_tab_widget(self):
"""
Provides the widget to be used for the notebook tab label. A
Provide the widget to be used for the notebook tab label. A
container class is provided, and the object may manipulate the
child widgets contained in the container.
@returns: gtk widget

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_PersonRefModel.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -49,5 +49,5 @@ class PersonRefModel(gtk.ListStore):
if p:
data = [name_displayer.display(p), p.gramps_id, obj.rel, obj]
else:
data = ['unknown','unknown',obj.rel,obj]
data = ['unknown','unknown', obj.rel, obj]
self.append(row=data)

View File

@ -21,7 +21,7 @@
# $Id$
"""
Provides the interface to allow a person to add a media object to the database.
Provide the interface to allow a person to add a media object to the database.
"""
#-------------------------------------------------------------------------
@ -80,7 +80,7 @@ class AddMediaObject(ManagedWindow.ManagedWindow):
def __init__(self, dbstate, uistate, track, mediaobj, callback=None):
"""
Creates and displays the dialog box
Create and displays the dialog box
db - the database in which the new object is to be stored
The mediaobject is updated with the information, and on save, the

View File

@ -124,7 +124,7 @@ class EditAddress(EditSecondary):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
@ -144,7 +144,7 @@ class EditAddress(EditSecondary):
notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True)
def build_menu_names(self,obj):
def build_menu_names(self, obj):
return (_('Address'),_('Address Editor'))
def save(self,*obj):

View File

@ -128,7 +128,7 @@ class EditChildRef(EditSecondary):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
notebook = gtk.Notebook()
@ -150,10 +150,10 @@ class EditChildRef(EditSecondary):
def _post_init(self):
self.ok_button.grab_focus()
def build_menu_names(self,obj):
def build_menu_names(self, obj):
return (_('Child Reference'),_('Child Reference Editor'))
def edit_child(self,obj,event):
def edit_child(self, obj,event):
if button_activated(event, _LEFT_BUTTON):
from _EditPerson import EditPerson
handle = self.obj.ref

View File

@ -149,7 +149,7 @@ class EditEvent(EditPrimary):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
notebook = gtk.Notebook()

View File

@ -165,7 +165,7 @@ class EditEventRef(EditReference):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
@ -223,7 +223,7 @@ class EditEventRef(EditReference):
submenu_label = _('New Event')
return (_('Event Reference Editor'),submenu_label)
def ok_clicked(self,obj):
def ok_clicked(self, obj):
trans = self.db.transaction_begin()
if self.source.handle:

View File

@ -367,7 +367,7 @@ class EditMediaRef(EditReference):
def build_menu_names(self, person):
"""
Provides the information needed by the base class to define the
Provide the information needed by the base class to define the
window management menu entries.
"""
if self.source:
@ -403,7 +403,7 @@ class EditMediaRef(EditReference):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
notebook_ref = self.top.get_widget('notebook_ref')

View File

@ -157,7 +157,7 @@ class EditName(EditSecondary):
else :
self.group_as.force_value(self.obj.get_surname())
format_list = [(name,number) for (number,name,fmt_str,act)
format_list = [(name, number) for (number, name,fmt_str,act)
in name_displayer.get_name_format(also_default=True)]
self.sort_as = MonitoredMenu(
@ -268,16 +268,16 @@ class EditName(EditSecondary):
self.global_group_set = True
def build_menu_names(self,name):
def build_menu_names(self, name):
if name:
ntext = name_displayer.display_name(name)
submenu_label = '%s: %s' % (_('Name'),ntext)
submenu_label = '%s: %s' % (_('Name'), ntext)
else:
submenu_label = _('New Name')
menu_label = _('Name Editor')
return (menu_label,submenu_label)
def update_group_as(self,obj):
def update_group_as(self, obj):
"""Callback if surname changes on GUI
If overwrite is not set, we change the group name too
"""
@ -302,7 +302,7 @@ class EditName(EditSecondary):
self.group_over.set_active(False)
self.group_as.enable(False)
def on_group_over_toggled(self,obj):
def on_group_over_toggled(self, obj):
""" group over changes, if activated, enable edit,
if unactivated, go back to surname.
"""

View File

@ -249,7 +249,7 @@ class EditNote(EditPrimary):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
notebook = self.top.get_widget("note_notebook")
@ -355,7 +355,7 @@ class EditNote(EditPrimary):
def build_menu_names(self, person):
"""
Provides the information needed by the base class to define the
Provide the information needed by the base class to define the
window management menu entries.
"""
return (_('Edit Note'), self.get_menu_title())

View File

@ -21,7 +21,7 @@
# $Id$
"""
EditPerson Dialog. Provides the interface to allow the GRAMPS program
EditPerson Dialog. Provide the interface to allow the GRAMPS program
to edit information about a particular Person.
"""

View File

@ -118,7 +118,7 @@ class EditPersonRef(EditSecondary):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
@ -138,7 +138,7 @@ class EditPersonRef(EditSecondary):
notebook.show_all()
self.top.get_widget('vbox').pack_start(notebook,True)
def build_menu_names(self,obj):
def build_menu_names(self, obj):
return (_('Person Reference'),_('Person Reference Editor'))
def save(self,*obj):

View File

@ -211,7 +211,7 @@ class EditPlace(EditPrimary):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""

View File

@ -162,7 +162,7 @@ class EditReference(ManagedWindow.ManagedWindow):
if notebook.get_current_page() != page_no:
notebook.set_current_page(page_no)
def _add_tab(self,notebook,page):
def _add_tab(self, notebook,page):
notebook.insert_page(page, page.get_tab_widget())
page.add_db_signal_callback(self._add_db_signal)
page.label.set_use_underline(True)

View File

@ -138,7 +138,7 @@ class EditRepoRef(EditReference):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
@ -187,7 +187,7 @@ class EditRepoRef(EditReference):
submenu_label = _('New Repository')
return (_('Repo Reference Editor'),submenu_label)
def ok_clicked(self,obj):
def ok_clicked(self, obj):
trans = self.db.transaction_begin()
if self.source.handle:

View File

@ -30,7 +30,7 @@ class EditSecondary(ManagedWindow.ManagedWindow):
HEIGHT_KEY = None
def __init__(self, state, uistate, track, obj, callback=None):
"""Creates an edit window. Associates a person with the window."""
"""Create an edit window. Associates a person with the window."""
self.obj = obj
self.dbstate = state
@ -80,7 +80,7 @@ class EditSecondary(ManagedWindow.ManagedWindow):
def _create_tabbed_pages(self):
pass
def build_window_key(self,obj):
def build_window_key(self, obj):
return id(obj)
def _setup_notebook_tabs(self, notebook):
@ -108,7 +108,7 @@ class EditSecondary(ManagedWindow.ManagedWindow):
if notebook.get_current_page() != page_no:
notebook.set_current_page(page_no)
def _add_tab(self,notebook,page):
def _add_tab(self, notebook,page):
notebook.insert_page(page, page.get_tab_widget())
page.add_db_signal_callback(self._add_db_signal)
page.label.set_use_underline(True)

View File

@ -143,7 +143,7 @@ class EditSourceRef(EditReference):
def _create_tabbed_pages(self):
"""
Creates the notebook tabs and inserts them into the main
Create the notebook tabs and inserts them into the main
window.
"""
notebook_src = self.top.get_widget('notebook_src')
@ -197,7 +197,7 @@ class EditSourceRef(EditReference):
submenu_label = _('New Source')
return (_('Source Reference Editor'),submenu_label)
def ok_clicked(self,obj):
def ok_clicked(self, obj):
trans = self.db.transaction_begin()
if self.source.handle:

View File

@ -94,7 +94,7 @@ class EditUrl(EditSecondary):
self.obj.set_type,
self.obj.get_type, self.db.readonly)
def build_menu_names(self,obj):
def build_menu_names(self, obj):
etitle =_('Internet Address Editor')
return (etitle, etitle)

View File

@ -157,7 +157,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
if isinstance(arg, gtk.Button) and arg.get_label() == 'gtk-go-forward':
self.forward_button = arg
def build_menu_names(self,obj):
def build_menu_names(self, obj):
"""Override ManagedWindow method."""
return (self.top_title, None)
@ -570,7 +570,7 @@ class ExportAssistant(gtk.Assistant, ManagedWindow.ManagedWindow) :
"""
filename = unicode(self.chooser.get_filename(),
sys.getfilesystemencoding())
Config.set(Config.RECENT_EXPORT_DIR,os.path.split(filename)[0])
Config.set(Config.RECENT_EXPORT_DIR, os.path.split(filename)[0])
ix = self.get_selected_format_index()
Config.set(Config.RECENT_EXPORT_TYPE, ix)
if self.exportformats[ix][3]:

View File

@ -116,14 +116,14 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.show()
def on_help_clicked(self,obj):
def on_help_clicked(self, obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('tools-util-cfe')
def close_window(self,obj):
def close_window(self, obj):
self.close()
def filter_name_changed(self,obj):
def filter_name_changed(self, obj):
name = unicode(self.fname.get_text())
# Make sure that the name is not empty
# and not in the list of existing filters (excluding this one)
@ -132,8 +132,8 @@ class EditFilter(ManagedWindow.ManagedWindow):
if filt != self.filter]
self.ok_btn.set_sensitive((len(name) != 0) and (name not in names))
def select_row(self,obj):
store,node = self.rlist.get_selected()
def select_row(self, obj):
store, node = self.rlist.get_selected()
if node:
self.edit_btn.set_sensitive(True)
self.del_btn.set_sensitive(True)
@ -146,13 +146,13 @@ class EditFilter(ManagedWindow.ManagedWindow):
for r in self.filter.get_rules():
self.rlist.add([r.name,r.display_values()],r)
def on_ok_clicked(self,obj):
def on_ok_clicked(self, obj):
n = unicode(self.fname.get_text()).strip()
if n == '':
return
if n != self.filter.get_name():
self.uistate.emit('filter-name-changed',
(self.namespace,unicode(self.filter.get_name()),n))
(self.namespace,unicode(self.filter.get_name()), n))
self.filter.set_name(n)
self.filter.set_comment(unicode(self.comment.get_text()).strip())
for f in self.filterdb.get_filters(self.namespace)[:]:
@ -172,7 +172,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.update()
self.close()
def on_add_clicked(self,obj):
def on_add_clicked(self, obj):
from _EditRule import EditRule
try:
@ -182,7 +182,7 @@ class EditFilter(ManagedWindow.ManagedWindow):
except Errors.WindowActiveError:
pass
def on_edit_clicked(self,obj):
def on_edit_clicked(self, obj):
store, node = self.rlist.get_selected()
if node:
from _EditRule import EditRule
@ -202,8 +202,8 @@ class EditFilter(ManagedWindow.ManagedWindow):
self.filter.add_rule(new_rule)
self.draw_rules()
def on_delete_clicked(self,obj):
store,node = self.rlist.get_selected()
def on_delete_clicked(self, obj):
store, node = self.rlist.get_selected()
if node:
gfilter = self.rlist.get_object(node)
self.filter.delete_rule(gfilter)

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_HasMedia.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -61,14 +61,14 @@ class HasMedia(Rule):
except:
pass
def apply(self,db,obj):
if not self.match_substring(0,obj.get_description()):
def apply(self,db, obj):
if not self.match_substring(0, obj.get_description()):
return False
if not self.match_substring(1,obj.get_mime_type()):
if not self.match_substring(1, obj.get_mime_type()):
return False
if not self.match_substring(2,obj.get_path()):
if not self.match_substring(2, obj.get_path()):
return False
if self.date:

View File

@ -51,8 +51,8 @@ class HasNote(Rule):
description = _("Matches Notes with particular parameters")
category = _('General filters')
def apply(self,db,note):
if not self.match_substring(0,note.get()):
def apply(self,db, note):
if not self.match_substring(0, note.get()):
return False
if self.list[1]:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_HasCommonAncestorWith.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -65,7 +65,7 @@ class HasCommonAncestorWith(Rule):
try:
handle = db.get_person_from_gramps_id(self.list[0]).get_handle()
if handle:
def init(self,handle): self.ancestor_cache[handle] = 1
def init(self, handle): self.ancestor_cache[handle] = 1
for_each_ancestor(db,[handle],init,self)
except:
pass
@ -79,5 +79,5 @@ class HasCommonAncestorWith(Rule):
handle = person.handle
return for_each_ancestor(
db,[handle],
lambda self,handle: self.ancestor_cache.has_key(handle),
lambda self, handle: self.ancestor_cache.has_key(handle),
self);

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_HasCommonAncestorWithFilterMatch.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -58,7 +58,7 @@ class HasCommonAncestorWithFilterMatch(HasCommonAncestorWith,MatchesFilter):
def init_ancestor_cache(self,db):
filt = MatchesFilter(self.list)
filt.prepare(db)
def init(self,h): self.ancestor_cache[h] = 1
def init(self, h): self.ancestor_cache[h] = 1
for handle in db.get_person_handles(sort_handles=False):
if (not self.ancestor_cache.has_key (handle)
and filt.apply (db, db.get_person_from_handle(handle))):

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_HasTextMatchingSubstringOf.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -191,7 +191,7 @@ class HasTextMatchingSubstringOf(Rule):
for handle in repo_list:
self.media_map[handle] = 1
def match_object(self,obj):
def match_object(self, obj):
if not obj:
return False
if self.regexp_match:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_IsLessThanNthGenerationAncestorOf.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -64,7 +64,7 @@ class IsLessThanNthGenerationAncestorOf(Rule):
def apply(self,db,person):
return self.map.has_key(person.handle)
def init_ancestor_list(self,handle,gen):
def init_ancestor_list(self, handle,gen):
# if self.map.has_key(p.get_handle()) == 1:
# loop_error(self.orig,p)
if not handle:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_IsLessThanNthGenerationAncestorOfBookmarked.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -69,7 +69,7 @@ class IsLessThanNthGenerationAncestorOfBookmarked(Rule):
self.init_ancestor_list(self.bookmarkhandle, 1)
def init_ancestor_list(self,handle,gen):
def init_ancestor_list(self, handle,gen):
# if self.map.has_key(p.get_handle()) == 1:
# loop_error(self.orig,p)
if not handle:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_IsLessThanNthGenerationAncestorOfDefaultPerson.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -62,7 +62,7 @@ class IsLessThanNthGenerationAncestorOfDefaultPerson(Rule):
else:
self.apply = lambda db,p: False
def init_ancestor_list(self,handle,gen):
def init_ancestor_list(self, handle,gen):
# if self.map.has_key(p.get_handle()) == 1:
# loop_error(self.orig,p)
if not handle:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_IsMoreThanNthGenerationAncestorOf.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -64,7 +64,7 @@ class IsMoreThanNthGenerationAncestorOf(Rule):
def apply(self,db,person):
return self.map.has_key(person.handle)
def init_ancestor_list(self,handle,gen):
def init_ancestor_list(self, handle,gen):
# if self.map.has_key(p.get_handle()) == 1:
# loop_error(self.orig,p)
if not handle:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_RelationshipPathBetween.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -75,7 +75,7 @@ class RelationshipPathBetween(Rule):
if child_ref.ref:
self.desc_list(child_ref.ref,map,0)
def apply_filter(self,rank,handle,plist,pmap):
def apply_filter(self,rank, handle,plist,pmap):
person = self.db.get_person_from_handle(handle)
if person == None:
return
@ -116,9 +116,9 @@ class RelationshipPathBetween(Rule):
for person_handle in common:
new_map = {}
self.desc_list(person_handle,new_map,1)
self.get_intersection(path1,firstMap,new_map)
self.get_intersection(path2,secondMap,new_map)
self.desc_list(person_handle, new_map,1)
self.get_intersection(path1,firstMap, new_map)
self.get_intersection(path2,secondMap, new_map)
for e in path1:
self.map[e] = 1

View File

@ -73,7 +73,7 @@ class RelationshipPathBetweenBookmarks(Rule):
#
# Returns a name, given a handle.
def hnm(self,handle):
def hnm(self, handle):
try:
person = self.db.get_person_from_handle(handle)
except:
@ -115,7 +115,7 @@ class RelationshipPathBetweenBookmarks(Rule):
#
# Given two handles for individuals, a list of all individuals
# in the relationship path between the two.
def rel_path_for_two(self,handle1,handle2):
def rel_path_for_two(self, handle1, handle2):
#print "rel_path_for_two (", handle1, self.hnm(handle1), ",", handle2, self.hnm(handle2), ")"
rel_path = {} # Result map
gmap1 = { handle1 : [ handle1 ] } # Key is ancestor, value is the path
@ -165,7 +165,7 @@ class RelationshipPathBetweenBookmarks(Rule):
for j in range(i+1, nb+1):
handle2 = bmarks[j]
try:
pathmap = self.rel_path_for_two(handle1,handle2)
pathmap = self.rel_path_for_two(handle1, handle2)
for handle in pathmap:
self.map[handle] = 1
except:

View File

@ -82,11 +82,11 @@ class MatchesFilterBase(Rule):
if Filters.SystemFilters:
for filt in Filters.SystemFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
return filt.check(db,obj.handle)
return filt.check(db, obj.handle)
if Filters.CustomFilters:
for filt in Filters.CustomFilters.get_filters(self.namespace):
if filt.get_name() == self.list[0]:
return filt.check(db,obj.handle)
return filt.check(db, obj.handle)
return False
def find_filter(self):

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_EventSidebarFilter.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -145,7 +145,7 @@ class EventSidebarFilter(SidebarFilter):
return generic_filter
def on_filters_changed(self,name_space):
def on_filters_changed(self, name_space):
if name_space == 'Event':
all_filter = GenericEventFilter()
all_filter.set_name(_("None"))

View File

@ -19,7 +19,7 @@
#
"""
Provides a rough estimate of the width of a text string.
Provide a rough estimate of the width of a text string.
"""
SWISS = [

View File

@ -90,7 +90,7 @@ def backup(database):
def __mk_backup_name(database, base):
"""
Returns the backup name of the database table
Return the backup name of the database table
@param database: database instance
@type database: GrampsDbDir
@ -101,7 +101,7 @@ def __mk_backup_name(database, base):
def __mk_tmp_name(database, base):
"""
Returns the temporary backup name of the database table
Return the temporary backup name of the database table
@param database: database instance
@type database: GrampsDbDir
@ -177,7 +177,7 @@ def __do_restore(database):
def __load_tbl_no_txn(backup_table, tbl):
"""
Returns the temporary backup name of the database table
Return the temporary backup name of the database table
@param backup_table: file containing the backup data
@type backup_table: file
@ -194,7 +194,7 @@ def __load_tbl_no_txn(backup_table, tbl):
def __load_tbl_txn(database, backup_table, tbl):
"""
Returns the temporary backup name of the database table
Return the temporary backup name of the database table
@param database: database instance
@type database: GrampsDbDir

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_GedcomInfo.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@ -157,7 +157,7 @@ lds_status = {
from xml.parsers.expat import ParserCreate
class GedcomDescription:
def __init__(self,name):
def __init__(self, name):
self.name = name
self.dest = ""
self.adopt = ADOPT_STD
@ -263,15 +263,15 @@ class GedcomInfoDB:
parser.parse(f)
f.close()
def add_description(self,name,obj):
def add_description(self, name, obj):
self.map[name] = obj
def get_description(self,name):
def get_description(self, name):
if self.map.has_key(name):
return self.map[name]
return self.standard
def get_from_source_tag(self,name):
def get_from_source_tag(self, name):
for k in self.map.keys():
val = self.map[k]
if val.get_dest() == name:

View File

@ -73,7 +73,7 @@ The function parsing the individual at level 1, would encounter the BIRT tag.
It would look up the BIRT token in the table to see if a function as defined
for this TOKEN, and pass control to this function. This function would then
start parsing level 2. It would encounter the DATE tag, look up the
corresponding function the in level 2 table, and pass control to its
corresponding function in the level 2 table, and pass control to its
associated function. This function would terminate, and return control back to
the level 2 parser, which would then encounter the "UKNOWN" tag. Since this is
not a valid token, it would not be in the table, and a function that would skip
@ -229,9 +229,11 @@ PERSON_RE = re.compile(r"\s*\d+\s+\@(\S+)\@\s+INDI(.*)$")
#-------------------------------------------------------------------------
def find_from_handle(gramps_id, table):
"""
Finds a handle corresponding the the specified GRAMPS ID. The passed
table contains the mapping. If the value is found, we return it,
otherwise we create a new handle, store it, and return it.
Find a handle corresponding to the specified GRAMPS ID.
The passed table contains the mapping. If the value is found, we return
it, otherwise we create a new handle, store it, and return it.
"""
intid = table.get(gramps_id)
if not intid:
@ -836,25 +838,25 @@ class GedcomParser(UpdateCallback):
def __find_person_handle(self, gramps_id):
"""
Returns the database handle associated with the person's GRAMPS ID
Return the database handle associated with the person's GRAMPS ID
"""
return find_from_handle(gramps_id, self.gid2id)
def __find_family_handle(self, gramps_id):
"""
Returns the database handle associated with the family's GRAMPS ID
Return the database handle associated with the family's GRAMPS ID
"""
return find_from_handle(gramps_id, self.fid2id)
def __find_object_handle(self, gramps_id):
"""
Returns the database handle associated with the media object's GRAMPS ID
Return the database handle associated with the media object's GRAMPS ID
"""
return find_from_handle(gramps_id, self.oid2id)
def __find_note_handle(self, gramps_id):
"""
Returns the database handle associated with the media object's GRAMPS ID
Return the database handle associated with the media object's GRAMPS ID
"""
return find_from_handle(gramps_id, self.nid2id)
@ -908,9 +910,11 @@ class GedcomParser(UpdateCallback):
def __find_or_create_source(self, gramps_id):
"""
Finds or creates a source based on the GRAMPS ID. If the ID is
already used (is in the db), we return the item in the db. Otherwise,
we create a new source, assign the handle and GRAMPS ID.
Find or create a source based on the GRAMPS ID.
If the ID is already used (is in the db), we return the item in the
db. Otherwise, we create a new source, assign the handle and GRAMPS ID.
"""
obj = gen.lib.Source()
intid = self.sid2id.get(gramps_id)
@ -1057,7 +1061,7 @@ class GedcomParser(UpdateCallback):
def __get_next_line(self):
"""
Gets the next line for analysis from the lexical analyzer. Return the
Get the next line for analysis from the lexical analyzer. Return the
same value if the _backup flag is set.
"""
if not self.backoff:
@ -1097,7 +1101,7 @@ class GedcomParser(UpdateCallback):
def _backup(self):
"""
Sets the _backup flag so that the current line can be accessed by the
Set the _backup flag so that the current line can be accessed by the
next level up.
"""
self.backoff = True
@ -1134,7 +1138,7 @@ class GedcomParser(UpdateCallback):
def __parse_record(self):
"""
Parses the top level (0 level) instances.
Parse the top level (0 level) instances.
"""
while True:
line = self.__get_next_line()
@ -1178,9 +1182,12 @@ class GedcomParser(UpdateCallback):
def __parse_level(self, state, __map, default):
"""
Loops trough the current GEDCOM level level, calling the appropriate
functions associated with the TOKEN. If no matching function for the
token is found, the default function is called instead.
Loop trough the current GEDCOM level, calling the appropriate
functions associated with the TOKEN.
If no matching function for the token is found, the default function
is called instead.
"""
while True:
line = self.__get_next_line()
@ -1854,7 +1861,7 @@ class GedcomParser(UpdateCallback):
def __person_resi_date(self, line, state):
"""
Sets the date on the address associated with and Address.
Set the date on the address associated with and Address.
@param line: The current line in GedLine format
@type line: GedLine
@ -4188,21 +4195,25 @@ class GedcomParser(UpdateCallback):
self.__skip_subordinate_levels(level)
def __parse_source_reference(self, src_ref, level, handle):
"""Reads the data associated with a SOUR reference"""
"""
Read the data associated with a SOUR reference.
"""
state = GedcomUtils.CurrentState(level=level+1)
state.src_ref = src_ref
state.handle = handle
self.__parse_level(state, self.srcref_parse_tbl, self.__ignore)
def __parse_header_head(self):
"""validiates that this is a valid GEDCOM file"""
"""
Validate that this is a valid GEDCOM file.
"""
line = self.__get_next_line()
if line.token != TOKEN_HEAD:
raise Errors.GedcomError("%s is not a GEDCOM file" % self.filename)
def __skip_subordinate_levels(self, level):
"""
Skips add lines of the specified level or lower.
Skip add lines of the specified level or lower.
"""
while True:
line = self.__get_next_line()
@ -4211,7 +4222,7 @@ class GedcomParser(UpdateCallback):
def handle_source(self, line, level):
"""
Handles the specified source, building a source reference to
Handle the specified source, building a source reference to
the object.
"""
source_ref = gen.lib.SourceRef()
@ -4393,7 +4404,7 @@ class GedcomParser(UpdateCallback):
def __add_default_source(self, obj):
"""
Adds the default source to the object.
Add the default source to the object.
"""
if self.use_def_src and len(obj.get_source_references()) == 0:
sref = gen.lib.SourceRef()

View File

@ -64,7 +64,7 @@ EMPTY_GED = _("Your GEDCOM file is empty.")
#-------------------------------------------------------------------------
def is_xref_value(value):
"""
Returns True if value is in the form of a XREF value. We assume that
Return True if value is in the form of a XREF value. We assume that
if we have a leading '@' character, then we are okay.
"""
return value and value[0] == '@'
@ -76,7 +76,7 @@ def is_xref_value(value):
#-------------------------------------------------------------------------
def add_to_list(table, key, value):
"""
Adds the value to the table entry associated with key. If the entry
Add the value to the table entry associated with key. If the entry
does not exist, it is added.
"""
if table.has_key(key):
@ -170,19 +170,19 @@ class StageOne:
def get_famc_map(self):
"""
Returns the Person to Child Family map
Return the Person to Child Family map
"""
return self.famc
def get_fams_map(self):
"""
Returns the Person to Family map (where the person is a spouse)
Return the Person to Family map (where the person is a spouse)
"""
return self.fams
def get_encoding(self):
"""
Returns the detected encoding
Return the detected encoding
"""
return self.enc.upper()
@ -195,12 +195,12 @@ class StageOne:
def get_person_count(self):
"""
Returns the number of INDI records found
Return the number of INDI records found
"""
return self.pcnt
def get_line_count(self):
"""
Returns the number of lines in the file
Return the number of lines in the file
"""
return self.lcnt

View File

@ -50,13 +50,13 @@ class CurrentState:
def __getattr__(self, name):
"""
Returns the value associated with the specified attribute.
Return the value associated with the specified attribute.
"""
return self.__dict__.get(name)
def __setattr__(self, name, value):
"""
Sets the value associated with the specified attribute.
Set the value associated with the specified attribute.
"""
self.__dict__[name] = value
@ -67,7 +67,7 @@ class CurrentState:
#-------------------------------------------------------------------------
class PlaceParser:
"""
Provides the ability to parse GEDCOM FORM statements for places, and
Provide the ability to parse GEDCOM FORM statements for places, and
the parse the line of text, mapping the text components to Location
values based of the FORM statement.
"""
@ -130,11 +130,11 @@ class PlaceParser:
#-------------------------------------------------------------------------
class IdFinder:
"""
Provides method of finding the next available ID.
Provide method of finding the next available ID.
"""
def __init__(self, keys, prefix):
"""
Initializes the object.
Initialize the object.
"""
self.ids = set(keys)
self.index = 0
@ -142,7 +142,7 @@ class IdFinder:
def find_next(self):
"""
Returns the next available GRAMPS' ID for a Event object based
Return the next available GRAMPS' ID for a Event object based
off the person ID prefix.
@return: Returns the next available index

View File

@ -21,7 +21,7 @@
# $Id$
"""
Provides the Berkeley DB (BSDDB) database backend for GRAMPS for GRAMPS up
Provide the Berkeley DB (BSDDB) database backend for GRAMPS for GRAMPS up
to version 2.2.x
"""
@ -70,14 +70,14 @@ _DBVERSION = 13
def find_surname(key, data):
"""
Returns the surname from the data stream. Used for building a secondary
Return the surname from the data stream. Used for building a secondary
index.
"""
return str(data[3][5])
def find_idmap(key, data):
"""
Returns the ID from the data stream. Used for building a secondary
Return the ID from the data stream. Used for building a secondary
index.
"""
return str(data[1])
@ -871,7 +871,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
"""
# Add references to the reference_map for all primary object referenced
# from the primary object 'obj' or any of its secondary objects.
# from the primary object 'obj, or any of its secondary objects.
handle = obj.handle
update = self.reference_map_primary_map.has_key(str(handle))
@ -945,7 +945,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
def __remove_reference(self, key, transaction, txn=None):
"""
Removes the reference specified by the key,
Remove the reference specified by the key,
preserving the change in the passed transaction.
"""
if not self.readonly:
@ -960,7 +960,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
def __add_reference(self, key, data, transaction, txn=None):
"""
Adds the reference specified by the key and the data,
Add the reference specified by the key and the data,
preserving the change in the passed transaction.
"""
@ -1485,7 +1485,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
def transaction_begin(self, msg="", batch=False, no_magic=False):
"""
Creates a new Transaction tied to the current UNDO database. The
Create a new Transaction tied to the current UNDO database. The
transaction has no effect until it is committed using the
transaction_commit function of the this database object.
"""
@ -2036,7 +2036,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
print "Done upgrading to DB version 13"
def commit_13(self,data_tuple,data_key_name,data_map,note_handles=None):
def commit_13(self,data_tuple,data_key_name,data_map, note_handles=None):
"""
Commits the specified object to the data_map table in the database,
add a reference to each note handle.
@ -2060,7 +2060,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
if the_txn:
the_txn.commit()
def convert_notes_13(self,name,obj,nttype=NoteType._DEFAULT,private=False):
def convert_notes_13(self, name, obj, nttype=NoteType._DEFAULT,private=False):
"""
This is the function for conversion all notes in all objects
and their child objects to the top-level notes and handle references.
@ -2258,7 +2258,7 @@ class GrampsBSDDB(GrampsDbBase, UpdateCallback):
note_handles += [item[1] for item in tuples]
new_obj = (handle, gramps_id, fh, mh, new_child_ref_list,
the_type, new_event_ref_list, new_media_list,
new_attr_list,new_lds_list, new_source_list, note_list,
new_attr_list, new_lds_list, new_source_list, note_list,
change, marker, priv)
elif name == 'MediaObject':
(handle, gramps_id, path, mime, desc, attr_list, source_list,

View File

@ -98,7 +98,7 @@ class GrampsDbXmlWriter(UpdateCallback):
def __init__(self, db, strip_photos=0, compress=1, version="unknown",
callback=None):
"""
Initializes, but does not write, an XML file.
Initialize, but does not write, an XML file.
db - database to write
strip_photos - remove paths off of media object paths
@ -123,7 +123,7 @@ class GrampsDbXmlWriter(UpdateCallback):
"""
base = os.path.dirname(filename)
if os.path.isdir(base):
if not os.access(base,os.W_OK) or not os.access(base,os.R_OK):
if not os.access(base, os.W_OK) or not os.access(base, os.R_OK):
raise GrampsDbWriteFailure(
_('Failure writing %s') % filename,
_("The database cannot be saved because you do "
@ -133,7 +133,7 @@ class GrampsDbXmlWriter(UpdateCallback):
return 0
if os.path.exists(filename):
if not os.access(filename,os.W_OK):
if not os.access(filename, os.W_OK):
raise GrampsDbWriteFailure(
_('Failure writing %s') % filename,
_("The database cannot be saved because you do "
@ -163,7 +163,7 @@ class GrampsDbXmlWriter(UpdateCallback):
g.close()
return 1
def write_handle(self,handle):
def write_handle(self, handle):
"""
Write the database to the specified file handle.
"""
@ -214,14 +214,14 @@ class GrampsDbXmlWriter(UpdateCallback):
self.g.write(" version=\"" + self.version + "\"")
self.g.write("/>\n")
self.g.write(" <researcher>\n")
self.write_line("resname",owner.get_name(),3)
self.write_line("resaddr",owner.get_address(),3)
self.write_line("rescity",owner.get_city(),3)
self.write_line("resstate",owner.get_state(),3)
self.write_line("rescountry",owner.get_country(),3)
self.write_line("respostal",owner.get_postal_code(),3)
self.write_line("resphone",owner.get_phone(),3)
self.write_line("resemail",owner.get_email(),3)
self.write_line("resname", owner.get_name(),3)
self.write_line("resaddr", owner.get_address(),3)
self.write_line("rescity", owner.get_city(),3)
self.write_line("resstate", owner.get_state(),3)
self.write_line("rescountry", owner.get_country(),3)
self.write_line("respostal", owner.get_postal_code(),3)
self.write_line("resphone", owner.get_phone(),3)
self.write_line("resemail", owner.get_email(),3)
self.g.write(" </researcher>\n")
self.write_metadata()
self.g.write(" </header>\n")
@ -374,10 +374,10 @@ class GrampsDbXmlWriter(UpdateCallback):
def write_name_formats(self):
if len(self.db.name_formats) > 0:
self.g.write(" <name-formats>\n")
for number,name,fmt_str,active in self.db.name_formats:
for number, name,fmt_str,active in self.db.name_formats:
self.g.write('%s<format number="%d" name="%s" '
'fmt_str="%s" active="%d"/>\n'
% (' ',number,name,fmt_str,int(active)) )
% (' ', number, name,fmt_str,int(active)) )
self.g.write(" </name-formats>\n")
def fix(self,line):
@ -388,15 +388,15 @@ class GrampsDbXmlWriter(UpdateCallback):
l = l.strip().translate(strip_dict)
return escxml(l)
def write_note_list(self,note_list,indent=0):
def write_note_list(self, note_list,indent=0):
for handle in note_list:
self.write_ref("noteref",handle,indent)
self.write_ref("noteref", handle,indent)
def write_note(self,note,index=1):
def write_note(self, note,index=1):
if not note:
return
self.write_primary_tag("note",note,2,close=False)
self.write_primary_tag("note", note,2,close=False)
ntype = escxml(note.get_type().xml_str())
format = note.get_format()
@ -514,7 +514,7 @@ class GrampsDbXmlWriter(UpdateCallback):
self.write_note_list(repo.get_note_list(),index+1)
self.g.write("%s</repository>\n" % sp)
def write_address_list(self,obj,index=1):
def write_address_list(self, obj,index=1):
if len(obj.get_address_list()) == 0:
return
sp = " "*index
@ -622,7 +622,7 @@ class GrampsDbXmlWriter(UpdateCallback):
self.write_media_list(event.get_media_list(),index+1)
self.g.write("%s</event>\n" % sp)
def dump_ordinance(self,ord,index=1):
def dump_ordinance(self, ord,index=1):
name = ord.type2xml()
@ -630,16 +630,16 @@ class GrampsDbXmlWriter(UpdateCallback):
sp2 = " " * (index+1)
priv = conf_priv(ord)
self.g.write('%s<lds_ord type="%s"%s>\n' % (sp,name,priv))
self.g.write('%s<lds_ord type="%s"%s>\n' % (sp, name,priv))
dateobj = ord.get_date_object()
if dateobj and not dateobj.is_empty():
self.write_date(dateobj,index+1)
if ord.get_temple():
self.g.write('%s<temple val="%s"/>\n'
% (sp2,self.fix(ord.get_temple())))
self.write_ref("place",ord.get_place_handle(),index+1)
self.write_ref("place", ord.get_place_handle(),index+1)
if ord.get_status() != 0:
self.g.write('%s<status val="%s"/>\n' % (sp2,ord.status2xml()))
self.g.write('%s<status val="%s"/>\n' % (sp2, ord.status2xml()))
if ord.get_family_handle():
self.g.write('%s<sealed_to hlink="%s"/>\n' %
(sp2,"_"+ord.get_family_handle()))
@ -673,7 +673,7 @@ class GrampsDbXmlWriter(UpdateCallback):
self.write_date(d,index+1)
self.g.write("%s</sourceref>\n" % (" " * index))
def write_ref(self,tagname,handle,index=1,close=True,extra_text=''):
def write_ref(self,tagname, handle,index=1,close=True,extra_text=''):
if handle:
if close:
close_tag = "/"
@ -681,9 +681,9 @@ class GrampsDbXmlWriter(UpdateCallback):
close_tag = ""
sp = " "*index
self.g.write('%s<%s hlink="_%s"%s%s>\n'
% (sp,tagname,handle,extra_text,close_tag))
% (sp,tagname, handle,extra_text,close_tag))
def write_primary_tag(self,tagname,obj,index=1,close=True):
def write_primary_tag(self,tagname, obj,index=1,close=True):
if not obj:
return
sp = " "*index
@ -694,7 +694,7 @@ class GrampsDbXmlWriter(UpdateCallback):
marker_text = ''
priv_text = conf_priv(obj)
change_text = ' change="%d"' % obj.get_change_time()
handle_id_text = ' id="%s" handle="_%s"' % (obj.gramps_id,obj.handle)
handle_id_text = ' id="%s" handle="_%s"' % (obj.gramps_id, obj.handle)
obj_text = '%s<%s' % (sp,tagname)
self.g.write(obj_text + handle_id_text + priv_text + marker_text +
@ -710,7 +710,7 @@ class GrampsDbXmlWriter(UpdateCallback):
if rel != "":
self.g.write(' %s<rel type="%s"/>\n' % (sp,rel) )
def write_last(self,name,indent=1):
def write_last(self, name,indent=1):
p = name.get_surname_prefix()
n = name.get_surname()
g = name.get_group_as()
@ -813,7 +813,7 @@ class GrampsDbXmlWriter(UpdateCallback):
if value != None:
self.g.write('%s<%s>%s</%s>\n' % (' '*indent,label,self.fix(value),label))
def dump_name(self,name,alternative=False,index=1):
def dump_name(self, name,alternative=False,index=1):
sp = " "*index
name_type = name.get_type().xml_str()
self.g.write('%s<name' % sp)
@ -828,12 +828,12 @@ class GrampsDbXmlWriter(UpdateCallback):
if name.get_display_as() != 0:
self.g.write(' display="%d"' % name.get_display_as())
self.g.write('>\n')
self.write_line("first",name.get_first_name(),index+1)
self.write_line("call",name.get_call_name(),index+1)
self.write_line("first", name.get_first_name(),index+1)
self.write_line("call", name.get_call_name(),index+1)
self.write_last(name,index+1)
self.write_line("suffix",name.get_suffix(),index+1)
self.write_line("patronymic",name.get_patronymic(),index+1)
self.write_line("title",name.get_title(),index+1)
self.write_line("suffix", name.get_suffix(),index+1)
self.write_line("patronymic", name.get_patronymic(),index+1)
self.write_line("title", name.get_title(),index+1)
if name.date:
self.write_date(name.date,4)
self.write_note_list(name.get_note_list(),index+1)
@ -842,7 +842,7 @@ class GrampsDbXmlWriter(UpdateCallback):
self.g.write('%s</name>\n' % sp)
def append_value(self,orig,val):
def append_value(self, orig,val):
if orig:
return "%s, %s" % (orig,val)
else:

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_WriteGrdb.py 9912 2008-01-22 09:17:46Z acraphae $
# Written by Alex Roitman
@ -64,6 +64,6 @@ def exportData(database, filename, person=None, callback=None, cl=False):
return
# copy all data from new_database to database
db_copy(database,new_database,callback)
db_copy(database, new_database,callback)
new_database.close()

View File

@ -2,7 +2,7 @@ from gettext import gettext as _
import Assistant
import const
import gtk
import sys,os,bsddb
import sys, os,bsddb
@ -53,14 +53,14 @@ class ErrorReportAssistant:
self.w.show()
def on_page_changed(self,obj,page,data=None):
def on_page_changed(self, obj,page,data=None):
if self.cb.has_key(page):
self.cb[page]()
def complete(self):
pass
def _copy_to_clipboard(self,obj=None):
def _copy_to_clipboard(self, obj=None):
clipboard = gtk.Clipboard()
clipboard.set_text(
self._final_report_text_buffer.get_text(
@ -73,14 +73,14 @@ class ErrorReportAssistant:
self._final_report_text_buffer.get_start_iter(),
self._final_report_text_buffer.get_end_iter()))
def _start_email_client(self,obj=None):
def _start_email_client(self, obj=None):
import GrampsDisplay
GrampsDisplay.url('mailto:gramps-bugs@lists.sourceforge.net?subject="bug report"&body="%s"' \
% self._final_report_text_buffer.get_text(
self._final_report_text_buffer.get_start_iter(),
self._final_report_text_buffer.get_end_iter()))
def _start_gramps_bts_in_browser(self,obj=None):
def _start_gramps_bts_in_browser(self, obj=None):
import GrampsDisplay
GrampsDisplay.url('http://bugs.gramps-project.org/bug_report_page.php')
@ -105,26 +105,26 @@ class ErrorReportAssistant:
operatingsystem,
distribution)
def _reset_error_details_text_buffer(self,obj=None):
def _reset_error_details_text_buffer(self, obj=None):
self._error_details_text_buffer.set_text(
"\n".join(self._rotate_handler.get_formatted_log(self._error_detail.get_record())) +
self._error_detail.get_formatted_log())
def _clear_error_details_text_buffer(self,obj=None):
def _clear_error_details_text_buffer(self, obj=None):
self._error_details_text_buffer.delete(
self._error_details_text_buffer.get_start_iter(),
self._error_details_text_buffer.get_end_iter())
def _reset_sys_information_text_buffer(self,obj=None):
def _reset_sys_information_text_buffer(self, obj=None):
self._sys_information_text_buffer.set_text(
self._get_sys_information())
def _clear_sys_information_text_buffer(self,obj=None):
def _clear_sys_information_text_buffer(self, obj=None):
self._sys_information_text_buffer.delete(
self._sys_information_text_buffer.get_start_iter(),
self._sys_information_text_buffer.get_end_iter())
def _clear_user_information_text_buffer(self,obj=None):
def _clear_user_information_text_buffer(self, obj=None):
self._user_information_text_buffer.delete(
self._user_information_text_buffer.get_start_iter(),
self._user_information_text_buffer.get_end_iter())

View File

@ -460,7 +460,7 @@ class MonitoredSpinButton:
def set_value(self, value):
"""
Sets the value of the monitored widget to the specified value.
Set the value of the monitored widget to the specified value.
@param value: Value to be set.
"""
@ -491,7 +491,7 @@ class MonitoredSpinButton:
def force_value(self, value):
"""
Sets the value of the monitored widget to the specified value.
Set the value of the monitored widget to the specified value.
@param value: Value to be set.
"""
@ -500,7 +500,7 @@ class MonitoredSpinButton:
def get_value(self):
"""
Gets the current value of the monitored widget.
Get the current value of the monitored widget.
@returns: Current value of monitored widget.
"""
@ -509,7 +509,7 @@ class MonitoredSpinButton:
def enable(self, value):
"""
Changes the property editable and sensitive of the monitored widget to value.
Change the property editable and sensitive of the monitored widget to value.
@param value: If widget should be editable or deactivated.
@type value: bool
@ -1221,7 +1221,7 @@ class Statusbar(gtk.HBox):
return new_bar_id
def get_context_id(self, context_description, bar_id=0):
"""Returns a new or existing context identifier.
"""Return a new or existing context identifier.
The target statusbar is identified by bar_id created when statusbar
was added.
@ -1853,7 +1853,7 @@ class MaskedEntry(gtk.Entry):
def set_mask(self, mask):
"""
Sets the mask of the Entry.
Set the mask of the Entry.
Supported format characters are:
- '0' digit
@ -1947,7 +1947,7 @@ class MaskedEntry(gtk.Entry):
def get_empty_mask(self, start=None, end=None):
"""
Gets the empty mask between start and end
Get the empty mask between start and end
@param start:
@param end:
@ -2784,7 +2784,7 @@ class ValidatableMaskedEntry(MaskedEntry):
return None
def set_valid(self):
"""Changes the validation state to valid, which will remove icons and
"""Change the validation state to valid, which will remove icons and
reset the background color
"""
@ -2795,7 +2795,7 @@ class ValidatableMaskedEntry(MaskedEntry):
self.set_pixbuf(None)
def set_invalid(self, text=None, fade=True):
"""Changes the validation state to invalid.
"""Change the validation state to invalid.
@param text: text of tooltip of None
@param fade: if we should fade the background
"""
@ -2853,7 +2853,7 @@ class ValidatableMaskedEntry(MaskedEntry):
self.set_pixbuf(None)
def set_blank(self):
"""Changes the validation state to blank state, this only applies
"""Change the validation state to blank state, this only applies
for mandatory widgets, draw an icon and set a tooltip"""
##log.debug('Setting state for %s to BLANK' % self.model_attribute)
@ -2871,7 +2871,7 @@ class ValidatableMaskedEntry(MaskedEntry):
def set_text(self, text):
"""
Sets the text of the entry
Set the text of the entry
@param text:
"""

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:ImgManip.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Image manipulation routines.
@ -47,7 +47,7 @@ import gobject
#-------------------------------------------------------------------------
def resize_to_jpeg(source, destination, width, height):
"""
Creates the destination, derived from the source, resizing it to the
Create the destination, derived from the source, resizing it to the
specified size, while converting to JPEG.
@param source: source image file, in any format that gtk recognizes
@ -70,7 +70,7 @@ def resize_to_jpeg(source, destination, width, height):
#-------------------------------------------------------------------------
def image_size(source):
"""
Returns the width and size of the specified image.
Return the width and size of the specified image.
@param source: source image file, in any format that gtk recongizes
@type source: unicode

View File

@ -19,7 +19,7 @@
#
"""
Provides the basic functionality for a list view
Provide the basic functionality for a list view
"""
#-------------------------------------------------------------------------
@ -165,7 +165,7 @@ class ListModel:
def unselect(self):
"""
Removes the selection from the view
Remove the selection from the view
"""
self.selection.unselect_all()
@ -177,7 +177,7 @@ class ListModel:
def new_model(self):
"""
Creates a new model instance
Create a new model instance
"""
if self.model:
self.cid = self.model.get_sort_column_id()
@ -222,13 +222,13 @@ class ListModel:
def get_selected(self):
"""
Returns the selected items
Return the selected items
"""
return self.selection.get_selected()
def get_row_at(self, xpos, ypos):
"""
Returns the row at the specified (x,y) coordinates
Return the row at the specified (x,y) coordinates
"""
path = self.tree.get_path_at_pos(xpos, ypos)
if path == None:
@ -238,7 +238,7 @@ class ListModel:
def get_selected_row(self):
"""
Gets the selected row number
Get the selected row number
"""
store, node = self.selection.get_selected()
if node:
@ -249,7 +249,7 @@ class ListModel:
def get_selected_objects(self):
"""
Returns the list of selected objects in the list
Return the list of selected objects in the list
"""
if self.count == 0:
return []
@ -266,7 +266,7 @@ class ListModel:
def get_icon(self):
"""
Returns an icond to be used for Drag and drop.
Return an icond to be used for Drag and drop.
"""
if self.mode == gtk.SELECTION_SINGLE:
store, node = self.selection.get_selected()
@ -292,14 +292,14 @@ class ListModel:
def remove(self, node):
"""
Removes the item from the model
Remove the item from the model
"""
self.model.remove(node)
self.count -= 1
def get_row(self, node):
"""
Returns the row associated with the selected node
Return the row associated with the selected node
"""
row = self.model.get_path(node)
return row[0]
@ -318,7 +318,7 @@ class ListModel:
def get_object(self, node):
"""
Returns the object associated with the node. This is controlled
Return the object associated with the node. This is controlled
by extracting the data from the associated data index
"""
return self.model.get_value(node, self.data_index)
@ -342,13 +342,13 @@ class ListModel:
def get_data(self, node, cols):
"""
Returns a list of data from the model associated with the node
Return a list of data from the model associated with the node
"""
return [ self.model.get_value(node, c) for c in cols ]
def add(self, data, info=None, select=0):
"""
Adds the data to the model at the end of the model
Add the data to the model at the end of the model
"""
self.count += 1
node = self.model.append()
@ -366,7 +366,7 @@ class ListModel:
def set(self, node, data, info=None, select=0):
"""
Changes the data associated with the specific node. It does not
Change the data associated with the specific node. It does not
add any data, just alters an existing row.
"""
col = 0

View File

@ -42,19 +42,19 @@ class LRU:
def __contains__(self, obj):
"""
Returns True if the object is contained in the LRU
Return True if the object is contained in the LRU
"""
return obj in self.data
def __getitem__(self, obj):
"""
Returns item assocated with Obj
Return item assocated with Obj
"""
return self.data[obj].value[1]
def __setitem__(self, obj, val):
"""
Sets the item in the LRU, removing an old entry if needed
Set the item in the LRU, removing an old entry if needed
"""
if obj in self.data:
del self[obj]

View File

@ -21,7 +21,7 @@
# $Id$
"""
Provides the managed window interface, which allows GRAMPS to track
Provide the managed window interface, which allows GRAMPS to track
the create/deletion of dialog windows.
"""
@ -94,7 +94,7 @@ class GrampsWindowManager:
def disable(self):
"""
Removes the UI and action groups if the navigation is enabled
Remove the UI and action groups if the navigation is enabled
"""
if self.active != DISABLED:
self.uimanager.remove_ui(self.active)
@ -320,7 +320,7 @@ class ManagedWindow:
@param track {list of parent windows, [] if the main GRAMPS window
is the parent}
@param obj The object that is used to id the managed window,
The inheriting object needs a method build_menu_names(self,obj)
The inheriting object needs a method build_menu_names(self, obj)
which works on this obj and creates menu labels
for use in the Gramps Window Menu.
If self.submenu_label ='' then leaf, otherwise branch

View File

@ -932,7 +932,7 @@ class MarkupBuffer(gtk.TextBuffer):
self.apply_tag(tag, start_iter, end_iter)
def get_text(self, start=None, end=None, include_hidden_chars=True):
"""Returns the buffer text with xml markup tags.
"""Return the buffer text with xml markup tags.
If no markup was applied returns clean text
(i.e. without even root tags).

View File

@ -93,14 +93,14 @@ class MergePlaces(ManagedWindow.ManagedWindow):
def close_window(self, obj):
self.close()
def build_menu_names(self,obj):
def build_menu_names(self, obj):
return (_('Merge Places'),None)
def help(self,obj):
def help(self, obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('adv-merge-places', webpage = WIKI_HELP_PAGE, section = WIKI_HELP_SEC)
def merge(self,obj):
def merge(self, obj):
"""
Performs the merge of the places when the merge button is clicked.
"""

View File

@ -107,14 +107,14 @@ class MergeSources(ManagedWindow.ManagedWindow):
self.glade.get_widget('help').connect('clicked',self.help)
self.show()
def close_window(self,obj):
def close_window(self, obj):
self.close()
def help(self,obj):
def help(self, obj):
"""Display the relevant portion of GRAMPS manual"""
GrampsDisplay.help('adv-merge-sources', webpage = WIKI_HELP_PAGE, section = WIKI_HELP_SEC)
def merge(self,obj):
def merge(self, obj):
"""
Performs the merge of the sources when the merge button is clicked.
"""

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_GnomeMime.py 9912 2008-01-22 09:17:46Z acraphae $
import gtk
import const
@ -33,7 +33,7 @@ except:
from gettext import gettext as _
def get_application(type):
"""Returns the application command and application name of the
"""Return the application command and application name of the
specified mime type"""
try:
applist = mime_get_short_list_applications(type)
@ -60,14 +60,14 @@ def _is_good_command(cmd):
return True
def get_description(type):
"""Returns the description of the specfied mime type"""
"""Return the description of the specfied mime type"""
try:
return mime_get_description(type)
except:
return _("unknown")
def get_type(file):
"""Returns the mime type of the specified file"""
"""Return the mime type of the specified file"""
try:
return get_mime_type(file)
except:

View File

@ -44,16 +44,16 @@ mimetypes.add_type('application/x-gramps-package','.GPKG')
mimetypes.add_type('text/x-comma-separated-values', '.csv')
def get_application(mime_type):
"""Returns the application command and application name of the
"""Return the application command and application name of the
specified mime type"""
return None
def get_description(mime_type):
"""Returns the description of the specfied mime type"""
"""Return the description of the specfied mime type"""
return _type_map.get(mime_type,_("unknown"))
def get_type(filename):
"""Returns the mime type of the specified file"""
"""Return the mime type of the specified file"""
value = mimetypes.guess_type(filename)
if value and value[0]:
return value[0]

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_WinMime.py 9912 2008-01-22 09:17:46Z acraphae $
"""
Mime utility functions for the MS Windows platform
@ -42,7 +42,7 @@ import _PythonMime
def get_application(mime_type):
"""Returns the application command and application name of the
"""Return the application command and application name of the
specified mime type"""
extension = _get_extension(mime_type)
progid = _get_prog_id(extension)
@ -93,7 +93,7 @@ def get_application(mime_type):
return (command, desc)
def get_description(mime_type):
"""Returns the description of the specfied mime type"""
"""Return the description of the specfied mime type"""
desc = None
extension = _get_extension(mime_type)
progid = _get_prog_id(extension)
@ -109,7 +109,7 @@ def get_description(mime_type):
return desc
def get_type(file):
"""Returns the mime type of the specified file"""
"""Return the mime type of the specified file"""
return _PythonMime.get_type(file)
def mime_type_is_defined(mime_type):

View File

@ -166,7 +166,7 @@ class FastFilterModel(gtk.GenericTreeModel):
def on_iter_nth_child(self, parent, n):
if parent:
ret = [parent[0],n]
ret = [parent[0], n]
else:
ret = [n,]
return ret

Some files were not shown because too many files have changed in this diff Show More