Bug 3011: change old-style classes to new-style classes

svn: r12559
This commit is contained in:
Gerald Britton 2009-05-21 17:19:50 +00:00
parent 316b997e6d
commit 021b754939
128 changed files with 229 additions and 235 deletions

View File

@ -80,7 +80,7 @@ Application options
#-------------------------------------------------------------------------
# ArgHandler
#-------------------------------------------------------------------------
class ArgHandler:
class ArgHandler(object):
"""
This class is responsible for handling command line arguments (if any)
given to gramps. The valid arguments are:

View File

@ -76,7 +76,7 @@ def fill_entry(entry, data_list):
# StandardCustomSelector class
#
#-------------------------------------------------------------------------
class StandardCustomSelector:
class StandardCustomSelector(object):
"""
This class provides an interface to selecting from the predefined
options or entering custom string.

View File

@ -138,7 +138,7 @@ def cnv2color(text):
# PaperSize
#
#------------------------------------------------------------------------
class PaperSize:
class PaperSize(object):
"""
Defines the dimensions of a sheet of paper. All dimensions are in
centimeters.
@ -188,7 +188,7 @@ class PaperSize:
# PaperStyle
#
#------------------------------------------------------------------------
class PaperStyle:
class PaperStyle(object):
"""
Define the various options for a sheet of paper.
"""
@ -301,7 +301,7 @@ class PaperStyle:
# FontStyle
#
#------------------------------------------------------------------------
class FontStyle:
class FontStyle(object):
"""
Defines a font style. Controls the font face, size, color, and
attributes. In order to remain generic, the only font faces available
@ -415,7 +415,7 @@ class FontStyle:
# TableStyle
#
#------------------------------------------------------------------------
class TableStyle:
class TableStyle(object):
"""
Specifies the style or format of a table. The TableStyle contains the
characteristics of table width (in percentage of the full width), the
@ -498,7 +498,7 @@ class TableStyle:
# TableCellStyle
#
#------------------------------------------------------------------------
class TableCellStyle:
class TableCellStyle(object):
"""
Defines the style of a particular table cell. Characteristics are:
right border, left border, top border, bottom border, and padding.
@ -592,7 +592,7 @@ class TableCellStyle:
# ParagraphStyle
#
#------------------------------------------------------------------------
class ParagraphStyle:
class ParagraphStyle(object):
"""
Defines the characteristics of a paragraph. The characteristics are:
font (a FontStyle instance), right margin, left margin, first indent,
@ -885,7 +885,7 @@ class ParagraphStyle:
# StyleSheetList
#
#------------------------------------------------------------------------
class StyleSheetList:
class StyleSheetList(object):
"""
Interface into the user's defined style sheets. Each StyleSheetList
has a predefined default style specified by the report. Additional
@ -1013,7 +1013,7 @@ class StyleSheetList:
# StyleSheet
#
#------------------------------------------------------------------------
class StyleSheet:
class StyleSheet(object):
"""
A collection of named paragraph styles.
"""
@ -1239,7 +1239,7 @@ class SheetParser(handler.ContentHandler):
# GraphicsStyle
#
#------------------------------------------------------------------------
class GraphicsStyle:
class GraphicsStyle(object):
"""
Defines the properties of graphics objects, such as line width,
color, fill, ect.
@ -1318,7 +1318,7 @@ class GraphicsStyle:
# IndexMark
#
#------------------------------------------------------------------------
class IndexMark:
class IndexMark(object):
"""
Defines a mark to be associated with text for indexing.
"""
@ -1335,7 +1335,7 @@ class IndexMark:
# BaseDoc
#
#------------------------------------------------------------------------
class BaseDoc:
class BaseDoc(object):
"""
Base class for document generators. Different output formats,
such as OpenOffice, AbiWord, and LaTeX are derived from this base
@ -1412,7 +1412,7 @@ class BaseDoc:
def noescape(text):
return text
class TextDoc:
class TextDoc(object):
"""
Abstract Interface for text document generators. Output formats for
text reports must implment this interface to be used by the report
@ -1760,7 +1760,7 @@ class TextDoc:
# DrawDoc
#
#------------------------------------------------------------------------
class DrawDoc:
class DrawDoc(object):
"""
Abstract Interface for graphical document generators. Output formats
for graphical reports must implment this interface to be used by the
@ -1820,7 +1820,7 @@ class DrawDoc:
# GVDoc
#
#-------------------------------------------------------------------------------
class GVDoc:
class GVDoc(object):
"""
Abstract Interface for Graphviz document generators. Output formats
for Graphviz reports must implment this interface to be used by the

View File

@ -86,7 +86,7 @@ def _make_cmp(a,b): return -cmp(a[1], b[1])
# NameDisplay class
#
#-------------------------------------------------------------------------
class NameDisplay:
class NameDisplay(object):
"""
Base class for displaying of Name instances.
"""

View File

@ -40,7 +40,7 @@ import time
# Callback updater
#
#-------------------------------------------------------------------------
class UpdateCallback:
class UpdateCallback(object):
"""
Basic class providing way of calling the callback to update
things during lenghty operations.

View File

@ -42,7 +42,7 @@ def make_bool(val):
else:
return True
class IniKeyClient:
class IniKeyClient(object):
""" Class to emulate gconf's client """
def __init__(self, filename = None):
""" Constructor takes an optional filename """

View File

@ -601,7 +601,7 @@ class Gramplet(object):
def save_options(self):
pass
class GuiGramplet:
class GuiGramplet(object):
"""
Class that handles the plugin interfaces for the GrampletView.
"""

View File

@ -152,7 +152,7 @@ class GuideMap(gtk.DrawingArea):
return (px,py)
# Map tile files used by the ZoomMap
class MapTile:
class MapTile(object):
def __init__( self, filename, x, y, w, h, pw, ph):
self.filename = filename
self.full_path = os.path.join(const.IMAGE_DIR,filename)
@ -226,7 +226,7 @@ class MapTile:
self.scale = None
self.scaled_pixbuf = None
class WMSMapTile:
class WMSMapTile(object):
def __init__(self,capabilities,change_cb=None):
self.change_cb = change_cb
self.scaled_pixbuf = None

View File

@ -357,7 +357,7 @@ class PersonBoxWidget( gtk.DrawingArea, _PersonWidget_base):
else:
self.window.draw_rectangle(self.border_gc, False, 0, 0, alloc.width-4, alloc.height-4)
class FormattingHelper:
class FormattingHelper(object):
def __init__(self,dbstate):
self.dbstate = dbstate
self._text_cache = {}

View File

@ -94,7 +94,7 @@ _KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
_LEFT_BUTTON = 1
_RIGHT_BUTTON = 3
class AttachList:
class AttachList(object):
def __init__(self):
self.list = []

View File

@ -106,7 +106,7 @@ WIKI_HELP_SEC = _('manual|Editing_Dates')
# DateEdit
#
#-------------------------------------------------------------------------
class DateEdit:
class DateEdit(object):
"""Class that associates a pixmap with a text widget, providing visual
feedback that indicates if the text widget contains a valid date"""

View File

@ -46,7 +46,7 @@ import GrampsLocale
# DateDisplay
#
#-------------------------------------------------------------------------
class DateDisplay:
class DateDisplay(object):
_months = GrampsLocale.long_months
MONS = GrampsLocale.short_months

View File

@ -122,7 +122,7 @@ def french_valid(date_tuple):
# Parser class
#
#-------------------------------------------------------------------------
class DateParser:
class DateParser(object):
"""
Convert a text string into a Date object. If the date cannot be
converted, the text string is assigned.

View File

@ -68,7 +68,7 @@ import Errors
# DbLoader class
#
#-------------------------------------------------------------------------
class DbLoader:
class DbLoader(object):
def __init__(self, dbstate, uistate):
self.dbstate = dbstate
self.uistate = uistate

View File

@ -103,7 +103,7 @@ STOCK_COL = 6
RCS_BUTTON = { True : _('_Extract'), False : _('_Archive') }
class CLIDbManager:
class CLIDbManager(object):
"""
Database manager without GTK functionality, allows users to create and
open databases

View File

@ -46,7 +46,7 @@ import Config
# NodeMap
#
#-------------------------------------------------------------------------
class NodeMap:
class NodeMap(object):
"""
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

View File

@ -68,7 +68,7 @@ from Lru import LRU
_CACHE_SIZE = 250
invalid_date_format = Config.get(Config.INVALID_DATE_FORMAT)
class NodeTreeMap:
class NodeTreeMap(object):
def __init__(self):

View File

@ -193,7 +193,7 @@ _RCT_BTM = '</menu></menu></menubar></ui>'
import RecentFiles
import os
class RecentDocsMenu:
class RecentDocsMenu(object):
def __init__(self, uistate, state, fileopen):
self.action_group = gtk.ActionGroup('RecentFiles')
self.active = DISABLED

View File

@ -53,7 +53,7 @@ from DdTargets import DdTargets
from Errors import WindowActiveError
from Selectors import selector_factory
class ObjEntry:
class ObjEntry(object):
"""
Handles the selection of a existing or new Object. Supports Drag and Drop
to select the object.

View File

@ -308,7 +308,7 @@ class EditFamilyEvent(EditEvent):
# Delete Query class
#
#-------------------------------------------------------------------------
class DelEventQuery:
class DelEventQuery(object):
def __init__(self, dbstate, uistate, event, person_list, family_list):
self.event = event
self.db = dbstate.db

View File

@ -381,7 +381,7 @@ class ChildEmbedList(EmbeddedList):
else:
return ("", "")
class FastMaleFilter:
class FastMaleFilter(object):
def __init__(self, db):
self.db = db
@ -390,7 +390,7 @@ class FastMaleFilter:
value = self.db.get_raw_person_data(handle)
return value[2] == gen.lib.Person.MALE
class FastFemaleFilter:
class FastFemaleFilter(object):
def __init__(self, db):
self.db = db

View File

@ -312,7 +312,7 @@ class EditMedia(EditPrimary):
return cmp(cmp_obj.serialize(True)[1:],
self.obj.serialize()[1:]) != 0
class DeleteMediaQuery:
class DeleteMediaQuery(object):
def __init__(self, dbstate, uistate, media_handle, the_lists):
self.db = dbstate.db

View File

@ -322,7 +322,7 @@ class EditNote(EditPrimary):
self.callback(self.obj.get_handle())
self.close()
class DeleteNoteQuery:
class DeleteNoteQuery(object):
def __init__(self, dbstate, uistate, note, the_lists):
self.note = note
self.db = dbstate.db

View File

@ -318,7 +318,7 @@ class EditPlace(EditPrimary):
# DeletePlaceQuery
#
#-------------------------------------------------------------------------
class DeletePlaceQuery:
class DeletePlaceQuery(object):
def __init__(self, dbstate, uistate, place, person_list, family_list,
event_list):

View File

@ -187,7 +187,7 @@ class EditRepository(EditPrimary):
def _cleanup_on_exit(self):
self.backref_list.close()
class DelRepositoryQuery:
class DelRepositoryQuery(object):
def __init__(self, dbstate, uistate, repository, sources):
self.obj = repository
self.db = dbstate.db

View File

@ -205,7 +205,7 @@ class EditSource(EditPrimary):
def _cleanup_on_exit(self):
self.backref_tab.close()
class DelSrcQuery:
class DelSrcQuery(object):
def __init__(self, dbstate, uistate, source, the_lists):
self.source = source
self.db = dbstate.db

View File

@ -46,7 +46,7 @@ from Filters import GenericFilter, Rules
# WriterOptionBox
#
#-------------------------------------------------------------------------
class WriterOptionBox:
class WriterOptionBox(object):
"""
Create a VBox with the option widgets and define methods to retrieve
the options.

View File

@ -32,7 +32,7 @@ from gettext import gettext as _
# Rule
#
#-------------------------------------------------------------------------
class Rule:
class Rule(object):
"""Base rule class."""
labels = []

View File

@ -30,7 +30,7 @@ import Config
_RETURN = gtk.gdk.keyval_from_name("Return")
_KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
class SidebarFilter:
class SidebarFilter(object):
_FILTER_WIDTH = 200
_FILTER_ELLIPSIZE = pango.ELLIPSIZE_END

View File

@ -40,7 +40,7 @@ from Filters._FilterParser import FilterParser
# FilterList
#
#-------------------------------------------------------------------------
class FilterList:
class FilterList(object):
"""
Container class for managing the generic filters.
It stores, saves, and loads the filters.

View File

@ -30,7 +30,7 @@ import gen.lib
# GenericFilter
#
#-------------------------------------------------------------------------
class GenericFilter:
class GenericFilter(object):
"""Filter class that consists of several rules."""
logical_functions = ['or', 'and', 'xor', 'one']

View File

@ -41,7 +41,7 @@ _KP_ENTER = gtk.gdk.keyval_from_name("KP_Enter")
# SearchBar
#
#-------------------------------------------------------------------------
class SearchBar:
class SearchBar(object):
def __init__( self, dbstate, uistate, on_apply, apply_done = None):
self.on_apply_callback = on_apply
self.apply_done_callback = apply_done

View File

@ -24,7 +24,7 @@
Package providing filtering framework for GRAMPS.
"""
class SearchFilter:
class SearchFilter(object):
def __init__(self, func, text, invert):
self.func = func
self.text = text.upper()

View File

@ -1098,7 +1098,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
button.show()
return button
class NameFormatEditDlg:
class NameFormatEditDlg(object):
"""
"""

View File

@ -21,7 +21,7 @@
from ansel_utf8 import ansel_to_utf8
import codecs
class BaseReader:
class BaseReader(object):
def __init__(self, ifile, encoding):
self.ifile = ifile
self.enc = encoding

View File

@ -156,7 +156,7 @@ lds_status = {
#-------------------------------------------------------------------------
from xml.parsers.expat import ParserCreate
class GedcomDescription:
class GedcomDescription(object):
def __init__(self, name):
self.name = name
self.dest = ""
@ -246,7 +246,7 @@ class GedcomDescription:
return self.tag2gramps_map[key]
return key
class GedcomInfoDB:
class GedcomInfoDB(object):
def __init__(self):
self.map = {}
@ -288,7 +288,7 @@ class GedcomInfoDB:
#
#
#-------------------------------------------------------------------------
class GedInfoParser:
class GedInfoParser(object):
def __init__(self,parent):
self.parent = parent
self.current = None

View File

@ -116,7 +116,7 @@ class GedcomDateParser(DateParser):
# GedLine - represents a tokenized version of a GEDCOM line
#
#-----------------------------------------------------------------------
class GedLine:
class GedLine(object):
"""
GedLine is a class the represents a GEDCOM line. The form of a GEDCOM line
is:
@ -325,7 +325,7 @@ def extract_date(text):
# Reader - serves as the lexical analysis engine
#
#-------------------------------------------------------------------------
class Reader:
class Reader(object):
def __init__(self, ifile):
self.ifile = ifile

View File

@ -89,7 +89,7 @@ def add_to_list(table, key, value):
# StageOne
#
#-------------------------------------------------------------------------
class StageOne:
class StageOne(object):
"""
The StageOne parser scans the file quickly, looking for a few things. This
includes:

View File

@ -33,7 +33,7 @@ SURNAME_RE = re.compile(r"/([^/]*)/([^/]*)")
# CurrentState
#
#-------------------------------------------------------------------------
class CurrentState:
class CurrentState(object):
"""
Keep track of the current state variables.
"""
@ -65,7 +65,7 @@ class CurrentState:
# PlaceParser
#
#-------------------------------------------------------------------------
class PlaceParser:
class PlaceParser(object):
"""
Provide the ability to parse GEDCOM FORM statements for places, and
the parse the line of text, mapping the text components to Location
@ -128,7 +128,7 @@ class PlaceParser:
# IdFinder
#
#-------------------------------------------------------------------------
class IdFinder:
class IdFinder(object):
"""
Provide method of finding the next available ID.
"""
@ -161,7 +161,7 @@ class IdFinder:
# IdMapper
#
#-------------------------------------------------------------------------
class IdMapper:
class IdMapper(object):
def __init__(self, trans, find_next, translate):
if translate:

View File

@ -6,7 +6,7 @@ import sys, os,bsddb
class ErrorReportAssistant:
class ErrorReportAssistant(object):
def __init__(self,error_detail,rotate_handler):
self._error_detail = error_detail

View File

@ -33,7 +33,7 @@ from gettext import gettext as _
LOG = logging.getLogger(".")
class LdsTemples:
class LdsTemples(object):
"""
Parsing class for the LDS temples file
"""

View File

@ -49,7 +49,7 @@ NOSORT = -1
# ListModel
#
#-------------------------------------------------------------------------
class ListModel:
class ListModel(object):
"""
Simple model for lists in smaller dialogs (not DataViews).
"""

View File

@ -21,7 +21,7 @@
Least recently used algorithm
"""
class Node:
class Node(object):
"""
Node to be stored in the LRU structure
"""
@ -30,7 +30,7 @@ class Node:
self.value = value
self.next = None
class LRU:
class LRU(object):
"""
Implementation of a length-limited O(1) LRU cache
"""

View File

@ -78,7 +78,7 @@ def get_object(self,value):
return object
return None
class GrampsWindowManager:
class GrampsWindowManager(object):
"""
Manage hierarchy of open GRAMPS windows.
@ -304,7 +304,7 @@ class GrampsWindowManager:
# Gramps Managed Window class
#
#-------------------------------------------------------------------------
class ManagedWindow:
class ManagedWindow(object):
"""
Managed window base class.

View File

@ -346,7 +346,7 @@ def name_of(p):
# Merge People
#
#-------------------------------------------------------------------------
class MergePeople:
class MergePeople(object):
def __init__(self, db, person1, person2):
self.db = db

View File

@ -55,7 +55,7 @@ _btm = [
]
class BaseNavigation:
class BaseNavigation(object):
"""
Base history navigation class. Builds the action group and ui for the
uimanager. Changes to the associated history objects are tracked. When

View File

@ -64,7 +64,7 @@ NAVIGATION_PERSON = 0
# PageView
#
#------------------------------------------------------------------------------
class PageView:
class PageView(object):
"""
The PageView class is the base class for all Data Views in GRAMPS. All
Views should derive from this class. The ViewManager understands the public

View File

@ -1331,7 +1331,7 @@ class GuiStyleOption(GuiEnumeratedListOption):
# GuiMenuOptions class
#
#------------------------------------------------------------------------
class GuiMenuOptions:
class GuiMenuOptions(object):
"""
Introduction
============

View File

@ -56,7 +56,7 @@ import Utils
# List of options for a single module
#
#-------------------------------------------------------------------------
class OptionList:
class OptionList(object):
"""
Implements a set of options to parse and store for a given module.
"""
@ -114,7 +114,7 @@ class OptionList:
# Collection of option lists
#
#-------------------------------------------------------------------------
class OptionListCollection:
class OptionListCollection(object):
"""
Implements a collection of option lists.
"""
@ -288,7 +288,7 @@ class OptionParser(handler.ContentHandler):
# Class handling options for plugins
#
#-------------------------------------------------------------------------
class OptionHandler:
class OptionHandler(object):
"""
Implements handling of the options for the plugins.
"""
@ -394,7 +394,7 @@ class OptionHandler:
# Base Options class
#
#------------------------------------------------------------------------
class Options:
class Options(object):
"""
Defines options and provides handling interface.

View File

@ -71,7 +71,7 @@ tool_categories = {
# Tool
#
#-------------------------------------------------------------------------
class Tool:
class Tool(object):
"""
The Tool base class. This is a base class for generating
customized tools. It cannot be used as is, but it can be easily
@ -82,13 +82,14 @@ class Tool:
from PluginUtils import MenuToolOptions
self.db = dbstate.db
self.person = dbstate.active
if issubclass(options_class, MenuToolOptions):
# FIXME: pass in person_id
self.options = options_class(name, None, dbstate)
elif isinstance(options_class, ClassType):
self.options = options_class(name)
elif isinstance(options_class, InstanceType):
self.options = options_class
try:
if issubclass(options_class, MenuToolOptions):
# FIXME: pass in person_id
self.options = options_class(name, None, dbstate)
else: # must be some kind of class or we get a TypeError
self.options = option_class(name)
except TypeError:
self.options = option_class
self.options.load_previous_values()
def run_tool(self):
@ -147,7 +148,7 @@ class ActivePersonTool(Tool):
# Command-line tool
#
#------------------------------------------------------------------------
class CommandLineTool:
class CommandLineTool(object):
"""
Provide a way to run tool from the command line.

View File

@ -50,7 +50,7 @@ try:
except:
ICON = None
class SaveDialog:
class SaveDialog(object):
def __init__(self,msg1,msg2,task1,task2,parent=None):
self.xml = Glade(toplevel='savedialog')
@ -81,7 +81,7 @@ class SaveDialog:
Config.set(Config.DONT_ASK,self.dontask.get_active())
self.top.destroy()
class QuestionDialog:
class QuestionDialog(object):
def __init__(self,msg1,msg2,label,task,parent=None):
self.xml = Glade(toplevel='questiondialog')
@ -107,7 +107,7 @@ class QuestionDialog:
if response == gtk.RESPONSE_ACCEPT:
task()
class QuestionDialog2:
class QuestionDialog2(object):
def __init__(self,msg1,msg2,label_msg1,label_msg2,parent=None):
self.xml = Glade(toplevel='questiondialog')
@ -137,7 +137,7 @@ class QuestionDialog2:
self.top.destroy()
return (response == gtk.RESPONSE_ACCEPT)
class OptionDialog:
class OptionDialog(object):
def __init__(self,msg1,msg2,btnmsg1,task1,btnmsg2,task2,parent=None):
self.xml = Glade(toplevel='optiondialog')
@ -236,7 +236,7 @@ class OkDialog(gtk.MessageDialog):
self.run()
self.destroy()
class InfoDialog:
class InfoDialog(object):
"""
Dialog to show selectable info in a scrolled window
"""
@ -266,7 +266,7 @@ class InfoDialog:
def get_response(self):
return self.response
class MissingMediaDialog:
class MissingMediaDialog(object):
def __init__(self,msg1,msg2,task1,task2,task3,parent=None):
self.xml = Glade(toplevel='missmediadialog')
@ -320,7 +320,7 @@ class MissingMediaDialog:
self.top)
return True
class MessageHideDialog:
class MessageHideDialog(object):
def __init__(self, title, message, key, parent=None):
self.xml = Glade(toplevel='hidedialog')

View File

@ -52,7 +52,7 @@ MAX_GRAMPS_ITEMS = 10
# RecentItem
#
#-------------------------------------------------------------------------
class RecentItem:
class RecentItem(object):
"""
Interface to a single GRAMPS recent-items item
"""
@ -88,7 +88,7 @@ class RecentItem:
# RecentFiles
#
#-------------------------------------------------------------------------
class RecentFiles:
class RecentFiles(object):
"""
Interface to a RecentFiles collection
"""
@ -187,7 +187,7 @@ class RecentFiles:
# RecentParser
#
#-------------------------------------------------------------------------
class RecentParser:
class RecentParser(object):
"""
Parsing class for the RecentFiles collection.
"""

View File

@ -340,7 +340,7 @@ _nephews_nieces_level = [ "",
#-------------------------------------------------------------------------
class RelationshipCalculator:
class RelationshipCalculator(object):
REL_MOTHER = 'm' # going up to mother
REL_FATHER = 'f' # going up to father

View File

@ -26,7 +26,7 @@ import string
import math
from gen.lib import SourceRef as SourceRef
class Citation:
class Citation(object):
"""
Store information about a citation and all of its references.
"""
@ -99,7 +99,7 @@ class Citation:
self.__ref_list.append((key, source_ref))
return key
class Bibliography:
class Bibliography(object):
"""
Store and organize multiple citations into a bibliography.
"""

View File

@ -101,7 +101,7 @@ def _validate_options(options, dbase):
# Command-line report
#
#------------------------------------------------------------------------
class CommandLineReport:
class CommandLineReport(object):
"""
Provide a way to generate report from the command line.
"""

View File

@ -910,11 +910,13 @@ class GraphvizReportDialog(ReportDialog):
name, translated_name)
def init_options(self, option_class):
if isinstance(option_class, ClassType):
self.options = option_class(self.raw_name,
try:
if (issubclass(option_class, object) or # New-style class
isinstance(options_class, ClassType)): # Old-style class
self.options = option_class(self.raw_name,
self.dbstate.get_database())
elif isinstance(option_class, InstanceType):
self.options = option_class
except TypeError:
self.options = option_class
################################
category = _("GraphViz Layout")

View File

@ -27,7 +27,7 @@
# Report
#
#-------------------------------------------------------------------------
class Report:
class Report(object):
"""
The Report base class. This is a base class for generating
customized reports. It cannot be used as is, but it can be easily

View File

@ -97,9 +97,11 @@ class ReportDialog(ManagedWindow.ManagedWindow):
self.init_interface()
def init_options(self, option_class):
if isinstance(option_class, ClassType):
self.options = option_class(self.raw_name, self.db)
elif isinstance(option_class, InstanceType):
try:
if (issubclass(option_class, object) or # New-style class
isinstance(options_class, ClassType)): # Old-style class
self.options = option_class(self.raw_name, self.db)
except TypeError:
self.options = option_class
self.options.load_previous_values()

View File

@ -542,7 +542,7 @@ class OptionParser(_Options.OptionParser):
# we don't have to handle them for reports that don't use documents (web)
#
#------------------------------------------------------------------------
class EmptyDoc:
class EmptyDoc(object):
def init(self):
pass

View File

@ -60,7 +60,7 @@ from glade import Glade
# StyleList class
#
#------------------------------------------------------------------------
class StyleListDisplay:
class StyleListDisplay(object):
"""
Shows the available paragraph/font styles. Allows the user to select,
add, edit, and delete styles from a StyleSheet.
@ -172,7 +172,7 @@ class StyleListDisplay:
# StyleEditor class
#
#------------------------------------------------------------------------
class StyleEditor:
class StyleEditor(object):
"""
Edits the current style definition. Presents a dialog allowing the values
of the paragraphs in the style to be altered.

View File

@ -887,7 +887,7 @@ class ScratchPadListModel(gtk.ListStore):
# ScratchPadListView class
# Now shown as 'Clipboard'
#-------------------------------------------------------------------------
class ScratchPadListView:
class ScratchPadListView(object):
LOCAL_DRAG_TARGET = ('MY_TREE_MODEL_ROW', gtk.TARGET_SAME_WIDGET, 0)
LOCAL_DRAG_TYPE = 'MY_TREE_MODEL_ROW'

View File

@ -33,7 +33,7 @@ from ReportBase import ReportUtils
from gen.lib import EventType
import Config
class SimpleAccess:
class SimpleAccess(object):
"""
Provide a simplified database access system. This system has been designed to
ease the development of reports.

View File

@ -23,7 +23,7 @@ Provide a simplified database access interface to the GRAMPS database.
"""
import BaseDoc
class SimpleDoc:
class SimpleDoc(object):
"""
Provide a simplified database access interface to the GRAMPS database.
"""

View File

@ -32,7 +32,7 @@ import Errors
import Config
import DateHandler
class SimpleTable:
class SimpleTable(object):
"""
Provide a simplified table creation interface.
"""

View File

@ -49,7 +49,7 @@ from ReportBase import ReportUtils
#
#-------------------------------------------------------------------------
class Sort:
class Sort(object):
def __init__(self, database):
self.database = database

View File

@ -168,7 +168,7 @@ LANGUAGES = {
'zu': _('Zulu'),
}
class Spell:
class Spell(object):
"""Attach a gtkspell instance to the passed TextView instance.
"""
lang = locale.getlocale()[0]

View File

@ -48,7 +48,7 @@ import gen.lib
# SubstKeywords
#
#------------------------------------------------------------------------
class SubstKeywords:
class SubstKeywords(object):
"""
Produce an object that will substitute information about a person
into a passed string.

View File

@ -121,7 +121,7 @@ class TipOfDay(ManagedWindow.ManagedWindow):
# Tip parser class
#
#-------------------------------------------------------------------------
class TipParser:
class TipParser(object):
"""
Interface to the document template file
"""

View File

@ -85,7 +85,7 @@ def short(val,size=60):
#
#-------------------------------------------------------------------------
class TipFromFunction:
class TipFromFunction(object):
"""
TipFromFunction generates a tooltip callable.
"""
@ -118,7 +118,7 @@ class TipFromFunction:
#
#-------------------------------------------------------------------------
class RepositoryTip:
class RepositoryTip(object):
def __init__(self,db,repos):
self._db = db
self._obj = repos
@ -176,7 +176,7 @@ class RepositoryTip:
__call__ = get_tip
class PersonTip:
class PersonTip(object):
def __init__(self,db,repos):
self._db = db
self._obj = repos
@ -214,7 +214,7 @@ class PersonTip:
__call__ = get_tip
class FamilyTip:
class FamilyTip(object):
def __init__(self,db, obj):
self._db = db
self._obj = obj

View File

@ -994,7 +994,7 @@ def media_path_full(db, filename):
return os.path.join(mpath, filename)
class ProgressMeter:
class ProgressMeter(object):
"""
Progress meter class for GRAMPS.

View File

@ -183,7 +183,7 @@ WIKI_HELP_PAGE_MAN = '%s' % const.URL_MANUAL_PAGE
# ViewManager
#
#-------------------------------------------------------------------------
class ViewManager:
class ViewManager(object):
"""
Overview
========

View File

@ -25,7 +25,7 @@ import BaseDoc
#
#
#------------------------------------------------------------------------
class SpreadSheetDoc:
class SpreadSheetDoc(object):
def __init__(self,type, orientation=BaseDoc.PAPER_PORTRAIT):
self.orientation = orientation
if orientation == BaseDoc.PAPER_PORTRAIT:

View File

@ -23,7 +23,7 @@
#
#
#------------------------------------------------------------------------
class TabbedDoc:
class TabbedDoc(object):
def __init__(self, columns):
self.columns = columns
self.name = ""

View File

@ -81,7 +81,7 @@ class DisplayBuf(ManagedWindow.ManagedWindow):
def get_title(self):
return self.title
class DocumentManager:
class DocumentManager(object):
def __init__(self, title, document, text_view):
self.title = title
self.document = document

View File

@ -94,7 +94,7 @@ KEY_TO_CLASS_MAP = {PERSON_KEY: Person.__name__,
_SIGBASE = ('person', 'family', 'source', 'event',
'media', 'place', 'repository', 'reference', 'note')
class GrampsDbBookmarks:
class GrampsDbBookmarks(object):
def __init__(self, default=[]):
self.bookmarks = list(default) # want a copy (not an alias)
@ -2540,7 +2540,7 @@ class GrampsDbBase(Callback):
"""
return self._bm_changes > 0
class Transaction:
class Transaction(object):
"""
Define a group of database commits that define a single logical operation.
"""

View File

@ -18,7 +18,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
class GrampsCursor:
class GrampsCursor(object):
"""
Provide a basic iterator that allows the user to cycle through
the elements in a particular map.

View File

@ -1073,43 +1073,32 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
self.reference_map.associate(self.reference_map_primary_map,
find_primary_handle, open_flags)
# Make a dictionary of the functions and classes that we need for
# Make a tuple of the functions and classes that we need for
# each of the primary object tables.
primary_tables = {
'Person': {'cursor_func': self.get_person_cursor,
'class_func': Person},
'Family': {'cursor_func': self.get_family_cursor,
'class_func': Family},
'Event': {'cursor_func': self.get_event_cursor,
'class_func': Event},
'Place': {'cursor_func': self.get_place_cursor,
'class_func': Place},
'Source': {'cursor_func': self.get_source_cursor,
'class_func': Source},
'MediaObject': {'cursor_func': self.get_media_cursor,
'class_func': MediaObject},
'Repository': {'cursor_func': self.get_repository_cursor,
'class_func': Repository},
'Note': {'cursor_func': self.get_note_cursor,
'class_func': Note},
}
transaction = self.transaction_begin(batch=True, no_magic=True)
callback(4)
primary_table = (
(self.get_person_cursor, Person),
(self.get_family_cursor, Family),
(self.get_event_cursor, Event),
(self.get_place_cursor, Place),
(self.get_source_cursor, Source),
(self.get_media_cursor, MediaObject),
(self.get_repository_cursor, Repository),
(self.get_note_cursor, Note),
)
# Now we use the functions and classes defined above
# to loop through each of the primary object tables.
for primary_table_name in primary_tables.keys():
cursor = primary_tables[primary_table_name]['cursor_func']()
for cursor_func, class_func in primary_table:
cursor = cursor_func()
data = cursor.first()
# Grab the real object class here so that the lookup does
# not happen inside the cursor loop.
class_func = primary_tables[primary_table_name]['class_func']
while data:
found_handle, val = data
obj = InstanceType(class_func)
obj = class_func()
obj.unserialize(val)
the_txn = self.env.txn_begin()
@ -1516,7 +1505,7 @@ class GrampsDBDir(GrampsDbBase, UpdateCallback):
if data_map:
_LOG.error("Failed to get from handle", exc_info=True)
if data:
newobj = InstanceType(class_type)
newobj = class_type()
newobj.unserialize(data)
return newobj
return None

View File

@ -36,7 +36,7 @@ from gen.lib.address import Address
# AddressBase classes
#
#-------------------------------------------------------------------------
class AddressBase:
class AddressBase(object):
"""
Base class for address-aware objects.
"""

View File

@ -36,7 +36,7 @@ from gen.lib.attribute import Attribute
# AttributeBase class
#
#-------------------------------------------------------------------------
class AttributeBase:
class AttributeBase(object):
"""
Base class for attribute-aware objects.
"""

View File

@ -36,7 +36,7 @@ import re
# Base Object
#
#-------------------------------------------------------------------------
class BaseObject:
class BaseObject(object):
"""
The BaseObject is the base class for all data objects in GRAMPS,
whether primary or not.

View File

@ -73,7 +73,7 @@ class DateError(Exception):
def __str__(self):
return self.value
class Span:
class Span(object):
"""
Span is used to represent the difference between two dates for three
main purposes: sorting, ranking, and describing.
@ -578,7 +578,7 @@ class Span:
# Date class
#
#-------------------------------------------------------------------------
class Date:
class Date(object):
"""
The core date handling class for GRAMPs.

View File

@ -36,7 +36,7 @@ from gen.lib.date import Date
# Base classes
#
#-------------------------------------------------------------------------
class DateBase:
class DateBase(object):
"""
Base class for storing date information.
"""

View File

@ -36,7 +36,7 @@ from gen.lib.person import Person
#
#
#-------------------------------------------------------------------------
class GenderStats:
class GenderStats(object):
"""
Class for keeping track of statistics related to Given Name vs. Gender.

View File

@ -36,7 +36,7 @@ from gen.lib.ldsord import LdsOrd
# LdsOrdBase classes
#
#-------------------------------------------------------------------------
class LdsOrdBase:
class LdsOrdBase(object):
"""
Base class for lds_ord-aware objects.
"""

View File

@ -29,7 +29,7 @@ LocationBase class for GRAMPS.
# LocationBase class
#
#-------------------------------------------------------------------------
class LocationBase:
class LocationBase(object):
"""
Base class for all things Address.
"""

View File

@ -36,7 +36,7 @@ from gen.lib.mediaref import MediaRef
# MediaBase class
#
#-------------------------------------------------------------------------
class MediaBase:
class MediaBase(object):
"""
Base class for storing media references.
"""

View File

@ -29,7 +29,7 @@ NoteBase class for GRAMPS.
# NoteBase class
#
#-------------------------------------------------------------------------
class NoteBase:
class NoteBase(object):
"""
Base class for storing notes.

View File

@ -29,7 +29,7 @@ PlaceBase class for GRAMPS.
# PlaceBase class
#
#-------------------------------------------------------------------------
class PlaceBase:
class PlaceBase(object):
"""
Base class for place-aware objects.
"""

View File

@ -29,7 +29,7 @@ PrivacyBase Object class for GRAMPS.
# PrivacyBase Object
#
#-------------------------------------------------------------------------
class PrivacyBase:
class PrivacyBase(object):
"""
Base class for privacy-aware objects.
"""

View File

@ -29,7 +29,7 @@ Base Reference class for GRAMPS.
# RefBase class
#
#-------------------------------------------------------------------------
class RefBase:
class RefBase(object):
"""
Base reference class to manage references to other objects.

View File

@ -36,7 +36,7 @@ from gen.lib.srcref import SourceRef
# SourceBase classes
#
#-------------------------------------------------------------------------
class SourceBase:
class SourceBase(object):
"""
Base class for storing source references.
"""

View File

@ -29,7 +29,7 @@ SourceNote class for GRAMPS.
# SourceNote classes
#
#-------------------------------------------------------------------------
class SourceNote:
class SourceNote(object):
"""This class is only present to enable db upgrade."""
def __init__(self):

View File

@ -36,7 +36,7 @@ from gen.lib.url import Url
# UrlBase classes
#
#-------------------------------------------------------------------------
class UrlBase:
class UrlBase(object):
"""
Base class for url-aware objects.
"""

View File

@ -29,7 +29,7 @@ Witness class for GRAMPS.
# Witness class
#
#-------------------------------------------------------------------------
class Witness:
class Witness(object):
"""This class is only present to enable db upgrade."""
def __init__(self):
pass

View File

@ -23,7 +23,7 @@
This module provides the base class for plugins.
"""
class Plugin:
class Plugin(object):
"""
This class serves as a base class for all plugins that can be registered
with the plugin manager

View File

@ -29,7 +29,7 @@ Abstracted option handling.
# Menu class
#
#-------------------------------------------------------------------------
class Menu:
class Menu(object):
"""
Introduction
============

View File

@ -34,7 +34,7 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
from gen.lib import *
class DbBase:
class DbBase(object):
"""
DbBase is intended to be an abstract base class for building classes that
implement the Gramps database. All functions raise a NotImplementedError to

View File

@ -223,7 +223,7 @@ def _display_welcome_message():
# Main Gramps class
#
#-------------------------------------------------------------------------
class Gramps:
class Gramps(object):
"""
Main class corresponding to a running gramps process.

View File

@ -181,7 +181,7 @@ def _get_subject(options, dbase):
# Book Item class
#
#------------------------------------------------------------------------
class BookItem:
class BookItem(object):
"""
Interface into the book item -- a smallest element of the book.
"""
@ -252,7 +252,7 @@ class BookItem:
# Book class
#
#------------------------------------------------------------------------
class Book:
class Book(object):
"""
Interface into the user-defined book -- a collection of book items.
"""
@ -359,7 +359,7 @@ class Book:
# BookList class
#
#------------------------------------------------------------------------
class BookList:
class BookList(object):
"""
Interface into the user-defined list of books.
@ -552,7 +552,7 @@ class BookParser(handler.ContentHandler):
# BookList Display class
#
#------------------------------------------------------------------------
class BookListDisplay:
class BookListDisplay(object):
"""
Interface into a dialog with the list of available books.

View File

@ -171,7 +171,7 @@ def paperstyle_to_pagesetup(paper_style):
# PrintPreview class
#
#------------------------------------------------------------------------
class PrintPreview:
class PrintPreview(object):
"""Implement a dialog to show print preview.
"""
zoom_factors = {

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