Broke the Editors into separate classes
svn: r464
This commit is contained in:
parent
4e90da3aa3
commit
0f21f2b76e
@ -174,7 +174,10 @@ class AbiWordDoc(TextDoc):
|
||||
self.f.write('</c></p>\n')
|
||||
|
||||
def write_text(self,text):
|
||||
self.f.write(text)
|
||||
text = string.replace(text,'&','&'); # Must be first
|
||||
text = string.replace(text,'<','<');
|
||||
text = string.replace(text,'>','>');
|
||||
self.f.write(text)
|
||||
|
||||
def start_bold(self):
|
||||
font = self.current_style.get_font()
|
||||
|
167
src/AddrEdit.py
Normal file
167
src/AddrEdit.py
Normal file
@ -0,0 +1,167 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 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
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import intl
|
||||
import const
|
||||
import utils
|
||||
from RelLib import *
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# AddressEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class AddressEditor:
|
||||
|
||||
def __init__(self,parent,addr):
|
||||
self.parent = parent
|
||||
self.addr = addr
|
||||
self.top = libglade.GladeXML(const.editPersonFile, "addr_edit")
|
||||
self.window = self.top.get_widget("addr_edit")
|
||||
self.addr_start = self.top.get_widget("address_start")
|
||||
self.street = self.top.get_widget("street")
|
||||
self.city = self.top.get_widget("city")
|
||||
self.state = self.top.get_widget("state")
|
||||
self.country = self.top.get_widget("country")
|
||||
self.postal = self.top.get_widget("postal")
|
||||
self.note_field = self.top.get_widget("addr_note")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
if self.addr:
|
||||
self.srcreflist = self.addr.getSourceRefList()
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
name = parent.person.getPrimaryName().getName()
|
||||
text = _("Address Editor for %s") % name
|
||||
self.top.get_widget("addrTitle").set_text(text)
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.addr_start);
|
||||
self.window.editable_enters(self.street);
|
||||
self.window.editable_enters(self.city);
|
||||
self.window.editable_enters(self.state);
|
||||
self.window.editable_enters(self.country);
|
||||
self.window.editable_enters(self.postal);
|
||||
self.window.editable_enters(self.note_field);
|
||||
|
||||
if self.addr != None:
|
||||
self.addr_start.set_text(self.addr.getDate())
|
||||
self.street.set_text(self.addr.getStreet())
|
||||
self.city.set_text(self.addr.getCity())
|
||||
self.state.set_text(self.addr.getState())
|
||||
self.country.set_text(self.addr.getCountry())
|
||||
self.postal.set_text(self.addr.getPostal())
|
||||
|
||||
self.priv.set_active(self.addr.getPrivacy())
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(self.addr.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_addr_edit_ok_clicked" : self.on_addr_edit_ok_clicked,
|
||||
"on_source_clicked" : self.on_addr_source_clicked
|
||||
})
|
||||
|
||||
def on_addr_source_clicked(self,obj):
|
||||
Sources.SourceSelector(self.srcreflist,self.parent,src_changed)
|
||||
|
||||
def on_addr_edit_ok_clicked(self,obj):
|
||||
date = self.addr_start.get_text()
|
||||
street = self.street.get_text()
|
||||
city = self.city.get_text()
|
||||
state = self.state.get_text()
|
||||
country = self.country.get_text()
|
||||
postal = self.postal.get_text()
|
||||
note = self.note_field.get_chars(0,-1)
|
||||
priv = self.priv.get_active()
|
||||
|
||||
if self.addr == None:
|
||||
self.addr = Address()
|
||||
self.addr.setSourceRefList(self.srcreflist)
|
||||
self.parent.plist.append(self.addr)
|
||||
|
||||
self.update_address(date,street,city,state,country,postal,note,priv)
|
||||
self.parent.redraw_addr_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def update_address(self,date,street,city,state,country,postal,note,priv):
|
||||
d = Date()
|
||||
d.set(date)
|
||||
|
||||
if self.addr.getDate() != d.getDate():
|
||||
self.addr.setDate(date)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getState() != state:
|
||||
self.addr.setState(state)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getStreet() != street:
|
||||
self.addr.setStreet(street)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getCountry() != country:
|
||||
self.addr.setCountry(country)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getCity() != city:
|
||||
self.addr.setCity(city)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getPostal() != postal:
|
||||
self.addr.setPostal(postal)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getNote() != note:
|
||||
self.addr.setNote(note)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.addr.getPrivacy() != priv:
|
||||
self.addr.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
141
src/AttrEdit.py
Normal file
141
src/AttrEdit.py
Normal file
@ -0,0 +1,141 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 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
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import GDK
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import intl
|
||||
import const
|
||||
import utils
|
||||
import Config
|
||||
from RelLib import *
|
||||
import Sources
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# AttributeEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class AttributeEditor:
|
||||
|
||||
def __init__(self,parent,attrib,title,list):
|
||||
self.parent = parent
|
||||
self.attrib = attrib
|
||||
self.top = libglade.GladeXML(const.dialogFile, "attr_edit")
|
||||
self.window = self.top.get_widget("attr_edit")
|
||||
self.type_field = self.top.get_widget("attr_type")
|
||||
self.value_field = self.top.get_widget("attr_value")
|
||||
self.note_field = self.top.get_widget("attr_note")
|
||||
self.attrib_menu = self.top.get_widget("attr_menu")
|
||||
self.source_field = self.top.get_widget("attr_source")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
if attrib:
|
||||
self.srcreflist = self.attrib.getSourceRefList()
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.type_field);
|
||||
self.window.editable_enters(self.value_field);
|
||||
|
||||
title = _("Attribute Editor for %s") % title
|
||||
self.top.get_widget("attrTitle").set_text(title)
|
||||
if len(list) > 0:
|
||||
self.attrib_menu.set_popdown_strings(list)
|
||||
|
||||
if attrib != None:
|
||||
self.type_field.set_text(attrib.getType())
|
||||
self.value_field.set_text(attrib.getValue())
|
||||
self.priv.set_active(attrib.getPrivacy())
|
||||
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(attrib.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_attr_edit_ok_clicked" : self.on_attrib_edit_ok_clicked,
|
||||
"on_source_clicked" : self.on_attrib_source_clicked
|
||||
})
|
||||
|
||||
def on_attrib_source_clicked(self,obj):
|
||||
Sources.SourceSelector(self.srcreflist,self.parent,src_changed)
|
||||
|
||||
def on_attrib_edit_ok_clicked(self,obj):
|
||||
|
||||
type = self.type_field.get_text()
|
||||
value = self.value_field.get_text()
|
||||
note = self.note_field.get_chars(0,-1)
|
||||
priv = self.priv.get_active()
|
||||
|
||||
if self.attrib == None:
|
||||
self.attrib = Attribute()
|
||||
self.attrib.setSourceRefList(self.srcreflist)
|
||||
self.parent.alist.append(self.attrib)
|
||||
|
||||
self.update_attrib(type,value,note,priv)
|
||||
|
||||
self.parent.redraw_attr_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def update_attrib(self,type,value,note,priv):
|
||||
|
||||
if self.attrib.getType() != const.save_pattr(type):
|
||||
self.attrib.setType(const.save_pattr(type))
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.attrib.getValue() != value:
|
||||
self.attrib.setValue(value)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.attrib.getNote() != note:
|
||||
self.attrib.setNote(note)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.attrib.getPrivacy() != priv:
|
||||
self.attrib.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
1658
src/EditPerson.py
1658
src/EditPerson.py
File diff suppressed because it is too large
Load Diff
105
src/EditPlace.py
105
src/EditPlace.py
@ -48,6 +48,7 @@ from RelLib import *
|
||||
import RelImage
|
||||
import Sources
|
||||
import ImageSelect
|
||||
import UrlEdit
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
@ -68,7 +69,7 @@ class EditPlace:
|
||||
self.callback = func
|
||||
self.path = db.getSavePath()
|
||||
self.not_loaded = 1
|
||||
self.list_changed = 0
|
||||
self.lists_changed = 0
|
||||
if place:
|
||||
self.srcreflist = place.getSourceRefList()
|
||||
else:
|
||||
@ -123,6 +124,7 @@ class EditPlace:
|
||||
"on_switch_page" : on_switch_page,
|
||||
"on_addphoto_clicked" : self.gallery.on_add_photo_clicked,
|
||||
"on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked,
|
||||
"on_edit_properties_clicked": self.gallery.popup_change_description,
|
||||
"on_add_url_clicked" : on_add_url_clicked,
|
||||
"on_delete_url_clicked" : on_delete_url_clicked,
|
||||
"on_update_url_clicked" : on_update_url_clicked,
|
||||
@ -220,7 +222,7 @@ def on_place_apply_clicked(obj):
|
||||
mloc.set_city(city)
|
||||
utils.modified()
|
||||
|
||||
if edit.list_changed:
|
||||
if edit.lists_changed:
|
||||
edit.place.setSourceRefList(edit.srcreflist)
|
||||
utils.modified()
|
||||
|
||||
@ -276,7 +278,12 @@ def on_switch_page(obj,a,page):
|
||||
def on_update_url_clicked(obj):
|
||||
if len(obj.selection) > 0:
|
||||
row = obj.selection[0]
|
||||
UrlEditor(obj.get_data(_PLACE),obj.get_row_data(row))
|
||||
mobj = obj.get_data(_PLACE)
|
||||
if mobj.place:
|
||||
name = _("Internet Address Editor for %s") % mobj.place.get_title()
|
||||
else:
|
||||
name = _("Internet Address Editor")
|
||||
UrlEdit.UrlEditor(mobj,name,obj.get_row_data(row))
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -316,7 +323,12 @@ def on_delete_loc_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_add_url_clicked(obj):
|
||||
UrlEditor(obj.get_data(_PLACE),None)
|
||||
mobj = obj.get_data(_PLACE)
|
||||
if mobj.place:
|
||||
name = _("Internet Address Editor for %s") % mobj.place.get_title()
|
||||
else:
|
||||
name = _("Internet Address Editor")
|
||||
UrlEdit.UrlEditor(mobj,name,None)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -336,64 +348,7 @@ def on_source_clicked(obj):
|
||||
Sources.SourceSelector(epo.srcreflist,epo,src_changed)
|
||||
|
||||
def src_changed(parent):
|
||||
parent.list_changed = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# UrlEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class UrlEditor:
|
||||
|
||||
def __init__(self,parent,url):
|
||||
self.parent = parent
|
||||
self.url = url
|
||||
self.top = libglade.GladeXML(const.editPersonFile, "url_edit")
|
||||
self.window = self.top.get_widget("url_edit")
|
||||
self.des = self.top.get_widget("url_des")
|
||||
self.addr = self.top.get_widget("url_addr")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
if parent.place:
|
||||
name = _("Internet Address Editor for %s") % parent.place.get_title()
|
||||
else:
|
||||
name = _("Internet Address Editor")
|
||||
|
||||
self.top.get_widget("urlTitle").set_text(name)
|
||||
|
||||
if url != None:
|
||||
self.des.set_text(url.get_description())
|
||||
self.addr.set_text(url.get_path())
|
||||
self.priv.set_active(url.getPrivacy())
|
||||
|
||||
self.window.set_data("o",self)
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_url_edit_ok_clicked" : on_url_edit_ok_clicked
|
||||
})
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_url_edit_ok_clicked(obj):
|
||||
ee = obj.get_data("o")
|
||||
url = ee.url
|
||||
|
||||
des = ee.des.get_text()
|
||||
addr = ee.addr.get_text()
|
||||
priv = ee.priv.get_active()
|
||||
|
||||
if url == None:
|
||||
url = Url()
|
||||
ee.parent.ulist.append(url)
|
||||
|
||||
if update_url(url,des,addr,priv):
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_url_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
parent.lists_changed = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -434,32 +389,6 @@ def on_loc_list_select_row(obj,row,b,c):
|
||||
epo.loc_state.set_text(loc.get_state())
|
||||
epo.loc_country.set_text(loc.get_country())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# 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
|
||||
# actually changed.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_url(url,des,addr,priv):
|
||||
changed = 0
|
||||
|
||||
if url.get_path() != addr:
|
||||
url.set_path(addr)
|
||||
changed = 1
|
||||
|
||||
if url.get_description() != des:
|
||||
url.set_description(des)
|
||||
changed = 1
|
||||
|
||||
if url.getPrivacy() != priv:
|
||||
url.setPrivacy(priv)
|
||||
changed = 1
|
||||
|
||||
return changed
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# update_location
|
||||
|
172
src/EventEdit.py
Normal file
172
src/EventEdit.py
Normal file
@ -0,0 +1,172 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 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
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import GDK
|
||||
|
||||
import libglade
|
||||
import os
|
||||
import intl
|
||||
import Sources
|
||||
import AttrEdit
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
import const
|
||||
import Config
|
||||
import utils
|
||||
from RelLib import *
|
||||
import RelImage
|
||||
import ImageSelect
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EventEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class EventEditor:
|
||||
|
||||
def __init__(self,parent,name,list,trans,event,read_only):
|
||||
self.parent = parent
|
||||
self.event = event
|
||||
self.trans = trans
|
||||
self.srcreflist = self.event.getSourceRefList()
|
||||
self.top = libglade.GladeXML(const.dialogFile, "event_edit")
|
||||
self.window = self.top.get_widget("event_edit")
|
||||
self.name_field = self.top.get_widget("eventName")
|
||||
self.place_field = self.top.get_widget("eventPlace")
|
||||
self.cause_field = self.top.get_widget("eventCause")
|
||||
self.place_combo = self.top.get_widget("eventPlace_combo")
|
||||
self.date_field = self.top.get_widget("eventDate")
|
||||
self.cause_field = self.top.get_widget("eventCause")
|
||||
self.descr_field = self.top.get_widget("eventDescription")
|
||||
self.note_field = self.top.get_widget("eventNote")
|
||||
self.event_menu = self.top.get_widget("personalEvents")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
self.top.get_widget("eventTitle").set_text(name)
|
||||
self.event_menu.set_popdown_strings(list)
|
||||
if read_only:
|
||||
self.event_menu.set_sensitive(0)
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.name_field);
|
||||
self.window.editable_enters(self.place_field);
|
||||
self.window.editable_enters(self.date_field);
|
||||
self.window.editable_enters(self.cause_field);
|
||||
self.window.editable_enters(self.descr_field);
|
||||
|
||||
values = self.parent.db.getPlaceMap().values()
|
||||
if event != None:
|
||||
self.name_field.set_text(event.getName())
|
||||
|
||||
utils.attach_places(values,self.place_combo,event.getPlace())
|
||||
self.place_field.set_text(event.getPlaceName())
|
||||
self.date_field.set_text(event.getDate())
|
||||
self.cause_field.set_text(event.getCause())
|
||||
self.descr_field.set_text(event.getDescription())
|
||||
self.priv.set_active(event.getPrivacy())
|
||||
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(event.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
else:
|
||||
utils.attach_places(values,self.place_combo,None)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_event_edit_ok_clicked" : self.on_event_edit_ok_clicked,
|
||||
"on_source_clicked" : self.on_edit_source_clicked
|
||||
})
|
||||
|
||||
def on_edit_source_clicked(self,obj):
|
||||
Sources.SourceSelector(self.srcreflist,self.parent,src_changed)
|
||||
|
||||
def on_event_edit_ok_clicked(self,obj):
|
||||
event = self.event
|
||||
|
||||
ename = self.name_field.get_text()
|
||||
edate = self.date_field.get_text()
|
||||
ecause = self.cause_field.get_text()
|
||||
eplace = string.strip(self.place_field.get_text())
|
||||
eplace_obj = utils.get_place_from_list(self.place_combo)
|
||||
enote = self.note_field.get_chars(0,-1)
|
||||
edesc = self.descr_field.get_text()
|
||||
epriv = self.priv.get_active()
|
||||
|
||||
if event == None:
|
||||
event = Event()
|
||||
event.setSourceRefList(self.srcreflist)
|
||||
self.parent.elist.append(event)
|
||||
|
||||
if eplace_obj == None and eplace != "":
|
||||
eplace_obj = Place()
|
||||
eplace_obj.set_title(eplace)
|
||||
self.parent.db.addPlace(eplace_obj)
|
||||
|
||||
self.update_event(ename,edate,eplace_obj,edesc,enote,epriv,ecause)
|
||||
self.parent.redraw_event_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def update_event(self,name,date,place,desc,note,priv,cause):
|
||||
if self.event.getPlace() != place:
|
||||
self.event.setPlace(place)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.event.getName() != self.trans(name):
|
||||
self.event.setName(self.trans(name))
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.event.getDescription() != desc:
|
||||
self.event.setDescription(desc)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.event.getNote() != note:
|
||||
self.event.setNote(note)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.event.getDate() != date:
|
||||
self.event.setDate(date)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.event.getCause() != cause:
|
||||
self.event.setCause(cause)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.event.getPrivacy() != priv:
|
||||
self.event.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
@ -49,6 +49,7 @@ import Config
|
||||
from RelLib import *
|
||||
import RelImage
|
||||
import Sources
|
||||
import AttrEdit
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
@ -125,7 +126,7 @@ class ImageSelect:
|
||||
type = utils.get_mime_type(filename)
|
||||
mobj = Photo()
|
||||
if description == "":
|
||||
description = os.path.basename(name)
|
||||
description = os.path.basename(filename)
|
||||
mobj.setDescription(description)
|
||||
mobj.setMimeType(type)
|
||||
self.savephoto(mobj)
|
||||
@ -219,7 +220,6 @@ class Gallery(ImageSelect):
|
||||
def add_thumbnail(self, photo):
|
||||
object = photo.getReference()
|
||||
path = object.getPath()
|
||||
src = os.path.basename(path)
|
||||
if object.getMimeType()[0:5] == "image":
|
||||
thumb = "%s/.thumb/%s.jpg" % (self.path,object.getId())
|
||||
RelImage.check_thumb(path,thumb,const.thumbScale)
|
||||
@ -368,7 +368,7 @@ class Gallery(ImageSelect):
|
||||
def popup_convert_to_private(self, obj):
|
||||
photo = self.dataobj.getPhotoList()[self.selectedIcon]
|
||||
object = photo.getReference()
|
||||
name = RelImage.import_photo(object.getPath(),self.path,self.prefix)
|
||||
name = RelImage.import_media_object(object.getPath(),self.path,self.prefix)
|
||||
|
||||
object.setPath(name)
|
||||
object.setLocal(1)
|
||||
@ -381,64 +381,105 @@ class Gallery(ImageSelect):
|
||||
#-------------------------------------------------------------------------
|
||||
def popup_change_description(self, obj):
|
||||
photo = self.dataobj.getPhotoList()[self.selectedIcon]
|
||||
object = photo.getReference()
|
||||
path = object.getPath()
|
||||
src = os.path.basename(path)
|
||||
LocalMediaProperties(photo,self.path)
|
||||
|
||||
|
||||
class LocalMediaProperties:
|
||||
|
||||
def __init__(self,photo,path):
|
||||
self.photo = photo
|
||||
self.object = photo.getReference()
|
||||
self.alist = photo.getAttributeList()[:]
|
||||
self.lists_changed = 0
|
||||
|
||||
fname = self.object.getPath()
|
||||
src = os.path.basename(fname)
|
||||
|
||||
self.change_dialog = libglade.GladeXML(const.imageselFile,"change_description")
|
||||
window = self.change_dialog.get_widget("change_description")
|
||||
self.change_dialog.get_widget("description").set_text(object.getDescription())
|
||||
descr_window = self.change_dialog.get_widget("description")
|
||||
pixmap = self.change_dialog.get_widget("pixmap")
|
||||
mtype = object.getMimeType()
|
||||
self.attr_type = self.change_dialog.get_widget("attr_type")
|
||||
self.attr_value = self.change_dialog.get_widget("attr_value")
|
||||
self.attr_details = self.change_dialog.get_widget("attr_details")
|
||||
self.attr_list = self.change_dialog.get_widget("attr_list")
|
||||
|
||||
descr_window.set_text(self.object.getDescription())
|
||||
mtype = self.object.getMimeType()
|
||||
if mtype[0:5] == "image":
|
||||
thumb = "%s/.thumb/%s" % (self.path,object.getId())
|
||||
RelImage.check_thumb(path,thumb,const.thumbScale)
|
||||
thumb = "%s/.thumb/%s" % (path,self.object.getId())
|
||||
RelImage.check_thumb(fname,thumb,const.thumbScale)
|
||||
pixmap.load_file(thumb)
|
||||
else:
|
||||
pixmap.load_file(utils.find_icon(mtype))
|
||||
|
||||
self.change_dialog.get_widget("private").set_active(photo.getPrivacy())
|
||||
self.change_dialog.get_widget("gid").set_text(object.getId())
|
||||
self.change_dialog.get_widget("description").set_text(object.getDescription())
|
||||
if object.getLocal():
|
||||
self.change_dialog.get_widget("gid").set_text(self.object.getId())
|
||||
|
||||
if self.object.getLocal():
|
||||
self.change_dialog.get_widget("path").set_text("<local>")
|
||||
else:
|
||||
self.change_dialog.get_widget("path").set_text(path)
|
||||
self.change_dialog.get_widget("path").set_text(fname)
|
||||
self.change_dialog.get_widget("type").set_text(utils.get_mime_description(mtype))
|
||||
self.change_dialog.get_widget("notes").insert_defaults(photo.getNote())
|
||||
window.set_data("p",photo)
|
||||
window.set_data("t",self.change_dialog)
|
||||
self.change_dialog.signal_autoconnect({
|
||||
"on_cancel_clicked" : utils.destroy_passed_object,
|
||||
"on_ok_clicked" : self.new_desc_ok_clicked,
|
||||
"on_apply_clicked" : self.new_desc_apply_clicked
|
||||
"on_ok_clicked" : self.on_ok_clicked,
|
||||
"on_apply_clicked" : self.on_apply_clicked,
|
||||
"on_attr_list_select_row" : self.on_attr_list_select_row,
|
||||
"on_add_attr_clicked": self.on_add_attr_clicked,
|
||||
"on_delete_attr_clicked" : self.on_delete_attr_clicked,
|
||||
"on_update_attr_clicked" : self.on_update_attr_clicked,
|
||||
})
|
||||
self.redraw_attr_list()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# new_desc_apply_clicked - Apply the new description.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def new_desc_apply_clicked(self, obj):
|
||||
photo = obj.get_data("p")
|
||||
top = obj.get_data('t')
|
||||
priv = top.get_widget("private").get_active()
|
||||
text = top.get_widget("notes").get_chars(0,-1)
|
||||
note = photo.getNote()
|
||||
if text != note or priv != photo.getPrivacy():
|
||||
photo.setNote(text)
|
||||
photo.setPrivacy(priv)
|
||||
def redraw_attr_list(self):
|
||||
utils.redraw_list(self.alist,self.attr_list,disp_attr)
|
||||
|
||||
def on_apply_clicked(self, obj):
|
||||
priv = self.change_dialog.get_widget("private").get_active()
|
||||
text = self.change_dialog.get_widget("notes").get_chars(0,-1)
|
||||
note = self.photo.getNote()
|
||||
if text != note or priv != self.photo.getPrivacy():
|
||||
self.photo.setNote(text)
|
||||
self.photo.setPrivacy(priv)
|
||||
utils.modified()
|
||||
if self.lists_changed:
|
||||
self.photo.setAttributeList(self.alist)
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# new_desc_ok_clicked - Apply the new description and close the dialog.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def new_desc_ok_clicked(self, obj):
|
||||
self.new_desc_apply_clicked(obj)
|
||||
def on_ok_clicked(self, obj):
|
||||
self.on_apply_clicked(obj)
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
|
||||
def on_attr_list_select_row(self,obj,row,b,c):
|
||||
attr = obj.get_row_data(row)
|
||||
|
||||
self.attr_type.set_label(attr.getType())
|
||||
self.attr_value.set_text(attr.getValue())
|
||||
self.attr_details.set_text(utils.get_detail_text(attr))
|
||||
|
||||
def on_update_attr_clicked(self,obj):
|
||||
if len(obj.selection) > 0:
|
||||
row = obj.selection[0]
|
||||
attr = obj.get_row_data(row)
|
||||
AttrEdit.AttributeEditor(self,attr,"Media Object",[])
|
||||
|
||||
def on_delete_attr_clicked(self,obj):
|
||||
if utils.delete_selected(obj,self.alist):
|
||||
self.lists_changed = 1
|
||||
self.redraw_attr_list()
|
||||
|
||||
def on_add_attr_clicked(self,obj):
|
||||
AttrEdit.AttributeEditor(self,None,"Media Object",[])
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def disp_attr(attr):
|
||||
detail = utils.get_detail_flags(attr)
|
||||
return [const.display_pattr(attr.getType()),attr.getValue(),detail]
|
||||
|
344
src/Marriage.py
344
src/Marriage.py
@ -3,7 +3,7 @@
|
||||
#
|
||||
# Copyright (C) 2000 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# This program is free software; you can redistribute it and/or modiy
|
||||
# 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.
|
||||
@ -31,6 +31,8 @@ import libglade
|
||||
import os
|
||||
import intl
|
||||
import Sources
|
||||
import AttrEdit
|
||||
import EventEdit
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
@ -85,6 +87,7 @@ class Marriage:
|
||||
"on_delete_attr_clicked" : on_delete_attr_clicked,
|
||||
"on_delete_event" : on_delete_event,
|
||||
"on_deletephoto_clicked" : self.gallery.on_delete_photo_clicked,
|
||||
"on_edit_properties_clicked": self.gallery.popup_change_description,
|
||||
"on_marriageAddBtn_clicked" : on_add_clicked,
|
||||
"on_marriageDeleteBtn_clicked" : on_delete_clicked,
|
||||
"on_marriageEventList_select_row" : on_select_row,
|
||||
@ -146,7 +149,7 @@ class Marriage:
|
||||
top_window.editable_enters(self.notes_field);
|
||||
top_window.editable_enters(self.get_widget("combo-entry1"));
|
||||
|
||||
self.redraw_events()
|
||||
self.redraw_event_list()
|
||||
self.redraw_attr_list()
|
||||
top_window.show()
|
||||
|
||||
@ -173,7 +176,7 @@ class Marriage:
|
||||
# reconstructing the list
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def redraw_events(self):
|
||||
def redraw_event_list(self):
|
||||
utils.redraw_list(self.elist,self.event_list,disp_event)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -310,7 +313,17 @@ def on_close_marriage_editor(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_add_clicked(obj):
|
||||
EventEditor(obj.get_data(MARRIAGE),None)
|
||||
mobj = obj.get_data(MARRIAGE)
|
||||
father = mobj.family.getFather()
|
||||
mother = mobj.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
EventEdit.EventEditor(mobj,name,const.marriageEvents,const.save_pevent,None,0)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -319,9 +332,21 @@ def on_add_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_update_clicked(obj):
|
||||
if len(obj.selection) > 0:
|
||||
row = obj.selection[0]
|
||||
EventEditor(obj.get_data(MARRIAGE),obj.get_row_data(row))
|
||||
if len(obj.selection) <= 0:
|
||||
return
|
||||
|
||||
mobj = obj.get_data(MARRIAGE)
|
||||
event = obj.get_row_data(obj.selection[0])
|
||||
father = mobj.family.getFather()
|
||||
mother = mobj.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
EventEdit.EventEditor(mobj,name,const.marriageEvents,const.save_pevent,event,0)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -334,7 +359,7 @@ def on_delete_clicked(obj):
|
||||
family_obj = obj.get_data(MARRIAGE)
|
||||
if utils.delete_selected(obj,family_obj.elist):
|
||||
family_obj.lists_changed = 1
|
||||
family_obj.redraw_events()
|
||||
family_obj.redraw_event_list()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -353,76 +378,6 @@ def on_select_row(obj,row,b,c):
|
||||
family_obj.event_details.set_text(utils.get_detail_text(event))
|
||||
family_obj.descr_field.set_text(event.getDescription())
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# update_attrib
|
||||
#
|
||||
# Updates the specified event with the specified date. Compares against
|
||||
# the previous value, so the that modified flag is not set if nothing has
|
||||
# actually changed.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_attrib(attr,type,value,note,priv):
|
||||
changed = 0
|
||||
|
||||
if attr.getType() != const.save_pattr(type):
|
||||
attr.setType(const.save_pattr(type))
|
||||
changed = 1
|
||||
|
||||
if attr.getValue() != value:
|
||||
attr.setValue(value)
|
||||
changed = 1
|
||||
|
||||
if attr.getNote() != note:
|
||||
attr.setNote(note)
|
||||
changed = 1
|
||||
|
||||
if attr.getPrivacy() != priv:
|
||||
attr.setPrivacy(priv)
|
||||
changed = 1
|
||||
|
||||
return changed
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# update_event
|
||||
#
|
||||
# Updates the specified event with the specified date. Compares against
|
||||
# the previous value, so the that modified flag is not set if nothing has
|
||||
# actually changed.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def update_event(event,name,date,place,desc,note,priv,cause):
|
||||
changed = 0
|
||||
if event.getPlace() != place:
|
||||
event.setPlace(place)
|
||||
changed = 1
|
||||
|
||||
if event.getName() != const.save_pevent(name):
|
||||
event.setName(const.save_pevent(name))
|
||||
changed = 1
|
||||
|
||||
if event.getDescription() != desc:
|
||||
event.setDescription(desc)
|
||||
changed = 1
|
||||
|
||||
if event.getNote() != note:
|
||||
event.setNote(note)
|
||||
changed = 1
|
||||
|
||||
if event.getDate() != date:
|
||||
event.setDate(date)
|
||||
changed = 1
|
||||
|
||||
if event.getCause() != cause:
|
||||
event.setCause(cause)
|
||||
changed = 1
|
||||
|
||||
if event.getPrivacy() != priv:
|
||||
event.setPrivacy(priv)
|
||||
changed = 1
|
||||
|
||||
return changed
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -447,7 +402,18 @@ def on_attr_list_select_row(obj,row,b,c):
|
||||
def on_update_attr_clicked(obj):
|
||||
if len(obj.selection) > 0:
|
||||
row = obj.selection[0]
|
||||
AttributeEditor(obj.get_data(MARRIAGE),obj.get_row_data(row))
|
||||
mobj = obj.get_data(MARRIAGE)
|
||||
attr = obj.get_row_data(row)
|
||||
father = mobj.family.getFather()
|
||||
mother = mobj.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
AttrEdit.AttributeEditor(mobj,attr,name,const.familyAttributes)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -466,214 +432,18 @@ def on_delete_attr_clicked(obj):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_add_attr_clicked(obj):
|
||||
AttributeEditor(obj.get_data(MARRIAGE),None)
|
||||
mobj = obj.get_data(MARRIAGE)
|
||||
father = mobj.family.getFather()
|
||||
mother = mobj.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
AttrEdit.AttributeEditor(mobj,None,name,const.familyAttributes)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# EventEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class EventEditor:
|
||||
|
||||
def __init__(self,parent,event):
|
||||
self.parent = parent
|
||||
self.event = event
|
||||
self.srcreflist = self.event.getSourceRefList()
|
||||
self.top = libglade.GladeXML(const.dialogFile, "event_edit")
|
||||
self.window = self.top.get_widget("event_edit")
|
||||
self.name_field = self.top.get_widget("eventName")
|
||||
self.place_field = self.top.get_widget("eventPlace")
|
||||
self.cause_field = self.top.get_widget("eventCause")
|
||||
self.place_combo = self.top.get_widget("eventPlace_combo")
|
||||
self.date_field = self.top.get_widget("eventDate")
|
||||
self.cause_field = self.top.get_widget("eventCause")
|
||||
self.descr_field = self.top.get_widget("eventDescription")
|
||||
self.note_field = self.top.get_widget("eventNote")
|
||||
self.event_menu = self.top.get_widget("personalEvents")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
father = parent.family.getFather()
|
||||
mother = parent.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
|
||||
self.top.get_widget("eventTitle").set_text(name)
|
||||
self.event_menu.set_popdown_strings(const.marriageEvents)
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.name_field);
|
||||
self.window.editable_enters(self.place_field);
|
||||
self.window.editable_enters(self.date_field);
|
||||
self.window.editable_enters(self.cause_field);
|
||||
self.window.editable_enters(self.descr_field);
|
||||
|
||||
values = self.parent.db.getPlaceMap().values()
|
||||
if event != None:
|
||||
self.name_field.set_text(event.getName())
|
||||
|
||||
utils.attach_places(values,self.place_combo,event.getPlace())
|
||||
self.place_field.set_text(event.getPlaceName())
|
||||
self.date_field.set_text(event.getDate())
|
||||
self.cause_field.set_text(event.getCause())
|
||||
self.descr_field.set_text(event.getDescription())
|
||||
self.priv.set_active(event.getPrivacy())
|
||||
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(event.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
else:
|
||||
utils.attach_places(values,self.place_combo,None)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_event_edit_ok_clicked" : on_event_edit_ok_clicked,
|
||||
"on_source_clicked" : on_edit_source_clicked
|
||||
})
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_edit_source_clicked(obj):
|
||||
ee = obj.get_data("o")
|
||||
Sources.SourceSelector(ee.srcreflist,ee.parent,src_changed)
|
||||
|
||||
def src_changed(parent):
|
||||
parent.list_changed = 1
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_event_edit_ok_clicked(obj):
|
||||
ee = obj.get_data("o")
|
||||
event = ee.event
|
||||
|
||||
ename = ee.name_field.get_text()
|
||||
edate = ee.date_field.get_text()
|
||||
ecause = ee.cause_field.get_text()
|
||||
eplace = string.strip(ee.place_field.get_text())
|
||||
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()
|
||||
|
||||
if event == None:
|
||||
event = Event()
|
||||
event.setSourceRefList(ee.srcreflist)
|
||||
ee.parent.elist.append(event)
|
||||
|
||||
if eplace_obj == None and eplace != "":
|
||||
eplace_obj = Place()
|
||||
eplace_obj.set_title(eplace)
|
||||
ee.parent.db.addPlace(eplace_obj)
|
||||
|
||||
if update_event(event,ename,edate,eplace_obj,edesc,enote,epriv,ecause):
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_events()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# AttributeEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class AttributeEditor:
|
||||
|
||||
def __init__(self,parent,attrib):
|
||||
self.parent = parent
|
||||
self.attrib = attrib
|
||||
self.top = libglade.GladeXML(const.dialogFile, "attr_edit")
|
||||
self.window = self.top.get_widget("attr_edit")
|
||||
self.type_field = self.top.get_widget("attr_type")
|
||||
self.value_field = self.top.get_widget("attr_value")
|
||||
self.note_field = self.top.get_widget("attr_note")
|
||||
self.attrib_menu = self.top.get_widget("attr_menu")
|
||||
self.source_field = self.top.get_widget("attr_source")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
if attrib:
|
||||
self.srcreflist = self.attrib.getSourceRefList()
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.type_field);
|
||||
self.window.editable_enters(self.value_field);
|
||||
|
||||
father = parent.family.getFather()
|
||||
mother = parent.family.getMother()
|
||||
if father and mother:
|
||||
name = _("%s and %s") % (father.getPrimaryName().getName(),
|
||||
mother.getPrimaryName().getName())
|
||||
elif father:
|
||||
name = father.getPrimaryName().getName()
|
||||
else:
|
||||
name = mother.getPrimaryName().getName()
|
||||
|
||||
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)
|
||||
|
||||
if attrib != None:
|
||||
self.type_field.set_text(attrib.getType())
|
||||
self.value_field.set_text(attrib.getValue())
|
||||
self.priv.set_active(attrib.getPrivacy())
|
||||
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(attrib.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
|
||||
self.window.set_data("o",self)
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_attr_edit_ok_clicked" : on_attrib_edit_ok_clicked,
|
||||
"on_source_clicked" : on_attrib_source_clicked
|
||||
})
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_attrib_source_clicked(obj):
|
||||
ee = obj.get_data("o")
|
||||
Sources.SourceSelector(ee.srcreflist,ee.parent,src_changed)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
def on_attrib_edit_ok_clicked(obj):
|
||||
ee = obj.get_data("o")
|
||||
attrib = ee.attrib
|
||||
|
||||
type = ee.type_field.get_text()
|
||||
value = ee.value_field.get_text()
|
||||
note = ee.note_field.get_chars(0,-1)
|
||||
priv = ee.priv.get_active()
|
||||
|
||||
if attrib == None:
|
||||
attrib = Attribute()
|
||||
attrib.setSourceRefList(ee.srcreflist)
|
||||
ee.parent.alist.append(attrib)
|
||||
|
||||
if update_attrib(attrib,type,value,note,priv):
|
||||
ee.parent.lists_changed = 1
|
||||
|
||||
ee.parent.redraw_attr_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -682,7 +452,7 @@ def on_attrib_edit_ok_clicked(obj):
|
||||
#-------------------------------------------------------------------------
|
||||
def disp_attr(attr):
|
||||
detail = utils.get_detail_flags(attr)
|
||||
return [const.display_pattr(attr.getType()),attr.getValue(),detail]
|
||||
return [const.display_fattr(attr.getType()),attr.getValue(),detail]
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
151
src/NameEdit.py
Normal file
151
src/NameEdit.py
Normal file
@ -0,0 +1,151 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 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
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import libglade
|
||||
import GdkImlib
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import intl
|
||||
import const
|
||||
import utils
|
||||
import Config
|
||||
from RelLib import *
|
||||
import RelImage
|
||||
import Sources
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# NameEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class NameEditor:
|
||||
|
||||
def __init__(self,parent,name):
|
||||
self.parent = parent
|
||||
self.name = name
|
||||
self.top = libglade.GladeXML(const.editPersonFile, "name_edit")
|
||||
self.window = self.top.get_widget("name_edit")
|
||||
self.given_field = self.top.get_widget("alt_given")
|
||||
self.surname_field = self.top.get_widget("alt_last")
|
||||
self.suffix_field = self.top.get_widget("alt_suffix")
|
||||
self.note_field = self.top.get_widget("alt_note")
|
||||
self.top.get_widget("alt_surname_list").set_popdown_strings(const.surnames)
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
if self.name:
|
||||
self.srcreflist = self.name.getSourceRefList()
|
||||
else:
|
||||
self.srcreflist = []
|
||||
|
||||
full_name = parent.person.getPrimaryName().getName()
|
||||
|
||||
self.top.get_widget("altTitle").set_text(
|
||||
_("Alternate Name Editor for %s") % full_name)
|
||||
|
||||
# Typing CR selects OK button
|
||||
self.window.editable_enters(self.given_field)
|
||||
self.window.editable_enters(self.surname_field)
|
||||
self.window.editable_enters(self.suffix_field)
|
||||
|
||||
if name != None:
|
||||
self.given_field.set_text(name.getFirstName())
|
||||
self.surname_field.set_text(name.getSurname())
|
||||
self.suffix_field.set_text(name.getSuffix())
|
||||
self.priv.set_active(name.getPrivacy())
|
||||
self.note_field.set_point(0)
|
||||
self.note_field.insert_defaults(name.getNote())
|
||||
self.note_field.set_word_wrap(1)
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_name_edit_ok_clicked" : self.on_name_edit_ok_clicked,
|
||||
"on_source_clicked" : self.on_name_source_clicked
|
||||
})
|
||||
|
||||
def on_name_source_clicked(self,obj):
|
||||
Sources.SourceSelector(self.srcreflist,self.parent,src_changed)
|
||||
|
||||
def on_name_edit_ok_clicked(self,obj):
|
||||
first = self.given_field.get_text()
|
||||
last = self.surname_field.get_text()
|
||||
suffix = self.suffix_field.get_text()
|
||||
note = self.note_field.get_chars(0,-1)
|
||||
priv = self.priv.get_active()
|
||||
|
||||
if self.name == None:
|
||||
self.name = Name()
|
||||
self.name.setSourceRefList(self.srcreflist)
|
||||
self.parent.nlist.append(self.name)
|
||||
|
||||
self.update_name(first,last,suffix,note,priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
self.parent.redraw_name_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def update_name(self,first,last,suffix,note,priv):
|
||||
|
||||
if self.name.getFirstName() != first:
|
||||
self.name.setFirstName(first)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.name.getSurname() != last:
|
||||
self.name.setSurname(last)
|
||||
if last not in const.surnames:
|
||||
const.surnames.append(last)
|
||||
const.surnames.sort()
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.name.getSuffix() != suffix:
|
||||
self.name.setSuffix(suffix)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.name.getNote() != note:
|
||||
self.name.setNote(note)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.name.getPrivacy() != priv:
|
||||
self.name.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
def src_changed(parent):
|
||||
parent.lists_changed = 1
|
||||
|
77
src/NoteEdit.py
Normal file
77
src/NoteEdit.py
Normal file
@ -0,0 +1,77 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 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
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import const
|
||||
import utils
|
||||
import Config
|
||||
from RelLib import *
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class NoteEditor:
|
||||
|
||||
def __init__(self,data):
|
||||
|
||||
self.editnote = libglade.GladeXML(const.editnoteFile,"editnote")
|
||||
self.textobj = self.editnote.get_widget("notetext")
|
||||
self.en_obj = self.editnote.get_widget("editnote")
|
||||
self.data = data
|
||||
self.en_obj.editable_enters(self.textobj);
|
||||
|
||||
self.textobj.set_point(0)
|
||||
self.textobj.insert_defaults(self.data.getNote())
|
||||
self.textobj.set_word_wrap(1)
|
||||
|
||||
self.editnote.signal_autoconnect({
|
||||
"on_save_note_clicked" : self.on_save_note_clicked,
|
||||
"destroy_passed_object" : utils.destroy_passed_object
|
||||
})
|
||||
|
||||
def on_save_note_clicked(self,obj):
|
||||
text = self.textobj.get_chars(0,-1)
|
||||
if text != self.data.getNote():
|
||||
self.data.setNote(text)
|
||||
utils.modified()
|
||||
utils.destroy_passed_object(obj)
|
@ -467,6 +467,10 @@ class ObjectRef:
|
||||
"""returns the property list associated with the image"""
|
||||
return self.attrlist
|
||||
|
||||
def setAttributeList(self,list):
|
||||
"""sets the property list associated with the image"""
|
||||
self.attrlist = list
|
||||
|
||||
class Attribute(DataObj):
|
||||
"""Provides a simple key/value pair for describing properties. Used
|
||||
by the Person and Family objects to store descriptive information."""
|
||||
|
104
src/UrlEdit.py
Normal file
104
src/UrlEdit.py
Normal file
@ -0,0 +1,104 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2000 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
|
||||
#
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Standard python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import os
|
||||
import string
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gtk import *
|
||||
from gnome.ui import *
|
||||
|
||||
import libglade
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
import intl
|
||||
import const
|
||||
import utils
|
||||
from RelLib import *
|
||||
|
||||
_ = intl.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# UrlEditor class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class UrlEditor:
|
||||
|
||||
def __init__(self,parent,name,url):
|
||||
self.parent = parent
|
||||
self.url = url
|
||||
self.top = libglade.GladeXML(const.editPersonFile, "url_edit")
|
||||
self.window = self.top.get_widget("url_edit")
|
||||
self.des = self.top.get_widget("url_des")
|
||||
self.addr = self.top.get_widget("url_addr")
|
||||
self.priv = self.top.get_widget("priv")
|
||||
|
||||
self.top.get_widget("urlTitle").set_text(name)
|
||||
|
||||
if url != None:
|
||||
self.des.set_text(url.get_description())
|
||||
self.addr.set_text(url.get_path())
|
||||
self.priv.set_active(url.getPrivacy())
|
||||
|
||||
self.top.signal_autoconnect({
|
||||
"destroy_passed_object" : utils.destroy_passed_object,
|
||||
"on_url_edit_ok_clicked" : self.on_url_edit_ok_clicked
|
||||
})
|
||||
|
||||
def on_url_edit_ok_clicked(self,obj):
|
||||
des = self.des.get_text()
|
||||
addr = self.addr.get_text()
|
||||
priv = self.priv.get_active()
|
||||
|
||||
if self.url == None:
|
||||
self.url = Url()
|
||||
self.parent.ulist.append(self.url)
|
||||
|
||||
self.update_url(des,addr,priv)
|
||||
self.parent.redraw_url_list()
|
||||
utils.destroy_passed_object(obj)
|
||||
|
||||
def update_url(self,des,addr,priv):
|
||||
if self.url.get_path() != addr:
|
||||
self.url.set_path(addr)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.url.get_description() != des:
|
||||
self.url.set_description(des)
|
||||
self.parent.lists_changed = 1
|
||||
|
||||
if self.url.getPrivacy() != priv:
|
||||
self.url.setPrivacy(priv)
|
||||
self.parent.lists_changed = 1
|
||||
|
@ -355,7 +355,7 @@
|
||||
<title>Gramps - Change Local Media Object Properties</title>
|
||||
<type>GTK_WINDOW_TOPLEVEL</type>
|
||||
<position>GTK_WIN_POS_NONE</position>
|
||||
<modal>True</modal>
|
||||
<modal>False</modal>
|
||||
<allow_shrink>False</allow_shrink>
|
||||
<allow_grow>True</allow_grow>
|
||||
<auto_shrink>False</auto_shrink>
|
||||
@ -895,7 +895,7 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkFrame</class>
|
||||
<name>frame2</name>
|
||||
<name>attr_type</name>
|
||||
<border_width>5</border_width>
|
||||
<label>No Attributes</label>
|
||||
<label_xalign>0</label_xalign>
|
||||
@ -943,7 +943,7 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label139</name>
|
||||
<name>attr_value</name>
|
||||
<label></label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
@ -969,7 +969,7 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkLabel</class>
|
||||
<name>label140</name>
|
||||
<name>attr_details</name>
|
||||
<label>Details</label>
|
||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||
<wrap>False</wrap>
|
||||
@ -1090,7 +1090,7 @@
|
||||
|
||||
<widget>
|
||||
<class>GtkCList</class>
|
||||
<name>clist1</name>
|
||||
<name>attr_list</name>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>select_row</name>
|
||||
|
@ -1303,7 +1303,7 @@
|
||||
<object>marriageEditor</object>
|
||||
<last_modification_time>Thu, 29 Mar 2001 13:45:03 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Add Image</label>
|
||||
<label>Add Media Object</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
@ -1318,7 +1318,22 @@
|
||||
<object>marriageEditor</object>
|
||||
<last_modification_time>Thu, 29 Mar 2001 13:45:15 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Delete Image</label>
|
||||
<label>Delete Media Object</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button109</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_edit_properties_clicked</handler>
|
||||
<object>marriageEditor</object>
|
||||
<last_modification_time>Sat, 13 Oct 2001 17:40:21 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Edit Properties</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -1212,7 +1212,7 @@
|
||||
<object>placeEditor</object>
|
||||
<last_modification_time>Thu, 31 May 2001 14:39:32 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Add Image</label>
|
||||
<label>Add Media Object</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
@ -1227,7 +1227,22 @@
|
||||
<object>placeEditor</object>
|
||||
<last_modification_time>Thu, 31 May 2001 14:39:16 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Delete Image</label>
|
||||
<label>Delete Media Object</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
|
||||
<widget>
|
||||
<class>GtkButton</class>
|
||||
<name>button132</name>
|
||||
<can_default>True</can_default>
|
||||
<can_focus>True</can_focus>
|
||||
<signal>
|
||||
<name>clicked</name>
|
||||
<handler>on_edit_properties_clicked</handler>
|
||||
<object>placeEditor</object>
|
||||
<last_modification_time>Sat, 13 Oct 2001 23:26:20 GMT</last_modification_time>
|
||||
</signal>
|
||||
<label>Edit Properties</label>
|
||||
<relief>GTK_RELIEF_NORMAL</relief>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -253,7 +253,6 @@ def view_photo(photo):
|
||||
open = ""
|
||||
edit = ""
|
||||
for key in gnome.mime.get_keys(type):
|
||||
print key,gnome.mime.get_value(type,key)
|
||||
if key == 'view':
|
||||
prog = string.split(gnome.mime.get_value(type,key))
|
||||
if key == 'open':
|
||||
@ -276,7 +275,6 @@ def view_photo(photo):
|
||||
else:
|
||||
args.append(val)
|
||||
|
||||
print args
|
||||
if os.fork() == 0:
|
||||
os.execvp(args[0],args)
|
||||
|
||||
@ -345,11 +343,9 @@ def find_icon(mtype):
|
||||
if nicon:
|
||||
p = "%s/%s" % (gnome.util.pixmap_file("nautilus"),nicon)
|
||||
if os.path.isfile(p):
|
||||
print "n",p
|
||||
return p
|
||||
p = "%s.png" % p
|
||||
if os.path.isfile(p):
|
||||
print "n",p
|
||||
return p
|
||||
if icon:
|
||||
return icon
|
||||
@ -369,3 +365,5 @@ def get_mime_description(type):
|
||||
if key == "description":
|
||||
return gnome.mime.get_value(type,key)
|
||||
return type
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user