pychecker fixes

svn: r3166
This commit is contained in:
Don Allingham 2004-05-13 22:45:51 +00:00
parent 5cbfb777a7
commit 5b81ee5c12
33 changed files with 207 additions and 224 deletions

View File

@ -107,7 +107,6 @@ class AddMediaObject:
"""
filename = self.glade.get_widget("photosel").get_full_path(0)
description = unicode(self.description.get_text())
external = self.glade.get_widget("private")
if os.path.exists(filename) == 0:
msgstr = _("Cannot import %s")
@ -115,13 +114,13 @@ class AddMediaObject:
ErrorDialog(msgstr % filename, msgstr2)
return
type = GrampsMime.get_type(filename)
mtype = GrampsMime.get_type(filename)
if description == "":
description = os.path.basename(filename)
mobj = RelLib.MediaObject()
mobj.set_description(description)
mobj.set_mime_type(type)
mobj.set_mime_type(mtype)
self.db.add_object(mobj)
name = filename
@ -134,7 +133,7 @@ class AddMediaObject:
self.db.commit_media_object(mobj,trans)
self.db.add_transaction(trans)
def on_name_changed(self,obj):
def on_name_changed(self,*obj):
"""
Called anytime the filename text window changes. Checks to
see if the file exists. If it does, the imgae is loaded into
@ -150,9 +149,9 @@ class AddMediaObject:
self.temp_name = root
if os.path.isfile(filename):
type = GrampsMime.get_type(filename)
mtype = GrampsMime.get_type(filename)
if type[0:5] == "image":
if mtype[0:5] == "image":
image = RelImage.scale_image(filename,const.thumbScale)
else:
image = gtk.gdk.pixbuf_new_from_file(Utils.find_icon(type))
@ -171,3 +170,4 @@ class AddMediaObject:
else:
self.window.destroy()
return None
return None

View File

@ -54,6 +54,7 @@ import Utils
import GrampsCfg
import PeopleModel
import Date
import Marriage
#-------------------------------------------------------------------------
#

View File

@ -38,7 +38,6 @@ import gnome
# gramps modules
#
#-------------------------------------------------------------------------
import Utils
from gettext import gettext as _
#-------------------------------------------------------------------------

View File

@ -49,7 +49,6 @@ import gnome
# gramps modules
#
#-------------------------------------------------------------------------
import Date
import RelLib
import const
import Utils

View File

@ -111,8 +111,8 @@ class EditPerson:
self.window.set_title("%s - GRAMPS" % _('Edit Person'))
self.icon_list = self.top.get_widget("iconlist")
self.gallery = ImageSelect.Gallery(person, self.path, self.icon_list,
self.db,self,self.window)
self.gallery = ImageSelect.Gallery(person, self.db.commit_person, self.path,
self.icon_list, self.db, self,self.window)
self.complete = self.get_widget('complete')
self.name_delete_btn = self.top.get_widget('aka_delete')

View File

@ -95,7 +95,8 @@ class EditPlace:
Utils.set_titles(self.top,title_label,_('Place Editor'))
self.glry = ImageSelect.Gallery(place, self.path, self.iconlist, self.db, self,self.top)
self.glry = ImageSelect.Gallery(place, self.db.commit_place, self.path,
self.iconlist, self.db, self,self.top)
self.title = self.top_window.get_widget("place_title")
self.city = self.top_window.get_widget("city")
self.parish = self.top_window.get_widget("parish")

View File

@ -76,7 +76,8 @@ class EditSource:
_('Source Editor'))
plwidget = self.top_window.get_widget("iconlist")
self.gallery = ImageSelect.Gallery(source, self.path, plwidget, db, self, self.top)
self.gallery = ImageSelect.Gallery(source, db.commit_place, self.path,
plwidget, db, self, self.top)
self.author = self.top_window.get_widget("author")
self.pubinfo = self.top_window.get_widget("pubinfo")
self.abbrev = self.top_window.get_widget("abbrev")

View File

@ -254,7 +254,7 @@ class FamilyView:
and event.state == gtk.gdk.CONTROL_MASK:
self.spouse_swap(obj)
elif event.keyval == gtk.gdk.keyval_from_name("Delete") and not event.state:
self.remove_spouse(obj,trans)
self.remove_spouse(obj)
elif event.keyval == gtk.gdk.keyval_from_name("Insert") and not event.state:
self.select_spouse(obj)
elif event.keyval == gtk.gdk.keyval_from_name("Insert") \

View File

@ -150,8 +150,8 @@ class GedcomInfoDB:
self.standard.set_dest("GEDCOM 5.5")
try:
file = "%s/gedcom.xml" % const.dataDir
f = open(file.encode('iso8859-1'),"r")
filepath = "%s/gedcom.xml" % const.dataDir
f = open(filepath.encode('iso8859-1'),"r")
except:
return

View File

@ -209,9 +209,10 @@ _drag_targets = [
#
#-------------------------------------------------------------------------
class Gallery(ImageSelect):
def __init__(self, dataobj, path, icon_list, db, parent, parent_window=None):
def __init__(self, dataobj, commit, path, icon_list, db, parent, parent_window=None):
ImageSelect.__init__(self, path, db, parent, parent_window)
self.commit = commit
if path:
icon_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, _drag_targets,
gtk.gdk.ACTION_COPY | gtk.gdk.ACTION_MOVE)
@ -255,6 +256,9 @@ class Gallery(ImageSelect):
if not ok:
if self.old_media_list is not None:
self.dataobj.set_media_list(self.old_media_list)
trans = self.db.start_transaction()
self.commit(self.dataobj,trans)
self.db.add_transaction(trans)
def on_canvas1_event(self,obj,event):
"""
@ -471,7 +475,6 @@ class Gallery(ImageSelect):
if GrampsCfg.mediaref == 0:
name = RelImage.import_media_object(name,self.path,photo.get_id())
photo.set_path(name)
photo.setLocal(1)
self.parent.lists_changed = 1
if GrampsCfg.globalprop:
GlobalMediaProperties(self.db,photo,None)
@ -488,7 +491,6 @@ class Gallery(ImageSelect):
photo = RelLib.MediaObject()
photo.set_mime_type(mime)
photo.set_description(d)
photo.setLocal(1)
photo.set_path(tfile)
self.db.add_object(photo)
oref = RelLib.MediaRef()
@ -497,7 +499,6 @@ class Gallery(ImageSelect):
try:
id = photo.get_id()
name = RelImage.import_media_object(tfile,self.path,id)
photo.setLocal(1)
photo.set_path(name)
except:
photo.set_path(tfile)
@ -529,7 +530,7 @@ class Gallery(ImageSelect):
return
index = index + 1
oref = RelLib.MediaRef()
oref.set_reference(data.data)
oref.set_reference_id(data.data)
self.dataobj.add_media_reference(oref)
self.add_thumbnail(oref)
self.parent.lists_changed = 1
@ -599,8 +600,9 @@ class Gallery(ImageSelect):
mtype = object.get_mime_type()
progname = GrampsMime.get_application(mtype)
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
photo,self.popup_view_photo)
if progname and len(progname) > 1:
Utils.add_menuitem(menu,_("Open in %s") % progname[1],
photo,self.popup_view_photo)
if mtype[0:5] == "image":
Utils.add_menuitem(menu,_("Edit with the GIMP"),
photo,self.popup_edit_photo)
@ -628,7 +630,6 @@ class Gallery(ImageSelect):
name = RelImage.import_media_object(object.get_path(),self.path,
object.get_id())
object.set_path(name)
object.setLocal(1)
def popup_change_description(self, obj):
"""Bring up a window allowing the user to edit the description

View File

@ -270,7 +270,6 @@ class MediaView:
name = RelImage.import_media_object(self.obj.get_path(),path,id)
if name:
self.obj.set_path(name)
self.obj.setLocal(1)
self.load_media()
def popup_change_description(self, obj):
@ -344,7 +343,7 @@ class MediaView:
if not iter:
return
if (const.dnd_images):
object = self.db.get_object(store.get_value(iter,1))
object = self.db.find_object_from_id(store.get_value(iter,1))
mtype = object.get_mime_type()
name = Utils.thumb_path(self.db.get_save_path(),object)
pix = gtk.gdk.pixbuf_new_from_file(name)
@ -361,6 +360,7 @@ class MediaView:
selection_data.set(selection_data.target, 8, id)
def on_drag_data_received(self,w, context, x, y, data, info, time):
print "on_drag_data_received"
import urlparse
if data and data.format == 8:
d = string.strip(string.replace(data.data,'\0',' '))
@ -371,8 +371,6 @@ class MediaView:
photo = RelLib.MediaObject()
photo.set_path(name)
photo.set_mime_type(mime)
if mime[0:5] == "image":
photo.set_thumbnail(RelImage.build_thumbnail(name))
description = os.path.basename(name)
photo.set_description(description)
trans = self.db.start_transaction()
@ -384,7 +382,6 @@ class MediaView:
photo.get_id())
if name:
photo.set_path(name)
photo.setLocal(1)
self.db.commit_media_object(photo,trans)
self.db.add_transaction(trans)
@ -402,21 +399,17 @@ class MediaView:
mime = GrampsMime.get_type(tfile)
photo = RelLib.MediaObject()
photo.set_mime_type(mime)
if mime[0:5] == "image":
photo.set_thumbnail(RelImage.build_thumbnail(name))
photo.set_description(d)
photo.setLocal(1)
photo.set_path(tfile)
trans = self.db.start_transaction()
self.db.add_object(photo,trans)
oref = RelLib.MediaRef()
oref.set_reference(photo)
oref.set_reference_id(photo.get_id())
try:
id = photo.get_id()
path = self.db.get_save_path()
name = RelImage.import_media_object(tfile,path,id)
if name:
photo.setLocal(1)
photo.set_path(name)
except:
photo.set_path(tfile)

View File

@ -136,11 +136,11 @@ class NameEditor:
self.add_itself_to_menu()
self.window.show()
def on_delete_event(self,obj,b):
def on_delete_event(self,*obj):
self.close_child_windows()
self.remove_itself_from_menu()
def close(self,obj):
def close(self,*obj):
self.close_child_windows()
self.remove_itself_from_menu()
self.window.destroy()
@ -175,10 +175,10 @@ class NameEditor:
self.winsmenu.destroy()
self.parent_menu_item.destroy()
def present(self,obj):
def present(self,*obj):
self.window.present()
def on_help_clicked(self,obj):
def on_help_clicked(self,*obj):
"""Display the relevant portion of GRAMPS manual"""
gnome.help_display('gramps-manual','gramps-edit-complete')
@ -192,12 +192,12 @@ class NameEditor:
format = self.preform.get_active()
priv = self.priv.get_active()
type = unicode(self.type_field.entry.get_text())
mtype = unicode(self.type_field.entry.get_text())
if const.NameTypesMap.has_value(type):
type = const.NameTypesMap.find_key(type)
if const.NameTypesMap.has_value(mtype):
mtype = const.NameTypesMap.find_key(mtype)
else:
type = "Also Known As"
mtype = "Also Known As"
if self.name == None:
self.name = RelLib.Name()
@ -205,7 +205,7 @@ class NameEditor:
self.name.set_source_reference_list(self.srcreflist)
self.update_name(first,last,suffix,title,type,note,format,priv)
self.update_name(first,last,suffix,title,mtype,note,format,priv)
self.parent.lists_changed = 1
self.callback(self.name)

View File

@ -32,7 +32,6 @@ import gtk
# gramps modules
#
#-------------------------------------------------------------------------
import Utils
from gettext import gettext as _
#-------------------------------------------------------------------------
@ -95,10 +94,10 @@ class NoteEditor:
self.add_itself_to_menu()
self.top.show()
def on_delete_event(self,obj,b):
def on_delete_event(self,*obj):
self.remove_itself_from_menu()
def close(self,obj):
def close(self,*obj):
self.remove_itself_from_menu()
self.top.destroy()
@ -113,14 +112,14 @@ class NoteEditor:
del self.parent.child_windows[self.win_key]
self.parent_menu_item.destroy()
def present(self,obj):
def present(self,*obj):
self.top.present()
def on_save_note_clicked(self,obj):
"""Saves the note and closes the window"""
buffer = self.entry.get_buffer()
text = unicode(buffer.get_text(buffer.get_start_iter(),
buffer.get_end_iter(),gtk.FALSE))
tbuffer = self.entry.get_buffer()
text = unicode(tbuffer.get_text(tbuffer.get_start_iter(),
tbuffer.get_end_iter(),gtk.FALSE))
if text != self.data.get_note():
self.data.set_note(text)
self.close(obj)

View File

@ -27,7 +27,6 @@
#
#-------------------------------------------------------------------------
from gettext import gettext as _
import os
#-------------------------------------------------------------------------
#
@ -39,8 +38,6 @@ import gtk.glade
from gtk.gdk import ACTION_COPY, BUTTON1_MASK
_sel_mode = gtk.SELECTION_SINGLE
#-------------------------------------------------------------------------
#
# gtk
@ -48,7 +45,6 @@ _sel_mode = gtk.SELECTION_SINGLE
#-------------------------------------------------------------------------
import PeopleModel
import GenericFilter
import const
column_names = [
_('Name'),
@ -131,7 +127,7 @@ class PeopleView:
self.sort_model.set_visible_column(PeopleModel.COLUMN_VIEW)
self.person_tree.set_model(self.sort_model)
def blist(self,store,path,iter,id_list):
def blist(self, store, path, iter, id_list):
id_list.append(self.sort_model.get_value(iter,1))
def get_selected_objects(self):
@ -192,11 +188,11 @@ class PeopleView:
self.parent.mhistory.remove(del_id)
def apply_filter_clicked(self):
qualifer = unicode(self.parent.filter_text.get_text())
mi = self.parent.filter_list.get_menu().get_active()
self.DataFilter = mi.get_data("filter")
if self.DataFilter.need_param:
self.DataFilter.set_parameter(unicode(self.parent.filter_text.get_text()))
qual = unicode(self.parent.filter_text.get_text())
self.DataFilter.set_parameter(qual)
self.apply_filter()
self.goto_active_person()
@ -207,14 +203,13 @@ class PeopleView:
if not self.parent.active_person:
return
p = self.parent.active_person
id = p.get_id()
path = self.person_model.on_get_path(id)
path = self.person_model.on_get_path(p.get_id())
top_path = self.person_model.on_get_path(p.get_primary_name().get_surname())
self.person_tree.expand_row(top_path,0)
self.person_selection.select_path(path)
self.person_tree.scroll_to_cell(path,None,1,0.5,0)
def alpha_event(self,obj,a,b):
def alpha_event(self,*obj):
self.parent.load_person(self.parent.active_person)
def apply_filter(self,current_model=None):

View File

@ -471,7 +471,6 @@ def register_import(task, name):
def register_report(task, name,
category=_("Uncategorized"),
description=_unavailable,
xpm=None,
status=_("Unknown"),
author_name=_("Unknown"),
author_email=_("Unknown")

View File

@ -42,7 +42,6 @@ import Calendar
import Date
import GrampsMime
import RelLib
import Utils
import const
#-------------------------------------------------------------------------
@ -69,7 +68,6 @@ def importData(database, filename, callback,cl=0):
database.smap = {}
database.pmap = {}
database.fmap = {}
missmedia_action = 0
parser = GrampsParser(database,callback,basefile)
@ -145,84 +143,84 @@ def importData(database, filename, callback,cl=0):
xml_file.close()
#-------------------------------------------------------------------------
def remove_clicked():
# File is lost => remove all references and the object itself
mobj = database.find_object_from_id(NewMediaID)
for fid in database.get_family_keys():
p = database.find_family_from_id(fid)
nl = p.get_media_list()
for o in nl:
if o.get_reference() == mobj:
nl.remove(o)
p.set_media_list(nl)
for key in database.get_person_keys():
p = database.find_person_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_id() == mobj.get_id():
nl.remove(o)
p.set_media_list(nl)
for key in database.get_source_keys():
p = database.find_source_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference_id() == mobj.get_id():
nl.remove(o)
p.set_media_list(nl)
for key in database.get_place_id_keys():
p = database.find_place_from_id(key)
nl = p.get_media_list()
for o in nl:
if o.get_reference() == mobj:
nl.remove(o)
p.set_media_list(nl)
database.remove_object(NewMediaID)
# def remove_clicked():
# # File is lost => remove all references and the object itself
# mobj = database.find_object_from_id(NewMediaID)
# for fid in database.get_family_keys():
# p = database.find_family_from_id(fid)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference() == mobj:
# nl.remove(o)
# p.set_media_list(nl)
# for key in database.get_person_keys():
# p = database.find_person_from_id(key)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference_id() == mobj.get_id():
# nl.remove(o)
# p.set_media_list(nl)
# for key in database.get_source_keys():
# p = database.find_source_from_id(key)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference_id() == mobj.get_id():
# nl.remove(o)
# p.set_media_list(nl)
# for key in database.get_place_id_keys():
# p = database.find_place_from_id(key)
# nl = p.get_media_list()
# for o in nl:
# if o.get_reference() == mobj:
# nl.remove(o)
# p.set_media_list(nl)
# database.remove_object(NewMediaID)
def leave_clicked():
# File is lost => do nothing, leave as is
pass
# def leave_clicked():
# # File is lost => do nothing, leave as is
# pass
def select_clicked():
# File is lost => select a file to replace the lost one
def fs_close_window(obj):
pass
# def select_clicked():
# # File is lost => select a file to replace the lost one
# def fs_close_window(obj):
# pass
def fs_ok_clicked(obj):
name = fs_top.get_filename()
if os.path.isfile(name):
shutil.copyfile(name,newfile)
try:
shutil.copystat(name,newfile)
except:
pass
# def fs_ok_clicked(obj):
# name = fs_top.get_filename()
# if os.path.isfile(name):
# shutil.copyfile(name,newfile)
# try:
# shutil.copystat(name,newfile)
# except:
# pass
choose = gtk.FileChooserDialog('Select file',
None,
gtk.FILE_CHOOSER_ACTION_OPEN,
(gtk.STOCK_CANCEL,
gtk.RESPONSE_CANCEL,
gtk.STOCK_OPEN,
gtk.RESPONSE_OK))
# choose = gtk.FileChooserDialog('Select file',
# None,
# gtk.FILE_CHOOSER_ACTION_OPEN,
# (gtk.STOCK_CANCEL,
# gtk.RESPONSE_CANCEL,
# gtk.STOCK_OPEN,
# gtk.RESPONSE_OK))
filter = gtk.FileFilter()
filter.set_name(_('All files'))
filter.add_pattern('*')
choose.add_filter(filter)
# filter = gtk.FileFilter()
# filter.set_name(_('All files'))
# filter.add_pattern('*')
# choose.add_filter(filter)
response = choose.run()
if response == gtk.RESPONSE_OK:
name = fs_top.get_filename()
if os.path.isfile(name):
shutil.copyfile(name,newfile)
try:
shutil.copystat(name,newfile)
except:
pass
choose.destroy()
# response = choose.run()
# if response == gtk.RESPONSE_OK:
# name = fs_top.get_filename()
# if os.path.isfile(name):
# shutil.copyfile(name,newfile)
# try:
# shutil.copystat(name,newfile)
# except:
# pass
# choose.destroy()
del parser
return 1
# del parser
# return 1
#-------------------------------------------------------------------------
#
@ -678,14 +676,14 @@ class GrampsParser:
else:
self.object.set_path(src)
def stop_people(self,tag):
def stop_people(self,*tag):
pass
def stop_object(self,tag):
def stop_object(self,*tag):
self.db.commit_media_object(self.object)
self.object = None
def stop_objref(self,tag):
def stop_objref(self,*tag):
self.objref = None
def start_photo(self,attrs):
@ -790,7 +788,7 @@ class GrampsParser:
def start_pos(self,attrs):
self.person.position = (int(attrs["x"]), int(attrs["y"]))
def stop_attribute(self,tag):
def stop_attribute(self,*tag):
self.attribute = None
def stop_comment(self,tag):
@ -815,27 +813,27 @@ class GrampsParser:
def stop_attr_value(self,tag):
self.attribute.set_value(tag)
def stop_address(self,tag):
def stop_address(self,*tag):
self.address = None
def stop_places(self,tag):
def stop_places(self,*tag):
self.placeobj = None
def stop_photo(self,tag):
def stop_photo(self,*tag):
self.photo = None
def stop_placeobj(self,tag):
def stop_placeobj(self,*tag):
if self.placeobj.get_title() == "":
loc = self.placeobj.get_main_location()
self.placeobj.set_title(build_place_title(loc))
self.db.commit_place(self.placeobj)
self.placeobj = None
def stop_family(self,tag):
def stop_family(self,*tag):
self.db.commit_family(self.family)
self.family = None
def stop_event(self,tag):
def stop_event(self,*tag):
self.event.name = self.event_type
if self.family:
@ -887,10 +885,10 @@ class GrampsParser:
def stop_first(self,tag):
self.name.set_first_name(tag)
def stop_families(self,tag):
def stop_families(self,*tag):
self.family = None
def stop_person(self,tag):
def stop_person(self,*tag):
self.db.commit_person(self.person)
self.person = None
@ -912,10 +910,10 @@ class GrampsParser:
def stop_stitle(self,tag):
self.source.set_title(tag)
def stop_sourceref(self,tag):
def stop_sourceref(self,*tag):
self.source_ref = None
def stop_source(self,tag):
def stop_source(self,*tag):
self.db.commit_source(self.source)
self.source = None
@ -948,7 +946,7 @@ class GrampsParser:
def stop_spage(self,tag):
self.source_ref.set_page(tag)
def stop_lds_ord(self,tag):
def stop_lds_ord(self,*tag):
self.ord = None
def stop_spubinfo(self,tag):

View File

@ -1377,9 +1377,9 @@ class Person(SourceNote):
"""returns the list of Event instances"""
return self.event_list
def set_event_list(self,list):
def set_event_list(self,elist):
"""sets the event list to the passed list"""
self.event_list = list
self.event_list = elist
def add_family_id(self,family_id):
"""adds the specified Family instance to the list of
@ -1401,7 +1401,7 @@ class Person(SourceNote):
def clear_family_id_list(self) :
self.family_list = []
def remove_family_id(self,family,trans=None):
def remove_family_id(self,family):
"""removes the specified Family instance from the list
of marriages/partnerships"""
assert(type(family) == types.StringType or type(family) == types.UnicodeType)
@ -1421,9 +1421,9 @@ class Person(SourceNote):
"""returns the list of addresses"""
return self.address_list
def set_address_list(self,list):
def set_address_list(self,alist):
"""sets the address list to the specified list"""
self.address_list = list
self.address_list = alist
def add_attribute(self,attribute):
"""adds an Attribute instance to the attribute list"""

View File

@ -439,7 +439,7 @@ class BareReportDialog:
change_button = gtk.Button("%s..." % _('C_hange') )
change_button.connect('clicked',self.on_center_person_change_clicked)
self.tbl.attach(change_button,3,4,self.col,self.col+1,gtk.SHRINK|gtk.SHRINK)
self.tbl.attach(change_button,3,4,self.col,self.col+1,gtk.SHRINK)
self.col += 1
def setup_style_frame(self):
@ -605,8 +605,8 @@ class BareReportDialog:
def setup_other_frames(self):
for key in self.frame_names:
list = self.frames[key]
table = gtk.Table(3,len(list))
flist = self.frames[key]
table = gtk.Table(3,len(flist))
table.set_col_spacings(12)
table.set_row_spacings(6)
table.set_border_width(6)
@ -615,7 +615,7 @@ class BareReportDialog:
self.notebook.append_page(table,l)
row = 0
for (text,widget) in list:
for (text,widget) in flist:
if text:
text_widget = gtk.Label('%s:' % text)
text_widget.set_alignment(0.0,0.5)
@ -709,7 +709,7 @@ class BareReportDialog:
# Callback functions from the dialog
#
#------------------------------------------------------------------------
def on_cancel(self,obj):
def on_cancel(self,*obj):
self.window.destroy()
def on_ok_clicked(self, obj):
@ -724,14 +724,14 @@ class BareReportDialog:
# Clean up the dialog object
self.window.destroy()
def on_style_edit_clicked(self, obj):
def on_style_edit_clicked(self, *obj):
"""The user has clicked on the 'Edit Styles' button. Create a
style sheet editor object and let them play. When they are
done, the previous routine will be called to update the dialog
menu for selecting a style."""
StyleEditor.StyleListDisplay(self.style_sheet_list,self.build_style_menu)
def on_center_person_change_clicked(self,obj):
def on_center_person_change_clicked(self,*obj):
import SelectPerson
sel_person = SelectPerson.SelectPerson(self.db,_('Select Person'))
new_person = sel_person.run()
@ -970,11 +970,11 @@ class ReportDialog(BareReportDialog):
self.tbl.attach(self.format_menu,2,4,self.col,self.col+1)
self.col += 1
type = self.format_menu.get_menu().get_active()
ext = type.get_data('ext')
mtype = self.format_menu.get_menu().get_active()
ext = mtype.get_data('ext')
if ext == None:
ext = ""
if type:
if mtype:
spath = self.get_default_directory()
if self.get_target_is_directory():
self.target_fileentry.set_filename(spath)

View File

@ -42,6 +42,14 @@ import const
from QuestionDialog import QuestionDialog
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
column_names = [
_('Title'),
_('ID'),
@ -50,13 +58,6 @@ column_names = [
_('Publication Information'),
]
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# SouceView

View File

@ -58,9 +58,9 @@ class TarFile:
temp = buf % (blank)
for c in temp:
chksum = chksum + ord(c)
sum = "%06o " % chksum
sum = sum + nul
buf = buf % sum
vsum = "%06o " % chksum
vsum = vsum + nul
buf = buf % vsum
self.pos = self.pos + len(buf)
self.f.write(buf)

View File

@ -89,10 +89,10 @@ class UrlEditor:
self.add_itself_to_menu()
self.window.show()
def on_delete_event(self,obj,b):
def on_delete_event(self,*obj):
self.remove_itself_from_menu()
def close(self,obj):
def close(self,*obj):
self.remove_itself_from_menu()
self.window.destroy()
@ -108,10 +108,10 @@ class UrlEditor:
del self.parent.child_windows[self.win_key]
self.parent_menu_item.destroy()
def present(self,obj):
def present(self,*obj):
self.window.present()
def on_help_clicked(self,obj):
def on_help_clicked(self,*obj):
"""Display the relevant portion of GRAMPS manual"""
gnome.help_display('gramps-manual','gramps-edit-complete')

View File

@ -35,6 +35,7 @@ import locale
#
#-------------------------------------------------------------------------
import gtk
import gnome
#-------------------------------------------------------------------------
#
@ -59,9 +60,6 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
_history_brokenFlag = 0
LISTOBJ = "s"
OBJECT = "o"
def history_broken():
global _history_brokenFlag
_history_brokenFlag = 1
@ -240,7 +238,7 @@ def delete_selected(obj,list):
#-------------------------------------------------------------------------
def add_menuitem(menu,msg,obj,func):
item = gtk.MenuItem(msg)
item.set_data(OBJECT,obj)
item.set_data('o',obj)
item.connect("activate",func)
item.show()
menu.append(item)

View File

@ -194,7 +194,10 @@ class AbiWordDoc(BaseDoc.BaseDoc):
except:
return
aspect_ratio = float(x)/float(y)
if y:
aspect_ratio = float(x)/float(y)
else:
aspect_ratio = 1
if aspect_ratio > x_cm/y_cm:
act_width = x_cm
@ -318,12 +321,12 @@ import Utils
try:
prog = GrampsMime.get_application("application/x-abiword")
type = GrampsMime.get_description('application/x-abiword')
mtype = GrampsMime.get_description('application/x-abiword')
if Utils.search_for(prog[0]):
print_label=_("Open in %s" % prog[1])
else:
print_label=None
Plugins.register_text_doc(type,AbiWordDoc,1,1,1,".abw", print_label)
Plugins.register_text_doc(mtype,AbiWordDoc,1,1,1,".abw", print_label)
except:
Plugins.register_text_doc('AbiWord document',AbiWordDoc,1,1,1,".abw", None)

View File

@ -359,15 +359,15 @@ print_label = None
try:
import Utils
prog = GrampsMime.get_application("text/plain")
type = GrampsMime.get_description('text/plain')
mprog = GrampsMime.get_application("text/plain")
mtype = GrampsMime.get_description('text/plain')
if Utils.search_for(prog[0]):
print_label=_("Open in %s" % prog[1])
if Utils.search_for(mprog[0]):
print_label=_("Open in %s" % mprog[1])
else:
print_label=None
Plugins.register_text_doc(type,AsciiDoc,1,1,1,".txt", print_label)
Plugins.register_text_doc(mtype,AsciiDoc,1,1,1,".txt", print_label)
except:
Plugins.register_text_doc("Plain Text",AsciiDoc,1,1,1,".txt", None)

View File

@ -481,12 +481,12 @@ try:
import Utils
prog = GrampsMime.get_application("text/html")
type = GrampsMime.get_description("text/html")
mtype = GrampsMime.get_description("text/html")
if Utils.search_for(prog[0]):
print_label=_("Open in %s") % prog[1]
else:
print_label=None
Plugins.register_text_doc(type,HtmlDoc,1,0,1,".html", print_label)
Plugins.register_text_doc(mtype,HtmlDoc,1,0,1,".html", print_label)
except:
Plugins.register_text_doc('HTML',HtmlDoc,1,0,1,".html", None)

View File

@ -228,8 +228,8 @@ class KwordDoc(BaseDoc.BaseDoc):
self.f.write('</STYLES>\n')
self.f.write('<PIXMAPS>\n')
for file in self.media_list:
self.f.write('<KEY name="%s" filename="%s" ' % (file[1],file[1]))
for filedata in self.media_list:
self.f.write('<KEY name="%s" filename="%s" ' % (filedata[1],filedata[1]))
a = time.localtime(self.mtime)
self.f.write('msec="%d" ' % a[6])
self.f.write('second="%d" ' % a[5])
@ -253,9 +253,9 @@ class KwordDoc(BaseDoc.BaseDoc):
tar.add_file("documentinfo.xml",self.mtime,self.m)
tar.add_file("maindoc.xml",self.mtime,self.f)
for file in self.media_list:
f = open(file[0],"r")
tar.add_file(file[1],self.mtime,f)
for filedata in self.media_list:
f = open(filedata[0],"r")
tar.add_file(filedata[1],self.mtime,f)
f.close()
tar.close()
@ -489,13 +489,13 @@ try:
import Utils
prog = GrampsMime.get_application("application/x-kword")
type = GrampsMime.get_description("application/x-kword")
mtype = GrampsMime.get_description("application/x-kword")
if prog and Utils.search_for(prog[0]):
print_label=_("Open in %s") % prog[1]
else:
print_label=None
Plugins.register_text_doc(type, KwordDoc, 1, 0, 1, ".kwd", print_label)
Plugins.register_text_doc(mtype, KwordDoc, 1, 0, 1, ".kwd", print_label)
except:
Plugins.register_text_doc('KWord', KwordDoc, 1, 0, 1, ".kwd", print_label)

View File

@ -62,7 +62,6 @@ else:
#------------------------------------------------------------------------
import BaseDoc
import Plugins
import ImgManip
#------------------------------------------------------------------------
#

View File

@ -971,16 +971,16 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
try:
import Utils
prog = GrampsMime.get_application(_apptype)
type = GrampsMime.get_description(_apptype)
mprog = GrampsMime.get_application(_apptype)
mtype = GrampsMime.get_description(_apptype)
if Utils.search_for(prog[0]):
if Utils.search_for(mprog[0]):
print_label = _("Open in OpenOffice.org")
else:
print_label = None
Plugins.register_text_doc(type,OpenOfficeDoc,1,1,1,".sxw", print_label)
Plugins.register_book_doc(type,OpenOfficeDoc,1,1,1,".sxw")
Plugins.register_text_doc(mtype,OpenOfficeDoc,1,1,1,".sxw", print_label)
Plugins.register_book_doc(mtype,OpenOfficeDoc,1,1,1,".sxw")
except:
Plugins.register_text_doc('OpenOffice.org Writer', OpenOfficeDoc,1,1,1,".sxw", None)
Plugins.register_book_doc("OpenOffice.org Writer", OpenOfficeDoc,1,1,1,".sxw")

View File

@ -422,11 +422,11 @@ class RTFDoc(BaseDoc.BaseDoc):
try:
import Utils
prog = GrampsMime.get_application("application/rtf")
type = GrampsMime.description("application/rtf")
mprog = GrampsMime.get_application("application/rtf")
mtype = GrampsMime.get_description("application/rtf")
if Utils.search_for(prog[0]):
print_label=_("Open in %s") % prog[1]
if Utils.search_for(mprog[0]):
print_label=_("Open in %s") % mprog[1]
else:
print_label=None
Plugins.register_text_doc(type, RTFDoc, 1, 0, 1, ".rtf", print_label)

View File

@ -227,7 +227,7 @@ class ComprehensiveAncestorsReport (Report.Report):
if thisgen > 2 and len (mfamily_ids):
for self.gp in [self.database.find_family_from_id(mfamily_ids[0]).get_father_id (),
self.database.find_family_from_id(mfamilies[0]).get_mother_id ()]:
self.database.find_family_from_id(mfamily_ids[0]).get_mother_id ()]:
if self.gp:
break
@ -1090,9 +1090,7 @@ def write_book_item(database,person,doc,options,newpage=0):
#
#
#------------------------------------------------------------------------
from Plugins import register_report, register_book_item
register_report(
Plugins.register_report(
report,
_("Comprehensive Ancestors Report"),
category=_("Text Reports"),
@ -1103,7 +1101,7 @@ register_report(
)
# (name,category,options_dialog,write_book_item,options,style_name,style_file,make_default_style)
register_book_item(
Plugins.register_book_item(
_("Comprehensive Ancestors Report"),
_("Text"),
ComprehensiveAncestorsBareReportDialog,

View File

@ -37,7 +37,6 @@ import os
import Report
import BaseDoc
import Errors
import Date
import Sort
from QuestionDialog import ErrorDialog
from gettext import gettext as _

View File

@ -51,7 +51,6 @@ import gtk.glade
#------------------------------------------------------------------------
import RelLib
import Utils
import Date
import Gregorian
from gettext import gettext as _

View File

@ -39,19 +39,19 @@ TABLE = string.maketrans('ABCDEFGIJKLMNOPQRSTUVXYZ',
# soundex - returns the soundex value for the specified string
#
#-------------------------------------------------------------------------
def soundex(str):
def soundex(strval):
"Return the soundex value to a string argument."
str = str.upper().strip()
if not str:
strval = strval.upper().strip()
if not strval:
return "Z000"
str = str.encode('iso-8859-1')
str2 = str[0]
str = str.translate(TABLE, IGNORE)
if not str:
strval = strval.encode('iso-8859-1')
str2 = strval[0]
strval = strval.translate(TABLE, IGNORE)
if not strval:
return "Z000"
prev = str[0]
for x in str[1:]:
prev = strval[0]
for x in strval[1:]:
if x != prev and x != "0":
str2 = str2 + x
prev = x