* src/glade/gramps.glade (select_person): Name the box.

* src/DataViews/_MediaView.py (row_change): Collect garbage on the
	row change.
	* src/Selectors/_BaseSelector.py: Use DisplaModel models;
	(_local_init): Add selector-specific hook.
	(_local_init): Set up preview; 
	(_row_change): Show preview; collect garbage.


svn: r6690
This commit is contained in:
Alex Roitman 2006-05-17 06:13:37 +00:00
parent f28b5b8f57
commit 80546c3905
5 changed files with 52 additions and 11 deletions

View File

@ -1,15 +1,21 @@
2006-05-16 Alex Roitman <shura@gramps-project.org>
* src/glade/gramps.glade (select_person): Name the box.
* src/DataViews/_MediaView.py (row_change): Collect garbage on the
row change.
* src/Editors/_EditLdsOrd.py: Adapt to new selector.
* src/DisplayTabs/_SourceEmbedList.py: Adapt to new selector.
* src/DisplayTabs/_EventEmbedList.py: Adapt to new selector.
* src/DisplayTabs/_GalleryTab.py: Adapt to new selector.
* src/Selectors/_BaseSelector.py: Use DisplaModel models.
* src/Selectors/_BaseSelector.py: Use DisplaModel models;
(_local_init): Add selector-specific hook.
* src/Selectors/_SelectRepository.py: Use DisplaModel models.
* src/Selectors/_SelectSource.py: Use DisplaModel models.
* src/Selectors/_SelectEvent.py: Use DisplaModel models.
* src/Selectors/_SelectFamily.py: Use DisplaModel models.
* src/Selectors/_SelectPlace.py: Use DisplaModel models.
* src/Selectors/_SelectObject.py: Use DisplaModel models.
(_local_init): Set up preview;
(_row_change): Show preview; collect garbage.
2006-05-16 Don Allingham <don@gramps-project.org>
* src/Editors/_EditEvent.py: start of SelectPlace integration

View File

@ -19,6 +19,14 @@
# $Id$
#-------------------------------------------------------------------------
#
# Python modules
#
#-------------------------------------------------------------------------
import gc
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK/Gnome modules
@ -42,13 +50,6 @@ from Editors import EditMedia
import Errors
from QuestionDialog import QuestionDialog, ErrorDialog
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
from gettext import gettext as _
column_names = [
_('Title'),
_('ID'),
@ -135,6 +136,7 @@ class MediaView(PageView.ListView):
obj = self.dbstate.db.get_object_from_handle(handle)
pix = ImgManip.get_thumbnail_image(obj.get_path())
self.image.set_from_pixbuf(pix)
gc.collect()
def ui_definition(self):
return '''<ui>

View File

@ -69,6 +69,7 @@ class BaseSelector(ManagedWindow.ManagedWindow):
self.tree.set_model(self.model)
self.add_columns(self.tree)
self._local_init()
self.show()
def add_columns(self,tree):
@ -112,6 +113,10 @@ class BaseSelector(ManagedWindow.ManagedWindow):
self.close()
return None
def _local_init(self):
# define selector-specific init routine
pass
def get_window_title(self):
# return _("Select something")
assert False, "Must be defined in the subclass"

View File

@ -20,23 +20,31 @@
# $Id$
#
# Written by Alex Roitman,
# largely based on the MediaView and SelectPerson by Don Allingham
#
#-------------------------------------------------------------------------
#
# internationalization
#
#-------------------------------------------------------------------------
import gc
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK+
#
#-------------------------------------------------------------------------
import gtk
#-------------------------------------------------------------------------
#
# gramps modules
#
#-------------------------------------------------------------------------
import const
import ImgManip
from DisplayModels import MediaModel
from _BaseSelector import BaseSelector
@ -65,3 +73,23 @@ class SelectObject(BaseSelector):
(_('ID'), 75, BaseSelector.TEXT),
(_('Type'), 75, BaseSelector.TEXT),
]
def _local_init(self):
self.preview = gtk.Image()
self.preview.set_size_request(int(const.thumbScale),
int(const.thumbScale))
vbox = self.glade.get_widget('select_person_vbox')
vbox.pack_start(self.preview,False)
vbox.reorder_child(self.preview,1)
self.preview.show()
self.selection.connect('changed',self._row_change)
def _row_change(self,obj):
id_list = self.get_selected_ids()
if not (id_list and id_list[0]):
return
handle = id_list[0]
obj = self.get_from_handle_func()(handle)
pix = ImgManip.get_thumbnail_image(obj.get_path())
self.preview.set_from_pixbuf(pix)
gc.collect()

View File

@ -4101,7 +4101,7 @@ Text Beside Icons</property>
</child>
<child>
<widget class="GtkVBox" id="vbox47">
<widget class="GtkVBox" id="select_person_vbox">
<property name="border_width">6</property>
<property name="visible">True</property>
<property name="homogeneous">False</property>