Evidence source new source editor version 1
* Overview tab * selection of template, which updates the template attribute svn: r22451
This commit is contained in:
commit
c449bbf588
@ -149,15 +149,16 @@ with open('srcattrtype_extra.py', 'wb') as srcattrfile:
|
||||
#
|
||||
|
||||
#first an English to internationalized map
|
||||
code = " #SRCTYPE has some predefined values which map to citation styles\n"
|
||||
code = " #SRCTEMPLATE has some predefined values which map to citation styles\n"
|
||||
|
||||
datamap = " _SRCTYPEVAL_MAP = [\n"
|
||||
datamap = " _SRCTEMPLATEVAL_MAP = [\n"\
|
||||
" (UNKNOWN, _('Unknown'), 'Unknown'),\n"
|
||||
allkeys = sorted(TYPE2CITEMAP.keys())
|
||||
for source_type in allkeys:
|
||||
code += " " + source_type + ' = %d\n' % TYPE2CITEMAP[source_type]['i']
|
||||
# we use descrcode in to translate string to reduce work for translators
|
||||
datamap += ' (' + source_type + ', ' + TYPE2CITEMAP[source_type]['descrcode'] \
|
||||
+', "' + TYPE2CITEMAP[source_type]['descr'] + '"),\n'
|
||||
datamap += " (" + source_type + ", " + TYPE2CITEMAP[source_type]['descrcode'] \
|
||||
+", '" + source_type+ "'),\n"
|
||||
|
||||
code += '\n # Localization of the different source types\n'\
|
||||
+ datamap + ' ]\n'
|
||||
@ -168,7 +169,7 @@ code += "\n #templates for the source types defined\n"\
|
||||
" # L: List reference (for in bibliography list)\n"
|
||||
code += ' EVIDENCETEMPLATES = {\n'
|
||||
for source_type in allkeys:
|
||||
code += " '" + source_type + "': {\n"
|
||||
code += " " + source_type + ": {\n"
|
||||
for val in ['F', 'L', 'S']:
|
||||
code += " '" + val + "': [\n"
|
||||
for field in TYPE2CITEMAP[source_type][val]:
|
||||
|
@ -31,7 +31,6 @@ AttributeBase class for GRAMPS.
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .attribute import Attribute
|
||||
from .srcattribute import SrcAttribute
|
||||
from .const import IDENTICAL, EQUAL
|
||||
from ..constfunc import STRTYPE
|
||||
|
||||
@ -167,7 +166,3 @@ class AttributeRootBase(object):
|
||||
|
||||
class AttributeBase(AttributeRootBase):
|
||||
_CLASS = Attribute
|
||||
|
||||
class SrcAttributeBase(AttributeRootBase):
|
||||
_CLASS = SrcAttribute
|
||||
|
||||
|
@ -44,7 +44,7 @@ from .mediabase import MediaBase
|
||||
from .notebase import NoteBase
|
||||
from .datebase import DateBase
|
||||
from .tagbase import TagBase
|
||||
from .attrbase import SrcAttributeBase
|
||||
from .srcattrbase import SrcAttributeBase
|
||||
from ..constfunc import cuni
|
||||
from .handle import Handle
|
||||
|
||||
|
@ -35,7 +35,7 @@ from .primaryobj import PrimaryObject
|
||||
from .mediabase import MediaBase
|
||||
from .notebase import NoteBase
|
||||
from .tagbase import TagBase
|
||||
from .attrbase import SrcAttributeBase
|
||||
from .srcattrbase import SrcAttributeBase
|
||||
from .reporef import RepoRef
|
||||
from .const import DIFFERENT, EQUAL, IDENTICAL
|
||||
from ..constfunc import cuni
|
||||
|
101
gramps/gen/lib/srcattrbase.py
Normal file
101
gramps/gen/lib/srcattrbase.py
Normal file
@ -0,0 +1,101 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2013 Benny Malengier
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
SrcAttributeBase class for GRAMPS.
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GRAMPS modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from .attrbase import AttributeRootBase
|
||||
from .srcattribute import SrcAttribute
|
||||
from .srcattrtype import SrcAttributeType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# SrcAttributeBase class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class SrcAttributeBase(AttributeRootBase):
|
||||
_CLASS = SrcAttribute
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Logical methods
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def get_source_template(self):
|
||||
"""
|
||||
Return the source template of the source/citation
|
||||
This is the value of the first source template in the attribute list
|
||||
If not known UNKNOWN is returned as key, which is integer. Other keys
|
||||
will be str.
|
||||
:rtype tuple: (key, translated_string, english_string)
|
||||
"""
|
||||
templ = SrcAttributeType.UNKNOWN
|
||||
for attr in self.attribute_list:
|
||||
if int(attr.get_type()) == SrcAttributeType.SRCTEMPLATE:
|
||||
val = attr.get_value()
|
||||
try:
|
||||
templ = SrcAttributeType.E2I_SRCTEMPLATEMAP[val]
|
||||
except KeyError:
|
||||
# a template not in the predefined list. convert to unknown
|
||||
print ('SrcAttributeType: Keyerror "', val,
|
||||
'"for now UNKNOWN taken, later custom templates?')
|
||||
break
|
||||
return (templ, SrcAttributeType.I2S_SRCTEMPLATEMAP[templ],
|
||||
SrcAttributeType.I2E_SRCTEMPLATEMAP[templ])
|
||||
|
||||
def set_source_template(self, tempindex, tempcustom_str):
|
||||
"""
|
||||
Set the source template of the source/citation
|
||||
This is the value of the first source template in the attribute list
|
||||
If tempindex is UNKNOWN, the template is removed.
|
||||
If tempindex is not CUSTOM, string value of tempindex is stored.
|
||||
Otherwise, the user given string value tempcustom_str is stored
|
||||
:param tempindex: integer template key
|
||||
:param tempcustom_str: string of a custom key to use as value for
|
||||
template
|
||||
"""
|
||||
attrtemp = None
|
||||
for attr in self.attribute_list:
|
||||
if int(attr.get_type()) == SrcAttributeType.SRCTEMPLATE:
|
||||
#we update the existing template
|
||||
attrtemp = attr
|
||||
break
|
||||
if attrtemp is None:
|
||||
#we create a new attribute and add it
|
||||
attrtemp = SrcAttribute()
|
||||
self.add_attribute(attrtemp)
|
||||
if tempindex == SrcAttributeType.UNKNOWN or \
|
||||
(tempindex == SrcAttributeType.CUSTOM and tempcustom_str.strip() == ''):
|
||||
self.remove_attribute(attrtemp)
|
||||
elif not (tempindex == SrcAttributeType.CUSTOM):
|
||||
attr.set_value(SrcAttributeType.I2E_SRCTEMPLATEMAP[tempindex])
|
||||
else:
|
||||
#custom key, store string as is
|
||||
attr.set_value(tempindex)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -60,4 +60,5 @@ from .repoembedlist import RepoEmbedList
|
||||
from .surnametab import SurnameTab
|
||||
from .sourcebackreflist import SourceBackRefList
|
||||
from .srcattrembedlist import SrcAttrEmbedList
|
||||
from .srctemplatetab import SrcTemplateTab
|
||||
from .webembedlist import WebEmbedList
|
||||
|
156
gramps/gui/editors/displaytabs/srctemplatetab.py
Normal file
156
gramps/gui/editors/displaytabs/srctemplatetab.py
Normal file
@ -0,0 +1,156 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2013 Benny Malengier
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Python modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.gettext
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps libraries
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib.srcattrtype import SrcAttributeType
|
||||
from ...autocomp import StandardCustomSelector
|
||||
from ...widgets.srctemplatetreeview import SrcTemplateTreeView
|
||||
from .grampstab import GrampsTab
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class SrcTemplateTab(GrampsTab):
|
||||
"""
|
||||
This class provides the tabpage for template generation of attributes.
|
||||
"""
|
||||
def __init__(self, dbstate, uistate, track, src, widget, scrolled,
|
||||
callback_src_changed):
|
||||
"""
|
||||
@param dbstate: The database state. Contains a reference to
|
||||
the database, along with other state information. The GrampsTab
|
||||
uses this to access the database and to pass to and created
|
||||
child windows (such as edit dialogs).
|
||||
@type dbstate: DbState
|
||||
@param uistate: The UI state. Used primarily to pass to any created
|
||||
subwindows.
|
||||
@type uistate: DisplayState
|
||||
@param track: The window tracking mechanism used to manage windows.
|
||||
This is only used to pass to generted child windows.
|
||||
@type track: list
|
||||
@param src: source which we manage in this tab
|
||||
@type src: gen.lib.Source
|
||||
@param widget: widget with all the elements
|
||||
@type widget: GTK dialog
|
||||
"""
|
||||
self.src = src
|
||||
self.callback_src_changed = callback_src_changed
|
||||
self.readonly = dbstate.db.readonly
|
||||
GrampsTab.__init__(self, dbstate, uistate, track, _("Source Template"))
|
||||
eventbox = Gtk.EventBox()
|
||||
eventbox.add(widget)
|
||||
self.pack_start(eventbox, True, True, 0)
|
||||
self._set_label(show_image=False)
|
||||
widget.connect('key_press_event', self.key_pressed)
|
||||
self.setup_interface(scrolled)
|
||||
self.show_all()
|
||||
|
||||
def is_empty(self):
|
||||
"""
|
||||
Override base class
|
||||
"""
|
||||
return False
|
||||
|
||||
def setup_interface(self, scrolled):
|
||||
"""
|
||||
Set all information on the widgets
|
||||
* template selection
|
||||
* setting attribute fields
|
||||
|
||||
:param scrolled: GtkScrolledWindow to which to add treeview with templates
|
||||
"""
|
||||
srcattr = SrcAttributeType()
|
||||
templ = self.src.get_source_template()
|
||||
self.temp_tv = SrcTemplateTreeView(templ[1],
|
||||
sel_callback=self.on_template_selected)
|
||||
scrolled.add(self.temp_tv)
|
||||
|
||||
def on_template_selected(self, index, key):
|
||||
"""
|
||||
Selected template changed, we save this and update interface
|
||||
"""
|
||||
self.src.set_source_template(index, key)
|
||||
self.callback_src_changed()
|
||||
|
||||
## def setup_autocomp_combobox(self):
|
||||
## """
|
||||
## Experimental code to set up a combobox with all templates.
|
||||
## This is too slow, we use treeview in second attempt
|
||||
## """
|
||||
## self.srctempcmb = Gtk.ComboBox(has_entry=True)
|
||||
## ignore_values = []
|
||||
## custom_values = []
|
||||
## srcattr = SrcAttributeType()
|
||||
## default = srcattr.get_templatevalue_default()
|
||||
## maptempval = srcattr.get_templatevalue_map().copy()
|
||||
## if ignore_values :
|
||||
## for key in list(maptempval.keys()):
|
||||
## if key in ignore_values and key not in (None, default):
|
||||
## del map[key]
|
||||
##
|
||||
## self.sel = StandardCustomSelector(
|
||||
## maptempval,
|
||||
## self.srctempcmb,
|
||||
## srcattr.get_custom(),
|
||||
## default,
|
||||
## additional=custom_values)
|
||||
##
|
||||
## templ = self.src.get_source_template()
|
||||
## self.sel.set_values((templ[0], templ[1]))
|
||||
## self.srctempcmb.set_sensitive(not self.readonly)
|
||||
## self.srctempcmb.connect('changed', self.on_change_template)
|
||||
## srctemphbox.pack_start(self.srctempcmb, False, True, 0)
|
||||
##
|
||||
## return topvbox
|
||||
|
||||
## def fix_value(self, value):
|
||||
## if value[0] == SrcAttributeType.CUSTOM:
|
||||
## return value
|
||||
## else:
|
||||
## return (value[0], '')
|
||||
##
|
||||
## def on_change_template(self, obj):
|
||||
## #value = self.fix_value(self.srctempcmb.get_values())
|
||||
## value = self.sel.get_values()
|
||||
## self.src.set_source_template(value[0], value[1])
|
@ -38,7 +38,7 @@ LOG = logging.getLogger(".citation")
|
||||
# GTK/Gnome modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk, Gdk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -47,9 +47,14 @@ from gi.repository import Gtk
|
||||
#-------------------------------------------------------------------------
|
||||
from gramps.gen.lib import NoteType, Source
|
||||
from gramps.gen.db import DbTxn
|
||||
from gramps.gen.utils.file import media_path_full
|
||||
from ..thumbnails import get_thumbnail_image
|
||||
from .editprimary import EditPrimary
|
||||
from .editreference import RefTab
|
||||
from .editmediaref import EditMediaRef
|
||||
|
||||
from .displaytabs import (NoteTab, GalleryTab, SrcAttrEmbedList,
|
||||
SrcTemplateTab,
|
||||
CitationBackRefList, RepoEmbedList)
|
||||
from ..widgets import MonitoredEntry, PrivacyButton, MonitoredTagList
|
||||
from ..dialog import ErrorDialog
|
||||
@ -89,10 +94,65 @@ class EditSource(EditPrimary):
|
||||
self.set_window(self.glade.toplevel, None,
|
||||
self.get_menu_title())
|
||||
|
||||
self.obj_photo = self.glade.get_object("sourcePix")
|
||||
self.frame_photo = self.glade.get_object("frame5")
|
||||
self.eventbox = self.glade.get_object("eventbox1")
|
||||
|
||||
def _post_init(self):
|
||||
"""
|
||||
Handle any initialization that needs to be done after the interface is
|
||||
brought up.
|
||||
|
||||
Post initalization function.
|
||||
This is called by _EditPrimary's init routine, and overridden in the
|
||||
derived class (this class).
|
||||
|
||||
"""
|
||||
self.load_source_image()
|
||||
self.title.grab_focus()
|
||||
|
||||
def load_source_image(self):
|
||||
"""
|
||||
Load the primary image into the main form if it exists.
|
||||
|
||||
Used as callback on Gallery Tab too.
|
||||
|
||||
"""
|
||||
media_list = self.obj.get_media_list()
|
||||
if media_list:
|
||||
ref = media_list[0]
|
||||
handle = ref.get_reference_handle()
|
||||
obj = self.dbstate.db.get_object_from_handle(handle)
|
||||
if obj is None :
|
||||
#notify user of error
|
||||
from ..dialog import RunDatabaseRepair
|
||||
RunDatabaseRepair(
|
||||
_('Non existing media found in the Gallery'))
|
||||
else:
|
||||
self.load_photo(ref, obj)
|
||||
else:
|
||||
self.obj_photo.hide()
|
||||
self.frame_photo.hide()
|
||||
|
||||
def load_photo(self, ref, obj):
|
||||
"""
|
||||
Load the source's main photo using the Thumbnailer.
|
||||
"""
|
||||
pixbuf = get_thumbnail_image(
|
||||
media_path_full(self.dbstate.db, obj.get_path()),
|
||||
obj.get_mime_type(),
|
||||
ref.get_rectangle())
|
||||
|
||||
self.obj_photo.set_from_pixbuf(pixbuf)
|
||||
self.obj_photo.show()
|
||||
self.frame_photo.show_all()
|
||||
|
||||
def _connect_signals(self):
|
||||
self.define_ok_button(self.glade.get_object('ok'),self.save)
|
||||
self.define_cancel_button(self.glade.get_object('cancel'))
|
||||
self.define_help_button(self.glade.get_object('help'))
|
||||
self.eventbox.connect('button-press-event',
|
||||
self._image_button_press)
|
||||
|
||||
def _connect_db_signals(self):
|
||||
"""
|
||||
@ -103,14 +163,16 @@ class EditSource(EditPrimary):
|
||||
self._add_db_signal('source-delete', self.check_for_close)
|
||||
|
||||
def _setup_fields(self):
|
||||
self.author = MonitoredEntry(self.glade.get_object("author"),
|
||||
self.obj.set_author, self.obj.get_author,
|
||||
self.db.readonly)
|
||||
|
||||
self.pubinfo = MonitoredEntry(self.glade.get_object("pubinfo"),
|
||||
self.obj.set_publication_info,
|
||||
self.obj.get_publication_info,
|
||||
self.db.readonly)
|
||||
## self.author = MonitoredEntry(self.glade.get_object("author"),
|
||||
## self.obj.set_author, self.obj.get_author,
|
||||
## self.db.readonly)
|
||||
##
|
||||
## self.pubinfo = MonitoredEntry(self.glade.get_object("pubinfo"),
|
||||
## self.obj.set_publication_info,
|
||||
## self.obj.get_publication_info,
|
||||
## self.db.readonly)
|
||||
self.author = self.glade.get_object("author")
|
||||
self.pubinfo = self.glade.get_object("pubinfo")
|
||||
|
||||
self.gid = MonitoredEntry(self.glade.get_object("gid"),
|
||||
self.obj.set_gramps_id,
|
||||
@ -136,8 +198,41 @@ class EditSource(EditPrimary):
|
||||
self.obj.set_title, self.obj.get_title,
|
||||
self.db.readonly)
|
||||
|
||||
self.update_attr()
|
||||
|
||||
def update_attr(self):
|
||||
"""
|
||||
Reaction to update on attributes
|
||||
"""
|
||||
self.author.set_text(self.obj.get_author())
|
||||
self.pubinfo.set_text(self.obj.get_publication_info())
|
||||
|
||||
def update_template_data(self):
|
||||
"""
|
||||
Change in the template tab must be reflected in other places
|
||||
"""
|
||||
self.attr_tab.rebuild_callback()
|
||||
|
||||
def _create_tabbed_pages(self):
|
||||
notebook = Gtk.Notebook()
|
||||
notebook = self.glade.get_object('notebook')
|
||||
gridsrc = self.glade.get_object('gridsrc')
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.overviewtab = RefTab(self.dbstate, self.uistate, self.track,
|
||||
_('Overview'), gridsrc)
|
||||
self._add_tab(notebook, self.overviewtab)
|
||||
|
||||
gridtemp = self.glade.get_object('gridtemplate')
|
||||
|
||||
#recreate start page as GrampsTab
|
||||
notebook.remove_page(0)
|
||||
self.template_tab = SrcTemplateTab(self.dbstate, self.uistate,
|
||||
self.track, self.obj, gridtemp,
|
||||
self.glade.get_object('scrolledtemplates'),
|
||||
self.update_template_data
|
||||
)
|
||||
self._add_tab(notebook, self.template_tab)
|
||||
self.track_ref_for_deletion("template_tab")
|
||||
|
||||
self.note_tab = NoteTab(self.dbstate,
|
||||
self.uistate,
|
||||
@ -151,7 +246,8 @@ class EditSource(EditPrimary):
|
||||
self.gallery_tab = GalleryTab(self.dbstate,
|
||||
self.uistate,
|
||||
self.track,
|
||||
self.obj.get_media_list())
|
||||
self.obj.get_media_list(),
|
||||
self.load_source_image)
|
||||
self._add_tab(notebook, self.gallery_tab)
|
||||
self.track_ref_for_deletion("gallery_tab")
|
||||
|
||||
@ -184,6 +280,76 @@ class EditSource(EditPrimary):
|
||||
def build_menu_names(self, source):
|
||||
return (_('Edit Source'), self.get_menu_title())
|
||||
|
||||
def _image_button_press(self, obj, event):
|
||||
"""
|
||||
Button press event that is caught when a button has been pressed while
|
||||
on the image on the main form.
|
||||
|
||||
This does not apply to the images in galleries, just the image on the
|
||||
main form.
|
||||
"""
|
||||
if event.type == Gdk.EventType._2BUTTON_PRESS and event.button == 1:
|
||||
|
||||
media_list = self.obj.get_media_list()
|
||||
if media_list:
|
||||
media_ref = media_list[0]
|
||||
object_handle = media_ref.get_reference_handle()
|
||||
media_obj = self.db.get_object_from_handle(object_handle)
|
||||
|
||||
try:
|
||||
EditMediaRef(self.dbstate, self.uistate, self.track,
|
||||
media_obj, media_ref, self.load_photo)
|
||||
except WindowActiveError:
|
||||
pass
|
||||
|
||||
elif is_right_click(event):
|
||||
media_list = self.obj.get_media_list()
|
||||
if media_list:
|
||||
photo = media_list[0]
|
||||
self._show_popup(photo, event)
|
||||
#do not propagate further:
|
||||
return True
|
||||
|
||||
def _show_popup(self, photo, event):
|
||||
"""
|
||||
Look for right-clicks on a picture and create a popup menu of the
|
||||
available actions.
|
||||
"""
|
||||
self.imgmenu = Gtk.Menu()
|
||||
menu = self.imgmenu
|
||||
menu.set_title(_("Media Object"))
|
||||
obj = self.db.get_object_from_handle(photo.get_reference_handle())
|
||||
if obj:
|
||||
add_menuitem(menu, _("View"), photo,
|
||||
self._popup_view_photo)
|
||||
add_menuitem(menu, _("Edit Object Properties"), photo,
|
||||
self._popup_change_description)
|
||||
menu.popup(None, None, None, None, event.button, event.time)
|
||||
|
||||
def _popup_view_photo(self, obj):
|
||||
"""
|
||||
Open this picture in the default picture viewer.
|
||||
"""
|
||||
media_list = self.obj.get_media_list()
|
||||
if media_list:
|
||||
photo = media_list[0]
|
||||
object_handle = photo.get_reference_handle()
|
||||
ref_obj = self.db.get_object_from_handle(object_handle)
|
||||
photo_path = media_path_full(self.db, ref_obj.get_path())
|
||||
open_file_with_default_application(photo_path)
|
||||
|
||||
def _popup_change_description(self, obj):
|
||||
"""
|
||||
Bring up the EditMediaRef dialog for the image on the main form.
|
||||
"""
|
||||
media_list = self.obj.get_media_list()
|
||||
if media_list:
|
||||
media_ref = media_list[0]
|
||||
object_handle = media_ref.get_reference_handle()
|
||||
media_obj = self.db.get_object_from_handle(object_handle)
|
||||
EditMediaRef(self.dbstate, self.uistate, self.track,
|
||||
media_obj, media_ref, self.load_photo)
|
||||
|
||||
def save(self, *obj):
|
||||
self.ok_button.set_sensitive(False)
|
||||
if self.object_is_empty():
|
||||
|
@ -15,6 +15,7 @@
|
||||
<object class="GtkBox" id="dialog-vbox17">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area17">
|
||||
<property name="visible">True</property>
|
||||
@ -23,12 +24,10 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="help">
|
||||
<property name="label">gtk-help</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -40,12 +39,10 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="cancel">
|
||||
<property name="label">gtk-cancel</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -57,12 +54,10 @@
|
||||
<child>
|
||||
<object class="GtkButton" id="ok">
|
||||
<property name="label">gtk-ok</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -128,18 +123,16 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="date_stat">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Invoke date editor</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<accelerator key="d" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<child internal-child="accessible">
|
||||
@ -164,7 +157,7 @@
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -179,7 +172,7 @@
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -196,7 +189,7 @@
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -213,7 +206,7 @@
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -239,7 +232,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -252,7 +245,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -297,7 +290,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -352,7 +345,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -368,16 +361,14 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="privacy">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<child internal-child="accessible">
|
||||
@ -403,17 +394,15 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_options"/>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tag_button2">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
@ -422,8 +411,8 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_options"/>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
@ -481,7 +470,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -498,7 +487,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -516,7 +505,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -533,7 +522,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -548,7 +537,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -593,7 +582,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">5</property>
|
||||
<property name="bottom_attach">6</property>
|
||||
<property name="x_options">GTK_EXPAND | GTK_SHRINK | GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -608,7 +597,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -623,7 +612,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -639,7 +628,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -706,7 +695,7 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
@ -719,16 +708,14 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="y_options"></property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="private">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="relief">none</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="private-atkobject">
|
||||
@ -753,17 +740,15 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_options"/>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tag_button">
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_action_appearance">False</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
@ -771,8 +756,8 @@ Very High =Direct and primary evidence used, or by dominance of the evidence </p
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options"></property>
|
||||
<property name="y_options"></property>
|
||||
<property name="x_options"/>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
@ -9,6 +9,7 @@
|
||||
<object class="GtkBox" id="dialog-vbox11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">8</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area11">
|
||||
@ -79,264 +80,584 @@
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table17">
|
||||
<object class="GtkNotebook" id="notebook">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="n_rows">5</property>
|
||||
<property name="n_columns">3</property>
|
||||
<property name="column_spacing">4</property>
|
||||
<property name="row_spacing">4</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label165">
|
||||
<object class="GtkGrid" id="gridsrc">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Title:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">source_title</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label166">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Author:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">author</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="source_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="has_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Title of the source.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="author">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Authors of the source.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="bottom_attach">2</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label167">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Pub. info.:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">pubinfo</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="pubinfo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Publication Information, such as city and year of publication, name of publisher, ...</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="bottom_attach">3</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="abbrev">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Provide a short title used for sorting, filing, and retrieving source records.</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label392">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">A_bbreviation:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">abbrev</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"/>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox134">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="row_spacing">3</property>
|
||||
<property name="column_spacing">3</property>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="gid">
|
||||
<property name="width_request">75</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">A unique ID to identify the source</property>
|
||||
<property name="invisible_char">●</property>
|
||||
<property name="width_chars">6</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<object class="GtkFrame" id="frame5">
|
||||
<property name="width_request">114</property>
|
||||
<property name="height_request">114</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Tags:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tag_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ypad">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label658">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_ID:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">gid</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="private">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Indicates if the record is private</property>
|
||||
<property name="tooltip_text" translatable="yes">Indicates if the record is private</property>
|
||||
<property name="relief">none</property>
|
||||
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="private-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2706">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">gtk-dialog-authentication</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="label_xalign">2.2351741291171123e-10</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="image2706-atkobject">
|
||||
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
|
||||
<object class="AtkObject" id="frame5-atkobject">
|
||||
<property name="AtkObject::accessible-description" translatable="yes">Image</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEventBox" id="eventbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="sourcePix">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label270">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Image</property>
|
||||
<attributes>
|
||||
<attribute name="weight" value="bold"/>
|
||||
</attributes>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label165">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Title:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">source_title</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="source_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label5">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_ID:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="mnemonic_widget">gid</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tag_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToggleButton" id="private">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="has_tooltip">True</property>
|
||||
<property name="tooltip_markup" translatable="yes">Indicates if the record is private</property>
|
||||
<property name="tooltip_text" translatable="yes">Indicates if the record is private</property>
|
||||
<property name="relief">none</property>
|
||||
<accelerator key="p" signal="activate" modifiers="GDK_CONTROL_MASK"/>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="private-atkobject">
|
||||
<property name="AtkObject::accessible-name" translatable="yes">Private</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkImage" id="image2706">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="icon_name">gtk-dialog-authentication</property>
|
||||
<child internal-child="accessible">
|
||||
<object class="AtkObject" id="image2706-atkobject">
|
||||
<property name="AtkObject::accessible-description" translatable="yes">Privacy</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkHBox" id="hbox134">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="gid">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Tags:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tag_label">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="ypad">2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander" id="expander1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="expanded">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="row_spacing">3</property>
|
||||
<property name="column_spacing">3</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label7">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">In List:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">Short footnote:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="refL">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="RefF">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="RefS">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label8">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">Full footnote:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label6">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>Reference Information</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">4</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander" id="expander2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">5</property>
|
||||
<property name="margin_right">5</property>
|
||||
<property name="row_spacing">2</property>
|
||||
<property name="column_spacing">5</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label166">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Author:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">author</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label167">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">_Pub. info.:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">pubinfo</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="pubinfo">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="author">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">label</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="label">
|
||||
<object class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes"><b>GEDCOM export</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">4</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label392">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">A_bbreviation:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">abbrev</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="UndoableEntry" id="abbrev">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="invisible_char">•</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">page 1</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="bottom_attach">4</property>
|
||||
<property name="x_options"/>
|
||||
<property name="y_options"/>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="tag_button">
|
||||
<object class="GtkGrid" id="gridtemplate">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_stock">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">3</property>
|
||||
<property name="margin_right">3</property>
|
||||
<property name="margin_top">5</property>
|
||||
<property name="row_spacing">3</property>
|
||||
<property name="column_spacing">3</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="label" translatable="yes">Source Template:</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkScrolledWindow" id="scrolledtemplates">
|
||||
<property name="height_request">150</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="right_attach">3</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="bottom_attach">5</property>
|
||||
<property name="x_options"/>
|
||||
<property name="y_options"/>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">page 2</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">1</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child type="tab">
|
||||
<object class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">page 3</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">2</property>
|
||||
<property name="tab_fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
163
gramps/gui/widgets/srctemplatetreeview.py
Normal file
163
gramps/gui/widgets/srctemplatetreeview.py
Normal file
@ -0,0 +1,163 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2013 Benny Malengier
|
||||
#
|
||||
# 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
|
||||
#
|
||||
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
A class to select source templates
|
||||
"""
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# GTK classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
from gi.repository import Gdk
|
||||
from gi.repository import Gtk
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Gramps classes
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
from gramps.gen.lib import SrcAttributeType
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# SrcTemplateTreeView class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
|
||||
class SrcTemplateTreeView(Gtk.TreeView):
|
||||
'''
|
||||
TreeView for SrcAttribute templates, to allow fast selection
|
||||
'''
|
||||
def __init__(self, default_key, sel_callback):
|
||||
"""
|
||||
Set up the treeview to select template.
|
||||
TreeView is initialized to default_key
|
||||
On setting a selection, sel_callback is called
|
||||
"""
|
||||
Gtk.TreeView.__init__(self)
|
||||
self.sel_callback = sel_callback
|
||||
self.default_key = default_key
|
||||
self.build_model()
|
||||
self.make_columns()
|
||||
self.selection = self.get_selection()
|
||||
self.set_model(self.model)
|
||||
# set up selection and fields on click
|
||||
self.connect('button-press-event', self._on_button_press)
|
||||
self.connect('key_press_event', self._on_key_press_event)
|
||||
self.defer_select = False
|
||||
|
||||
def build_model(self):
|
||||
"""
|
||||
Obtains all templates and stores them in a TreeStore
|
||||
"""
|
||||
srcattrt = SrcAttributeType()
|
||||
self.I2Str = srcattrt.I2S_SRCTEMPLATEMAP
|
||||
self.I2Key = srcattrt.I2E_SRCTEMPLATEMAP
|
||||
self.Str2I = srcattrt.S2I_SRCTEMPLATEMAP
|
||||
# store (index, key, cat, cat_type, src_type)
|
||||
self.model = Gtk.TreeStore(int, str, str)
|
||||
alltexts = sorted(self.Str2I.keys())
|
||||
parentiter = None
|
||||
parentiterlev1 = None
|
||||
prevstrval = ['', '']
|
||||
for alltext in alltexts:
|
||||
vals = alltext.split('-')
|
||||
lastval = vals[-1]
|
||||
if len(vals) > 3:
|
||||
vals = [vals[0], vals[1], ' - '.join(vals[2:])]
|
||||
lastval = vals[2]
|
||||
vals = [x.strip() for x in vals]
|
||||
truevals = ['','','']
|
||||
if len(vals) < 3 :
|
||||
truevals[:len(vals)] = vals[:]
|
||||
vals = truevals
|
||||
index = self.Str2I[alltext]
|
||||
row = [index, self.I2Key[index], lastval]
|
||||
if prevstrval[0] == vals[0] and prevstrval[1] == vals[1]:
|
||||
#same parentiter
|
||||
self.model.append(parentiter, row)
|
||||
elif prevstrval[0] == vals[0]:
|
||||
#up one parentiter, make new sublevel2 if needed
|
||||
parentiter = parentiterlev1
|
||||
if vals[2]:
|
||||
parentiter = self.model.append(parentiter, [-10, '', vals[1]])
|
||||
self.model.append(parentiter, row)
|
||||
else:
|
||||
#new value
|
||||
parentiterlev1 = None
|
||||
if vals[2] and vals[1]:
|
||||
#new sublevel1 and 2 needed
|
||||
parentiterlev1 = self.model.append(None, [-10, '', vals[0]])
|
||||
#make sublevel2
|
||||
parentiter= self.model.append(parentiterlev1, [-10, '', vals[1]])
|
||||
elif vals[1]:
|
||||
#only new sublevel1 needed
|
||||
parentiterlev1 = self.model.append(None, [-10, '', vals[0]])
|
||||
parentiter = parentiterlev1
|
||||
self.model.append(parentiter, row)
|
||||
prevstrval = [vals[0], vals[1]]
|
||||
|
||||
def make_columns(self):
|
||||
#make the column in the treeview
|
||||
renderer = Gtk.CellRendererText()
|
||||
column = Gtk.TreeViewColumn("Template", renderer, text=2)
|
||||
self.append_column(column)
|
||||
#no headers needed:
|
||||
self.set_headers_visible (False)
|
||||
|
||||
def get_selected(self):
|
||||
"""
|
||||
Return the (index, key) associated with selected row in the model,
|
||||
"""
|
||||
(model, node) = self.selection.get_selected()
|
||||
if node:
|
||||
return (model.get_value(node, 0), model.get_value(node,1), node)
|
||||
return None
|
||||
|
||||
def _on_button_press(self, obj, event):
|
||||
"""
|
||||
Handle button press
|
||||
"""
|
||||
if event.type == Gdk.EventType.BUTTON_PRESS and event.button == 1:
|
||||
ref = self.get_selected()
|
||||
if ref and ref[0] != -10:
|
||||
self.sel_callback(ref[0], ref[1])
|
||||
return False
|
||||
|
||||
def _on_key_press_event(self, widget, event):
|
||||
if event.type == Gdk.EventType.KEY_PRESS:
|
||||
if event.keyval in (Gdk.KEY_Return, Gdk.KEY_KP_Enter):
|
||||
ref = self.get_selected()
|
||||
if ref:
|
||||
if ref[0] != -10:
|
||||
self.sel_callback(ref[0], ref[1])
|
||||
else:
|
||||
path = self.model.get_path(ref[2])
|
||||
if self.row_expanded(path):
|
||||
self.collapse_row(path)
|
||||
else:
|
||||
self.expand_row(path, False)
|
||||
return False
|
Loading…
x
Reference in New Issue
Block a user