2006-05-04 Alex Roitman <shura@gramps-project.org>

* src/SelectObject.py: Convert to managed window.
	* src/SelectEvent.py: Convert to managed window.
	* src/SelectSource.py: Convert to managed window.
	* src/DisplayTabs.py: Properly call selectors.



svn: r6543
This commit is contained in:
Alex Roitman 2006-05-04 18:30:36 +00:00
parent 9e8b7ad996
commit 49b9de1063
6 changed files with 59 additions and 41 deletions

View File

@ -1,3 +1,9 @@
2006-05-04 Alex Roitman <shura@gramps-project.org>
* src/SelectObject.py: Convert to managed window.
* src/SelectEvent.py: Convert to managed window.
* src/SelectSource.py: Convert to managed window.
* src/DisplayTabs.py: Properly call selectors.
2006-05-03 Alex Roitman <shura@gramps-project.org>
* src/DisplayTabs.py (NoteTab.build_interface): Add spacing to
radiobuttons.

View File

@ -689,7 +689,8 @@ class EventEmbedList(EmbeddedList):
def share_button_clicked(self, obj):
import SelectEvent
sel = SelectEvent.SelectEvent(self.dbstate.db, "Event Select")
sel = SelectEvent.SelectEvent(self.dbstate,self.uistate,self.track,
_("Select event"))
event = sel.run()
if event:
try:
@ -1663,7 +1664,8 @@ class GalleryTab(ButtonTab):
"""
import SelectObject
sel = SelectObject.SelectObject(self.dbstate.db, _("Select media"))
sel = SelectObject.SelectObject(self.dbstate,self.uistate,self.track,
_("Select media"))
src = sel.run()
if src:
sref = RelLib.MediaRef()
@ -1750,7 +1752,8 @@ class SourceEmbedList(EmbeddedList):
def share_button_clicked(self, obj):
import SelectSource
sel = SelectSource.SelectSource(self.dbstate.db, "Source Select")
sel = SelectSource.SelectSource(self.dbstate,self.uistate,self.track,
_("Select source"))
src = sel.run()
if src:
try:

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2005 Donald N. Allingham
# Copyright (C) 2003-2006 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
@ -47,33 +47,36 @@ import gtk.glade
#
#-------------------------------------------------------------------------
import const
import Utils
import ListModel
import DateHandler
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectEvent
#
#-------------------------------------------------------------------------
class SelectEvent:
class SelectEvent(ManagedWindow.ManagedWindow):
"""
Selects an event from the list of available events
"""
def __init__(self, database, title, parent_window=None):
def __init__(self, dbstate, uistate, track, title):
"""
Create an Event Selector, allowing the user to select on of the
events in the event list.
"""
self.db = database
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile, "select_person", "gramps")
self.top = self.glade.get_widget('select_person')
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title')
self.elist = self.glade.get_widget('plist')
Utils.set_titles(self.top, title_label, title)
self.set_window(window, title_label, self.title)
titles = [(_('Description'), 4, 250), (_('ID'), 1, 75),
(_('Type'), 2, 75), (_('Date'), 3, 150), ('', 4, 0) ]
@ -82,10 +85,10 @@ class SelectEvent:
self.model = ListModel.ListModel(self.elist, titles)
self.redraw()
self.top.show()
self.show()
if parent_window:
self.top.set_transient_for(parent_window)
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
"""
@ -110,7 +113,7 @@ class SelectEvent:
Runs te dialog, returning None if the event was not selected,
or the event that was selected.
"""
val = self.top.run()
val = self.window.run()
if val == gtk.RESPONSE_OK:
store, node = self.model.get_selected()
@ -120,8 +123,8 @@ class SelectEvent:
return_value = self.db.get_event_from_handle(handle)
else:
return_value = None
self.top.destroy()
self.close()
return return_value
else:
self.top.destroy()
self.close()
return None

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2004 Donald N. Allingham
# Copyright (C) 2003-2006 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
@ -55,27 +55,29 @@ import gtk.gdk
#
#-------------------------------------------------------------------------
import const
import Utils
import ListModel
import ImgManip
import Mime
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectPerson
#
#-------------------------------------------------------------------------
class SelectObject:
class SelectObject(ManagedWindow.ManagedWindow):
def __init__(self,db,title):
def __init__(self, dbstate, uistate, track, title):
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = db
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
self.top = self.glade.get_widget('select_person')
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('object_title')
self.object_tree = self.glade.get_widget('plist')
Utils.set_titles(self.top,title_label,title)
self.set_window(window,title_label,self.title)
titles = [
(_('Preview'),0,50,ListModel.IMAGE),
@ -91,7 +93,10 @@ class SelectObject:
self.selection = self.object_tree.get_selection()
self.redraw()
self.top.show()
self.show()
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
self.object_model.clear()
@ -109,7 +114,7 @@ class SelectObject:
self.object_model.connect_model()
def run(self):
val = self.top.run()
val = self.window.run()
if val == gtk.RESPONSE_OK:
store,node = self.object_model.get_selected()
@ -119,10 +124,10 @@ class SelectObject:
return_value = self.db.get_object_from_handle(handle)
else:
return_value = None
self.top.destroy()
self.close()
gc.collect()
return return_value
else:
self.top.destroy()
self.close()
gc.collect()
return None

View File

@ -42,7 +42,6 @@ import pango
#
#-------------------------------------------------------------------------
import const
import Utils
import PeopleModel
import ManagedWindow

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2005 Donald N. Allingham
# Copyright (C) 2003-2006 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
@ -42,25 +42,27 @@ import gtk.glade
#
#-------------------------------------------------------------------------
import const
import Utils
import ListModel
import ManagedWindow
#-------------------------------------------------------------------------
#
# SelectEvent
#
#-------------------------------------------------------------------------
class SelectSource:
class SelectSource(ManagedWindow.ManagedWindow):
def __init__(self,db,title,parent_window=None):
def __init__(self, dbstate, uistate, track, title):
self.title = title
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
self.db = db
self.db = dbstate.db
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
self.top = self.glade.get_widget('select_person')
window = self.glade.get_widget('select_person')
title_label = self.glade.get_widget('title')
self.elist = self.glade.get_widget('plist')
Utils.set_titles(self.top,title_label,title)
self.set_window(window,title_label,self.title)
titles = [(_('Title'),4,350), (_('ID'),1,50), ('',0,0)]
self.ncols = len(titles)
@ -68,10 +70,10 @@ class SelectSource:
self.model = ListModel.ListModel(self.elist,titles)
self.redraw()
self.top.show()
self.show()
if parent_window:
self.top.set_transient_for(parent_window)
def build_menu_names(self,obj):
return (self.title, None)
def redraw(self):
self.model.clear()
@ -85,7 +87,7 @@ class SelectSource:
self.model.connect_model()
def run(self):
val = self.top.run()
val = self.window.run()
if val == gtk.RESPONSE_OK:
store,node = self.model.get_selected()
@ -95,8 +97,8 @@ class SelectSource:
return_value = self.db.get_source_from_handle(handle)
else:
return_value = None
self.top.destroy()
self.close()
return return_value
else:
self.top.destroy()
self.close()
return None