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

@@ -84,7 +84,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
self.init_options(option_class)
self.init_interface()
def init_options(self,option_class):
def init_options(self, option_class):
if type(option_class) == ClassType:
self.options = option_class(self.raw_name, self.db)
elif type(option_class) == InstanceType:
@@ -92,11 +92,11 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
self.options.load_previous_values()
def build_window_key(self,obj):
def build_window_key(self, obj):
key = self.raw_name
return key
def build_menu_names(self,obj):
def build_menu_names(self, obj):
return (_("Configuration"),self.report_name)
def init_interface(self):
@@ -490,7 +490,7 @@ class BareReportDialog(ManagedWindow.ManagedWindow):
#
#------------------------------------------------------------------------
def add_tooltip(self,widget,string):
"""Adds a tooltip to the specified widget"""
"""Add a tooltip to the specified widget"""
if not widget or not string:
return
tip = gtk.Tooltips()

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_BookFormatComboBox.py 9912 2008-01-22 09:17:46Z acraphae $
#-------------------------------------------------------------------------
#
@@ -43,7 +43,7 @@ import PluginUtils
#-------------------------------------------------------------------------
class BookFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None):
def set(self,tables,callback, obj=None,active=None):
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()

View File

@@ -20,6 +20,14 @@
# $Id$
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
from gettext import gettext as _
import logging
log = logging.getLogger(".")
@@ -39,11 +47,10 @@ import const
#------------------------------------------------------------------------
class CommandLineReport:
"""
Provides a way to generate report from the command line.
Provide a way to generate report from the command line.
"""
def __init__(self,database,name,category,option_class,options_str_dict,
def __init__(self,database, name,category, option_class, options_str_dict,
noopt=False):
self.database = database
self.category = category
@@ -55,7 +62,7 @@ class CommandLineReport:
self.parse_option_str()
self.show_options()
def init_options(self,noopt):
def init_options(self, noopt):
self.options_dict = {
'of' : self.option_class.handler.module_name,
'off' : self.option_class.handler.get_format_name(),
@@ -213,11 +220,11 @@ class CommandLineReport:
# Command-line report generic task
#
#------------------------------------------------------------------------
def cl_report(database,name,category,report_class,
options_class,options_str_dict):
def cl_report(database, name, category, report_class, options_class,
options_str_dict):
clr = CommandLineReport(database,name,category,
options_class,options_str_dict)
clr = CommandLineReport(database, name, category, options_class,
options_str_dict)
# Exit here if show option was given
if clr.show:

View File

@@ -187,7 +187,7 @@ class DocReportDialog(ReportDialog):
self.setup_html_frame()
ReportDialog.setup_report_options_frame(self)
def html_file_enable(self,obj):
def html_file_enable(self, obj):
active = obj.get_active()
text = unicode(obj.get_model()[active][0])
if _template_map.has_key(text):
@@ -274,7 +274,7 @@ class DocReportDialog(ReportDialog):
if text == _user_template:
self.template_name = self.html_fileentry.get_full_path(0)
else:
self.template_name = "%s%s%s" % (const.TEMPLATE_DIR,os.path.sep,
self.template_name = "%s%s%s" % (const.TEMPLATE_DIR, os.path.sep,
_template_map[text])
else:
self.template_name = ""

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_DrawFormatComboBox.py 9912 2008-01-22 09:17:46Z acraphae $
import gtk
import gobject
@@ -32,7 +32,7 @@ import PluginUtils
#-------------------------------------------------------------------------
class DrawFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None):
def set(self,tables,callback, obj=None,active=None):
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_FileEntry.py 9912 2008-01-22 09:17:46Z acraphae $
import os
import sys
@@ -43,7 +43,7 @@ class FileEntry(gtk.HBox):
self.pack_start(self.entry,True,True)
self.pack_end(self.button,False,False)
def select_file(self,obj):
def select_file(self, obj):
if self.dir:
my_action = gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER
else:
@@ -90,5 +90,5 @@ class FileEntry(gtk.HBox):
def get_full_path(self,val):
return self.entry.get_text()
def set_directory_entry(self,opt):
def set_directory_entry(self, opt):
self.dir = opt

View File

@@ -109,7 +109,7 @@ class GVDocBase(BaseDoc.BaseDoc,BaseDoc.GVDoc):
inherit from this class will only need to implement the close function.
The close function will generate the actual file of the appropriate type.
"""
def __init__(self,options,paper_style):
def __init__(self, options,paper_style):
BaseDoc.BaseDoc.__init__(self,None,paper_style,None)
self.options = options.handler.options_dict

View File

@@ -52,9 +52,9 @@ import Utils
#
#-------------------------------------------------------------------------
try:
from xml.sax import make_parser,handler,SAXParseException
from xml.sax import make_parser, handler,SAXParseException
except:
from _xmlplus.sax import make_parser,handler,SAXParseException
from _xmlplus.sax import make_parser, handler,SAXParseException
#-------------------------------------------------------------------------
#
@@ -346,7 +346,7 @@ class PageSizeParser(handler.ContentHandler):
name = attrs['name']
height = Utils.gfloat(attrs['height'])
width = Utils.gfloat(attrs['width'])
self.paper_list.append(BaseDoc.PaperSize(name,height,width))
self.paper_list.append(BaseDoc.PaperSize(name, height,width))
#-------------------------------------------------------------------------
#

View File

@@ -201,7 +201,7 @@ class ReportDialog(BareReportDialog):
and self.get_target_is_directory():
# check whether the dir has rwx permissions
if not os.access(self.target_path,os.R_OK|os.W_OK|os.X_OK):
if not os.access(self.target_path, os.R_OK|os.W_OK|os.X_OK):
ErrorDialog(_('Permission problem'),
_("You do not have permission to write "
"under the directory %s\n\n"
@@ -227,7 +227,7 @@ class ReportDialog(BareReportDialog):
# we will need to create the file/dir
# need to make sure we can create in the parent dir
parent_dir = os.path.dirname(os.path.normpath(self.target_path))
if not os.access(parent_dir,os.W_OK):
if not os.access(parent_dir, os.W_OK):
ErrorDialog(_('Permission problem'),
_("You do not have permission to create "
"%s\n\n"
@@ -261,8 +261,8 @@ class ReportDialog(BareReportDialog):
# Generic task function a standalone GUI report
#
#------------------------------------------------------------------------
def report(dbstate,uistate,person,report_class,options_class,
trans_name,name,category, require_active):
def report(dbstate,uistate,person,report_class, options_class,
trans_name, name,category, require_active):
"""
report - task starts the report. The plugin system requires that the
task be in the format of task that takes a database and a person as

View File

@@ -80,7 +80,7 @@ class OptionList(_Options.OptionList):
def set_style_name(self,style_name):
"""
Sets the style name for the OptionList.
Set the style name for the OptionList.
@param style_name: name of the style to set.
@type style_name: str
"""
@@ -88,7 +88,7 @@ class OptionList(_Options.OptionList):
def get_style_name(self):
"""
Returns the style name of the OptionList.
Return the style name of the OptionList.
@returns: string representing the style name
@rtype: str
"""
@@ -96,7 +96,7 @@ class OptionList(_Options.OptionList):
def set_paper_metric(self,paper_metric):
"""
Sets the paper metric for the OptionList.
Set the paper metric for the OptionList.
@param paper_metric: whether to use metric.
@type paper_name: boolean
"""
@@ -104,7 +104,7 @@ class OptionList(_Options.OptionList):
def get_paper_metric(self):
"""
Returns the paper metric of the OptionList.
Return the paper metric of the OptionList.
@returns: returns whether to use metric
@rtype: boolean
"""
@@ -112,7 +112,7 @@ class OptionList(_Options.OptionList):
def set_paper_name(self,paper_name):
"""
Sets the paper name for the OptionList.
Set the paper name for the OptionList.
@param paper_name: name of the paper to set.
@type paper_name: str
"""
@@ -120,15 +120,15 @@ class OptionList(_Options.OptionList):
def get_paper_name(self):
"""
Returns the paper name of the OptionList.
Return the paper name of the OptionList.
@returns: returns the paper name
@rtype: str
"""
return self.paper_name
def set_orientation(self,orientation):
def set_orientation(self, orientation):
"""
Sets the orientation for the OptionList.
Set the orientation for the OptionList.
@param orientation: orientation to set. Possible values are
BaseDoc.PAPER_LANDSCAPE or BaseDoc.PAPER_PORTRAIT
@type orientation: int
@@ -137,7 +137,7 @@ class OptionList(_Options.OptionList):
def get_orientation(self):
"""
Returns the orientation for the OptionList.
Return the orientation for the OptionList.
@returns: returns the selected orientation. Valid values are
BaseDoc.PAPER_LANDSCAPE or BaseDoc.PAPER_PORTRAIT
@rtype: int
@@ -146,7 +146,7 @@ class OptionList(_Options.OptionList):
def set_custom_paper_size(self,paper_size):
"""
Sets the custom paper size for the OptionList.
Set the custom paper size for the OptionList.
@param paper_size: paper size to set in cm.
@type paper_size: [float, float]
"""
@@ -154,7 +154,7 @@ class OptionList(_Options.OptionList):
def get_custom_paper_size(self):
"""
Returns the custom paper size for the OptionList.
Return the custom paper size for the OptionList.
@returns: returns the custom paper size in cm
@rtype: [float, float]
"""
@@ -162,7 +162,7 @@ class OptionList(_Options.OptionList):
def set_margins(self,margins):
"""
Sets the margins for the OptionList.
Set the margins for the OptionList.
@param margins: margins to set. Possible values are floats in cm
@type margins: [float, float, float, float]
"""
@@ -170,7 +170,7 @@ class OptionList(_Options.OptionList):
def get_margins(self):
"""
Returns the margins for the OptionList.
Return the margins for the OptionList.
@returns margins: returns the margins, floats in cm
@rtype margins: [float, float, float, float]
"""
@@ -178,7 +178,7 @@ class OptionList(_Options.OptionList):
def set_margin(self,pos,value):
"""
Sets a margin for the OptionList.
Set a margin for the OptionList.
@param pos: Position of margin [left, right, top, bottom]
@param value: floating point in cm
@type pos: int
@@ -188,7 +188,7 @@ class OptionList(_Options.OptionList):
def get_margin(self,pos):
"""
Returns a margin for the OptionList.
Return a margin for the OptionList.
@param pos: Position of margin [left, right, top, bottom]
@type pos: int
@returns: float cm of margin
@@ -198,7 +198,7 @@ class OptionList(_Options.OptionList):
def set_template_name(self,template_name):
"""
Sets the template name for the OptionList.
Set the template name for the OptionList.
@param template_name: name of the template to set.
@type template_name: str
"""
@@ -206,7 +206,7 @@ class OptionList(_Options.OptionList):
def get_template_name(self):
"""
Returns the template name of the OptionList.
Return the template name of the OptionList.
@returns: template name
@rtype: str
"""
@@ -214,7 +214,7 @@ class OptionList(_Options.OptionList):
def set_format_name(self,format_name):
"""
Sets the format name for the OptionList.
Set the format name for the OptionList.
@param format_name: name of the format to set.
@type format_name: str
"""
@@ -222,7 +222,7 @@ class OptionList(_Options.OptionList):
def get_format_name(self):
"""
Returns the format name of the OptionList.
Return the format name of the OptionList.
@returns: returns the format name
@rtype: str
"""
@@ -262,7 +262,7 @@ class OptionListCollection(_Options.OptionListCollection):
def set_last_paper_metric(self,paper_metric):
"""
Sets the last paper metric used for the any report in this collection.
Set the last paper metric used for the any report in this collection.
@param paper_metric: whether to use metric.
@type paper_name: boolean
"""
@@ -270,7 +270,7 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_paper_metric(self):
"""
Returns the last paper metric used for the any report in this collection.
Return the last paper metric used for the any report in this collection.
@returns: returns whether or not to use metric
@rtype: boolean
"""
@@ -278,7 +278,7 @@ class OptionListCollection(_Options.OptionListCollection):
def set_last_paper_name(self,paper_name):
"""
Sets the last paper name used for the any report in this collection.
Set the last paper name used for the any report in this collection.
@param paper_name: name of the paper to set.
@type paper_name: str
"""
@@ -286,15 +286,15 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_paper_name(self):
"""
Returns the last paper name used for the any report in this collection.
Return the last paper name used for the any report in this collection.
@returns: returns the name of the paper
@rtype: str
"""
return self.last_paper_name
def set_last_orientation(self,orientation):
def set_last_orientation(self, orientation):
"""
Sets the last orientation used for the any report in this collection.
Set the last orientation used for the any report in this collection.
@param orientation: orientation to set.
@type orientation: int
"""
@@ -302,7 +302,7 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_orientation(self):
"""
Returns the last orientation used for the any report in this
Return the last orientation used for the any report in this
collection.
@returns: last orientation used
@rtype: int
@@ -311,7 +311,7 @@ class OptionListCollection(_Options.OptionListCollection):
def set_last_custom_paper_size(self,custom_paper_size):
"""
Sets the last custom paper size used for the any report in this collection.
Set the last custom paper size used for the any report in this collection.
@param custom_paper_size: size to set in cm (width, height)
@type margins: [float, float]
"""
@@ -319,7 +319,7 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_custom_paper_size(self):
"""
Returns the last custom paper size used for the any report in this
Return the last custom paper size used for the any report in this
collection.
@returns: list of last custom paper size used in cm (width, height)
@rtype: [float, float]
@@ -328,7 +328,7 @@ class OptionListCollection(_Options.OptionListCollection):
def set_last_margins(self,margins):
"""
Sets the last margins used for the any report in this collection.
Set the last margins used for the any report in this collection.
@param margins: margins to set in cm (left, right, top, bottom)
@type margins: [float, float, float, float]
"""
@@ -336,7 +336,7 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_margins(self):
"""
Returns the last margins used for the any report in this
Return the last margins used for the any report in this
collection.
@returns: list of last margins used in cm (left, right, top, bottom)
@rtype: [float, float, float, float]
@@ -345,7 +345,7 @@ class OptionListCollection(_Options.OptionListCollection):
def set_last_margin(self,pos,value):
"""
Sets the last margin used for the any report in this collection.
Set the last margin used for the any report in this collection.
@param pos: pos to set (0-4) (left, right, top, bottom)
@type pos: int
@param value: value to set the margin to in cm
@@ -355,7 +355,7 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_margin(self,pos):
"""
Returns the last margins used for the any report in this
Return the last margins used for the any report in this
collection.
@param pos: position in margins list
@type pos: int
@@ -366,7 +366,7 @@ class OptionListCollection(_Options.OptionListCollection):
def set_last_template_name(self,template_name):
"""
Sets the last template used for the any report in this collection.
Set the last template used for the any report in this collection.
template_name: name of the style to set.
"""
@@ -374,13 +374,13 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_template_name(self):
"""
Returns the last template used for the any report in this collection.
Return the last template used for the any report in this collection.
"""
return self.last_template_name
def set_last_format_name(self,format_name):
"""
Sets the last format used for the any report in this collection.
Set the last format used for the any report in this collection.
format_name: name of the format to set.
"""
@@ -388,7 +388,7 @@ class OptionListCollection(_Options.OptionListCollection):
def get_last_format_name(self):
"""
Returns the last format used for the any report in this collection.
Return the last format used for the any report in this collection.
"""
return self.last_format_name
@@ -409,7 +409,7 @@ class OptionListCollection(_Options.OptionListCollection):
f.write(' <orientation value="%d"/>\n' % self.get_last_orientation() )
f.write('</last-common>\n')
def write_module_common(self,f,option_list):
def write_module_common(self,f, option_list):
if option_list.get_style_name() \
and option_list.get_style_name() != self.default_style_name:
f.write(' <style name="%s"/>\n' % escxml(option_list.get_style_name()) )
@@ -464,7 +464,7 @@ class OptionParser(_Options.OptionParser):
def __init__(self,collection):
"""
Creates a OptionParser class that populates the passed collection.
Create a OptionParser class that populates the passed collection.
collection: BookList to be loaded from the file.
"""
@@ -563,7 +563,7 @@ class OptionHandler(_Options.OptionHandler):
"""
Implements handling of the options for the plugins.
"""
def __init__(self,module_name,options_dict):
def __init__(self,module_name, options_dict):
_Options.OptionHandler.__init__(self, module_name, options_dict, None)
def init_subclass(self):
@@ -679,7 +679,7 @@ class OptionHandler(_Options.OptionHandler):
def get_orientation(self):
return self.orientation
def set_orientation(self,orientation):
def set_orientation(self, orientation):
self.orientation = orientation
def get_custom_paper_size(self):
@@ -704,12 +704,12 @@ class ReportOptions(_Options.Options):
"""
Defines options and provides handling interface.
This is a base Options class for the reports. All reports' options
This is a base Options class for the reports. All reports, options
classes should derive from it.
"""
def __init__(self, name, dbase):
"""
Initializes the class, performing usual house-keeping tasks.
Initialize the class, performing usual house-keeping tasks.
Subclasses MUST call this in their __init__() method.
"""
self.name = name

View File

@@ -1172,7 +1172,7 @@ _rtype = {
#-------------------------------------------------------------------------
def pt2cm(pt):
"""
Converts points to centimeters. Fonts are typically specified in points,
Convert points to centimeters. Fonts are typically specified in points,
but the BaseDoc classes use centimeters.
@param pt: points
@@ -1184,7 +1184,7 @@ def pt2cm(pt):
def cm2pt(cm):
"""
Converts centimeters to points. Fonts are typically specified in points,
Convert centimeters to points. Fonts are typically specified in points,
but the BaseDoc classes use centimeters.
@param cm: centimeters
@@ -1196,7 +1196,7 @@ def cm2pt(cm):
def rgb_color(color):
"""
Converts color value from 0-255 integer range into 0-1 float range.
Convert color value from 0-255 integer range into 0-1 float range.
@param color: list or tuple of integer values for red, green, and blue
@type color: int
@@ -1585,7 +1585,7 @@ def empty_notes(whatever):
def get_birth_death_strings(database, person, empty_date="", empty_place=""):
"""
Returns strings for dates and places of birth and death.
Return strings for dates and places of birth and death.
"""
bplace = dplace = empty_place
@@ -2575,7 +2575,7 @@ def common_name(person, use_call=False):
#-------------------------------------------------------------------------
def get_person_mark(db, person):
"""
Returns a IndexMark that can be used to index a person in a report
Return a IndexMark that can be used to index a person in a report
@param db: the GRAMPS database instance
@param person: the the key is for
@@ -2612,7 +2612,7 @@ def get_person_mark(db, person):
#-------------------------------------------------------------------------
def get_address_str(addr):
"""
Returns a string that combines the elements of an addres
Return a string that combines the elements of an addres
@param addr: the GRAMPS address instance
"""
@@ -2640,7 +2640,7 @@ def get_address_str(addr):
#-------------------------------------------------------------------------
def get_person_filters(person, include_single=True):
"""
Returns a list of filters that are relevant for the given person
Return a list of filters that are relevant for the given person
@param person: the person the filters should apply to.
@type person: L{gen.lib.Person}

View File

@@ -38,7 +38,7 @@ class StyleComboBox(gtk.ComboBox):
def __init__(self,model=None):
"""
Initializes the combobox, building the display column.
Initialize the combobox, building the display column.
"""
gtk.ComboBox.__init__(self,model)
cell = gtk.CellRendererText()
@@ -47,7 +47,7 @@ class StyleComboBox(gtk.ComboBox):
def set(self,style_map,default):
"""
Sets the options for the ComboBox, using the passed style
Set the options for the ComboBox, using the passed style
map as the data.
@param style_map: dictionary of style names and the corresponding
@@ -76,7 +76,7 @@ class StyleComboBox(gtk.ComboBox):
def get_value(self):
"""
Returns the selected key (style sheet name).
Return the selected key (style sheet name).
@returns: Returns the name of the selected style sheet
@rtype: str

View File

@@ -67,7 +67,7 @@ class StyleListDisplay:
def __init__(self, stylesheetlist, callback, parent_window):
"""
Creates a StyleListDisplay object that displays the styles in the
Create a StyleListDisplay object that displays the styles in the
StyleSheet.
stylesheetlist - styles that can be editied
@@ -177,7 +177,7 @@ class StyleEditor:
def __init__(self, name, style, parent):
"""
Creates the StyleEditor.
Create the StyleEditor.
name - name of the style that is to be edited
style - style object that is to be edited

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_TemplateParser.py 9912 2008-01-22 09:17:46Z acraphae $
#-----------------------------------------------------------------------
#
@@ -35,9 +35,9 @@ import os
#
#-----------------------------------------------------------------------
try:
from xml.sax import make_parser,handler,SAXParseException
from xml.sax import make_parser, handler,SAXParseException
except:
from _xmlplus.sax import make_parser,handler,SAXParseException
from _xmlplus.sax import make_parser, handler,SAXParseException
#-----------------------------------------------------------------------
#
@@ -57,7 +57,7 @@ class TemplateParser(handler.ContentHandler):
"""
def __init__(self,data,fpath):
"""
Creates a template parser. The parser loads map of tempate names
Create a template parser. The parser loads map of tempate names
to the file containing the tempate.
data - dictionary that holds the name to path mappings
@@ -68,7 +68,7 @@ class TemplateParser(handler.ContentHandler):
self.path = fpath
def setDocumentLocator(self,locator):
"""Sets the XML document locator"""
"""Set the XML document locator"""
self.locator = locator
def startElement(self,tag,attrs):

View File

@@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# $Id$
# $Id:_TextFormatComboBox.py 9912 2008-01-22 09:17:46Z acraphae $
import gtk
import gobject
@@ -32,7 +32,7 @@ import PluginUtils
#-------------------------------------------------------------------------
class TextFormatComboBox(gtk.ComboBox):
def set(self,tables,callback,obj=None,active=None):
def set(self,tables,callback, obj=None,active=None):
self.store = gtk.ListStore(gobject.TYPE_STRING)
self.set_model(self.store)
cell = gtk.CellRendererText()