GEP18: start with construction citation template fields
svn: r22511
This commit is contained in:
parent
06e4dcd11d
commit
9391218f20
@ -56,6 +56,7 @@ from .editmediaref import EditMediaRef
|
||||
from .displaytabs import (NoteTab, GalleryTab, SrcAttrEmbedList,
|
||||
SrcTemplateTab, CitedInTab,
|
||||
CitationBackRefList, RepoEmbedList)
|
||||
from .displaytabs.srctemplatetab import TemplateFields
|
||||
from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredTagList,
|
||||
MonitoredMenu)
|
||||
from ..dialog import ErrorDialog, QuestionDialog2
|
||||
@ -102,6 +103,8 @@ class EditSource(EditPrimary):
|
||||
else:
|
||||
#no citation given.
|
||||
self.citation_loaded = False
|
||||
#we put an empty base citation ready.
|
||||
self.citation = Citation()
|
||||
self.callertitle = callertitle
|
||||
|
||||
self.citation_ready = False
|
||||
@ -118,7 +121,7 @@ class EditSource(EditPrimary):
|
||||
title = _('Source') + ": " + title
|
||||
else:
|
||||
title = _('New Source')
|
||||
if self.citation is not None:
|
||||
if self.citation_loaded:
|
||||
citeid = self.citation.get_gramps_id()
|
||||
if self.citation.get_handle():
|
||||
if self.callertitle:
|
||||
@ -165,7 +168,7 @@ class EditSource(EditPrimary):
|
||||
derived class (this class).
|
||||
|
||||
"""
|
||||
if self.citation is None:
|
||||
if not self.citation_loaded:
|
||||
self.unload_citation()
|
||||
|
||||
self.load_source_image()
|
||||
@ -173,7 +176,7 @@ class EditSource(EditPrimary):
|
||||
#new source, open on template view, and focus there.
|
||||
self.notebook_src.set_current_page(self.template_page_nr)
|
||||
self.template_tab.make_active()
|
||||
elif self.citation:
|
||||
elif self.citation_loaded:
|
||||
#there is a citation!
|
||||
if self.citation.handle:
|
||||
#existing citation!
|
||||
@ -297,8 +300,7 @@ class EditSource(EditPrimary):
|
||||
self.db.readonly)
|
||||
|
||||
#editable citation fields
|
||||
if self.citation:
|
||||
self._setup_citation_fields()
|
||||
self._setup_citation_fields()
|
||||
|
||||
#trigger updates of read only fields
|
||||
self.update_attr()
|
||||
@ -360,7 +362,7 @@ class EditSource(EditPrimary):
|
||||
|
||||
#set fields with the template
|
||||
self.refL.set_text(self.srctemp.reference_L())
|
||||
if self.citation:
|
||||
if self.citation_loaded:
|
||||
self.refF.set_text(self.srctemp.reference_F())
|
||||
self.refS.set_text(self.srctemp.reference_S())
|
||||
else:
|
||||
@ -383,6 +385,13 @@ class EditSource(EditPrimary):
|
||||
self.attr_tab.rebuild_callback()
|
||||
self.update_attr()
|
||||
|
||||
def callback_cite_changed(self):
|
||||
"""
|
||||
Change in the citation part might lead to changes needed in the src GUI
|
||||
section
|
||||
"""
|
||||
pass
|
||||
|
||||
def update_notes(self, *par):
|
||||
"""
|
||||
Change the source text on the overview page when notebase of the source
|
||||
@ -468,8 +477,7 @@ class EditSource(EditPrimary):
|
||||
self.glade.get_object('vbox').pack_start(notebook, True, True, 0)
|
||||
|
||||
#now create citation tabbed pages
|
||||
if self.citation:
|
||||
self._create_citation_tabbed_pages()
|
||||
self._create_citation_tabbed_pages()
|
||||
|
||||
def _create_citation_tabbed_pages(self):
|
||||
if self.citation_ready:
|
||||
@ -484,6 +492,10 @@ class EditSource(EditPrimary):
|
||||
_('General'), tblref)
|
||||
self._add_tab(notebook_ref, self.reftab)
|
||||
self.track_ref_for_deletion("reftab")
|
||||
#reftab contains the citation template fields
|
||||
self.tmplfields = TemplateFields(self.dbstate.db,
|
||||
self.glade.get_object('grid_citefields'),
|
||||
self.obj, self.citation, None, self.callback_cite_changed)
|
||||
|
||||
self.comment_tab = NoteTab(self.dbstate, self.uistate, self.track,
|
||||
self.citation.get_note_list(), self.get_menu_title(),
|
||||
|
@ -118,6 +118,10 @@
|
||||
<object class="GtkGrid" id="grid1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_left">3</property>
|
||||
<property name="margin_right">3</property>
|
||||
<property name="margin_top">3</property>
|
||||
<property name="margin_bottom">1</property>
|
||||
<property name="row_spacing">3</property>
|
||||
<property name="column_spacing">3</property>
|
||||
<child>
|
||||
@ -311,22 +315,54 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes"><b>Citation Fields</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="margin_left">10</property>
|
||||
<property name="shadow_type">in</property>
|
||||
<child>
|
||||
<object class="GtkViewport" id="viewport1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<object class="GtkGrid" id="grid_citefields">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
<child>
|
||||
<placeholder/>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">3</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
Loading…
Reference in New Issue
Block a user