Elimination of redundant code, new registering method for plugins
svn: r367
This commit is contained in:
parent
1d5bf3f11f
commit
65625b02a6
@ -49,7 +49,8 @@ NAMEINST = "namelist"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# Interface to gramps' bookmarks. Handles building the bookmarks menu
|
||||
# for the main window, and provides the bookmark editor.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Bookmarks :
|
||||
@ -59,9 +60,13 @@ class Bookmarks :
|
||||
#
|
||||
# __init__ - Creates a the bookmark editor
|
||||
#
|
||||
# arguments are:
|
||||
# bookmarks - list of People
|
||||
# menu - parent menu to attach users
|
||||
# callback - task to connect to the menu item as a callback
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def __init__(self,bookmarks,map,menu,callback):
|
||||
self.map = map
|
||||
def __init__(self,bookmarks,menu,callback):
|
||||
self.menu = menu
|
||||
self.bookmarks = bookmarks
|
||||
self.callback = callback
|
||||
@ -69,17 +74,14 @@ class Bookmarks :
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# redraw - (re)create the pulldown menu
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def redraw(self):
|
||||
if len(self.bookmarks) > 0:
|
||||
self.myMenu = gtk.GtkMenu()
|
||||
for person in self.bookmarks:
|
||||
item = gtk.GtkMenuItem(person.getPrimaryName().getName())
|
||||
item.show()
|
||||
item.connect("activate", self.callback , person)
|
||||
self.myMenu.append(item)
|
||||
self.add_to_menu(person)
|
||||
self.menu.set_submenu(self.myMenu)
|
||||
self.menu.set_sensitive(1)
|
||||
else:
|
||||
@ -88,33 +90,43 @@ class Bookmarks :
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# add - adds the person to the bookmarks, appended to the botom
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def add(self,person):
|
||||
if person not in self.bookmarks:
|
||||
utils.modified()
|
||||
self.bookmarks.append(person)
|
||||
item = gtk.GtkMenuItem(person.getPrimaryName().getName())
|
||||
item.show()
|
||||
item.connect("activate", self.callback, person)
|
||||
self.redraw()
|
||||
self.add_to_menu(person)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# add_to_menu - adds a person's name to the drop down menu
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def add_to_menu(person):
|
||||
item = gtk.GtkMenuItem(person.getPrimaryName().getName())
|
||||
item.connect("activate", self.callback, person)
|
||||
item.show()
|
||||
self.myMenu.append(item)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# edit - display the bookmark editor.
|
||||
#
|
||||
# The current bookmarked people are inserted into the namelist,
|
||||
# attaching the person object to the corresponding row. The currently
|
||||
# selected row is attached to the name list. This is either 0 if the
|
||||
# list is not empty, or -1 if it is.
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def edit(self):
|
||||
|
||||
top = libglade.GladeXML(const.bookFile,TOPINST)
|
||||
namelist = top.get_widget(NAMEINST)
|
||||
|
||||
namelist.clear()
|
||||
self.index = 0
|
||||
for val in self.bookmarks:
|
||||
namelist.append([val.getPrimaryName().getName()])
|
||||
namelist.set_row_data(self.index,val)
|
||||
for person in self.bookmarks:
|
||||
namelist.append([person.getPrimaryName().getName()])
|
||||
namelist.set_row_data(self.index,person)
|
||||
self.index = self.index + 1
|
||||
|
||||
if self.index > 0:
|
||||
@ -137,11 +149,11 @@ class Bookmarks :
|
||||
topBox.set_data(OBJECT,self)
|
||||
topBox.set_data(NAMEINST,namelist)
|
||||
topBox.show()
|
||||
self.redraw()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# on_namelist_select_row - changes the selected row stored on the namelist
|
||||
# to the row that was just selected.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_namelist_select_row(obj,row,junk,junk2):
|
||||
@ -149,7 +161,10 @@ def on_namelist_select_row(obj,row,junk,junk2):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# on_delete_clicked - gets the selected row and number of rows that have
|
||||
# been attached to the namelist. If the selected row is greater than 0,
|
||||
# then the row is deleted from the list. The number of rows is then
|
||||
# decremented.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_clicked(obj):
|
||||
@ -165,7 +180,7 @@ def on_delete_clicked(obj):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# on_up_clicked - swap rows if the selected row is greater than 0
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_up_clicked(obj):
|
||||
@ -176,7 +191,7 @@ def on_up_clicked(obj):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# on_down_clicked - swap rows if the selected index is not the last index
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_down_clicked(obj):
|
||||
@ -188,31 +203,27 @@ def on_down_clicked(obj):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# on_ok_clicked - loop through the name list, extracting the attached
|
||||
# person from list, and building up the new bookmark list. The menu is
|
||||
# then redrawn.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_ok_clicked(obj):
|
||||
bmobj = obj.get_data(OBJECT)
|
||||
bkmarks = obj.get_data(OBJECT)
|
||||
namelist = obj.get_data(NAMEINST)
|
||||
del bmobj.bookmarks[0:]
|
||||
del bkmarks.bookmarks[0:]
|
||||
|
||||
bmobj.myMenu = gtk.GtkMenu()
|
||||
for index in range(0,bmobj.index):
|
||||
for index in range(0,bkmarks.index):
|
||||
person = namelist.get_row_data(index)
|
||||
if person == None:
|
||||
break
|
||||
bmobj.bookmarks.append(person)
|
||||
item = gtk.GtkMenuItem(person.getPrimaryName().getName())
|
||||
item.show()
|
||||
item.connect("activate", bmobj.callback , person)
|
||||
bmobj.myMenu.append(item)
|
||||
bmobj.menu.set_submenu(bmobj.myMenu)
|
||||
bmobj.redraw()
|
||||
if person:
|
||||
bkmarks.bookmarks.append(person)
|
||||
|
||||
bkmarks.redraw()
|
||||
obj.destroy()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
# on_cancel_clicked - destroy the bookmark editor
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_cancel_clicked(obj):
|
||||
|
@ -48,7 +48,6 @@ import libglade
|
||||
from RelLib import *
|
||||
from Date import *
|
||||
|
||||
import Researcher
|
||||
import const
|
||||
import utils
|
||||
import ListColors
|
||||
@ -89,7 +88,7 @@ _name_format_list = [
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
owner = Researcher.Researcher()
|
||||
owner = Researcher()
|
||||
prefsTop = None
|
||||
autoload = 0
|
||||
usetabs = 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
#! /usr/bin/python -O
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
@ -34,7 +33,6 @@ import string
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import gnome.mime
|
||||
|
||||
import libglade
|
||||
|
||||
@ -93,10 +91,9 @@ class EditPlace:
|
||||
self.loc_state = self.top_window.get_widget("loc_state")
|
||||
self.loc_country = self.top_window.get_widget("loc_country")
|
||||
|
||||
self.lists_changed = 0
|
||||
self.ulist = place.getUrlList()[:]
|
||||
self.urls_changed = 0
|
||||
self.llist = place.get_alternate_locations()[:]
|
||||
self.locations_changed = 0
|
||||
|
||||
self.title.set_text(place.get_title())
|
||||
mloc = place.get_main_location()
|
||||
@ -124,7 +121,6 @@ class EditPlace:
|
||||
"on_photolist_button_press_event" : on_photolist_button_press_event,
|
||||
"on_switch_page" : on_switch_page,
|
||||
"on_addphoto_clicked" : on_add_photo_clicked,
|
||||
"on_browse_clicked": on_browse_clicked,
|
||||
"on_deletephoto_clicked" : on_delete_photo_clicked,
|
||||
"on_add_url_clicked" : on_add_url_clicked,
|
||||
"on_delete_url_clicked" : on_delete_url_clicked,
|
||||
@ -157,16 +153,11 @@ class EditPlace:
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_urls(self):
|
||||
def update_lists(self):
|
||||
self.place.setUrlList(self.ulist)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_locations(self):
|
||||
self.place.set_alternate_locations(self.llist)
|
||||
if self.lists_changed:
|
||||
utils.modified()
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
@ -174,60 +165,21 @@ class EditPlace:
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def redraw_url_list(self):
|
||||
self.web_list.freeze()
|
||||
self.web_list.clear()
|
||||
|
||||
self.web_index = 0
|
||||
for url in self.ulist:
|
||||
self.web_list.append([url.get_path(),url.get_description()])
|
||||
self.web_list.set_row_data(self.web_index,url)
|
||||
self.web_index = self.web_index + 1
|
||||
|
||||
current_row = self.web_list.get_data(INDEX)
|
||||
|
||||
if self.web_index > 0:
|
||||
if current_row <= 0:
|
||||
current_row = 0
|
||||
elif self.web_index <= current_row:
|
||||
current_row = current_row - 1
|
||||
self.web_list.select_row(current_row,0)
|
||||
self.web_list.moveto(current_row,0)
|
||||
length = utils.redraw_list(self.ulist,self.web_list,disp_url)
|
||||
if length > 0:
|
||||
self.web_url.set_sensitive(1)
|
||||
else:
|
||||
self.web_url.set_label("")
|
||||
self.web_url.set_sensitive(0)
|
||||
self.web_url.set_label("")
|
||||
self.web_description.set_text("")
|
||||
|
||||
self.web_list.set_data(INDEX,current_row)
|
||||
self.web_list.thaw()
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
#
|
||||
# redraw_location_list
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def redraw_location_list(self):
|
||||
self.loc_list.freeze()
|
||||
self.loc_list.clear()
|
||||
|
||||
self.loc_index = 0
|
||||
for loc in self.llist:
|
||||
self.loc_list.append([loc.get_city(),loc.get_county(),
|
||||
loc.get_state(),loc.get_country()])
|
||||
self.loc_list.set_row_data(self.loc_index,loc)
|
||||
self.loc_index = self.loc_index + 1
|
||||
|
||||
current_row = self.loc_list.get_data(INDEX)
|
||||
|
||||
if self.loc_index > 0:
|
||||
if current_row <= 0:
|
||||
current_row = 0
|
||||
elif self.loc_index <= current_row:
|
||||
current_row = current_row - 1
|
||||
self.loc_list.select_row(current_row,0)
|
||||
self.loc_list.moveto(current_row,0)
|
||||
self.loc_list.set_data(INDEX,current_row)
|
||||
self.loc_list.thaw()
|
||||
utils.redraw_list(self.llist,self.loc_list,disp_loc)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -235,12 +187,9 @@ class EditPlace:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_thumbnail(self,photo):
|
||||
src = photo.getPath()
|
||||
thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \
|
||||
os.path.basename(src)
|
||||
|
||||
src = os.path.basename(photo.getPath())
|
||||
thumb = "%s%s.thumb%s%s" % (self.path,os.sep,os.sep,src)
|
||||
RelImage.check_thumb(src,thumb,const.thumbScale)
|
||||
|
||||
self.photo_list.append(thumb,photo.getDescription())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -251,8 +200,6 @@ class EditPlace:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def load_images(self):
|
||||
if len(self.place.getPhotoList()) == 0:
|
||||
return
|
||||
self.photo_list.freeze()
|
||||
self.photo_list.clear()
|
||||
for photo in self.place.getPhotoList():
|
||||
@ -313,13 +260,7 @@ def on_place_apply_clicked(obj):
|
||||
edit.place.setNote(note)
|
||||
utils.modified()
|
||||
|
||||
edit.update_urls()
|
||||
if edit.urls_changed:
|
||||
utils.modified()
|
||||
|
||||
edit.update_locations()
|
||||
if edit.locations_changed:
|
||||
utils.modified()
|
||||
edit.update_lists()
|
||||
|
||||
utils.destroy_passed_object(edit.top)
|
||||
edit.callback(edit.place)
|
||||
@ -349,15 +290,12 @@ def on_photo_select_icon(obj,iconNumber,event):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_photo_clicked(obj):
|
||||
edit_place_obj = obj.get_data(PLACE)
|
||||
icon = edit_place_obj.selectedIcon
|
||||
epo = obj.get_data(PLACE)
|
||||
icon = epo.selectedIcon
|
||||
|
||||
if icon == -1:
|
||||
return
|
||||
|
||||
photolist = edit_place_obj.place.getPhotoList()
|
||||
edit_place_obj.photo_list.remove(icon)
|
||||
del photolist[edit_place_obj.selectedIcon]
|
||||
if icon != -1:
|
||||
epo.photo_list.remove(icon)
|
||||
del epo.place.getPhotoList()[icon]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -367,9 +305,7 @@ def on_delete_photo_clicked(obj):
|
||||
def on_add_photo_clicked(obj):
|
||||
|
||||
edit_place = obj.get_data(PLACE)
|
||||
|
||||
image_select = libglade.GladeXML(const.imageselFile,"imageSelect")
|
||||
|
||||
edit_place.isel = image_select
|
||||
|
||||
image_select.signal_autoconnect({
|
||||
@ -399,7 +335,7 @@ def on_savephoto_clicked(obj):
|
||||
if os.path.exists(filename) == 0:
|
||||
return
|
||||
|
||||
prefix = "s%s" % edit_place_obj.place.getId()
|
||||
prefix = "p%s" % edit_place_obj.place.getId()
|
||||
if edit_place_obj.external.get_active() == 1:
|
||||
if os.path.isfile(filename):
|
||||
name = filename
|
||||
@ -437,28 +373,14 @@ def on_photolist_button_press_event(obj,event):
|
||||
menu = GtkMenu()
|
||||
item = GtkTearoffMenuItem()
|
||||
item.show()
|
||||
view = GtkMenuItem(_("View Image"))
|
||||
view.set_data("m",myobj)
|
||||
view.connect("activate",on_view_photo)
|
||||
view.show()
|
||||
edit = GtkMenuItem(_("Edit Image"))
|
||||
edit.set_data("m",myobj)
|
||||
edit.connect("activate",on_edit_photo)
|
||||
edit.show()
|
||||
change = GtkMenuItem(_("Edit Description"))
|
||||
change.set_data("m",myobj)
|
||||
change.connect("activate",on_change_description)
|
||||
change.show()
|
||||
menu.append(item)
|
||||
menu.append(view)
|
||||
menu.append(edit)
|
||||
menu.append(change)
|
||||
utils.add_menuitem(menu,_("View Image"),myobj,on_view_photo)
|
||||
utils.add_menuitem(menu,_("Edit Image"),myobj,on_edit_photo)
|
||||
utils.add_menuitem(menu,_("Edit Description"),myobj,
|
||||
on_change_description)
|
||||
if photo.getPrivate() == 0:
|
||||
private = GtkMenuItem(_("Convert to private copy"))
|
||||
private.set_data("m",myobj)
|
||||
private.connect("activate",on_convert_to_private)
|
||||
private.show()
|
||||
menu.append(private)
|
||||
utils.add_menuitem(menu,_("Convert to private copy"),myobj,
|
||||
on_convert_to_private)
|
||||
menu.popup(None,None,None,0,0)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -470,7 +392,7 @@ def on_convert_to_private(obj):
|
||||
edit_place_obj = obj.get_data("m")
|
||||
photo = edit_place_obj.place.getPhotoList()[edit_place_obj.selectedIcon]
|
||||
|
||||
prefix = "i%s" % edit_place_obj.place.getId()
|
||||
prefix = "p%s" % edit_place_obj.place.getId()
|
||||
name = RelImage.import_photo(photo.getPath(),edit_place_obj.path,prefix)
|
||||
|
||||
photo.setPath(name)
|
||||
@ -484,18 +406,8 @@ def on_convert_to_private(obj):
|
||||
def on_view_photo(obj):
|
||||
myobj = obj.get_data("m")
|
||||
photo = myobj.place.getPhotoList()[myobj.selectedIcon]
|
||||
type = gnome.mime.type(photo.getPath())
|
||||
|
||||
prog = string.split(gnome.mime.get_value(type,'view'))
|
||||
args = []
|
||||
for val in prog:
|
||||
if val == "%f":
|
||||
args.append(photo.getPath())
|
||||
else:
|
||||
args.append(val)
|
||||
|
||||
if os.fork() == 0:
|
||||
os.execvp(args[0],args)
|
||||
utils.view_photo(photo)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -574,9 +486,7 @@ def on_name_changed(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_update_url_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
|
||||
if row >= 0:
|
||||
UrlEditor(obj.get_data(PLACE),obj.get_row_data(row))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -586,9 +496,7 @@ def on_update_url_clicked(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_update_loc_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
|
||||
if row >= 0:
|
||||
LocationEditor(obj.get_data(PLACE),obj.get_row_data(row))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -597,18 +505,10 @@ def on_update_loc_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_url_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
|
||||
epo = obj.get_data(PLACE)
|
||||
del epo.ulist[row]
|
||||
|
||||
if row > len(epo.ulist)-1:
|
||||
obj.set_data(INDEX,row-1)
|
||||
|
||||
if utils.delete_selected(obj,epo.ulist):
|
||||
epo.lists_changed = 1
|
||||
epo.redraw_url_list()
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -616,18 +516,10 @@ def on_delete_url_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_loc_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
|
||||
epo = obj.get_data(PLACE)
|
||||
del epo.llist[row]
|
||||
|
||||
if row > len(epo.llist)-1:
|
||||
obj.set_data(INDEX,row-1)
|
||||
|
||||
if utils.delete_selected(obj,epo.llist):
|
||||
epo.lists_changed = 1
|
||||
epo.redraw_location_list()
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -635,7 +527,6 @@ def on_delete_loc_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_add_url_clicked(obj):
|
||||
epo = obj.get_data(PLACE)
|
||||
UrlEditor(obj.get_data(PLACE),None)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -644,7 +535,6 @@ def on_add_url_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_add_loc_clicked(obj):
|
||||
epo = obj.get_data(PLACE)
|
||||
LocationEditor(obj.get_data(PLACE),None)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -708,14 +598,14 @@ def on_url_edit_ok_clicked(obj):
|
||||
ee.parent.ulist.append(url)
|
||||
|
||||
if update_url(url,des,addr,priv):
|
||||
ee.parent.urls_changed = 1
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_url_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# on_name_list_select_row - sets the row object attached to the passed
|
||||
# on_web_list_select_row - sets the row object attached to the passed
|
||||
# object, and then updates the display with the data corresponding to
|
||||
# the row.
|
||||
#
|
||||
@ -732,7 +622,7 @@ def on_web_list_select_row(obj,row,b,c):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# on_name_list_select_row - sets the row object attached to the passed
|
||||
# on_loclist_select_row - sets the row object attached to the passed
|
||||
# object, and then updates the display with the data corresponding to
|
||||
# the row.
|
||||
#
|
||||
@ -750,7 +640,7 @@ def on_loc_list_select_row(obj,row,b,c):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# update_attrib
|
||||
# update_url
|
||||
#
|
||||
# Updates the specified event with the specified date. Compares against
|
||||
# the previous value, so the that modified flag is not set if nothing has
|
||||
@ -776,7 +666,7 @@ def update_url(url,des,addr,priv):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# update_attrib
|
||||
# update_location
|
||||
#
|
||||
# Updates the specified event with the specified date. Compares against
|
||||
# the previous value, so the that modified flag is not set if nothing has
|
||||
@ -801,21 +691,8 @@ def update_location(loc,city,county,state,country):
|
||||
if loc.get_country() != country:
|
||||
loc.set_country(country)
|
||||
changed = 1
|
||||
|
||||
return changed
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_browse_clicked(obj):
|
||||
import gnome.url
|
||||
|
||||
path = obj.get()[2:]
|
||||
if path != "":
|
||||
gnome.url.show(path)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# LocationEditor class
|
||||
@ -871,60 +748,24 @@ def on_location_edit_ok_clicked(obj):
|
||||
ee.parent.llist.append(loc)
|
||||
|
||||
if update_location(loc,city,county,state,country):
|
||||
ee.parent.locations_changed = 1
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_location_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# on_name_list_select_row - sets the row object attached to the passed
|
||||
# object, and then updates the display with the data corresponding to
|
||||
# the row.
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_location_list_select_row(obj,row,b,c):
|
||||
obj.set_data(INDEX,row)
|
||||
|
||||
epo = obj.get_data(PLACE)
|
||||
loc = obj.get_row_data(row)
|
||||
def disp_url(url):
|
||||
return [url.get_path(),url.get_description()]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_detail_flags(obj):
|
||||
detail = ""
|
||||
if Config.show_detail:
|
||||
if obj.getNote() != "":
|
||||
detail = "N"
|
||||
if obj.getSourceRef().getBase():
|
||||
detail = detail + "S"
|
||||
if obj.getPrivacy():
|
||||
detail = detail + "P"
|
||||
return detail
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_detail_text(obj):
|
||||
if obj.getNote() != "":
|
||||
details = "%s" % _("Note")
|
||||
else:
|
||||
details = ""
|
||||
if obj.getSourceRef().getBase() != None:
|
||||
if details == "":
|
||||
details = _("Source")
|
||||
else:
|
||||
details = "%s, %s" % (details,_("Source"))
|
||||
if obj.getPrivacy() == 1:
|
||||
if details == "":
|
||||
details = _("Private")
|
||||
else:
|
||||
details = "%s, %s" % (details,_("Private"))
|
||||
return details
|
||||
|
||||
def disp_loc(loc):
|
||||
return [loc.get_city(),loc.get_county(),loc.get_state(),loc.get_country()]
|
||||
|
||||
|
@ -25,7 +25,6 @@
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -34,8 +33,6 @@ import string
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import gnome.mime
|
||||
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -109,12 +106,9 @@ class EditSource:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_thumbnail(self,photo):
|
||||
src = photo.getPath()
|
||||
thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \
|
||||
os.path.basename(src)
|
||||
|
||||
src = os.path.basename(photo.getPath())
|
||||
thumb = "%s%s.thumb%s%s" % (self.path,os.sep,os.sep,src)
|
||||
RelImage.check_thumb(src,thumb,const.thumbScale)
|
||||
|
||||
self.photo_list.append(thumb,photo.getDescription())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -125,8 +119,6 @@ class EditSource:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def load_images(self):
|
||||
if len(self.source.getPhotoList()) == 0:
|
||||
return
|
||||
self.photo_list.freeze()
|
||||
self.photo_list.clear()
|
||||
for photo in self.source.getPhotoList():
|
||||
@ -190,15 +182,12 @@ def on_photo_select_icon(obj,iconNumber,event):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_photo_clicked(obj):
|
||||
edit_source_obj = obj.get_data(SOURCE)
|
||||
icon = edit_source_obj.selectedIcon
|
||||
eso = obj.get_data(SOURCE)
|
||||
icon = eso.selectedIcon
|
||||
|
||||
if icon == -1:
|
||||
return
|
||||
|
||||
photolist = edit_source_obj.source.getPhotoList()
|
||||
edit_source_obj.photo_list.remove(icon)
|
||||
del photolist[edit_source_obj.selectedIcon]
|
||||
if icon != -1:
|
||||
eso.photo_list.remove(icon)
|
||||
del eso.source.getPhotoList()[icon]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -208,9 +197,7 @@ def on_delete_photo_clicked(obj):
|
||||
def on_add_photo_clicked(obj):
|
||||
|
||||
edit_source = obj.get_data(SOURCE)
|
||||
|
||||
image_select = libglade.GladeXML(const.imageselFile,"imageSelect")
|
||||
|
||||
edit_source.isel = image_select
|
||||
|
||||
image_select.signal_autoconnect({
|
||||
@ -231,8 +218,8 @@ def on_add_photo_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_savephoto_clicked(obj):
|
||||
edit_source_obj = obj.get_data(SOURCE)
|
||||
image_select = edit_source_obj.isel
|
||||
eso = obj.get_data(SOURCE)
|
||||
image_select = eso.isel
|
||||
|
||||
filename = image_select.get_widget("photosel").get_full_path(0)
|
||||
description = image_select.get_widget("photoDescription").get_text()
|
||||
@ -240,14 +227,14 @@ def on_savephoto_clicked(obj):
|
||||
if os.path.exists(filename) == 0:
|
||||
return
|
||||
|
||||
prefix = "s%s" % edit_source_obj.source.getId()
|
||||
if edit_source_obj.external.get_active() == 1:
|
||||
prefix = "s%s" % eso.source.getId()
|
||||
if eso.external.get_active() == 1:
|
||||
if os.path.isfile(filename):
|
||||
name = filename
|
||||
else:
|
||||
return
|
||||
else:
|
||||
name = RelImage.import_photo(filename,edit_source_obj.path,prefix)
|
||||
name = RelImage.import_photo(filename,eso.path,prefix)
|
||||
if name == None:
|
||||
return
|
||||
|
||||
@ -255,8 +242,8 @@ def on_savephoto_clicked(obj):
|
||||
photo.setPath(name)
|
||||
photo.setDescription(description)
|
||||
|
||||
edit_source_obj.source.addPhoto(photo)
|
||||
edit_source_obj.add_thumbnail(photo)
|
||||
eso.source.addPhoto(photo)
|
||||
eso.add_thumbnail(photo)
|
||||
|
||||
utils.modified()
|
||||
utils.destroy_passed_object(obj)
|
||||
@ -278,28 +265,14 @@ def on_photolist_button_press_event(obj,event):
|
||||
menu = GtkMenu()
|
||||
item = GtkTearoffMenuItem()
|
||||
item.show()
|
||||
view = GtkMenuItem(_("View Image"))
|
||||
view.set_data("m",myobj)
|
||||
view.connect("activate",on_view_photo)
|
||||
view.show()
|
||||
edit = GtkMenuItem(_("Edit Image"))
|
||||
edit.set_data("m",myobj)
|
||||
edit.connect("activate",on_edit_photo)
|
||||
edit.show()
|
||||
change = GtkMenuItem(_("Edit Description"))
|
||||
change.set_data("m",myobj)
|
||||
change.connect("activate",on_change_description)
|
||||
change.show()
|
||||
menu.append(item)
|
||||
menu.append(view)
|
||||
menu.append(edit)
|
||||
menu.append(change)
|
||||
utils.add_menuitem(menu,_("View Image"),myobj,on_view_photo)
|
||||
utils.add_menuitem(menu,_("Edit Image"),myobj,on_edit_photo)
|
||||
utils.add_menuitem(menu,_("Edit Description"),myobj,
|
||||
on_change_description)
|
||||
if photo.getPrivate() == 0:
|
||||
private = GtkMenuItem(_("Convert to private copy"))
|
||||
private.set_data("m",myobj)
|
||||
private.connect("activate",on_convert_to_private)
|
||||
private.show()
|
||||
menu.append(private)
|
||||
utils.add_menuitem(menu,_("Convert to private copy"),myobj,
|
||||
on_convert_to_private)
|
||||
menu.popup(None,None,None,0,0)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -308,11 +281,11 @@ def on_photolist_button_press_event(obj,event):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_convert_to_private(obj):
|
||||
edit_source_obj = obj.get_data("m")
|
||||
photo = edit_source_obj.source.getPhotoList()[edit_source_obj.selectedIcon]
|
||||
eso = obj.get_data("m")
|
||||
photo = eso.source.getPhotoList()[eso.selectedIcon]
|
||||
|
||||
prefix = "i%s" % edit_source_obj.source.getId()
|
||||
name = RelImage.import_photo(photo.getPath(),edit_source_obj.path,prefix)
|
||||
prefix = "s%s" % eso.source.getId()
|
||||
name = RelImage.import_photo(photo.getPath(),eso.path,prefix)
|
||||
|
||||
photo.setPath(name)
|
||||
photo.setPrivate(1)
|
||||
@ -325,18 +298,8 @@ def on_convert_to_private(obj):
|
||||
def on_view_photo(obj):
|
||||
myobj = obj.get_data("m")
|
||||
photo = myobj.source.getPhotoList()[myobj.selectedIcon]
|
||||
type = gnome.mime.type(photo.getPath())
|
||||
|
||||
prog = string.split(gnome.mime.get_value(type,'view'))
|
||||
args = []
|
||||
for val in prog:
|
||||
if val == "%f":
|
||||
args.append(photo.getPath())
|
||||
else:
|
||||
args.append(val)
|
||||
|
||||
if os.fork() == 0:
|
||||
os.execvp(args[0],args)
|
||||
utils.view_photo(photo)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -27,6 +27,7 @@ import re
|
||||
import os
|
||||
import sys
|
||||
import intl
|
||||
import gtk
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
@ -85,32 +86,21 @@ class Filter:
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# create - creates a new filter object from the passed data. Eliminates
|
||||
# the need to know the name of the class.
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def create(text):
|
||||
return Filter(text)
|
||||
|
||||
_filter_list = [(Filter, _("All people"), 0)]
|
||||
|
||||
def register_filter(class_name, description=None, qualifier=0):
|
||||
if description == None:
|
||||
description = _("No description")
|
||||
_filter_list.append((class_name,description,qualifier))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# need_qualifier - indicates if another parameter is needed. Used to
|
||||
# enable or disable the qualifier field on the display
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
filterList = [ _("All people") ]
|
||||
filterMap = { _("All people") : create }
|
||||
filterEnb = { _("All people") : need_qualifier }
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# load_filters - loads all filters in the specfied directory. Looks for
|
||||
# a task named "create". The create and need_qualifer tasks are loaded in
|
||||
# hash tables so that the filter description can be used to retrieve the
|
||||
# create and need_qualifier functions
|
||||
# load_filters - loads all filters in the specfied directory. Assumes
|
||||
# that the filters will register themselves
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def load_filters(dir):
|
||||
@ -123,23 +113,29 @@ def load_filters(dir):
|
||||
for file in os.listdir(dir):
|
||||
name = os.path.split(file)
|
||||
match = pymod.match(name[1])
|
||||
if match == None:
|
||||
continue
|
||||
if match:
|
||||
groups = match.groups()
|
||||
try:
|
||||
plugin = __import__(groups[0])
|
||||
except:
|
||||
continue
|
||||
print _("Failed to load the module: %s") % groups[0]
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
|
||||
if plugin.__dict__.has_key("get_name"):
|
||||
name = plugin.get_name()
|
||||
else:
|
||||
name = plugin.__doc__
|
||||
|
||||
if plugin.__dict__.has_key("create"):
|
||||
filterMap[name] = plugin.create
|
||||
filterList.append(name)
|
||||
if plugin.__dict__.has_key("need_qualifier"):
|
||||
filterEnb[name] = plugin.need_qualifier
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_filter_menu(callback):
|
||||
myMenu = gtk.GtkMenu()
|
||||
for filter in _filter_list:
|
||||
menuitem = gtk.GtkMenuItem(filter[1])
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data("filter",filter[0])
|
||||
menuitem.set_data("qual",filter[2])
|
||||
menuitem.connect("activate",callback)
|
||||
menuitem.show()
|
||||
return myMenu
|
||||
|
||||
|
||||
|
@ -110,7 +110,7 @@ except:
|
||||
|
||||
try:
|
||||
import LaTeXDoc
|
||||
_textdoc.append((_LATEX, _has_tables, _paper, _no_styles))
|
||||
_textdoc.append((_LATEX, _no_tables, _paper, _no_styles))
|
||||
except:
|
||||
pass
|
||||
|
||||
|
@ -1,3 +1,22 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2001 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
_swiss = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -25,6 +44,7 @@ _swiss = [
|
||||
0.889, 0.500, 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
||||
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584, 0.611, 0.556,
|
||||
0.556, 0.556, 0.556, 0.500, 0.556, 0.500]
|
||||
|
||||
_swiss_b = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -52,6 +72,7 @@ _swiss_b = [
|
||||
0.889, 0.556, 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
||||
0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584, 0.611, 0.611,
|
||||
0.611, 0.611, 0.611, 0.556, 0.611, 0.556]
|
||||
|
||||
_swiss_i = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -79,6 +100,7 @@ _swiss_i = [
|
||||
0.889, 0.500, 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
||||
0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.556, 0.584, 0.611, 0.556,
|
||||
0.556, 0.556, 0.556, 0.500, 0.556, 0.500]
|
||||
|
||||
_swiss_bi = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -106,6 +128,7 @@ _swiss_bi = [
|
||||
0.889, 0.556, 0.556, 0.556, 0.556, 0.556, 0.278, 0.278, 0.278, 0.278,
|
||||
0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.611, 0.584, 0.611, 0.611,
|
||||
0.611, 0.611, 0.611, 0.556, 0.611, 0.556]
|
||||
|
||||
_roman = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -133,6 +156,7 @@ _roman = [
|
||||
0.667, 0.444, 0.444, 0.444, 0.444, 0.444, 0.278, 0.278, 0.278, 0.278,
|
||||
0.500, 0.500, 0.500, 0.500, 0.500, 0.500, 0.500, 0.564, 0.500, 0.500,
|
||||
0.500, 0.500, 0.500, 0.500, 0.500, 0.500]
|
||||
|
||||
_roman_b = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -160,6 +184,7 @@ _roman_b = [
|
||||
0.722, 0.444, 0.444, 0.444, 0.444, 0.444, 0.278, 0.278, 0.278, 0.278,
|
||||
0.500, 0.556, 0.500, 0.500, 0.500, 0.500, 0.500, 0.570, 0.500, 0.556,
|
||||
0.556, 0.556, 0.556, 0.500, 0.556, 0.500]
|
||||
|
||||
_roman_i = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -187,6 +212,7 @@ _roman_i = [
|
||||
0.667, 0.444, 0.444, 0.444, 0.444, 0.444, 0.278, 0.278, 0.278, 0.278,
|
||||
0.500, 0.500, 0.500, 0.500, 0.500, 0.500, 0.500, 0.675, 0.500, 0.500,
|
||||
0.500, 0.500, 0.500, 0.444, 0.500, 0.444]
|
||||
|
||||
_roman_bi = [
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000, 0.000,
|
||||
@ -214,9 +240,15 @@ _roman_bi = [
|
||||
0.722, 0.444, 0.444, 0.444, 0.444, 0.444, 0.278, 0.278, 0.278, 0.278,
|
||||
0.500, 0.556, 0.500, 0.500, 0.500, 0.500, 0.500, 0.570, 0.500, 0.556,
|
||||
0.556, 0.556, 0.556, 0.444, 0.500, 0.444]
|
||||
|
||||
_font_array = [ [_swiss, _swiss_b, _swiss_i, _swiss_bi ],
|
||||
[_roman, _roman_b, _roman_i, _roman_bi ] ]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def string_width(font,text):
|
||||
i = font.get_type_face()
|
||||
j = font.get_bold() + font.get_italic()*2
|
||||
|
@ -19,7 +19,6 @@
|
||||
#
|
||||
|
||||
from RelLib import *
|
||||
from Researcher import Researcher
|
||||
|
||||
import string
|
||||
import os
|
||||
|
@ -60,9 +60,6 @@ class LaTeXDoc(TextDoc):
|
||||
self.f.write("\\title{}\n")
|
||||
self.f.write("\\author{}\n")
|
||||
self.in_list = 0
|
||||
self.in_table = 0
|
||||
self.cell_number = 1
|
||||
self.columns = 0
|
||||
|
||||
def close(self):
|
||||
if self.in_list:
|
||||
@ -99,10 +96,8 @@ class LaTeXDoc(TextDoc):
|
||||
def end_paragraph(self):
|
||||
if self.level > 0:
|
||||
self.f.write('}\n')
|
||||
elif not self.in_list and not self.in_table:
|
||||
elif not self.in_list:
|
||||
self.f.write('\n\\par\\noindent\n')
|
||||
elif self.in_table:
|
||||
pass
|
||||
else:
|
||||
self.f.write('\n')
|
||||
|
||||
@ -115,38 +110,18 @@ class LaTeXDoc(TextDoc):
|
||||
pass
|
||||
|
||||
def start_table(self,name,style_name):
|
||||
self.f.write('\n\\par\\noindent\n')
|
||||
self.f.write("\\medskip\n");
|
||||
self.f.write("\\begin{tabular}{");
|
||||
tbl = self.table_styles[style_name]
|
||||
self.columns = tbl.get_columns()
|
||||
for i in range(0, self.columns ):
|
||||
self.f.write("l");
|
||||
self.f.write("}\n");
|
||||
self.in_table = 1
|
||||
self.cell_number = 0
|
||||
pass
|
||||
|
||||
def end_table(self):
|
||||
# self.f.write("\\hline\n");
|
||||
self.f.write("\\end{tabular}\n");
|
||||
pass
|
||||
|
||||
def start_row(self):
|
||||
# self.f.write("\\hline\n");
|
||||
self.cell_number = 0
|
||||
pass
|
||||
|
||||
def end_row(self):
|
||||
for i in range( self.cell_number, self.columns ):
|
||||
self.f.write(" & ");
|
||||
self.f.write("\\\\\n")
|
||||
pass
|
||||
|
||||
def start_cell(self,style_name,span=1):
|
||||
if self.cell_number > 0:
|
||||
self.f.write(" & ");
|
||||
self.cell_number = self.cell_number +1
|
||||
pass
|
||||
|
||||
def end_cell(self):
|
||||
@ -161,3 +136,4 @@ class LaTeXDoc(TextDoc):
|
||||
def write_text(self,text):
|
||||
self.f.write(text)
|
||||
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
|
||||
import gnome.mime
|
||||
import libglade
|
||||
import os
|
||||
import intl
|
||||
@ -94,8 +93,9 @@ class Marriage:
|
||||
|
||||
top_window = self.get_widget("marriageEditor")
|
||||
text_win = self.get_widget("marriageTitle")
|
||||
text_win.set_text(Config.nameof(family.getFather()) + " and " + \
|
||||
title = _("%s and %s") % (Config.nameof(family.getFather()),
|
||||
Config.nameof(family.getMother()))
|
||||
text_win.set_text(title)
|
||||
|
||||
self.event_list = self.get_widget("marriageEventList")
|
||||
self.photo_list = self.get_widget("photolist")
|
||||
@ -118,14 +118,14 @@ class Marriage:
|
||||
|
||||
self.elist = family.getEventList()[:]
|
||||
self.alist = family.getAttributeList()[:]
|
||||
self.events_changed = 0
|
||||
self.attr_changed = 0
|
||||
self.lists_changed = 0
|
||||
|
||||
# set initial data
|
||||
self.load_images()
|
||||
|
||||
self.type_field.set_popdown_strings(const.familyRelations)
|
||||
self.type_field.entry.set_text(const.display_frel(family.getRelationship()))
|
||||
frel = const.display_frel(family.getRelationship())
|
||||
self.type_field.entry.set_text(frel)
|
||||
|
||||
# stored object data
|
||||
top_window.set_data(MARRIAGE,self)
|
||||
@ -148,15 +148,8 @@ class Marriage:
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_events(self):
|
||||
def update_lists(self):
|
||||
self.family.setEventList(self.elist)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_attributes(self):
|
||||
self.family.setAttributeList(self.alist)
|
||||
|
||||
#---------------------------------------------------------------------
|
||||
@ -165,46 +158,7 @@ class Marriage:
|
||||
#
|
||||
#---------------------------------------------------------------------
|
||||
def redraw_attr_list(self):
|
||||
self.attr_list.freeze()
|
||||
self.attr_list.clear()
|
||||
|
||||
self.attr_index = 0
|
||||
for attr in self.alist:
|
||||
details = get_detail_flags(attr)
|
||||
self.attr_list.append([const.display_fattr(attr.getType()),\
|
||||
attr.getValue(),details])
|
||||
self.attr_list.set_row_data(self.attr_index,attr)
|
||||
self.attr_index = self.attr_index + 1
|
||||
|
||||
current_row = self.attr_list.get_data(INDEX)
|
||||
|
||||
if self.attr_index > 0:
|
||||
if current_row <= 0:
|
||||
current_row = 0
|
||||
elif self.attr_index <= current_row:
|
||||
current_row = current_row - 1
|
||||
self.attr_list.select_row(current_row,0)
|
||||
self.attr_list.moveto(current_row,0)
|
||||
self.attr_list.set_data(INDEX,current_row)
|
||||
self.attr_list.thaw()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# add_event - adds the event to the window, attaching the event structure
|
||||
# to each row.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_event(self,text,event):
|
||||
if not event:
|
||||
return
|
||||
detail = get_detail_flags(event)
|
||||
if event.getPlace():
|
||||
p = event.getPlace().get_title()
|
||||
else:
|
||||
p = ""
|
||||
self.event_list.append([text,event.getQuoteDate(),p,detail])
|
||||
self.event_list.set_row_data(self.lines,event)
|
||||
self.lines = self.lines + 1
|
||||
utils.redraw_list(self.alist,self.attr_list,disp_attr)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -215,13 +169,9 @@ class Marriage:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_thumbnail(self,photo):
|
||||
|
||||
src = photo.getPath()
|
||||
thumb = self.db.getSavePath() + os.sep + ".thumb" + os.sep + \
|
||||
os.path.basename(src)
|
||||
|
||||
src = os.path.basename(photo.getPath())
|
||||
thumb = "%s%s.thumb%s%s" % (self.path,os.sep,os.sep,src)
|
||||
RelImage.check_thumb(src,thumb,const.thumbScale)
|
||||
|
||||
self.photo_list.append(thumb,photo.getDescription())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -232,9 +182,6 @@ class Marriage:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def load_images(self):
|
||||
|
||||
if len(self.family.getPhotoList()) == 0:
|
||||
return
|
||||
self.photo_list.freeze()
|
||||
self.photo_list.clear()
|
||||
for photo in self.family.getPhotoList():
|
||||
@ -248,26 +195,7 @@ class Marriage:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def redraw_events(self):
|
||||
self.lines = 0
|
||||
self.event_list.freeze()
|
||||
self.event_list.clear()
|
||||
|
||||
for event in self.elist:
|
||||
self.add_event(const.display_fevent(event.getName()),event)
|
||||
|
||||
current_row = self.event_list.get_data(INDEX)
|
||||
if current_row == None:
|
||||
current_row = -1
|
||||
|
||||
if self.lines >= 0:
|
||||
if current_row < 0:
|
||||
current_row = 0
|
||||
elif self.lines < current_row:
|
||||
current_row = current_row - 1
|
||||
self.event_list.select_row(current_row,0)
|
||||
self.event_list.moveto(current_row,0)
|
||||
self.event_list.set_data(INDEX,current_row)
|
||||
self.event_list.thaw()
|
||||
utils.redraw_list(self.elist,self.event_list,disp_event)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -294,10 +222,7 @@ def did_data_change(obj):
|
||||
if text != family_obj.family.getNote():
|
||||
changed = 1
|
||||
|
||||
if family_obj.events_changed:
|
||||
changed = 1
|
||||
|
||||
if family_obj.events_changed:
|
||||
if family_obj.lists_changed:
|
||||
changed = 1
|
||||
|
||||
return changed
|
||||
@ -332,9 +257,9 @@ def cancel_callback(a):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_event(obj,b):
|
||||
global quit
|
||||
|
||||
if did_data_change(obj):
|
||||
global quit
|
||||
q = _("Data was modified. Are you sure you want to abandon your changes?")
|
||||
quit = obj
|
||||
GnomeQuestionDialog(q,cancel_callback)
|
||||
@ -375,12 +300,8 @@ def on_close_marriage_editor(obj):
|
||||
|
||||
utils.destroy_passed_object(family_obj.get_widget("marriageEditor"))
|
||||
|
||||
family_obj.update_events()
|
||||
if family_obj.events_changed:
|
||||
utils.modified()
|
||||
|
||||
family_obj.update_attributes()
|
||||
if family_obj.attr_changed:
|
||||
family_obj.update_lists()
|
||||
if family_obj.lists_changed:
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -401,8 +322,7 @@ def on_add_clicked(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_update_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
if row >= 0:
|
||||
EventEditor(obj.get_data(MARRIAGE),obj.get_row_data(row))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -414,18 +334,9 @@ def on_update_clicked(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_clicked(obj):
|
||||
family_obj = obj.get_data(MARRIAGE)
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
|
||||
del family_obj.elist[row]
|
||||
|
||||
if row > len(family_obj.elist)-1:
|
||||
obj.set_data(INDEX,row-1)
|
||||
|
||||
if utils.delete_selected(obj,family_obj.elist):
|
||||
family_obj.lists_changed = 1
|
||||
family_obj.redraw_events()
|
||||
family_obj.events_changed = 1
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -439,9 +350,9 @@ def on_select_row(obj,row,b,c):
|
||||
event = obj.get_row_data(row)
|
||||
|
||||
family_obj.date_field.set_text(event.getDate())
|
||||
family_obj.place_field.set_text(event.getPlace().get_title())
|
||||
family_obj.place_field.set_text(event.getPlaceName())
|
||||
family_obj.name_field.set_label(const.display_fevent(event.getName()))
|
||||
family_obj.event_details.set_text(get_detail_text(event))
|
||||
family_obj.event_details.set_text(utils.get_detail_text(event))
|
||||
family_obj.descr_field.set_text(event.getDescription())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -525,27 +436,24 @@ def update_event(event,name,date,place,desc,note,priv,conf):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_photolist_button_press_event(obj,event):
|
||||
if event.button == 3:
|
||||
myobj = obj.get_data(MARRIAGE)
|
||||
icon = myobj.selectedIcon
|
||||
if icon == -1:
|
||||
return
|
||||
|
||||
if event.button == 3:
|
||||
photo = myobj.family.getPhotoList()[icon]
|
||||
menu = GtkMenu()
|
||||
item = GtkTearoffMenuItem()
|
||||
item.show()
|
||||
view = GtkMenuItem(_("View Image"))
|
||||
view.set_data("m",myobj)
|
||||
view.connect("activate",on_view_photo)
|
||||
view.show()
|
||||
edit = GtkMenuItem(_("Edit Image"))
|
||||
edit.set_data("m",myobj)
|
||||
edit.connect("activate",on_edit_photo)
|
||||
edit.show()
|
||||
change = GtkMenuItem(_("Edit Description"))
|
||||
change.set_data("m",myobj)
|
||||
change.connect("activate",on_change_description)
|
||||
change.show()
|
||||
menu.append(item)
|
||||
menu.append(view)
|
||||
menu.append(edit)
|
||||
menu.append(change)
|
||||
utils.add_menuitem(menu,_("View Image"),myobj,on_view_photo)
|
||||
utils.add_menuitem(menu,_("Edit Image"),myobj,on_edit_photo)
|
||||
utils.add_menuitem(menu,_("Edit Description"),myobj,
|
||||
on_change_description)
|
||||
if photo.getPrivate() == 0:
|
||||
utils.add_menuitem(menu,_("Convert to private copy"),myobj,
|
||||
on_convert_to_private)
|
||||
menu.popup(None,None,None,0,0)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -556,18 +464,7 @@ def on_photolist_button_press_event(obj,event):
|
||||
def on_view_photo(obj):
|
||||
myobj = obj.get_data("m")
|
||||
photo = myobj.family.getPhotoList()[myobj.selectedIcon]
|
||||
type = gnome.mime.type(photo.getPath())
|
||||
|
||||
prog = string.split(gnome.mime.get_value(type,'view'))
|
||||
args = []
|
||||
for val in prog:
|
||||
if val == "%f":
|
||||
args.append(photo.getPath())
|
||||
else:
|
||||
args.append(val)
|
||||
|
||||
if os.fork() == 0:
|
||||
os.execvp(args[0],args)
|
||||
utils.view_photo(photo)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -595,10 +492,11 @@ def on_photo_select_icon(obj,iconNumber,event):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_photo_clicked(obj):
|
||||
marriage_obj = obj.get_data(MARRIAGE)
|
||||
icon = marriage_obj.selectedIcon
|
||||
|
||||
photolist = marriage_obj.family.getPhotoList()
|
||||
marriage_obj.photo_list.remove(marriage_obj.selectedIcon)
|
||||
del photolist[marriage_obj.selectedIcon]
|
||||
if icon != -1:
|
||||
marriage_obj.photo_list.remove(icon)
|
||||
del marriage_obj.family.getPhotoList()[icon]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -713,7 +611,7 @@ def on_attr_list_select_row(obj,row,b,c):
|
||||
|
||||
family_obj.attr_type.set_label(const.display_fattr(attr.getType()))
|
||||
family_obj.attr_value.set_text(attr.getValue())
|
||||
family_obj.attr_details_field.set_text(get_detail_text(attr))
|
||||
family_obj.attr_details_field.set_text(utils.get_detail_text(attr))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -722,8 +620,7 @@ def on_attr_list_select_row(obj,row,b,c):
|
||||
#-------------------------------------------------------------------------
|
||||
def on_update_attr_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
if row >= 0:
|
||||
AttributeEditor(obj.get_data(MARRIAGE),obj.get_row_data(row))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -732,18 +629,10 @@ def on_update_attr_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_delete_attr_clicked(obj):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return
|
||||
|
||||
family_obj = obj.get_data(MARRIAGE)
|
||||
del family_obj.alist[row]
|
||||
|
||||
if row > len(family_obj.alist)-1:
|
||||
obj.set_data(INDEX,row-1)
|
||||
|
||||
if utils.delete_selected(obj,family_obj.alist):
|
||||
family_obj.lists_changed = 1
|
||||
family_obj.redraw_attr_list()
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -793,27 +682,14 @@ class EventEditor:
|
||||
self.top.get_widget("eventTitle").set_text(name)
|
||||
self.event_menu.set_popdown_strings(const.marriageEvents)
|
||||
|
||||
myMenu = GtkMenu()
|
||||
index = 0
|
||||
for name in const.confidence:
|
||||
item = GtkMenuItem(name)
|
||||
item.set_data("a",index)
|
||||
item.show()
|
||||
myMenu.append(item)
|
||||
index = index + 1
|
||||
|
||||
self.conf_menu.set_menu(myMenu)
|
||||
build_confidence_menu(self.conf_menu)
|
||||
|
||||
values = self.parent.db.getPlaceMap().values()
|
||||
if event != None:
|
||||
self.name_field.set_text(event.getName())
|
||||
|
||||
attach_places(values,self.place_combo,event.getPlace())
|
||||
if event.getPlace():
|
||||
self.place_field.set_text(event.getPlace().get_title())
|
||||
else:
|
||||
self.place_field.set_text('')
|
||||
|
||||
utils.attach_places(values,self.place_combo,event.getPlace())
|
||||
self.place_field.set_text(event.getPlaceName())
|
||||
self.date_field.set_text(event.getDate())
|
||||
self.descr_field.set_text(event.getDescription())
|
||||
self.conf_menu.set_history(event.getConfidence())
|
||||
@ -830,7 +706,7 @@ class EventEditor:
|
||||
self.note_field.insert_defaults(event.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
else:
|
||||
attach_places(values,self.place_combo,None)
|
||||
utils.attach_places(values,self.place_combo,None)
|
||||
self.conf_menu.set_history(2)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
@ -861,7 +737,7 @@ def on_event_edit_ok_clicked(obj):
|
||||
ename = ee.name_field.get_text()
|
||||
edate = ee.date_field.get_text()
|
||||
eplace = string.strip(ee.place_field.get_text())
|
||||
eplace_obj = get_place_from_list(ee.place_combo)
|
||||
eplace_obj = utils.get_place_from_list(ee.place_combo)
|
||||
enote = ee.note_field.get_chars(0,-1)
|
||||
edesc = ee.descr_field.get_text()
|
||||
epriv = ee.priv.get_active()
|
||||
@ -877,17 +753,15 @@ def on_event_edit_ok_clicked(obj):
|
||||
ee.parent.db.addPlace(eplace_obj)
|
||||
|
||||
if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,econf):
|
||||
ee.parent.events_changed = 1
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
if not source_refs_equal(event.getSourceRef(),ee.srcref):
|
||||
event.setSourceRef(ee.srcref)
|
||||
ee.parent.events_changed = 1
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_events()
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# AttributeEditor class
|
||||
@ -922,19 +796,12 @@ class AttributeEditor:
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
|
||||
self.top.get_widget("attrTitle").set_text(_("Attribute Editor for %s") % name)
|
||||
title = _("Attribute Editor for %s") % name
|
||||
self.top.get_widget("attrTitle").set_text(title)
|
||||
if len(const.familyAttributes) > 0:
|
||||
self.attrib_menu.set_popdown_strings(const.familyAttributes)
|
||||
|
||||
myMenu = GtkMenu()
|
||||
index = 0
|
||||
for name in const.confidence:
|
||||
item = GtkMenuItem(name)
|
||||
item.set_data("a",index)
|
||||
item.show()
|
||||
myMenu.append(item)
|
||||
index = index + 1
|
||||
self.conf_menu.set_menu(myMenu)
|
||||
build_confidence_menu(self.conf_menu)
|
||||
|
||||
if attrib != None:
|
||||
self.type_field.set_text(attrib.getType())
|
||||
@ -946,7 +813,6 @@ class AttributeEditor:
|
||||
self.source_field.set_text("")
|
||||
|
||||
self.conf_menu.set_history(attrib.getConfidence())
|
||||
|
||||
self.priv.set_active(attrib.getPrivacy())
|
||||
|
||||
self.note_field.set_point(0)
|
||||
@ -991,53 +857,15 @@ def on_attrib_edit_ok_clicked(obj):
|
||||
ee.parent.alist.append(attrib)
|
||||
|
||||
if update_attrib(attrib,type,value,note,priv,conf):
|
||||
ee.parent.attr_changed = 1
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
if not source_refs_equal(attrib.getSourceRef(),ee.srcref):
|
||||
attrib.setSourceRef(ee.srcref)
|
||||
ee.parent.attr_changed = 1
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_attr_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_detail_flags(obj):
|
||||
detail = ""
|
||||
if Config.show_detail:
|
||||
if obj.getNote() != "":
|
||||
detail = "N"
|
||||
if obj.getSourceRef().getBase():
|
||||
detail = detail + "S"
|
||||
if obj.getPrivacy():
|
||||
detail = detail + "P"
|
||||
return detail
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_detail_text(obj):
|
||||
if obj.getNote() != "":
|
||||
details = _("Note")
|
||||
else:
|
||||
details = ""
|
||||
if obj.getSourceRef().getBase() != None:
|
||||
if details == "":
|
||||
details = _("Source")
|
||||
else:
|
||||
details = "%s, %s" % (details,_("Source"))
|
||||
if obj.getPrivacy() == 1:
|
||||
if details == "":
|
||||
details = _("Private")
|
||||
else:
|
||||
details = "%s, %s" % (details,_("Private"))
|
||||
return details
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -1063,44 +891,15 @@ def source_refs_equal(one,two):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def attach_places(values,combo,place):
|
||||
l = GtkLabel("")
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",None)
|
||||
c.show()
|
||||
sel_child = c
|
||||
list = [c]
|
||||
mymap = {}
|
||||
for src in values:
|
||||
l = GtkLabel("%s [%s]" % (src.get_title(),src.getId()))
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data("s",src)
|
||||
c.show()
|
||||
list.append(c)
|
||||
if src == place:
|
||||
sel_child = c
|
||||
mymap[src] = c
|
||||
|
||||
combo.list.append_items(list)
|
||||
combo.list.select_child(sel_child)
|
||||
|
||||
for v in mymap.keys():
|
||||
combo.set_item_string(mymap[v],v.get_title())
|
||||
def disp_attr(attr):
|
||||
detail = utils.get_detail_flags(attr)
|
||||
return [const.display_pattr(attr.getType()),attr.getValue(),detail]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_place_from_list(obj):
|
||||
select = obj.list.get_selection()
|
||||
if len(select) == 0:
|
||||
return None
|
||||
else:
|
||||
return select[0].get_data("s")
|
||||
def disp_event(event):
|
||||
return [const.display_fevent(event.getName()), event.getQuoteDate(),
|
||||
event.getPlaceName(), utils.get_detail_flags(event)]
|
||||
|
@ -30,8 +30,6 @@ import intl
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
names = {}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -55,10 +53,21 @@ import utils
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
reports = []
|
||||
imports = []
|
||||
exports = []
|
||||
tools = []
|
||||
_reports = []
|
||||
_tools = []
|
||||
_imports = []
|
||||
_exports = []
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
OBJECT = "o"
|
||||
DOCSTRING = "d"
|
||||
IMAGE = "i"
|
||||
TASK = "f"
|
||||
TITLE = "t"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -71,63 +80,18 @@ class ReportPlugins:
|
||||
self.db = db
|
||||
self.active = active
|
||||
|
||||
self.plugins_dialog = libglade.GladeXML(const.pluginsFile,"report")
|
||||
self.plugins_dialog.signal_autoconnect({
|
||||
self.dialog = libglade.GladeXML(const.pluginsFile,"report")
|
||||
self.dialog.signal_autoconnect({
|
||||
"on_report_apply_clicked" : on_report_apply_clicked,
|
||||
"on_report_ok_clicked" : on_report_ok_clicked,
|
||||
"on_report_ok_clicked" : on_report_apply_clicked,
|
||||
"destroy_passed_object" : utils.destroy_passed_object
|
||||
})
|
||||
|
||||
top = self.plugins_dialog.get_widget("report")
|
||||
top.set_data("o",self)
|
||||
tree = self.plugins_dialog.get_widget("tree1")
|
||||
top = self.dialog.get_widget("report")
|
||||
top.set_data(OBJECT,self)
|
||||
tree = self.dialog.get_widget("tree1")
|
||||
self.run_tool = None
|
||||
|
||||
item_hash = {}
|
||||
for report in reports:
|
||||
if report.__dict__.has_key("get_name"):
|
||||
doc = report.get_name()
|
||||
else:
|
||||
doc = report.__doc__
|
||||
|
||||
info = string.split(doc,"/")
|
||||
if len(info) == 1:
|
||||
category = _("Uncategorized")
|
||||
name = info[0]
|
||||
else:
|
||||
category = info[0]
|
||||
name = info[1]
|
||||
item = GtkTreeItem(name)
|
||||
item.set_data("o",self)
|
||||
item.set_data("c",report.report)
|
||||
if "get_description" in report.__dict__.keys():
|
||||
item.set_data("d",report.get_description)
|
||||
else:
|
||||
item.set_data("d",no_description)
|
||||
if "get_xpm_image" in report.__dict__.keys():
|
||||
item.set_data("i",report.get_xpm_image)
|
||||
else:
|
||||
item.set_data("i",no_image)
|
||||
item.set_data("t",doc)
|
||||
item.connect("select",on_report_node_selected)
|
||||
if item_hash.has_key(category):
|
||||
item_hash[category].append(item)
|
||||
else:
|
||||
item_hash[category] = [item]
|
||||
|
||||
key_list = item_hash.keys()
|
||||
key_list.sort()
|
||||
for key in key_list:
|
||||
top_item = GtkTreeItem(key)
|
||||
top_item.show()
|
||||
tree.append(top_item)
|
||||
subtree = GtkTree()
|
||||
subtree.show()
|
||||
top_item.set_subtree(subtree)
|
||||
subtree.show()
|
||||
for item in item_hash[key]:
|
||||
item.show()
|
||||
subtree.append(item)
|
||||
build_tree(tree,_reports,on_report_node_selected)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -140,36 +104,39 @@ class ToolPlugins:
|
||||
self.active = active
|
||||
self.update = update
|
||||
|
||||
self.plugins_dialog = libglade.GladeXML(const.pluginsFile,"pluginsel")
|
||||
self.plugins_dialog.signal_autoconnect({
|
||||
self.dialog = libglade.GladeXML(const.pluginsFile,"pluginsel")
|
||||
self.dialog.signal_autoconnect({
|
||||
"on_apply_clicked" : on_apply_clicked,
|
||||
"on_ok_clicked" : on_ok_clicked,
|
||||
"destroy_passed_object" : utils.destroy_passed_object
|
||||
})
|
||||
|
||||
top = self.plugins_dialog.get_widget("pluginsel")
|
||||
top.set_data("o",self)
|
||||
tree = self.plugins_dialog.get_widget("tree")
|
||||
top = self.dialog.get_widget("pluginsel")
|
||||
top.set_data(OBJECT,self)
|
||||
tree = self.dialog.get_widget("tree")
|
||||
self.run_tool = None
|
||||
build_tree(tree,_tools,on_node_selected)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_tree(tree,list,task):
|
||||
item_hash = {}
|
||||
for report in tools:
|
||||
if report.__dict__.has_key("get_name"):
|
||||
doc = report.get_name()
|
||||
else:
|
||||
doc = report.__doc__
|
||||
for report in list:
|
||||
item = GtkTreeItem(report[2])
|
||||
item.connect("select",task)
|
||||
item.set_data(OBJECT,self)
|
||||
item.set_data(TASK,report[0])
|
||||
item.set_data(TITLE,report[2])
|
||||
item.set_data(DOCSTRING,report[3])
|
||||
item.set_data(IMAGE,report[4])
|
||||
|
||||
info = string.split(doc,"/")
|
||||
item = GtkTreeItem(info[1])
|
||||
item.set_data("o",self)
|
||||
item.set_data("c",report.runTool)
|
||||
item.set_data("d",report.get_description)
|
||||
item.set_data("t",doc)
|
||||
item.connect("select",on_node_selected)
|
||||
if item_hash.has_key(info[0]):
|
||||
item_hash[info[0]].append(item)
|
||||
if item_hash.has_key(report[1]):
|
||||
item_hash[report[1]].append(item)
|
||||
else:
|
||||
item_hash[info[0]] = [item]
|
||||
item_hash[report[1]] = [item]
|
||||
|
||||
key_list = item_hash.keys()
|
||||
key_list.sort()
|
||||
@ -191,13 +158,13 @@ class ToolPlugins:
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_node_selected(obj):
|
||||
myobj = obj.get_data("o")
|
||||
doc = obj.get_data("d")
|
||||
title = string.split(obj.get_data("t"),"/")
|
||||
myobj = obj.get_data(OBJECT)
|
||||
doc = obj.get_data(DOCSTRING)
|
||||
title = obj.get_data(TITLE)
|
||||
|
||||
myobj.plugins_dialog.get_widget("description").set_text(doc())
|
||||
myobj.plugins_dialog.get_widget("pluginTitle").set_text(title[1])
|
||||
myobj.run_tool = obj.get_data("c")
|
||||
myobj.dialog.get_widget("description").set_text(doc)
|
||||
myobj.dialog.get_widget("pluginTitle").set_text(title)
|
||||
myobj.run_tool = obj.get_data(TASK)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -205,31 +172,19 @@ def on_node_selected(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_report_node_selected(obj):
|
||||
myobj = obj.get_data("o")
|
||||
doc = obj.get_data("d")
|
||||
xpm_func = obj.get_data("i")
|
||||
myobj = obj.get_data(OBJECT)
|
||||
doc = obj.get_data(DOCSTRING)
|
||||
xpm = obj.get_data(IMAGE)
|
||||
title = obj.get_data(TITLE)
|
||||
img = myobj.dialog.get_widget("image")
|
||||
|
||||
title = string.split(obj.get_data("t"),"/")
|
||||
img = myobj.plugins_dialog.get_widget("image")
|
||||
myobj.dialog.get_widget("description").set_text(DOC)
|
||||
|
||||
myobj.plugins_dialog.get_widget("description").set_text(doc())
|
||||
|
||||
i,m = create_pixmap_from_xpm_d(GtkWindow(),None,xpm_func())
|
||||
i,m = create_pixmap_from_xpm_d(GtkWindow(),None,xpm)
|
||||
img.set(i,m)
|
||||
|
||||
if len(title) == 1:
|
||||
myobj.plugins_dialog.get_widget("report_title").set_text(title[0])
|
||||
else:
|
||||
myobj.plugins_dialog.get_widget("report_title").set_text(title[1])
|
||||
myobj.run_tool = obj.get_data("c")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def by_doc(a,b):
|
||||
return cmp(names[a],names[b])
|
||||
myobj.dialog.get_widget("report_title").set_text(title)
|
||||
myobj.run_tool = obj.get_data(TASK)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -237,9 +192,9 @@ def by_doc(a,b):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_apply_clicked(obj):
|
||||
myobj = obj.get_data("o")
|
||||
myobj = obj.get_data(OBJECT)
|
||||
utils.destroy_passed_object(obj)
|
||||
if myobj.run_tool != None:
|
||||
if myobj.run_tool:
|
||||
myobj.run_tool(myobj.db,myobj.active,myobj.update)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -248,9 +203,9 @@ def on_apply_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_report_apply_clicked(obj):
|
||||
myobj = obj.get_data("o")
|
||||
myobj = obj.get_data(OBJECT)
|
||||
utils.destroy_passed_object(obj)
|
||||
if myobj.run_tool != None:
|
||||
if myobj.run_tool:
|
||||
myobj.run_tool(myobj.db,myobj.active)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -261,14 +216,6 @@ def on_report_apply_clicked(obj):
|
||||
def on_ok_clicked(obj):
|
||||
on_apply_clicked(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_report_ok_clicked(obj):
|
||||
on_report_apply_clicked(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -289,76 +236,146 @@ def load_plugins(dir):
|
||||
groups = match.groups()
|
||||
try:
|
||||
plugin = __import__(groups[0])
|
||||
try:
|
||||
names[plugin] = plugin.get_name()
|
||||
except:
|
||||
names[plugin] = plugin.__doc__
|
||||
except:
|
||||
print _("Failed to load the module: %s") % groups[0]
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
continue
|
||||
if plugin.__dict__.has_key("report"):
|
||||
reports.append(plugin)
|
||||
elif plugin.__dict__.has_key("writeData"):
|
||||
exports.append(plugin)
|
||||
elif plugin.__dict__.has_key("runTool"):
|
||||
tools.append(plugin)
|
||||
elif plugin.__dict__.has_key("readData"):
|
||||
imports.append(plugin)
|
||||
|
||||
tools.sort(by_doc)
|
||||
imports.sort(by_doc)
|
||||
exports.sort(by_doc)
|
||||
reports.sort(by_doc)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def export_menu(callback):
|
||||
def build_export_menu(top_menu,callback):
|
||||
myMenu = GtkMenu()
|
||||
|
||||
for report in exports:
|
||||
try:
|
||||
text = report.get_name()
|
||||
except:
|
||||
text = report.__doc__
|
||||
item = GtkMenuItem(text)
|
||||
|
||||
for report in _exports:
|
||||
item = GtkMenuItem(report[1])
|
||||
item.connect("activate", callback ,report[0])
|
||||
item.show()
|
||||
item.connect("activate", callback ,report.writeData)
|
||||
myMenu.append(item)
|
||||
return myMenu
|
||||
top_menu.set_submenu(myMenu)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def import_menu(callback):
|
||||
def build_import_menu(top_menu,callback):
|
||||
myMenu = GtkMenu()
|
||||
|
||||
for report in imports:
|
||||
try:
|
||||
text = report.get_name()
|
||||
except:
|
||||
text = report.__doc__
|
||||
item = GtkMenuItem(text)
|
||||
|
||||
for report in _imports:
|
||||
item = GtkMenuItem(report[1])
|
||||
item.connect("activate", callback ,report[0])
|
||||
item.show()
|
||||
item.connect("activate", callback ,report.readData)
|
||||
myMenu.append(item)
|
||||
return myMenu
|
||||
top_menu.set_submenu(myMenu)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def no_description():
|
||||
return _("No description was provided")
|
||||
def register_export(task, name):
|
||||
_exports.append((task, name))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def register_import(task, name):
|
||||
_imports.append((task, name))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def register_report(task, name, category=None, description=None, xpm=None):
|
||||
if xpm == None:
|
||||
xpm_data = no_image()
|
||||
elif type(xpm) == type([]):
|
||||
xpm_data = xpm
|
||||
else:
|
||||
xpm_data = xpm
|
||||
|
||||
if category == None:
|
||||
category = _("Uncategorized")
|
||||
if description == None:
|
||||
description = _("No description was provided")
|
||||
|
||||
_reports.append((task, category, name, description, xpm_data))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def register_tool(task, name, category=None, description=None, xpm=None):
|
||||
if xpm == None:
|
||||
xpm_data = no_image()
|
||||
elif type(xpm) == type([]):
|
||||
xpm_data = xpm
|
||||
else:
|
||||
xpm_data = xpm
|
||||
|
||||
if category == None:
|
||||
category = _("Uncategorized")
|
||||
if description == None:
|
||||
description = _("No description was provided")
|
||||
|
||||
_tools.append((task, category, name, description, xpm_data))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_menu(top_menu,list,callback):
|
||||
report_menu = GtkMenu()
|
||||
report_menu.show()
|
||||
|
||||
hash = {}
|
||||
for report in list:
|
||||
if hash.has_key(report[1]):
|
||||
hash[report[1]].append((report[2],report[0]))
|
||||
else:
|
||||
hash[report[1]] = [(report[2],report[0])]
|
||||
|
||||
catlist = hash.keys()
|
||||
catlist.sort()
|
||||
for key in catlist:
|
||||
entry = GtkMenuItem(key)
|
||||
entry.show()
|
||||
report_menu.append(entry)
|
||||
submenu = GtkMenu()
|
||||
submenu.show()
|
||||
entry.set_submenu(submenu)
|
||||
list = hash[key]
|
||||
list.sort()
|
||||
for name in list:
|
||||
subentry = GtkMenuItem(name[0])
|
||||
subentry.show()
|
||||
subentry.connect("activate",callback,name[1])
|
||||
submenu.append(subentry)
|
||||
top_menu.set_submenu(report_menu)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_report_menu(top_menu,callback):
|
||||
build_menu(top_menu,_reports,callback)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_tools_menu(top_menu,callback):
|
||||
build_menu(top_menu,_tools,callback)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -20,18 +20,23 @@
|
||||
|
||||
from RelLib import *
|
||||
from GrampsParser import *
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
import string
|
||||
import time
|
||||
import gzip
|
||||
import os
|
||||
from gnome.ui import *
|
||||
|
||||
import sys
|
||||
|
||||
import intl
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Try to abstract SAX1 from SAX2
|
||||
@ -165,8 +170,6 @@ def loadData(database, filename, callback=None):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
import time
|
||||
import profile
|
||||
|
||||
database = RelDataBase()
|
||||
|
@ -51,12 +51,11 @@ def import_photo(filename,path,prefix):
|
||||
return None
|
||||
|
||||
for index in range(0,1000):
|
||||
base = "%s_%d.jpg" % (prefix,index)
|
||||
name = path + os.sep + base
|
||||
name = "%s%s%s_%d.jpg" % (path,os.sep,prefix,index)
|
||||
if os.path.exists(name) == 0:
|
||||
break
|
||||
|
||||
thumb = path+os.sep+".thumb"
|
||||
thumb = "%s%s.thumb" % (path,os.sep)
|
||||
|
||||
try:
|
||||
if not os.path.exists(thumb):
|
||||
@ -67,7 +66,7 @@ def import_photo(filename,path,prefix):
|
||||
GnomeErrorDialog(_("Could not create %s") % thumb)
|
||||
|
||||
try:
|
||||
path = thumb + os.sep + base
|
||||
path = "%s%s%s" % (thumb,os.sep,base)
|
||||
|
||||
mk_thumb(filename,path,const.thumbScale)
|
||||
|
||||
@ -81,7 +80,6 @@ def import_photo(filename,path,prefix):
|
||||
PIL.Image.open(filename).save(name)
|
||||
except:
|
||||
return None
|
||||
|
||||
return name
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -19,7 +19,6 @@
|
||||
#
|
||||
|
||||
from Date import *
|
||||
from Researcher import *
|
||||
|
||||
class Place:
|
||||
def __init__(self,source=None):
|
||||
@ -138,6 +137,56 @@ class Place:
|
||||
def getPhotoList(self):
|
||||
return self.photoList
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Researcher
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class Researcher:
|
||||
def __init__(self):
|
||||
self.name = ""
|
||||
self.addr = ""
|
||||
self.city = ""
|
||||
self.state = ""
|
||||
self.country = ""
|
||||
self.postal = ""
|
||||
self.phone = ""
|
||||
self.email = ""
|
||||
|
||||
def getName(self):
|
||||
return self.name
|
||||
|
||||
def getAddress(self):
|
||||
return self.addr
|
||||
|
||||
def getCity(self):
|
||||
return self.city
|
||||
|
||||
def getState(self):
|
||||
return self.state
|
||||
|
||||
def getCountry(self):
|
||||
return self.country
|
||||
|
||||
def getPostalCode(self):
|
||||
return self.postal
|
||||
|
||||
def getPhone(self):
|
||||
return self.phone
|
||||
|
||||
def getEmail(self):
|
||||
return self.email
|
||||
|
||||
def set(self,name,addr,city,state,country,postal,phone,email):
|
||||
self.name = string.strip(name)
|
||||
self.addr = string.strip(addr)
|
||||
self.city = string.strip(city)
|
||||
self.state = string.strip(state)
|
||||
self.country = string.strip(country)
|
||||
self.postal = string.strip(postal)
|
||||
self.phone = string.strip(phone)
|
||||
self.email = string.strip(email)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Location
|
||||
@ -895,6 +944,12 @@ class Event:
|
||||
def getPlace(self) :
|
||||
return self.place
|
||||
|
||||
def getPlaceName(self) :
|
||||
if self.place:
|
||||
return self.place.get_title()
|
||||
else:
|
||||
return ""
|
||||
|
||||
def setNote(self,note) :
|
||||
if self.note == None:
|
||||
self.note = Note()
|
||||
@ -954,6 +1009,13 @@ class Family:
|
||||
self.photoList = []
|
||||
self.note = Note()
|
||||
self.attributeList = []
|
||||
self.position = None
|
||||
|
||||
def setPosition(self,pos):
|
||||
self.position = pos
|
||||
|
||||
def getPosition(self):
|
||||
return self.position
|
||||
|
||||
def addAttribute(self,attribute) :
|
||||
self.attributeList.append(attribute)
|
||||
|
@ -26,7 +26,13 @@ import const
|
||||
|
||||
from TextDoc import *
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StyleListDisplay:
|
||||
|
||||
def __init__(self,stylesheetlist,callback,object):
|
||||
self.object = object
|
||||
self.callback = callback
|
||||
@ -46,17 +52,24 @@ class StyleListDisplay:
|
||||
self.dialog.set_data("o",self)
|
||||
self.redraw()
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def redraw(self):
|
||||
self.list.clear()
|
||||
|
||||
self.list.set_data("i",0)
|
||||
box = ListColors.ColorList(self.list,1)
|
||||
box.add_with_data(["default"],("default",self.sheetlist.get_style_sheet("default")))
|
||||
sheet = self.sheetlist.get_style_sheet("default")
|
||||
box.add_with_data(["default"],("default",sheet))
|
||||
|
||||
for style in self.sheetlist.get_style_names():
|
||||
if style == "default":
|
||||
continue
|
||||
box.add_with_data([style],(style,self.sheetlist.get_style_sheet(style)))
|
||||
sheet = self.sheetlist.get_style_sheet(style)
|
||||
box.add_with_data([style],(style,sheet))
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -153,6 +166,11 @@ class StyleEditor:
|
||||
myMenu.append(menuitem)
|
||||
self.pnames.set_menu(myMenu)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def draw(self,p):
|
||||
self.current_p = p
|
||||
font = p.get_font()
|
||||
@ -184,6 +202,11 @@ class StyleEditor:
|
||||
c = p.get_background_color()
|
||||
self.top.get_widget("bgcolor").set_i8(c[0],c[1],c[2],0)
|
||||
|
||||
#--------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#--------------------------------------------------------------------
|
||||
def save_paragraph(self,p):
|
||||
font = p.get_font()
|
||||
font.set_size(int(self.top.get_widget("size").get_value()))
|
||||
|
@ -19,7 +19,6 @@
|
||||
#
|
||||
|
||||
from RelLib import *
|
||||
from Researcher import *
|
||||
import const
|
||||
|
||||
import string
|
||||
@ -504,9 +503,3 @@ def exportData(database, filename, callback):
|
||||
g.write("</database>\n")
|
||||
g.close()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -62,26 +62,7 @@ class EventAfter(Filter.Filter):
|
||||
break
|
||||
return val
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("People with an event after ...")
|
||||
Filter.register_filter(EventAfter,
|
||||
description=_("People with an event after ..."),
|
||||
qualifier=1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def create(text):
|
||||
return EventAfter(text)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
@ -33,11 +33,8 @@ class HaveAltFamilies(Filter.Filter):
|
||||
def match(self,person):
|
||||
return len(person.getAltFamilyList()) > 0
|
||||
|
||||
def create(text):
|
||||
return HaveAltFamilies(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
Filter.register_filter(HaveAltFamilies,
|
||||
description=_("People who were adopted"),
|
||||
qualifier=0)
|
||||
|
||||
def get_name():
|
||||
return _("People who were adopted")
|
||||
|
@ -68,21 +68,7 @@ class EventBefore(Filter.Filter):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def create(text):
|
||||
return EventBefore(text)
|
||||
Filter.register_filter(EventBefore,
|
||||
description=_("People with an event before ..."),
|
||||
qualifier=1)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("People with an event before ...")
|
||||
|
@ -31,11 +31,12 @@ class Disconnected(Filter.Filter):
|
||||
def match(self,person):
|
||||
return person.getMainFamily() == None and len(person.getFamilyList()) == 0
|
||||
|
||||
def create(text):
|
||||
return Disconnected(text)
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(Disconnected,
|
||||
description= _("Disconnected individuals"),
|
||||
qualifier=0)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("Disconnected individuals")
|
||||
|
@ -49,11 +49,11 @@ class EventPlace(Filter.Filter):
|
||||
break
|
||||
return val
|
||||
|
||||
def create(text):
|
||||
return EventPlace(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
def get_name():
|
||||
return _("People with an event location of ...")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(EventPlace,
|
||||
description=_("People with an event location of ..."),
|
||||
qualifier=1)
|
||||
|
@ -33,11 +33,11 @@ class EventType(Filter.Filter):
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def create(text):
|
||||
return EventType(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
def get_name():
|
||||
return _("People who have an event type of ...")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(EventType,
|
||||
description=_("People who have an event type of ..."),
|
||||
qualifier=1)
|
||||
|
@ -33,11 +33,11 @@ class Females(Filter.Filter):
|
||||
def match(self,person):
|
||||
return person.getGender() == Person.female
|
||||
|
||||
def create(text):
|
||||
return Females(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("Females")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(Females,
|
||||
description=_("Females"),
|
||||
qualifier=0)
|
||||
|
@ -32,11 +32,12 @@ class HavePhotos(Filter.Filter):
|
||||
def match(self,person):
|
||||
return len(person.getPhotoList()) > 0
|
||||
|
||||
def create(text):
|
||||
return HavePhotos(text)
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(HavePhotos,
|
||||
description=_("People who have images"),
|
||||
qualifier=0)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("People who have images")
|
||||
|
@ -32,11 +32,11 @@ class IncompleteNames(Filter.Filter):
|
||||
name = person.getPrimaryName()
|
||||
return name.getFirstName() == "" or name.getSurname() == ""
|
||||
|
||||
def create(text):
|
||||
return IncompleteNames(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("People with incomplete names")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(IncompleteNames,
|
||||
description=_("People with incomplete names"),
|
||||
qualifier=0)
|
||||
|
@ -33,11 +33,12 @@ class Males(Filter.Filter):
|
||||
def match(self,person):
|
||||
return person.getGender() == Person.male
|
||||
|
||||
def create(text):
|
||||
return Males(text)
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(Males,
|
||||
description=_("Males"),
|
||||
qualifier=0)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("Males")
|
||||
|
@ -36,11 +36,11 @@ class MatchSndEx(Filter.Filter):
|
||||
def match(self,person):
|
||||
return self.sndex == soundex.soundex(person.getPrimaryName().getSurname())
|
||||
|
||||
def create(text):
|
||||
return MatchSndEx(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
def get_name():
|
||||
return _("Names with same SoundEx code as ...")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(MatchSndEx,
|
||||
description=_("Names with same SoundEx code as ..."),
|
||||
qualifier=1)
|
||||
|
@ -32,11 +32,11 @@ class MatchSndEx2(Filter.Filter):
|
||||
def match(self,person):
|
||||
return self.text == soundex.soundex(person.getPrimaryName().getSurname())
|
||||
|
||||
def create(text):
|
||||
return MatchSndEx2(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
def get_name():
|
||||
return _("Names with the specified SoundEx code")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(MatchSndEx2,
|
||||
description=_("Names with the specified SoundEx code"),
|
||||
qualifier=1)
|
||||
|
@ -32,11 +32,11 @@ class MultipleMarriages(Filter.Filter):
|
||||
def match(self,person):
|
||||
return len(person.getFamilyList()) > 1
|
||||
|
||||
def create(text):
|
||||
return MultipleMarriages(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("People with multiple marriage records")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(MultipleMarriages,
|
||||
description=_("People with multiple marriage records"),
|
||||
qualifier=0)
|
||||
|
@ -32,11 +32,12 @@ class NeverMarried(Filter.Filter):
|
||||
def match(self,person):
|
||||
return len(person.getFamilyList()) == 0
|
||||
|
||||
def create(text):
|
||||
return NeverMarried(text)
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(NeverMarried,
|
||||
description=_("People with no marriage records"),
|
||||
qualifier=0)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("People with no marriage records")
|
||||
|
@ -32,13 +32,12 @@ class NoBirthdate(Filter.Filter):
|
||||
def match(self,person):
|
||||
return person.getBirth().getDate() == ""
|
||||
|
||||
def create(text):
|
||||
return NoBirthdate(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("People without a birth date")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(NoBirthdate,
|
||||
description=_("People without a birth date"),
|
||||
qualifier=0)
|
||||
|
||||
|
@ -37,12 +37,12 @@ class HaveChildren(Filter.Filter):
|
||||
break
|
||||
return val
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(HaveChildren,
|
||||
description=_("People with children"),
|
||||
qualifier=0)
|
||||
|
||||
def create(text):
|
||||
return HaveChildren(text)
|
||||
|
||||
def need_qualifier():
|
||||
return 0
|
||||
|
||||
def get_name():
|
||||
return _("People with children")
|
||||
|
@ -43,11 +43,18 @@ class RegExMatch(Filter.Filter):
|
||||
else:
|
||||
return self.regexp.search(utils.phonebook_name(person))
|
||||
|
||||
def create(text):
|
||||
return RegExMatch(text)
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(RegExMatch,
|
||||
description=_("Names that match a regular expression"),
|
||||
qualifier=1)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
def get_name():
|
||||
return _("Names that match a regular expression")
|
||||
|
@ -32,11 +32,12 @@ class SubString(Filter.Filter):
|
||||
def match(self,person):
|
||||
return string.find(utils.phonebook_name(person),self.text) >= 0
|
||||
|
||||
def create(text):
|
||||
return SubString(text)
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
Filter.register_filter(SubString,
|
||||
description=_("Names that contain a substring"),
|
||||
qualifier=1)
|
||||
|
||||
def need_qualifier():
|
||||
return 1
|
||||
|
||||
def get_name():
|
||||
return _("Names that contain a substring")
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -364,27 +364,10 @@ def on_save_clicked(obj):
|
||||
doc = FindDoc.make_draw_doc(styles,format,paper,orien)
|
||||
|
||||
MyReport = AncestorReport(db,text,active_person,outputName,doc,max_gen)
|
||||
|
||||
MyReport.write_report()
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Produces a graphical ancestral tree graph")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Generate files/Ancestor Chart")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -446,11 +429,18 @@ def get_xpm_image():
|
||||
" ",
|
||||
" "]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_report
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Ancestor Chart"),
|
||||
category=_("Generate Files"),
|
||||
description=_("Produces a graphical ancestral tree graph"),
|
||||
xpm=get_xpm_image()
|
||||
)
|
||||
|
||||
|
@ -401,17 +401,6 @@ def on_save_clicked(obj):
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Produces a textual ancestral report")
|
||||
|
||||
def get_name():
|
||||
return _("Generate files/Ahnentafel Report")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -472,3 +461,19 @@ def get_xpm_image():
|
||||
" ",
|
||||
" ",
|
||||
" "]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Ahnentafel Report"),
|
||||
category=_("Generate Files"),
|
||||
description= _("Produces a textual ancestral report"),
|
||||
xpm=get_xpm_image()
|
||||
)
|
||||
|
||||
|
@ -87,13 +87,16 @@ def runTool(database,person,callback):
|
||||
"on_apply_clicked" : on_apply_clicked
|
||||
})
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Allows all the events of a certain name to be renamed to a new name")
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_tool
|
||||
|
||||
def get_name():
|
||||
return _("Database Processing/Rename personal event types")
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Rename personal event types"),
|
||||
category=_("Database Processing"),
|
||||
description=_("Allows all the events of a certain name to be renamed to a new name")
|
||||
)
|
||||
|
@ -227,13 +227,17 @@ class CheckIntegrity:
|
||||
textwindow.show_string(text)
|
||||
top.show()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Checks the database for integrity problems, fixing the problems that it can")
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_tool
|
||||
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Check and repair database"),
|
||||
category=_("Database Processing"),
|
||||
description=_("Checks the database for integrity problems, fixing the problems that it can")
|
||||
)
|
||||
|
||||
def get_name():
|
||||
return _("Database Processing/Check and repair database")
|
||||
|
@ -79,19 +79,17 @@ def add_to_tree(tree,person):
|
||||
item.set_subtree(subtree)
|
||||
add_to_tree(subtree,child)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Analysis and Exploration/Interactive descendant browser")
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_tool
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Provides a browsable hierarchy based on the active person")
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Interactive descendant browser"),
|
||||
category=_("Analysis and Exploration"),
|
||||
description=_("Provides a browsable hierarchy based on the active person")
|
||||
)
|
||||
|
||||
|
@ -259,22 +259,6 @@ def on_save_clicked(obj):
|
||||
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Generates a list of descendants of the active person")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Generate files/Descendant Report")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -335,3 +319,19 @@ def get_xpm_image():
|
||||
" ",
|
||||
" ",
|
||||
" "]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Descendant Report"),
|
||||
category=_("Generate Files"),
|
||||
description=_("Generates a list of descendants of the active person"),
|
||||
xpm=get_xpm_image()
|
||||
)
|
||||
|
||||
|
@ -199,7 +199,7 @@ class EventComparison:
|
||||
self.filter_list = []
|
||||
|
||||
myMenu = GtkMenu()
|
||||
for filter in Filter.filterList:
|
||||
for filter in Filter.filterMap.keys():
|
||||
menuitem = GtkMenuItem(filter)
|
||||
myMenu.append(menuitem)
|
||||
menuitem.set_data(FILTER,Filter.filterMap[filter])
|
||||
@ -449,17 +449,6 @@ class EventComparison:
|
||||
def runTool(database,person,callback):
|
||||
EventComparison(database)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Aids in the analysis of data by allowing the development of custom filters that can be applied to the database to find similar events")
|
||||
|
||||
def get_name():
|
||||
return _("Analysis and Exploration/Compare individual events")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -608,3 +597,18 @@ def fix(line):
|
||||
l = string.replace(l,'>','>')
|
||||
l = string.replace(l,'<','<')
|
||||
return string.replace(l,'"','"')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Plugins import register_tool
|
||||
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Compare individual events"),
|
||||
category=_("Analysis and Exploration"),
|
||||
description=_("Aids in the analysis of data by allowing the development of custom filters that can be applied to the database to find similar events")
|
||||
)
|
||||
|
||||
|
@ -164,10 +164,7 @@ class FamilyGroup:
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContentsEnd")
|
||||
self.doc.start_paragraph('Normal')
|
||||
if birth.getPlace() != None:
|
||||
self.doc.write_text(birth.getPlace().get_title())
|
||||
else:
|
||||
self.doc.write_text("")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
@ -185,10 +182,7 @@ class FamilyGroup:
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("TextContentsEnd")
|
||||
self.doc.start_paragraph('Normal')
|
||||
if death.getPlace() != None:
|
||||
self.doc.write_text(death.getPlace().get_title())
|
||||
else:
|
||||
self.doc.write_text("")
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
@ -234,10 +228,7 @@ class FamilyGroup:
|
||||
def dump_child_event(self,text,name,event):
|
||||
if event:
|
||||
date = event.getDate()
|
||||
if event.getPlace() != None:
|
||||
place = event.getPlace().get_title()
|
||||
else:
|
||||
place = ""
|
||||
else:
|
||||
date = ""
|
||||
place = ""
|
||||
@ -526,8 +517,12 @@ def on_save_clicked(obj):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Creates a family group report, showing information on a set of parents and their children.")
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Family Group Report"),
|
||||
category=_("Generate Files"),
|
||||
description=_("Creates a family group report, showing information on a set of parents and their children.")
|
||||
)
|
||||
|
||||
def get_name():
|
||||
return _("Generate files/Family Group Report")
|
||||
|
@ -244,5 +244,17 @@ def get_description():
|
||||
" " + \
|
||||
_("For more information or to get a copy of GraphViz, goto http://www.graphviz.org")
|
||||
|
||||
def get_name():
|
||||
return _("Generate files/Relationship graph")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Relationship graph"),
|
||||
category=_("Generate Files"),
|
||||
description=get_description()
|
||||
)
|
||||
|
||||
|
@ -545,13 +545,18 @@ def dump_index(person_list,filename,prefix,templateTop,templateBottom,targetDir)
|
||||
html.write(line)
|
||||
|
||||
html.close()
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Generates web (HTML) pages for individuals, or a set of individuals.")
|
||||
|
||||
def get_name():
|
||||
return _("Generate files/Individual web pages")
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Individual web pages"),
|
||||
category=_("Generate Files"),
|
||||
description=_("Generates web (HTML) pages for individuals, or a set of individuals.")
|
||||
)
|
||||
|
||||
|
@ -474,11 +474,14 @@ def on_save_clicked(obj):
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Produces a detailed report on the selected person.")
|
||||
from Plugins import register_report
|
||||
|
||||
def get_name():
|
||||
return _("Generate files/Individual Summary")
|
||||
register_report(
|
||||
report,
|
||||
_("Individual Summary"),
|
||||
category=_("Generate Files"),
|
||||
description=_("Produces a detailed report on the selected person.")
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -905,17 +905,6 @@ class Merge:
|
||||
def runTool(database,active_person,callback):
|
||||
mergeObj = Merge(database,callback)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Searches the entire database, looking for individual entries that may represent the same person.")
|
||||
|
||||
def get_name():
|
||||
return _("Database Processing/Merge people")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -950,3 +939,18 @@ def on_merge_clicked(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def by_id(p1,p2):
|
||||
return cmp(p1.getId(),p2.getId())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Plugins import register_tool
|
||||
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Merge people"),
|
||||
category=_("Database Processing"),
|
||||
description=_("Searches the entire database, looking for individual entries that may represent the same person.")
|
||||
)
|
||||
|
||||
|
@ -113,24 +113,19 @@ def on_ok_clicked(obj):
|
||||
utils.destroy_passed_object(obj)
|
||||
cb(1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Searches the entire database and attempts to extract titles and nicknames that may be embedded in a person's given name field.")
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Database Processing/Extract information from names")
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_tool
|
||||
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Extract information from names"),
|
||||
category=_("Database Processing"),
|
||||
description=_("Searches the entire database and attempts to extract titles and nicknames that may be embedded in a person's given name field.")
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
@ -1550,28 +1550,6 @@ def readData(database,active_person,cb):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Import from GEDCOM")
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
import sys
|
||||
|
||||
db = RelDataBase()
|
||||
if len(sys.argv) == 1:
|
||||
g = GedcomParser(db,"test.ged")
|
||||
else:
|
||||
g = GedcomParser(db,sys.argv[1])
|
||||
g.parse_gedcom_file()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
from Plugins import register_import
|
||||
|
||||
register_import(readData,"Import from GEDCOM")
|
||||
|
@ -82,10 +82,12 @@ def on_ok_clicked(obj):
|
||||
importData(db,name,progress)
|
||||
callback(1)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Import from Gramps")
|
||||
#------------------------------------------------------------------------
|
||||
from Plugins import register_import
|
||||
|
||||
register_import(readData,_("Import from Gramps"))
|
||||
|
||||
|
@ -259,8 +259,11 @@ def runTool(database,person,callback):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Calculates the relationship between two people")
|
||||
from Plugins import register_tool
|
||||
|
||||
def get_name():
|
||||
return _("Utilities/Relationship calculator")
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Relationship calculator"),
|
||||
category=_("Utilities"),
|
||||
description=_("Calculates the relationship between two people")
|
||||
)
|
||||
|
@ -73,8 +73,12 @@ def runTool(database,active_person,callback):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Reorders the gramps IDs according to gramps' default rules.")
|
||||
from Plugins import register_tool
|
||||
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Reorder gramps IDs"),
|
||||
category=_("Database Processing"),
|
||||
description=_("Reorders the gramps IDs according to gramps' default rules.")
|
||||
)
|
||||
|
||||
def get_name():
|
||||
return _("Database Processing/Reorder gramps IDs")
|
||||
|
@ -115,9 +115,12 @@ def report(database,person):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Provides a summary of the current database")
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Summary of the database"),
|
||||
category=_("View"),
|
||||
description=_("Provides a summary of the current database")
|
||||
)
|
||||
|
||||
def get_name():
|
||||
return _("View/Summary of the database")
|
||||
|
@ -776,18 +776,17 @@ def dump_index(person_list,styles,template,html_dir):
|
||||
doc.newline()
|
||||
doc.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Generates web (HTML) pages for individuals, or a set of individuals.")
|
||||
#-------------------------------------------------------------------------
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Generate Web Site"),
|
||||
category=_("Web Page"),
|
||||
description=_("Generates web (HTML) pages for individuals, or a set of individuals.")
|
||||
)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Web Site/Generate Web Site")
|
||||
|
@ -686,5 +686,11 @@ def writeData(database,person):
|
||||
|
||||
topDialog.get_widget("gedcomExport").show()
|
||||
|
||||
def get_name():
|
||||
return _("Export to GEDCOM")
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from Plugins import register_export
|
||||
|
||||
register_export(writeData,_("Export to GEDCOM"))
|
||||
|
@ -84,9 +84,12 @@ def report(database,person):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Counts number of ancestors of selected person")
|
||||
from Plugins import register_report
|
||||
|
||||
register_report(
|
||||
report,
|
||||
_("Number of ancestors"),
|
||||
category=_("View"),
|
||||
description=_("Counts number of ancestors of selected person")
|
||||
)
|
||||
|
||||
def get_name():
|
||||
return _("View/Number of ancestors")
|
||||
|
@ -76,13 +76,13 @@ def runTool(database,active_person,callback):
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_description():
|
||||
return _("Generates SoundEx codes for names")
|
||||
from Plugins import register_tool
|
||||
|
||||
register_tool(
|
||||
runTool,
|
||||
_("Generate SoundEx codes"),
|
||||
category=_("Utilities"),
|
||||
description=_("Generates SoundEx codes for names")
|
||||
)
|
||||
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_name():
|
||||
return _("Utilities/Generate SoundEx codes")
|
||||
|
@ -19,9 +19,15 @@
|
||||
#
|
||||
|
||||
import gtk
|
||||
|
||||
import gnome.mime
|
||||
import string
|
||||
import os
|
||||
import const
|
||||
_modifiedFlag = 0
|
||||
|
||||
LISTOBJ = "s"
|
||||
INDEX = "i"
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Sets the modified flag, which is used to determine if the database
|
||||
@ -102,7 +108,6 @@ def destroy_passed_object(obj):
|
||||
# point numbers
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import string
|
||||
|
||||
if string.find("%.3f" % 1.2, ",") == -1:
|
||||
_use_comma = 0
|
||||
@ -127,3 +132,178 @@ def txt2fl(st):
|
||||
#-------------------------------------------------------------------------
|
||||
def fl2txt(fmt,val):
|
||||
return string.replace(fmt % val, ',', '.')
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_detail_flags(obj):
|
||||
import Config
|
||||
|
||||
detail = ""
|
||||
if Config.show_detail:
|
||||
if obj.getNote() != "":
|
||||
detail = "N"
|
||||
if obj.getSourceRef().getBase():
|
||||
detail = detail + "S"
|
||||
if obj.getPrivacy():
|
||||
detail = detail + "P"
|
||||
return detail
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_detail_text(obj):
|
||||
if obj.getNote() != "":
|
||||
details = "%s" % _("Note")
|
||||
else:
|
||||
details = ""
|
||||
if obj.getSourceRef().getBase() != None:
|
||||
if details == "":
|
||||
details = _("Source")
|
||||
else:
|
||||
details = "%s, %s" % (details,_("Source"))
|
||||
if obj.getPrivacy() == 1:
|
||||
if details == "":
|
||||
details = _("Private")
|
||||
else:
|
||||
details = "%s, %s" % (details,_("Private"))
|
||||
return details
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def build_confidence_menu(menu):
|
||||
myMenu = gtk.GtkMenu()
|
||||
index = 0
|
||||
for name in const.confidence:
|
||||
item = gtk.GtkMenuItem(name)
|
||||
item.set_data("a",index)
|
||||
item.show()
|
||||
myMenu.append(item)
|
||||
index = index + 1
|
||||
menu.set_menu(myMenu)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def redraw_list(dlist,clist,func):
|
||||
clist.freeze()
|
||||
clist.clear()
|
||||
|
||||
index = 0
|
||||
for object in dlist:
|
||||
clist.append(func(object))
|
||||
clist.set_row_data(index,object)
|
||||
index = index + 1
|
||||
|
||||
current_row = clist.get_data(INDEX)
|
||||
if index > 0:
|
||||
if current_row <= 0:
|
||||
current_row = 0
|
||||
elif index <= current_row:
|
||||
current_row = current_row - 1
|
||||
clist.select_row(current_row,0)
|
||||
clist.moveto(current_row,0)
|
||||
clist.set_data(INDEX,current_row)
|
||||
clist.thaw()
|
||||
return index
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def delete_selected(obj,list):
|
||||
row = obj.get_data(INDEX)
|
||||
if row < 0:
|
||||
return 0
|
||||
del list[row]
|
||||
if row > len(list)-1:
|
||||
obj.set_data(INDEX,row-1)
|
||||
return 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def add_menuitem(menu,msg,obj,func):
|
||||
item = gtk.GtkMenuItem(msg)
|
||||
item.set_data("m",obj)
|
||||
item.connect("activate",func)
|
||||
item.show()
|
||||
menu.append(item)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def view_photo(photo):
|
||||
type = gnome.mime.type(photo.getPath())
|
||||
prog = string.split(gnome.mime.get_value(type,'view'))
|
||||
args = []
|
||||
for val in prog:
|
||||
if val == "%f":
|
||||
args.append(photo.getPath())
|
||||
else:
|
||||
args.append(val)
|
||||
|
||||
if os.fork() == 0:
|
||||
os.execvp(args[0],args)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def attach_places(values,combo,place):
|
||||
l = gtk.GtkLabel("")
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = gtk.GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data(LISTOBJ,None)
|
||||
c.show()
|
||||
sel_child = c
|
||||
list = [c]
|
||||
mymap = {}
|
||||
for src in values:
|
||||
l = gtk.GtkLabel("%s [%s]" % (src.get_title(),src.getId()))
|
||||
l.show()
|
||||
l.set_alignment(0,0.5)
|
||||
c = gtk.GtkListItem()
|
||||
c.add(l)
|
||||
c.set_data(LISTOBJ,src)
|
||||
c.show()
|
||||
list.append(c)
|
||||
if src == place:
|
||||
sel_child = c
|
||||
mymap[src] = c
|
||||
|
||||
combo.list.append_items(list)
|
||||
combo.list.select_child(sel_child)
|
||||
|
||||
for v in mymap.keys():
|
||||
combo.set_item_string(mymap[v],v.get_title())
|
||||
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def get_place_from_list(obj):
|
||||
select = obj.list.get_selection()
|
||||
if len(select) == 0:
|
||||
return None
|
||||
else:
|
||||
return select[0].get_data(LISTOBJ)
|
||||
|
Loading…
Reference in New Issue
Block a user