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,
|
from .displaytabs import (NoteTab, GalleryTab, SrcAttrEmbedList,
|
||||||
SrcTemplateTab, CitedInTab,
|
SrcTemplateTab, CitedInTab,
|
||||||
CitationBackRefList, RepoEmbedList)
|
CitationBackRefList, RepoEmbedList)
|
||||||
|
from .displaytabs.srctemplatetab import TemplateFields
|
||||||
from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredTagList,
|
from ..widgets import (MonitoredEntry, PrivacyButton, MonitoredTagList,
|
||||||
MonitoredMenu)
|
MonitoredMenu)
|
||||||
from ..dialog import ErrorDialog, QuestionDialog2
|
from ..dialog import ErrorDialog, QuestionDialog2
|
||||||
@ -102,6 +103,8 @@ class EditSource(EditPrimary):
|
|||||||
else:
|
else:
|
||||||
#no citation given.
|
#no citation given.
|
||||||
self.citation_loaded = False
|
self.citation_loaded = False
|
||||||
|
#we put an empty base citation ready.
|
||||||
|
self.citation = Citation()
|
||||||
self.callertitle = callertitle
|
self.callertitle = callertitle
|
||||||
|
|
||||||
self.citation_ready = False
|
self.citation_ready = False
|
||||||
@ -118,7 +121,7 @@ class EditSource(EditPrimary):
|
|||||||
title = _('Source') + ": " + title
|
title = _('Source') + ": " + title
|
||||||
else:
|
else:
|
||||||
title = _('New Source')
|
title = _('New Source')
|
||||||
if self.citation is not None:
|
if self.citation_loaded:
|
||||||
citeid = self.citation.get_gramps_id()
|
citeid = self.citation.get_gramps_id()
|
||||||
if self.citation.get_handle():
|
if self.citation.get_handle():
|
||||||
if self.callertitle:
|
if self.callertitle:
|
||||||
@ -165,7 +168,7 @@ class EditSource(EditPrimary):
|
|||||||
derived class (this class).
|
derived class (this class).
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if self.citation is None:
|
if not self.citation_loaded:
|
||||||
self.unload_citation()
|
self.unload_citation()
|
||||||
|
|
||||||
self.load_source_image()
|
self.load_source_image()
|
||||||
@ -173,7 +176,7 @@ class EditSource(EditPrimary):
|
|||||||
#new source, open on template view, and focus there.
|
#new source, open on template view, and focus there.
|
||||||
self.notebook_src.set_current_page(self.template_page_nr)
|
self.notebook_src.set_current_page(self.template_page_nr)
|
||||||
self.template_tab.make_active()
|
self.template_tab.make_active()
|
||||||
elif self.citation:
|
elif self.citation_loaded:
|
||||||
#there is a citation!
|
#there is a citation!
|
||||||
if self.citation.handle:
|
if self.citation.handle:
|
||||||
#existing citation!
|
#existing citation!
|
||||||
@ -297,8 +300,7 @@ class EditSource(EditPrimary):
|
|||||||
self.db.readonly)
|
self.db.readonly)
|
||||||
|
|
||||||
#editable citation fields
|
#editable citation fields
|
||||||
if self.citation:
|
self._setup_citation_fields()
|
||||||
self._setup_citation_fields()
|
|
||||||
|
|
||||||
#trigger updates of read only fields
|
#trigger updates of read only fields
|
||||||
self.update_attr()
|
self.update_attr()
|
||||||
@ -360,7 +362,7 @@ class EditSource(EditPrimary):
|
|||||||
|
|
||||||
#set fields with the template
|
#set fields with the template
|
||||||
self.refL.set_text(self.srctemp.reference_L())
|
self.refL.set_text(self.srctemp.reference_L())
|
||||||
if self.citation:
|
if self.citation_loaded:
|
||||||
self.refF.set_text(self.srctemp.reference_F())
|
self.refF.set_text(self.srctemp.reference_F())
|
||||||
self.refS.set_text(self.srctemp.reference_S())
|
self.refS.set_text(self.srctemp.reference_S())
|
||||||
else:
|
else:
|
||||||
@ -383,6 +385,13 @@ class EditSource(EditPrimary):
|
|||||||
self.attr_tab.rebuild_callback()
|
self.attr_tab.rebuild_callback()
|
||||||
self.update_attr()
|
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):
|
def update_notes(self, *par):
|
||||||
"""
|
"""
|
||||||
Change the source text on the overview page when notebase of the source
|
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)
|
self.glade.get_object('vbox').pack_start(notebook, True, True, 0)
|
||||||
|
|
||||||
#now create citation tabbed pages
|
#now create citation tabbed pages
|
||||||
if self.citation:
|
self._create_citation_tabbed_pages()
|
||||||
self._create_citation_tabbed_pages()
|
|
||||||
|
|
||||||
def _create_citation_tabbed_pages(self):
|
def _create_citation_tabbed_pages(self):
|
||||||
if self.citation_ready:
|
if self.citation_ready:
|
||||||
@ -484,6 +492,10 @@ class EditSource(EditPrimary):
|
|||||||
_('General'), tblref)
|
_('General'), tblref)
|
||||||
self._add_tab(notebook_ref, self.reftab)
|
self._add_tab(notebook_ref, self.reftab)
|
||||||
self.track_ref_for_deletion("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.comment_tab = NoteTab(self.dbstate, self.uistate, self.track,
|
||||||
self.citation.get_note_list(), self.get_menu_title(),
|
self.citation.get_note_list(), self.get_menu_title(),
|
||||||
|
@ -118,6 +118,10 @@
|
|||||||
<object class="GtkGrid" id="grid1">
|
<object class="GtkGrid" id="grid1">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</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="row_spacing">3</property>
|
||||||
<property name="column_spacing">3</property>
|
<property name="column_spacing">3</property>
|
||||||
<child>
|
<child>
|
||||||
@ -311,22 +315,54 @@
|
|||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<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>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkScrolledWindow" id="scrolledwindow2">
|
||||||
</child>
|
<property name="visible">True</property>
|
||||||
<child>
|
<property name="can_focus">True</property>
|
||||||
<placeholder/>
|
<property name="margin_left">10</property>
|
||||||
</child>
|
<property name="shadow_type">in</property>
|
||||||
<child>
|
<child>
|
||||||
<placeholder/>
|
<object class="GtkViewport" id="viewport1">
|
||||||
</child>
|
<property name="visible">True</property>
|
||||||
<child>
|
<property name="can_focus">False</property>
|
||||||
<placeholder/>
|
<child>
|
||||||
</child>
|
<object class="GtkGrid" id="grid_citefields">
|
||||||
<child>
|
<property name="visible">True</property>
|
||||||
<placeholder/>
|
<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>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user