* src/ChooseParents.py: pychecker changes

* src/DdTargets.py: pychecker changes
* src/FamilyView.py: pychecker changes
* src/GrampsCfg.py: pychecker changes
* src/MergeData.py: pychecker changes
* src/MergePeople.py: pychecker changes
* src/NameEdit.py: pychecker changes
* src/NoteEdit.py: pychecker changes
* src/RelLib.py: pychecker changes
* src/gramps_main.py: pychecker changes


svn: r4327
This commit is contained in:
Don Allingham 2005-04-09 03:11:03 +00:00
parent 02171a00af
commit 4736f4ece9
12 changed files with 34 additions and 1307 deletions

View File

@ -1,4 +1,15 @@
2005-04-08 Don Allingham <don@gramps-project.org> 2005-04-08 Don Allingham <don@gramps-project.org>
* src/AddMedia.py: pychecker changes
* src/ChooseParents.py: pychecker changes
* src/DdTargets.py: pychecker changes
* src/FamilyView.py: pychecker changes
* src/GrampsCfg.py: pychecker changes
* src/MergeData.py: pychecker changes
* src/MergePeople.py: pychecker changes
* src/NameEdit.py: pychecker changes
* src/NoteEdit.py: pychecker changes
* src/RelLib.py: pychecker changes
* src/gramps_main.py: pychecker changes
* src/GrampsDbBase.py: correctly handle signals when undoing a * src/GrampsDbBase.py: correctly handle signals when undoing a
delete operation delete operation
* src/PeopleView.py: remove unused signal * src/PeopleView.py: remove unused signal

View File

@ -114,8 +114,6 @@ class AddMediaObject:
description = unicode(self.description.get_text()) description = unicode(self.description.get_text())
if self.internal.get_active(): if self.internal.get_active():
import NoteEdit
mobj = RelLib.MediaObject() mobj = RelLib.MediaObject()
mobj.set_description(description) mobj.set_description(description)
mobj.set_mime_type(None) mobj.set_mime_type(None)
@ -169,7 +167,7 @@ class AddMediaObject:
self.image.set_from_pixbuf(image) self.image.set_from_pixbuf(image)
def run(self): def run(self):
while 1: while True:
val = self.window.run() val = self.window.run()
if val == gtk.RESPONSE_OK: if val == gtk.RESPONSE_OK:

View File

@ -644,8 +644,6 @@ class ModifyParents:
self.window.destroy() self.window.destroy()
def build_list(self,opt_menu,sel): def build_list(self,opt_menu,sel):
cell = gtk.CellRendererText()
store = gtk.ListStore(str) store = gtk.ListStore(str)
for val in self.keys: for val in self.keys:
store.append(row=[val]) store.append(row=[val])

View File

@ -67,9 +67,9 @@ class _DdType:
def _calculate_id(self): def _calculate_id(self):
"""return the next available app_id.""" """return the next available app_id."""
id = _DdType._APP_ID_OFFSET idval = _DdType._APP_ID_OFFSET
_DdType._APP_ID_OFFSET += 1 _DdType._APP_ID_OFFSET += 1
return id return idval
def target(self): def target(self):
"""return the full target information in the format """return the full target information in the format

View File

@ -635,7 +635,7 @@ class FamilyView:
self.person.set_preferred_family_handle(self.family) self.person.set_preferred_family_handle(self.family)
trans = self.parent.db.transaction_begin() trans = self.parent.db.transaction_begin()
self.parent.db.commit_person(self.person,trans) self.parent.db.commit_person(self.person,trans)
n = self.person.get_primary_name().get_regular_name() n = NameDisplay.displayer.display(self.person)
self.parent.db.transaction_commit(trans,_("Set Preferred Spouse (%s)") % n) self.parent.db.transaction_commit(trans,_("Set Preferred Spouse (%s)") % n)
self.load_family() self.load_family()
@ -648,9 +648,7 @@ class FamilyView:
DisplayTrace.DisplayTrace() DisplayTrace.DisplayTrace()
def edit_marriage_callback(self,obj): def edit_marriage_callback(self,obj):
Marriage.Marriage( Marriage.Marriage(self.parent, self.family,self.parent.db)
self.parent, self.family,self.parent.db, self.parent.new_after_edit,
self.load_family, self.parent.source_view.build_tree)
def sp_button_press(self,obj,event): def sp_button_press(self,obj,event):
if event.state & gtk.gdk.SHIFT_MASK and \ if event.state & gtk.gdk.SHIFT_MASK and \
@ -880,9 +878,9 @@ class FamilyView:
p.remove_family_handle(cur_family.get_handle()) p.remove_family_handle(cur_family.get_handle())
self.parent.db.commit_person(p,trans) self.parent.db.commit_person(p,trans)
if len(cur_person.get_family_handle_list()) > 0: # if len(cur_person.get_family_handle_list()) > 0:
handle = cur_person.get_family_handle_list()[0] # handle = cur_person.get_family_handle_list()[0]
family = self.parent.db.find_family_from_handle(handle,trans) # family = self.parent.db.find_family_from_handle(handle,trans)
person_id = cur_person.get_handle() person_id = cur_person.get_handle()
self.person = self.parent.db.get_person_from_handle(person_id) self.person = self.parent.db.get_person_from_handle(person_id)
@ -1111,7 +1109,6 @@ class FamilyView:
self.family = self.parent.db.get_family_from_handle(flist[0]) self.family = self.parent.db.get_family_from_handle(flist[0])
else: else:
self.family = None self.family = None
n = NameDisplay.displayer.display(person)
def display_marriage(self,family): def display_marriage(self,family):
if not family: if not family:

View File

@ -85,7 +85,6 @@ def set_calendar_date_format():
def _update_calendar_date_format(active,dlist): def _update_calendar_date_format(active,dlist):
GrampsKeys.save_date_format(active,dlist) GrampsKeys.save_date_format(active,dlist)
format_list = DateHandler.get_date_formats()
DateHandler.set_format(active) DateHandler.set_format(active)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,6 @@ from gettext import gettext as _
import RelLib import RelLib
import ReportUtils import ReportUtils
import Utils import Utils
import ListModel
import NameDisplay import NameDisplay
import const import const
import gtk import gtk
@ -117,8 +116,8 @@ class Compare:
if len(plist) > 0: if len(plist) > 0:
self.add(tobj,title,_("Parents")) self.add(tobj,title,_("Parents"))
for fid in person.get_parent_family_handle_list(): for fid in person.get_parent_family_handle_list():
(fn,mn,id) = self.get_parent_info(fid[0]) (fn,mn,gid) = self.get_parent_info(fid[0])
self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),id)) self.add(tobj,normal,"%s:\t%s" % (_('Family ID'),gid))
if fn: if fn:
self.add(tobj,indent,"%s:\t%s" % (_('Father'),fn)) self.add(tobj,indent,"%s:\t%s" % (_('Father'),fn))
if mn: if mn:
@ -421,7 +420,7 @@ class MergePeople:
src_family = self.db.get_family_from_handle(src_family_handle) src_family = self.db.get_family_from_handle(src_family_handle)
family_num += 1 family_num += 1
if not src_family or src_family in self.p1.get_family_handle_list(): if not src_family or src_family in family_list:
continue continue
tgt_family = self.find_family(src_family) tgt_family = self.find_family(src_family)
@ -538,7 +537,7 @@ class MergePeople:
if self.p2 == fam.get_mother_handle(): if self.p2 == fam.get_mother_handle():
fam.set_mother_handle(self.p1) fam.set_mother_handle(self.p1)
if fam.get_father_handle() == None and fam.get_mother_handle() == None: if fam.get_father_handle() == None and fam.get_mother_handle() == None:
self.delete_empty_family(fam) self.delete_empty_family(fam,trans)
data = cursor.next() data = cursor.next()
def remove_marriage(self,family,person,trans): def remove_marriage(self,family,person,trans):

View File

@ -282,7 +282,7 @@ class NameEditor:
self.name.set_sort_as(self.sort_as.get_active()) self.name.set_sort_as(self.sort_as.get_active())
self.parent.lists_changed = 1 self.parent.lists_changed = 1
if self.group_over.get_active() == False: if not self.group_over.get_active():
self.name.set_group_as("") self.name.set_group_as("")
self.parent.lists_changed = 1 self.parent.lists_changed = 1
elif self.name.get_group_as() != grp_as: elif self.name.get_group_as() != grp_as:

View File

@ -65,7 +65,6 @@ class NoteEditor:
def draw(self): def draw(self):
"""Displays the NoteEditor window""" """Displays the NoteEditor window"""
title = "%s - GRAMPS" % _("Edit Note")
self.top = self.glade.get_widget('note_edit') self.top = self.glade.get_widget('note_edit')
alt_title = self.glade.get_widget('title_msg') alt_title = self.glade.get_widget('title_msg')

View File

@ -165,6 +165,7 @@ class PrimaryObject(BaseObject):
@param source: Object used to initialize the new object @param source: Object used to initialize the new object
@type source: PrimaryObject @type source: PrimaryObject
""" """
BaseObject.__init__(self)
if source: if source:
self.gramps_id = source.gramps_id self.gramps_id = source.gramps_id
self.handle = source.handle self.handle = source.handle
@ -1994,13 +1995,13 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
return self.place == handle return self.place == handle
elif classname == 'Person': elif classname == 'Person':
return handle in [ witness.val for witness in self.witness \ return handle in [ witness.val for witness in self.witness \
if witness.type == ID ] if witness.type == Event.ID ]
return False return False
def _remove_handle_references(self,classname,handle_list): def _remove_handle_references(self,classname,handle_list):
if classname == 'Person' and self.witness: if classname == 'Person' and self.witness:
new_list = [ witness for witness in self.witness \ new_list = [ witness for witness in self.witness \
if witness.type == ID and \ if witness.type == Event.ID and \
witness.val not in handle_list ] witness.val not in handle_list ]
self.witness = new_list self.witness = new_list
elif classname == 'Place' and self.place in handle_list: elif classname == 'Place' and self.place in handle_list:
@ -2009,8 +2010,8 @@ class Event(PrimaryObject,PrivateSourceNote,MediaBase,DateBase,PlaceBase):
def _replace_handle_reference(self,classname,old_handle,new_handle): def _replace_handle_reference(self,classname,old_handle,new_handle):
if classname == 'Person' and self.witness: if classname == 'Person' and self.witness:
for witness in self.witness: for witness in self.witness:
if witness.type == ID and witness.val == old_handle: if witness.type == Event.ID and witness.val == old_handle:
witness.val = new_hanlde witness.val = new_handle
elif classname == 'Place' and self.place == old_handle: elif classname == 'Place' and self.place == old_handle:
self.place = new_handle self.place = new_handle

View File

@ -726,7 +726,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
if self.hindex > 0: if self.hindex > 0:
try: try:
self.hindex -= step self.hindex -= step
handle = unicode(self.history[self.hindex]) handle = str(self.history[self.hindex])
self.active_person = self.db.get_person_from_handle(handle) self.active_person = self.db.get_person_from_handle(handle)
self.modify_statusbar() self.modify_statusbar()
self.emit('active-changed',(handle,)) self.emit('active-changed',(handle,))
@ -756,7 +756,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
if self.hindex+1 < len(self.history): if self.hindex+1 < len(self.history):
try: try:
self.hindex += step self.hindex += step
handle = unicode(self.history[self.hindex]) handle = str(self.history[self.hindex])
self.active_person = self.db.get_person_from_handle(handle) self.active_person = self.db.get_person_from_handle(handle)
self.modify_statusbar() self.modify_statusbar()
self.emit('active-changed',(handle,)) self.emit('active-changed',(handle,))
@ -1458,7 +1458,7 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
self.set_buttons(0) self.set_buttons(0)
self.active_person = None self.active_person = None
self.modify_statusbar() self.modify_statusbar()
self.emit('active-changed',(u"",)) self.emit('active-changed',("",))
elif (self.active_person == None or elif (self.active_person == None or
person.get_handle() != self.active_person.get_handle()): person.get_handle() != self.active_person.get_handle()):
self.active_person = self.db.get_person_from_handle(person.get_handle()) self.active_person = self.db.get_person_from_handle(person.get_handle())
@ -1486,11 +1486,11 @@ class Gramps(GrampsDBCallback.GrampsDBCallback):
else: else:
self.backbtn.set_sensitive(0) self.backbtn.set_sensitive(0)
self.back.set_sensitive(0) self.back.set_sensitive(0)
self.emit('active-changed',(unicode(person.get_handle()),)) self.emit('active-changed',(str(person.get_handle()),))
else: else:
self.active_person = self.db.get_person_from_handle(person.get_handle()) self.active_person = self.db.get_person_from_handle(person.get_handle())
self.set_buttons(1) self.set_buttons(1)
self.emit('active-changed',(unicode(person.get_handle()),)) self.emit('active-changed',(str(person.get_handle()),))
def modify_statusbar(self): def modify_statusbar(self):