Handle changes to the EditPerson main image
svn: r518
This commit is contained in:
parent
2a287f8c23
commit
53420a8626
@ -74,6 +74,7 @@ class EditPerson:
|
|||||||
self.lists_changed = 0
|
self.lists_changed = 0
|
||||||
pid = "i%s" % person.getId()
|
pid = "i%s" % person.getId()
|
||||||
|
|
||||||
|
self.load_obj = None
|
||||||
self.top = libglade.GladeXML(const.editPersonFile, "editPerson")
|
self.top = libglade.GladeXML(const.editPersonFile, "editPerson")
|
||||||
self.gallery_widget = self.top.get_widget("photolist")
|
self.gallery_widget = self.top.get_widget("photolist")
|
||||||
self.gallery = ImageSelect.Gallery(person, self.path, pid, self.gallery_widget, self.db)
|
self.gallery = ImageSelect.Gallery(person, self.path, pid, self.gallery_widget, self.db)
|
||||||
@ -240,13 +241,7 @@ class EditPerson:
|
|||||||
self.title.set_text(self.pname.getTitle())
|
self.title.set_text(self.pname.getTitle())
|
||||||
self.update_birth_death()
|
self.update_birth_death()
|
||||||
|
|
||||||
# load photos into the photo window
|
self.load_person_image()
|
||||||
photo_list = person.getPhotoList()
|
|
||||||
if len(photo_list) != 0:
|
|
||||||
ph = photo_list[0]
|
|
||||||
object = ph.getReference()
|
|
||||||
if object.getMimeType()[0:5] == "image":
|
|
||||||
self.load_photo(object.getPath())
|
|
||||||
|
|
||||||
# set notes data
|
# set notes data
|
||||||
self.notes_field.set_point(0)
|
self.notes_field.set_point(0)
|
||||||
@ -570,6 +565,10 @@ class EditPerson:
|
|||||||
|
|
||||||
def load_photo(self,photo):
|
def load_photo(self,photo):
|
||||||
"""loads, scales, and displays the person's main photo"""
|
"""loads, scales, and displays the person's main photo"""
|
||||||
|
self.load_obj = photo
|
||||||
|
if photo == None:
|
||||||
|
self.get_widget("personPix").load_imlib(const.empty_image)
|
||||||
|
else:
|
||||||
i = GdkImlib.Image(photo)
|
i = GdkImlib.Image(photo)
|
||||||
scale = float(const.picWidth)/float(max(i.rgb_height,i.rgb_width))
|
scale = float(const.picWidth)/float(max(i.rgb_height,i.rgb_width))
|
||||||
x = int(scale*(i.rgb_width))
|
x = int(scale*(i.rgb_width))
|
||||||
@ -732,8 +731,23 @@ class EditPerson:
|
|||||||
import NoteEdit
|
import NoteEdit
|
||||||
NoteEdit.NoteEditor(self.pname)
|
NoteEdit.NoteEditor(self.pname)
|
||||||
|
|
||||||
|
def load_person_image(self):
|
||||||
|
photo_list = self.person.getPhotoList()
|
||||||
|
if len(photo_list) != 0:
|
||||||
|
ph = photo_list[0]
|
||||||
|
object = ph.getReference()
|
||||||
|
if self.load_obj != object.getPath():
|
||||||
|
if object.getMimeType()[0:5] == "image":
|
||||||
|
self.load_photo(object.getPath())
|
||||||
|
else:
|
||||||
|
self.load_photo(None)
|
||||||
|
else:
|
||||||
|
self.load_photo(None)
|
||||||
|
|
||||||
def on_switch_page(self,obj,a,page):
|
def on_switch_page(self,obj,a,page):
|
||||||
if page == 6 and self.not_loaded:
|
if page == 0:
|
||||||
|
self.load_person_image()
|
||||||
|
elif page == 6 and self.not_loaded:
|
||||||
self.not_loaded = 0
|
self.not_loaded = 0
|
||||||
self.gallery.load_images()
|
self.gallery.load_images()
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import intl
|
import intl
|
||||||
|
import GdkImlib
|
||||||
|
|
||||||
_ = intl.gettext
|
_ = intl.gettext
|
||||||
|
|
||||||
@ -504,3 +505,12 @@ familyAttributes = initialize_family_attribute_list()
|
|||||||
familyRelations = initialize_family_relation_list()
|
familyRelations = initialize_family_relation_list()
|
||||||
places = []
|
places = []
|
||||||
surnames = []
|
surnames = []
|
||||||
|
|
||||||
|
xpm_data = [
|
||||||
|
'/* XPM */',
|
||||||
|
'static char * foo_xpm[] = {',
|
||||||
|
'"1 1 1 1"',
|
||||||
|
'" c None"',
|
||||||
|
'" "};']
|
||||||
|
|
||||||
|
empty_image = GdkImlib.create_image_from_xpm(xpm_data)
|
||||||
|
@ -232,7 +232,7 @@ def on_writing_extensions_activate(obj):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_remove_child_clicked(obj):
|
def on_remove_child_clicked(obj):
|
||||||
if not active_family or not active_child:
|
if not active_family or not active_child or not active_person:
|
||||||
return
|
return
|
||||||
|
|
||||||
active_family.removeChild(active_child)
|
active_family.removeChild(active_child)
|
||||||
@ -265,16 +265,20 @@ def delete_family_from(person):
|
|||||||
def on_add_sp_clicked(obj):
|
def on_add_sp_clicked(obj):
|
||||||
"""Add a new spouse to the current person"""
|
"""Add a new spouse to the current person"""
|
||||||
import AddSpouse
|
import AddSpouse
|
||||||
|
if active_person:
|
||||||
AddSpouse.AddSpouse(database,active_person,load_family,redisplay_person_list)
|
AddSpouse.AddSpouse(database,active_person,load_family,redisplay_person_list)
|
||||||
|
|
||||||
def on_edit_sp_clicked(obj):
|
def on_edit_sp_clicked(obj):
|
||||||
"""Edit the marriage information for the current family"""
|
"""Edit the marriage information for the current family"""
|
||||||
|
if active_person:
|
||||||
Marriage.Marriage(active_family,database)
|
Marriage.Marriage(active_family,database)
|
||||||
|
|
||||||
def on_delete_sp_clicked(obj):
|
def on_delete_sp_clicked(obj):
|
||||||
"""Delete the currently selected spouse from the family"""
|
"""Delete the currently selected spouse from the family"""
|
||||||
|
|
||||||
if active_person == active_family.getFather():
|
if active_person == None:
|
||||||
|
return
|
||||||
|
elif active_person == active_family.getFather():
|
||||||
person = active_family.getMother()
|
person = active_family.getMother()
|
||||||
active_family.setMother(None)
|
active_family.setMother(None)
|
||||||
else:
|
else:
|
||||||
@ -340,11 +344,13 @@ def on_fv_prev_clicked(obj):
|
|||||||
def on_add_child_clicked(obj):
|
def on_add_child_clicked(obj):
|
||||||
"""Select an existing child to add to the active family"""
|
"""Select an existing child to add to the active family"""
|
||||||
import SelectChild
|
import SelectChild
|
||||||
|
if active_person:
|
||||||
SelectChild.SelectChild(database,active_family,active_person,load_family)
|
SelectChild.SelectChild(database,active_family,active_person,load_family)
|
||||||
|
|
||||||
def on_add_new_child_clicked(obj):
|
def on_add_new_child_clicked(obj):
|
||||||
"""Create a new child to add to the existing family"""
|
"""Create a new child to add to the existing family"""
|
||||||
import SelectChild
|
import SelectChild
|
||||||
|
if active_person:
|
||||||
SelectChild.NewChild(database,active_family,active_person,update_after_newchild)
|
SelectChild.NewChild(database,active_family,active_person,update_after_newchild)
|
||||||
|
|
||||||
|
|
||||||
@ -355,6 +361,7 @@ def on_add_new_child_clicked(obj):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_choose_parents_clicked(obj):
|
def on_choose_parents_clicked(obj):
|
||||||
import ChooseParents
|
import ChooseParents
|
||||||
|
if active_person:
|
||||||
ChooseParents.ChooseParents(database,active_person,active_parents,load_family)
|
ChooseParents.ChooseParents(database,active_person,active_parents,load_family)
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -371,7 +378,7 @@ def new_database_response(val):
|
|||||||
"""Clear out the database if permission was granted"""
|
"""Clear out the database if permission was granted"""
|
||||||
global active_person, active_father
|
global active_person, active_father
|
||||||
global active_family, active_mother
|
global active_family, active_mother
|
||||||
global active_child
|
global active_child, active_spouse
|
||||||
global id2col,alt2col,person_list
|
global id2col,alt2col,person_list
|
||||||
|
|
||||||
if val == 1:
|
if val == 1:
|
||||||
@ -390,6 +397,7 @@ def new_database_response(val):
|
|||||||
active_family = None
|
active_family = None
|
||||||
active_mother = None
|
active_mother = None
|
||||||
active_child = None
|
active_child = None
|
||||||
|
active_spouse = None
|
||||||
id2col = {}
|
id2col = {}
|
||||||
alt2col = {}
|
alt2col = {}
|
||||||
|
|
||||||
@ -1291,32 +1299,26 @@ def display_comment_box(filename):
|
|||||||
def on_person_list1_activate(obj):
|
def on_person_list1_activate(obj):
|
||||||
"""Switches to the person list view"""
|
"""Switches to the person list view"""
|
||||||
notebook.set_page(0)
|
notebook.set_page(0)
|
||||||
merge_button.show()
|
|
||||||
|
|
||||||
def on_family1_activate(obj):
|
def on_family1_activate(obj):
|
||||||
"""Switches to the family view"""
|
"""Switches to the family view"""
|
||||||
notebook.set_page(1)
|
notebook.set_page(1)
|
||||||
merge_button.hide()
|
|
||||||
|
|
||||||
def on_pedegree1_activate(obj):
|
def on_pedegree1_activate(obj):
|
||||||
"""Switches to the pedigree view"""
|
"""Switches to the pedigree view"""
|
||||||
notebook.set_page(2)
|
notebook.set_page(2)
|
||||||
merge_button.hide()
|
|
||||||
|
|
||||||
def on_sources_activate(obj):
|
def on_sources_activate(obj):
|
||||||
"""Switches to the sources view"""
|
"""Switches to the sources view"""
|
||||||
notebook.set_page(3)
|
notebook.set_page(3)
|
||||||
merge_button.hide()
|
|
||||||
|
|
||||||
def on_places_activate(obj):
|
def on_places_activate(obj):
|
||||||
"""Switches to the places view"""
|
"""Switches to the places view"""
|
||||||
notebook.set_page(4)
|
notebook.set_page(4)
|
||||||
merge_button.show()
|
|
||||||
|
|
||||||
def on_media_activate(obj):
|
def on_media_activate(obj):
|
||||||
"""Switches to the media view"""
|
"""Switches to the media view"""
|
||||||
notebook.set_page(5)
|
notebook.set_page(5)
|
||||||
merge_button.hide()
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -1324,19 +1326,23 @@ def on_media_activate(obj):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_notebook1_switch_page(obj,junk,page):
|
def on_notebook1_switch_page(obj,junk,page):
|
||||||
if not active_person:
|
|
||||||
return
|
|
||||||
if page == 0:
|
if page == 0:
|
||||||
goto_active_person()
|
goto_active_person()
|
||||||
|
merge_button.show()
|
||||||
elif page == 1:
|
elif page == 1:
|
||||||
|
merge_button.hide()
|
||||||
load_family()
|
load_family()
|
||||||
elif page == 2:
|
elif page == 2:
|
||||||
|
merge_button.hide()
|
||||||
load_canvas()
|
load_canvas()
|
||||||
elif page == 3:
|
elif page == 3:
|
||||||
|
merge_button.hide()
|
||||||
load_sources()
|
load_sources()
|
||||||
elif page == 4:
|
elif page == 4:
|
||||||
|
merge_button.show()
|
||||||
load_places()
|
load_places()
|
||||||
elif page == 5:
|
elif page == 5:
|
||||||
|
merge_button.hide()
|
||||||
load_media()
|
load_media()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
@ -1435,6 +1441,13 @@ def load_media():
|
|||||||
if index > 0:
|
if index > 0:
|
||||||
media_list.select_row(current_row,0)
|
media_list.select_row(current_row,0)
|
||||||
media_list.moveto(current_row)
|
media_list.moveto(current_row)
|
||||||
|
else:
|
||||||
|
mid.set_text("")
|
||||||
|
mtype.set_text("")
|
||||||
|
mdesc.set_text("")
|
||||||
|
mpath.set_text("")
|
||||||
|
mdetails.set_text("")
|
||||||
|
preview.load_imlib(const.empty_image)
|
||||||
|
|
||||||
media_list.thaw()
|
media_list.thaw()
|
||||||
|
|
||||||
@ -2236,6 +2249,10 @@ canvas_items = []
|
|||||||
def load_canvas():
|
def load_canvas():
|
||||||
global canvas_items
|
global canvas_items
|
||||||
|
|
||||||
|
root = canvas.root()
|
||||||
|
|
||||||
|
for i in canvas_items:
|
||||||
|
i.destroy()
|
||||||
if active_person == None:
|
if active_person == None:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -2244,10 +2261,6 @@ def load_canvas():
|
|||||||
|
|
||||||
cx1,cy1,cx2,cy2 = canvas.get_allocation()
|
cx1,cy1,cx2,cy2 = canvas.get_allocation()
|
||||||
canvas.set_scroll_region(cx1,cy1,cx2,cy2)
|
canvas.set_scroll_region(cx1,cy1,cx2,cy2)
|
||||||
root = canvas.root()
|
|
||||||
|
|
||||||
for i in canvas_items:
|
|
||||||
i.destroy()
|
|
||||||
|
|
||||||
style = canvas['style']
|
style = canvas['style']
|
||||||
font = style.font
|
font = style.font
|
||||||
|
Loading…
Reference in New Issue
Block a user