* src/GrampsDb/_GrampsDbBase.py: pychecker
* src/GrampsDb/_GrampsBSDDB.py: pychecker * src/RelLib/_CalSdn.py: pychecker * src/RelLib/_PrivateSourceNote.py: pychecker * src/RelLib/_GenderStats.py: pychecker * src/MergePeople.py: pychecker * src/SelectObject.py: pychecker * src/ScratchPad.py: pychecker * src/ImgManip.py: pychecker * src/docgen/ODFDoc.py: pychecker * src/docgen/OpenOfficeDoc.py: pychecker * src/docgen/LPRDoc.py: pychecker * src/SelectEvent.py: pychecker svn: r6418
This commit is contained in:
parent
e275aef029
commit
5b8749ba73
13
ChangeLog
13
ChangeLog
@ -3,6 +3,19 @@
|
||||
* src/plugins/NavWebPage.py: keep up with RelLib changes
|
||||
|
||||
2006-04-22 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_GrampsDbBase.py: pychecker
|
||||
* src/GrampsDb/_GrampsBSDDB.py: pychecker
|
||||
* src/RelLib/_CalSdn.py: pychecker
|
||||
* src/RelLib/_PrivateSourceNote.py: pychecker
|
||||
* src/RelLib/_GenderStats.py: pychecker
|
||||
* src/MergePeople.py: pychecker
|
||||
* src/SelectObject.py: pychecker
|
||||
* src/ScratchPad.py: pychecker
|
||||
* src/ImgManip.py: pychecker
|
||||
* src/docgen/ODFDoc.py: pychecker
|
||||
* src/docgen/OpenOfficeDoc.py: pychecker
|
||||
* src/docgen/LPRDoc.py: pychecker
|
||||
* src/SelectEvent.py: pychecker
|
||||
* src/GrampsDb/_ReadXML.py: fix Type str_from_xml calls
|
||||
* src/DataViews/_MediaView.py: Shorten tab name
|
||||
* src/DataViews/_RepositoryView.py: Shorten tab name
|
||||
|
@ -1217,7 +1217,7 @@ class GrampsBSDDB(GrampsDbBase):
|
||||
while data:
|
||||
handle,val = data
|
||||
p = Person(val)
|
||||
self.genderStats.count_person(p,self)
|
||||
self.genderStats.count_person(p)
|
||||
data = cursor.next()
|
||||
cursor.close()
|
||||
self.metadata.put('version',7)
|
||||
|
@ -405,9 +405,9 @@ class GrampsDbBase(GrampsDBCallback):
|
||||
if (old_data[2] != person.gender or
|
||||
old_data[3][2]!= person.primary_name.first_name):
|
||||
self.genderStats.uncount_person(old_person)
|
||||
self.genderStats.count_person(person, self)
|
||||
self.genderStats.count_person(person)
|
||||
else:
|
||||
self.genderStats.count_person(person, self)
|
||||
self.genderStats.count_person(person)
|
||||
|
||||
for attr in person.attribute_list:
|
||||
self.individual_attributes.add(str(attr.type))
|
||||
@ -831,7 +831,7 @@ class GrampsDbBase(GrampsDBCallback):
|
||||
obj.handle = self.create_id()
|
||||
commit_func(obj, transaction)
|
||||
if obj.__class__.__name__ == 'Person':
|
||||
self.genderStats.count_person (obj, self)
|
||||
self.genderStats.count_person (obj)
|
||||
return obj.handle
|
||||
|
||||
def add_person(self, person, transaction):
|
||||
|
@ -67,9 +67,6 @@ class ImgManip:
|
||||
return (self.width, self.height)
|
||||
|
||||
def fmt_thumbnail(self,dest,width,height,cnv):
|
||||
w = int(width)
|
||||
h = int(height)
|
||||
|
||||
scaled = self.img.scale_simple(width, height, gtk.gdk.INTERP_BILINEAR)
|
||||
scaled.save(dest,cnv)
|
||||
|
||||
|
@ -55,7 +55,7 @@ sex = ( _("female"), _("male"), _("unknown"))
|
||||
class Compare:
|
||||
|
||||
def __init__(self, db, person1, person2, update) :
|
||||
self.glade = gtk.glade.XML(const.mergeFile,"merge")
|
||||
self.glade = gtk.glade.XML(const.merge_glade, "merge")
|
||||
self.top = self.glade.get_widget('merge')
|
||||
self.text1 = self.glade.get_widget('text1')
|
||||
self.text2 = self.glade.get_widget('text2')
|
||||
@ -166,7 +166,7 @@ class Compare:
|
||||
if spouse_id:
|
||||
spouse = self.db.get_person_from_handle(spouse_id)
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Spouse'),name_of(spouse)))
|
||||
relstr = const.family_relations[family.get_relationship()][0]
|
||||
relstr = str(family.get_relationship())
|
||||
self.add(tobj,indent,"%s:\t%s" % (_('Type'),relstr))
|
||||
event = ReportUtils.find_marriage(self.db,family)
|
||||
if event:
|
||||
@ -256,7 +256,7 @@ def check_for_child(p1, p2):
|
||||
class MergePeopleUI:
|
||||
|
||||
def __init__(self,db,person1,person2,update):
|
||||
glade = gtk.glade.XML(const.mergeFile,'merge_people')
|
||||
glade = gtk.glade.XML(const.merge_glade, 'merge_people')
|
||||
top = glade.get_widget('merge_people')
|
||||
p1 = glade.get_widget('person1')
|
||||
p2 = glade.get_widget('person2')
|
||||
@ -572,7 +572,7 @@ class MergePeople:
|
||||
# of the families, and adding the families to the merged
|
||||
# person
|
||||
|
||||
for (family_handle,mrel,frel) in parent_list:
|
||||
for family_handle in parent_list:
|
||||
self.convert_child_ids(family_handle, self.new_handle,
|
||||
self.old_handle, trans)
|
||||
new.add_parent_family_handle(family_handle, mrel, frel)
|
||||
@ -584,13 +584,14 @@ class MergePeople:
|
||||
"""
|
||||
family = self.db.get_family_from_handle(fhandle)
|
||||
new_child_list = []
|
||||
orig_list = family.get_child_handle_list()
|
||||
orig_list = family.get_child_ref_list()
|
||||
|
||||
# loop through original child list. If a handle matches the
|
||||
# old handle, replace it with the new handle if the new handle
|
||||
# is not already in the list
|
||||
for child_id in orig_list:
|
||||
if child_id == old_handle:
|
||||
|
||||
for child_ref in orig_list:
|
||||
if child_ref.ref == old_handle:
|
||||
if new_handle not in new_child_list:
|
||||
new_child_list.append(new_handle)
|
||||
elif child_id not in new_child_list:
|
||||
@ -599,7 +600,7 @@ class MergePeople:
|
||||
# compare the new list with the original list. If this list
|
||||
# is different, we need to save the changes to the database.
|
||||
if new_child_list != orig_list:
|
||||
family.set_child_handle_list(new_child_list)
|
||||
family.set_child_ref_list(new_child_list)
|
||||
self.db.commit_family(family,trans)
|
||||
|
||||
def merge_relationships(self,new,trans):
|
||||
|
@ -25,7 +25,7 @@
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import cmath
|
||||
import math
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -482,24 +482,24 @@ def persian_sdn(year, month, day):
|
||||
v1 = (month - 1) * 31
|
||||
else:
|
||||
v1 = ((month - 1) * 30) + 6
|
||||
v2 = cmath.floor(((epyear * 682) - 110) / 2816)
|
||||
v2 = math.floor(((epyear * 682) - 110) / 2816)
|
||||
v3 = (epyear - 1) * 365 + day
|
||||
v4 = cmath.floor(epbase / 2820) * 1029983
|
||||
v4 = math.floor(epbase / 2820) * 1029983
|
||||
|
||||
return int(cmath.ceil(v1 + v2 + v3 + v4 + _PRS_EPOCH - 1))
|
||||
return int(math.ceil(v1 + v2 + v3 + v4 + _PRS_EPOCH - 1))
|
||||
|
||||
def persian_ymd(sdn):
|
||||
sdn = cmath.floor(sdn) + 0.5
|
||||
sdn = math.floor(sdn) + 0.5
|
||||
|
||||
depoch = sdn - 2121446
|
||||
cycle = cmath.floor(depoch / 1029983)
|
||||
cycle = math.floor(depoch / 1029983)
|
||||
cyear = depoch % 1029983
|
||||
if cyear == 1029982:
|
||||
ycycle = 2820
|
||||
else:
|
||||
aux1 = cmath.floor(cyear / 366)
|
||||
aux1 = math.floor(cyear / 366)
|
||||
aux2 = cyear % 366
|
||||
ycycle = cmath.floor(((2134*aux1)+(2816*aux2)+2815)/1028522) + aux1 + 1
|
||||
ycycle = math.floor(((2134*aux1)+(2816*aux2)+2815)/1028522) + aux1 + 1
|
||||
|
||||
year = ycycle + (2820 * cycle) + 474
|
||||
if year <= 0:
|
||||
@ -507,22 +507,22 @@ def persian_ymd(sdn):
|
||||
|
||||
yday = sdn - persian_sdn(year, 1, 1) + 1
|
||||
if yday < 186:
|
||||
month = cmath.ceil(yday / 31)
|
||||
month = math.ceil(yday / 31)
|
||||
else:
|
||||
month = cmath.ceil((yday - 6) / 30)
|
||||
month = math.ceil((yday - 6) / 30)
|
||||
day = (sdn - persian_sdn(year, month, 1)) + 1
|
||||
return (int(year), int(month), int(day))
|
||||
|
||||
def islamic_sdn(year, month, day):
|
||||
v1 = cmath.ceil(29.5 * (month - 1))
|
||||
v1 = math.ceil(29.5 * (month - 1))
|
||||
v2 = (year - 1) * 354
|
||||
v3 = cmath.floor((3 + (11 *year)) / 30)
|
||||
v3 = math.floor((3 + (11 *year)) / 30)
|
||||
|
||||
return int(cmath.ceil((day + v1 + v2 + v3 + _ISM_EPOCH) - 1))
|
||||
return int(math.ceil((day + v1 + v2 + v3 + _ISM_EPOCH) - 1))
|
||||
|
||||
def islamic_ymd(sdn):
|
||||
sdn = cmath.floor(sdn) + 0.5
|
||||
year = int(cmath.floor(((30*(sdn-_ISM_EPOCH))+10646)/10631))
|
||||
month = int(min(12, cmath.ceil((sdn-(29+islamic_sdn(year,1,1)))/29.5) + 1))
|
||||
sdn = math.floor(sdn) + 0.5
|
||||
year = int(math.floor(((30*(sdn-_ISM_EPOCH))+10646)/10631))
|
||||
month = int(min(12, math.ceil((sdn-(29+islamic_sdn(year,1,1)))/29.5) + 1))
|
||||
day = int((sdn - islamic_sdn(year,month,1)) + 1)
|
||||
return (year,month,day)
|
||||
|
@ -63,7 +63,7 @@ class GenderStats:
|
||||
return self.stats[name]
|
||||
return (0, 0, 0)
|
||||
|
||||
def count_person (self, person, db, undo = 0):
|
||||
def count_person (self, person, undo = 0):
|
||||
if not person:
|
||||
return
|
||||
# Let the Person do their own counting later
|
||||
@ -90,7 +90,7 @@ class GenderStats:
|
||||
return
|
||||
|
||||
def uncount_person (self, person):
|
||||
return self.count_person (person, None, undo = 1)
|
||||
return self.count_person (person, undo = 1)
|
||||
|
||||
def guess_gender (self, name):
|
||||
name = self._get_key_from_name (name)
|
||||
|
@ -24,6 +24,9 @@
|
||||
PrivateSourceNote class for GRAMPS
|
||||
"""
|
||||
|
||||
from _SourceNote import SourceNote
|
||||
from _PrivacyBase import PrivacyBase
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PrivateSourceNote class
|
||||
@ -32,4 +35,5 @@ PrivateSourceNote class for GRAMPS
|
||||
class PrivateSourceNote(SourceNote,PrivacyBase):
|
||||
# FIXME: this class is only present to enable db upgrade
|
||||
def __init__(self):
|
||||
pass
|
||||
SourceNote.__init__(self)
|
||||
PrivacyBase.__init__(self)
|
||||
|
@ -29,7 +29,6 @@ import cPickle as pickle
|
||||
import os
|
||||
from xml.sax.saxutils import escape
|
||||
from gettext import gettext as _
|
||||
import Utils
|
||||
from time import strftime as strftime
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -193,9 +192,6 @@ class ScratchPadLocation(ScratchPadGrampsTypeWrapper):
|
||||
"\t<b>%s:</b>\t%s\n"\
|
||||
"\t<b>%s:</b>\n"\
|
||||
"\t\t%s\n"\
|
||||
"\t\t%s\n"\
|
||||
"\t\t%s\n"\
|
||||
"\t\t%s\n"\
|
||||
"\t<b>%s:</b>\t%s\n" % (
|
||||
_("Location"),
|
||||
escape(self._obj.get_city()),
|
||||
@ -259,8 +255,8 @@ class ScratchPadFamilyEvent(ScratchPadGrampsTypeWrapper):
|
||||
DRAG_TARGET = DdTargets.FAMILY_EVENT
|
||||
ICON = BLANK_PIC
|
||||
|
||||
def __init__(self,db,obj):
|
||||
ScratchPadGrampsTypeWrapper.__init__(self,db,obj)
|
||||
def __init__(self, dbstate, obj):
|
||||
ScratchPadGrampsTypeWrapper.__init__(self, dbstate, obj)
|
||||
self._type = _("Family Event")
|
||||
self._title = str(self._obj.get_type())
|
||||
self._value = self._obj.get_description()
|
||||
@ -277,7 +273,7 @@ class ScratchPadFamilyEvent(ScratchPadGrampsTypeWrapper):
|
||||
_("Family Event"),
|
||||
_("Type"),escape(str(self._obj.get_type())),
|
||||
_("Date"),escape(DateHandler.get_date(self._obj)),
|
||||
_("Place"),escape(place_title(self.db,self._obj)),
|
||||
_("Place"),escape(place_title(self._db, self._obj)),
|
||||
_("Cause"),escape(self._obj.get_cause()),
|
||||
_("Description"), escape(self._obj.get_description()))
|
||||
|
||||
@ -325,7 +321,7 @@ class ScratchPadAttribute(ScratchPadGrampsTypeWrapper):
|
||||
def __init__(self, db, obj):
|
||||
ScratchPadGrampsTypeWrapper.__init__(self, db, obj)
|
||||
self._type = _("Attribute")
|
||||
self._title = Utils.format_personal_attribute(self._obj.get_type())
|
||||
self._title = str(self._obj.get_type())
|
||||
self._value = self._obj.get_value()
|
||||
|
||||
def tooltip(self):
|
||||
@ -334,7 +330,7 @@ class ScratchPadAttribute(ScratchPadGrampsTypeWrapper):
|
||||
"\t<b>%s:</b>\t%s\n"\
|
||||
"\t<b>%s:</b>\t%s" % (_("Attribute"),
|
||||
_("Type"),
|
||||
escape(Utils.format_personal_attribute(self._obj.get_type())),
|
||||
escape(str(self._obj.get_type())),
|
||||
_("Value"),
|
||||
escape(self._obj.get_value()))
|
||||
|
||||
@ -358,7 +354,7 @@ class ScratchPadFamilyAttribute(ScratchPadGrampsTypeWrapper):
|
||||
def __init__(self, db, obj):
|
||||
ScratchPadGrampsTypeWrapper.__init__(self, db, obj)
|
||||
self._type = _("Family Attribute")
|
||||
self._title = Utils.format_family_attribute(self._obj.get_type())
|
||||
self._title = str(self._obj.get_type())
|
||||
self._value = self._obj.get_value()
|
||||
|
||||
def tooltip(self):
|
||||
@ -367,7 +363,7 @@ class ScratchPadFamilyAttribute(ScratchPadGrampsTypeWrapper):
|
||||
"\t<b>%s:</b>\t%s\n"\
|
||||
"\t<b>%s:</b>\t%s" % (_("Family Attribute"),
|
||||
_("Type"),
|
||||
escape(Utils.format_family_attribute(self._obj.get_type())),
|
||||
escape(str(self._obj.get_type())),
|
||||
_("Value"),
|
||||
escape(self._obj.get_value()))
|
||||
|
||||
@ -506,7 +502,7 @@ class ScratchMediaObj(ScratchPadWrapper):
|
||||
DRAG_TARGET = DdTargets.MEDIAOBJ
|
||||
ICON = LINK_PIC
|
||||
|
||||
def __init__(self, db, nobj):
|
||||
def __init__(self, db, obj):
|
||||
ScratchPadWrapper.__init__(self, db, obj)
|
||||
self._type = _("Media Object")
|
||||
|
||||
|
@ -49,7 +49,6 @@ import gtk.glade
|
||||
import const
|
||||
import Utils
|
||||
import ListModel
|
||||
import RelLib
|
||||
import DateHandler
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -108,36 +108,6 @@ class SelectObject:
|
||||
self.object_model.add([pixbuf,title,obj.get_gramps_id(),the_type],key)
|
||||
self.object_model.connect_model()
|
||||
|
||||
def on_select_row(self,obj):
|
||||
store,node = self.object_model.get_selected()
|
||||
if not node:
|
||||
return
|
||||
data = self.object_model.get_data(node,range(self.ncols))
|
||||
handle = data[4]
|
||||
obj = self.db.get_object_from_handle(handle)
|
||||
the_type = obj.get_mime_type()
|
||||
path = obj.get_path()
|
||||
|
||||
if the_type and the_type.startswith("image/"):
|
||||
image = ImgManip.get_thumbnail_image(path,the_type)
|
||||
else:
|
||||
image = Mime.find_mime_type_pixbuf(the_type)
|
||||
self.preview.set_from_pixbuf(image)
|
||||
|
||||
self.object_handle.set_text(obj.get_gramps_id())
|
||||
if the_type:
|
||||
self.object_type.set_text(the_type)
|
||||
else:
|
||||
self.object_type.set_text("")
|
||||
self.object_desc.set_text(obj.get_description())
|
||||
if len(path) == 0:
|
||||
self.object_path.set_text(_("The file no longer exists"))
|
||||
elif path[0] == "/":
|
||||
self.object_path.set_text(path)
|
||||
else:
|
||||
self.object_path.set_text("<local>")
|
||||
self.object_details.set_text(Utils.get_detail_text(obj,0))
|
||||
|
||||
def run(self):
|
||||
val = self.top.run()
|
||||
|
||||
|
@ -60,6 +60,8 @@ else:
|
||||
print " or wait for the next gnome-python release."
|
||||
### end FIXME ###
|
||||
|
||||
import Errors
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
@ -773,7 +775,6 @@ class LPRDoc(BaseDoc.BaseDoc):
|
||||
photo.get_rowstride())
|
||||
|
||||
self.gpc.grestore()
|
||||
x = x
|
||||
y = y - height
|
||||
return (x,y)
|
||||
|
||||
|
@ -38,7 +38,6 @@ from math import pi, cos, sin, fabs
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Errors
|
||||
import BaseDoc
|
||||
import const
|
||||
from PluginUtils import ReportUtils, \
|
||||
|
@ -28,7 +28,6 @@
|
||||
import os
|
||||
import zipfile
|
||||
import time
|
||||
import locale
|
||||
from cStringIO import StringIO
|
||||
from math import pi, cos, sin, fabs
|
||||
from gettext import gettext as _
|
||||
@ -39,7 +38,6 @@ from xml.sax.saxutils import escape
|
||||
# Gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import Errors
|
||||
import BaseDoc
|
||||
import const
|
||||
from PluginUtils import ReportUtils, \
|
||||
|
Loading…
Reference in New Issue
Block a user