2006-04-27 Don Allingham <don@gramps-project.org>
* src/Editors/_EditReference.py: fix warn_box call * src/DisplayTabs.py: handle canceled edit box for media * src/AddMedia.py: ManagedWindow support * src/SelectPerson.py: ManagedWindow support svn: r6478
This commit is contained in:
parent
5f7cf6a91a
commit
81f6548c5c
@ -1,3 +1,9 @@
|
|||||||
|
2006-04-27 Don Allingham <don@gramps-project.org>
|
||||||
|
* src/Editors/_EditReference.py: fix warn_box call
|
||||||
|
* src/DisplayTabs.py: handle canceled edit box for media
|
||||||
|
* src/AddMedia.py: ManagedWindow support
|
||||||
|
* src/SelectPerson.py: ManagedWindow support
|
||||||
|
|
||||||
2006-04-27 Alex Roitman <shura@gramps-project.org>
|
2006-04-27 Alex Roitman <shura@gramps-project.org>
|
||||||
* src/ViewManager.py (reports_clicked, tools_clicked): handle
|
* src/ViewManager.py (reports_clicked, tools_clicked): handle
|
||||||
exception.
|
exception.
|
||||||
|
@ -56,27 +56,36 @@ import Utils
|
|||||||
import RelLib
|
import RelLib
|
||||||
import Mime
|
import Mime
|
||||||
import GrampsDisplay
|
import GrampsDisplay
|
||||||
|
import ManagedWindow
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# AddMediaObject
|
# AddMediaObject
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class AddMediaObject:
|
class AddMediaObject(ManagedWindow.ManagedWindow):
|
||||||
"""
|
"""
|
||||||
Displays the Add Media Dialog window, allowing the user to select
|
Displays the Add Media Dialog window, allowing the user to select
|
||||||
a media object from the file system, while providing a description.
|
a media object from the file system, while providing a description.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self,db):
|
def __init__(self,dbstate, uistate, track):
|
||||||
"""
|
"""
|
||||||
Creates and displays the dialog box
|
Creates and displays the dialog box
|
||||||
|
|
||||||
db - the database in which the new object is to be stored
|
db - the database in which the new object is to be stored
|
||||||
"""
|
"""
|
||||||
self.db = db
|
|
||||||
|
ManagedWindow.ManagedWindow.__init__(self, uistate, track, self)
|
||||||
|
|
||||||
|
self.db = dbstate.db
|
||||||
self.glade = gtk.glade.XML(const.gladeFile,"imageSelect","gramps")
|
self.glade = gtk.glade.XML(const.gladeFile,"imageSelect","gramps")
|
||||||
self.window = self.glade.get_widget("imageSelect")
|
|
||||||
|
self.set_window(
|
||||||
|
self.glade.get_widget("imageSelect"),
|
||||||
|
self.glade.get_widget('title'),
|
||||||
|
_('Select a media object'))
|
||||||
|
|
||||||
self.description = self.glade.get_widget("photoDescription")
|
self.description = self.glade.get_widget("photoDescription")
|
||||||
self.image = self.glade.get_widget("image")
|
self.image = self.glade.get_widget("image")
|
||||||
self.file_text = self.glade.get_widget("fname")
|
self.file_text = self.glade.get_widget("fname")
|
||||||
@ -86,12 +95,12 @@ class AddMediaObject:
|
|||||||
self.temp_name = ""
|
self.temp_name = ""
|
||||||
self.object = None
|
self.object = None
|
||||||
|
|
||||||
Utils.set_titles(self.window,self.glade.get_widget('title'),
|
|
||||||
_('Select a media object'))
|
|
||||||
|
|
||||||
self.glade.get_widget('fname').connect('update_preview',
|
self.glade.get_widget('fname').connect('update_preview',
|
||||||
self.on_name_changed)
|
self.on_name_changed)
|
||||||
self.window.show()
|
self.show()
|
||||||
|
|
||||||
|
def build_menu_names(self, obj):
|
||||||
|
return(_('Select media object'),None)
|
||||||
|
|
||||||
def internal_toggled(self, obj):
|
def internal_toggled(self, obj):
|
||||||
self.file_text.set_sensitive(not obj.get_active())
|
self.file_text.set_sensitive(not obj.get_active())
|
||||||
@ -173,12 +182,12 @@ class AddMediaObject:
|
|||||||
|
|
||||||
if val == gtk.RESPONSE_OK:
|
if val == gtk.RESPONSE_OK:
|
||||||
self.on_savephoto_clicked()
|
self.on_savephoto_clicked()
|
||||||
self.window.destroy()
|
self.close()
|
||||||
return self.object
|
return self.object
|
||||||
elif val == gtk.RESPONSE_HELP:
|
elif val == gtk.RESPONSE_HELP:
|
||||||
self.on_help_imagesel_clicked(None)
|
self.on_help_imagesel_clicked(None)
|
||||||
else:
|
else:
|
||||||
self.window.destroy()
|
self.close()
|
||||||
return None
|
return None
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -1622,7 +1622,8 @@ class GalleryTab(ButtonTab):
|
|||||||
self._connect_icon_model()
|
self._connect_icon_model()
|
||||||
self._set_label()
|
self._set_label()
|
||||||
self._selection_changed()
|
self._selection_changed()
|
||||||
self.update()
|
if self.update:
|
||||||
|
self.update()
|
||||||
|
|
||||||
def get_selected(self):
|
def get_selected(self):
|
||||||
node = self.iconlist.get_selected_items()
|
node = self.iconlist.get_selected_items()
|
||||||
@ -1633,18 +1634,19 @@ class GalleryTab(ButtonTab):
|
|||||||
def add_button_clicked(self, obj):
|
def add_button_clicked(self, obj):
|
||||||
import AddMedia
|
import AddMedia
|
||||||
|
|
||||||
am = AddMedia.AddMediaObject(self.dbstate.db)
|
am = AddMedia.AddMediaObject(self.dbstate, self.uistate, self.track)
|
||||||
am.run()
|
am.run()
|
||||||
src = am.object
|
src = am.object
|
||||||
|
|
||||||
sref = RelLib.MediaRef()
|
if src:
|
||||||
try:
|
sref = RelLib.MediaRef()
|
||||||
from Editors import EditMediaRef
|
try:
|
||||||
|
from Editors import EditMediaRef
|
||||||
|
|
||||||
EditMediaRef(self.dbstate, self.uistate, self.track,
|
EditMediaRef(self.dbstate, self.uistate, self.track,
|
||||||
src, sref, self.add_callback)
|
src, sref, self.add_callback)
|
||||||
except Errors.WindowActiveError:
|
except Errors.WindowActiveError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def add_callback(self, media_ref, media):
|
def add_callback(self, media_ref, media):
|
||||||
media_ref.ref = media.handle
|
media_ref.ref = media.handle
|
||||||
|
@ -89,7 +89,7 @@ class EditReference(ManagedWindow.ManagedWindow):
|
|||||||
self.warn_box = box
|
self.warn_box = box
|
||||||
|
|
||||||
def enable_warnbox(self):
|
def enable_warnbox(self):
|
||||||
self.warn_box.show_all()
|
self.warn_box.show()
|
||||||
|
|
||||||
def define_expander(self,expander):
|
def define_expander(self,expander):
|
||||||
expander.set_expanded(True)
|
expander.set_expanded(True)
|
||||||
|
@ -44,37 +44,30 @@ import pango
|
|||||||
import const
|
import const
|
||||||
import Utils
|
import Utils
|
||||||
import PeopleModel
|
import PeopleModel
|
||||||
|
import ManagedWindow
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# SelectPerson
|
# SelectPerson
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
class SelectPerson:
|
class SelectPerson(ManagedWindow.ManagedWindow):
|
||||||
|
|
||||||
def __init__(self, db, title, filter=None, skip=[]):
|
def __init__(self, dbstate, uistate, title, filter=None, skip=[]):
|
||||||
|
|
||||||
|
ManagedWindow.ManagedWindow.__init__(self, uistate, [], self)
|
||||||
|
|
||||||
self.renderer = gtk.CellRendererText()
|
self.renderer = gtk.CellRendererText()
|
||||||
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
|
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
|
||||||
self.db = db
|
self.db = dbstate.db
|
||||||
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
|
self.glade = gtk.glade.XML(const.gladeFile,"select_person","gramps")
|
||||||
self.top = self.glade.get_widget('select_person')
|
|
||||||
self.plist = self.glade.get_widget('plist')
|
self.plist = self.glade.get_widget('plist')
|
||||||
self.notebook = self.glade.get_widget('notebook')
|
self.notebook = self.glade.get_widget('notebook')
|
||||||
|
|
||||||
Utils.set_titles(self.top,
|
self.set_window(
|
||||||
self.glade.get_widget('title'),
|
self.glade.get_widget('select_person'),
|
||||||
title)
|
self.glade.get_widget('title'),
|
||||||
|
title)
|
||||||
# import hotshot, hotshot.stats
|
|
||||||
|
|
||||||
# pr = hotshot.Profile('profile.data')
|
|
||||||
# pr.runcall(self.foo)
|
|
||||||
# pr.close()
|
|
||||||
# stats = hotshot.stats.load('profile.data')
|
|
||||||
# stats.strip_dirs()
|
|
||||||
# stats.sort_stats('time','calls')
|
|
||||||
# stats.print_stats(35)
|
|
||||||
|
|
||||||
self.model = PeopleModel.PeopleModel(self.db,
|
self.model = PeopleModel.PeopleModel(self.db,
|
||||||
data_filter=filter,
|
data_filter=filter,
|
||||||
@ -82,10 +75,10 @@ class SelectPerson:
|
|||||||
|
|
||||||
self.add_columns(self.plist)
|
self.add_columns(self.plist)
|
||||||
self.plist.set_model(self.model)
|
self.plist.set_model(self.model)
|
||||||
self.top.show()
|
self.show()
|
||||||
|
|
||||||
def foo(self):
|
def build_menu_names(self,obj):
|
||||||
PeopleModel.PeopleModel(self.db)
|
return (_('Select Person'), None)
|
||||||
|
|
||||||
def add_columns(self,tree):
|
def add_columns(self,tree):
|
||||||
tree.set_fixed_height_mode(True)
|
tree.set_fixed_height_mode(True)
|
||||||
@ -113,15 +106,15 @@ class SelectPerson:
|
|||||||
return mlist
|
return mlist
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
val = self.top.run()
|
val = self.window.run()
|
||||||
if val == gtk.RESPONSE_OK:
|
if val == gtk.RESPONSE_OK:
|
||||||
idlist = self.get_selected_ids()
|
idlist = self.get_selected_ids()
|
||||||
self.top.destroy()
|
self.close()
|
||||||
if idlist and idlist[0]:
|
if idlist and idlist[0]:
|
||||||
return_value = self.db.get_person_from_handle(idlist[0])
|
return_value = self.db.get_person_from_handle(idlist[0])
|
||||||
else:
|
else:
|
||||||
return_value = None
|
return_value = None
|
||||||
return return_value
|
return return_value
|
||||||
else:
|
else:
|
||||||
self.top.destroy()
|
self.close()
|
||||||
return None
|
return None
|
||||||
|
Loading…
Reference in New Issue
Block a user