Extend Pro-Gen importer II
Adapted to Pro-Gen test fix, expanded functionality and fixed minor bugs.
This commit is contained in:
parent
009783a59a
commit
1a065485e3
File diff suppressed because it is too large
Load Diff
@ -118,21 +118,83 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="imp_citation_conf">
|
||||
<object class="GtkEntry" id="imp_source_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Citation confidence level
|
||||
(Very low - very high).</property>
|
||||
<property name="halign">start</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="imp_citation_conf_txt"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Source reference text
|
||||
(Text & import Filename).</property>
|
||||
<property name="hexpand">True</property>
|
||||
<signal name="key-release-event" handler="on_import_entry_keyrelease" swapped="no"/>
|
||||
</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="imp_source_title_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Title</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_source_attr_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="label" translatable="yes">Attribut</property>
|
||||
<attributes>
|
||||
<attribute name="stretch" value="semi-condensed"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="imp_source_attr">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Source attribute text
|
||||
(Text, import Filename & (System-)Date).</property>
|
||||
<property name="opacity">0.9882352941176471</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="hexpand">True</property>
|
||||
</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="GtkCheckButton" id="imp_citation_btn">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Citation reference.</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_citation_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
@ -151,7 +213,7 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
@ -186,11 +248,92 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">2</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_citation_conf_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">2</property>
|
||||
<property name="label" translatable="yes">Confidence</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="imp_citation_conf">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Citation confidence level
|
||||
(Very low - very high).</property>
|
||||
<property name="halign">start</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="imp_citation_conf_txt"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_citation_page_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Page</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="imp_citation_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Citation volume/page text
|
||||
(Text & (System-)Date).</property>
|
||||
<property name="hexpand">True</property>
|
||||
<signal name="key-release-event" handler="on_import_entry_keyrelease" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_citation_attr_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Attribut</property>
|
||||
<attributes>
|
||||
<attribute name="stretch" value="semi-condensed"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="imp_citation_attr">
|
||||
<property name="visible">True</property>
|
||||
@ -204,120 +347,11 @@
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="top_attach">6</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="imp_citation_btn">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Citation reference.</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_citation_button_toggled" swapped="no"/>
|
||||
</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="GtkEntry" id="imp_source_title">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Source reference text
|
||||
(Text & import Filename).</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="hexpand">True</property>
|
||||
<signal name="key-release-event" handler="on_import_entry_keyrelease" swapped="no"/>
|
||||
</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="GtkEntry" id="imp_citation_page">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Citation volume/page text
|
||||
(Text & (System-)Date).</property>
|
||||
<property name="hexpand">True</property>
|
||||
<signal name="key-release-event" handler="on_import_entry_keyrelease" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">2</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">1</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_source_">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_bottom">10</property>
|
||||
<property name="label" translatable="yes">Title</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_citation_page_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Page</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">4</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_citation_attr_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="label" translatable="yes">Attribut</property>
|
||||
<attributes>
|
||||
<attribute name="stretch" value="semi-condensed"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">5</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="imp_citation_conf_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">2</property>
|
||||
<property name="label" translatable="yes">Confidence</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">3</property>
|
||||
<property name="width">2</property>
|
||||
<property name="height">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child type="tab">
|
||||
@ -338,7 +372,7 @@
|
||||
<property name="halign">start</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="dflt_lbl">
|
||||
<object class="GtkLabel" id="dfltbox_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
@ -390,7 +424,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tag_default_file_lbl">
|
||||
<object class="GtkLabel" id="tag_default_fname_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin_right">2</property>
|
||||
@ -403,7 +437,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="tag_default_file">
|
||||
<object class="GtkEntry" id="tag_default_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Import Filename.</property>
|
||||
@ -485,7 +519,7 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="tag_lb">
|
||||
<object class="GtkLabel" id="taggrid_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
@ -831,14 +865,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_person_file">
|
||||
<object class="GtkCheckButton" id="tag_person_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -848,14 +882,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_family_file">
|
||||
<object class="GtkCheckButton" id="tag_family_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -865,14 +899,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_event_file">
|
||||
<object class="GtkCheckButton" id="tag_event_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -882,14 +916,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_place_file">
|
||||
<object class="GtkCheckButton" id="tag_place_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -899,14 +933,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_source_file">
|
||||
<object class="GtkCheckButton" id="tag_source_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -916,14 +950,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_citation_file">
|
||||
<object class="GtkCheckButton" id="tag_citation_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -933,14 +967,14 @@
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="tag_note_file">
|
||||
<object class="GtkCheckButton" id="tag_note_fname">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_file_button_toggled" swapped="no"/>
|
||||
<signal name="toggled" handler="on_fname_button_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -1076,7 +1110,6 @@
|
||||
<property name="receives_default">True</property>
|
||||
<property name="tooltip_text" translatable="yes">Copy Default Text
|
||||
to all Tag Text'.</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="on_text_button_clicked" swapped="no"/>
|
||||
@ -1093,12 +1126,12 @@ to all Tag Text'.</property>
|
||||
<property name="label" translatable="yes">File</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Copy Default Filename
|
||||
to all Tag Text'.</property>
|
||||
to all sensitive Tag Text'.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="on_file_button_clicked" swapped="no"/>
|
||||
<signal name="clicked" handler="on_fname_button_clicked" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">3</property>
|
||||
@ -1112,9 +1145,9 @@ to all Tag Text'.</property>
|
||||
<property name="label" translatable="yes">Date</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Copy Default Date
|
||||
to all Tag Text'.</property>
|
||||
to all sensitive Tag Text'.</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="relief">none</property>
|
||||
<signal name="clicked" handler="on_date_button_clicked" swapped="no"/>
|
||||
@ -1175,7 +1208,7 @@ all object tags.</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="primobj_lbl">
|
||||
<object class="GtkLabel" id="primobjbox_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
@ -1264,7 +1297,7 @@ Child import.</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="option_lbl">
|
||||
<object class="GtkLabel" id="miscbox_lbl">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
|
@ -40,7 +40,7 @@ _ = glocale.translation.gettext
|
||||
from gramps.gen.config import config
|
||||
|
||||
from gramps.gen.lib import Citation
|
||||
from gramps.gen.lib.date import Date, Today
|
||||
from gramps.gen.lib.date import Today
|
||||
from gramps.gen.lib.datebase import DateBase
|
||||
from gramps.gen.utils.libformatting import ImportInfo
|
||||
|
||||
@ -117,12 +117,13 @@ class ImportSourceCitation(object):
|
||||
def __init__(self, dflt_btn, dflt_text, text, fname, date):
|
||||
""""""
|
||||
self.source_btn = ImportValue(dflt_btn)
|
||||
self.source_title = ImportEntry(_('Import from Pro-Gen (%s)') % fname)
|
||||
self.source_priv = ImportPrivacy(False)
|
||||
self.source_title = ImportEntry(_('Import from Pro-Gen (%s)') % fname)
|
||||
self.source_attr = ImportEntry('%s (%s) %s' % (text, fname, date))
|
||||
self.citation_btn = ImportValue(dflt_btn)
|
||||
self.citation_page = ImportEntry('%s' % dflt_text)
|
||||
self.citation_priv = ImportPrivacy(False)
|
||||
self.citation_conf = ImportValue(Citation.CONF_HIGH)
|
||||
self.citation_page = ImportEntry('%s' % dflt_text)
|
||||
self.citation_attr = ImportEntry('%s (%s) %s' % (text, fname, date))
|
||||
|
||||
class ImportTagTextDefault(object):
|
||||
@ -130,41 +131,45 @@ class ImportTagTextDefault(object):
|
||||
|
||||
def __init__(self, text, fname):
|
||||
""""""
|
||||
self.dflt_text = ImportEntry(text)
|
||||
self.dflt_file = ImportEntry(fname)
|
||||
self.dflt_date = Date()
|
||||
self.text = ImportEntry(text)
|
||||
self.fname = ImportEntry(fname)
|
||||
self.date = Today()
|
||||
self.date.text = '{:04d}-{:02d}-{:02d}'.format \
|
||||
(self.date.dateval[2], self.date.dateval[1], self.date.dateval[0])
|
||||
|
||||
# sets / gets Default entries
|
||||
def set_dfltdate(self, date):
|
||||
""" connects to 'set' method of MonitoredDate """
|
||||
self.dflt_date = date
|
||||
self.date = date
|
||||
def get_dfltdate(self):
|
||||
""" connects to 'get' method of MonitoredDate """
|
||||
return self.dflt_date.text
|
||||
return self.date.text
|
||||
|
||||
class ImportTagText(object):
|
||||
""" Class for internal values for tag objects """
|
||||
|
||||
def __init__(self, text, fname, date):
|
||||
def __init__(self, default):
|
||||
""""""
|
||||
self.tag_dflt = default
|
||||
self.tag_obj = ImportValue(True)
|
||||
self.tag_file = ImportValue(True)
|
||||
self.tag_fname = ImportValue(True)
|
||||
self.tag_date = ImportValue(True)
|
||||
self.act_text, self.dflt_file, self.dflt_date = text, fname, date
|
||||
self.tag_text = "%s(%s)%s" % (text, fname, date)
|
||||
tag_text = '%s (%s) %s' % \
|
||||
(default.text.get_entry(),
|
||||
default.fname.get_entry(),
|
||||
default.get_dfltdate())
|
||||
self.tag_text = ImportEntry(tag_text)
|
||||
|
||||
def set_tagtext(self, text):
|
||||
""" connects to 'set' method of MonitoredEntry """
|
||||
# \xa0 as (non breakable) space to separate text elements
|
||||
self.act_text = text.split('\xa0')[0].rstrip()
|
||||
def get_tagtext(self):
|
||||
""" connects to 'get' method of MonitoredEntry """
|
||||
self.tag_text = self.act_text
|
||||
if self.tag_file.get_value():
|
||||
self.tag_text += '\xa0(%s)' % self.dflt_file
|
||||
def get_dflttext(self):
|
||||
""" set Tag Text to default values """
|
||||
tag_text = self.tag_dflt.text.get_entry()
|
||||
if self.tag_fname.get_value():
|
||||
tag_text += ' (%s)' % self.tag_dflt.fname.get_entry()
|
||||
if self.tag_date.get_value():
|
||||
self.tag_text += '\xa0%s' % self.dflt_date
|
||||
return self.tag_text
|
||||
tag_text += ' %s' % self.tag_dflt.get_dfltdate()
|
||||
self.tag_text.set_entry(tag_text)
|
||||
|
||||
return tag_text
|
||||
|
||||
def _importData(database, filename, user):
|
||||
"""
|
||||
@ -187,8 +192,7 @@ def _importData(database, filename, user):
|
||||
if info: # successful import
|
||||
# display qualified/standard statistic window
|
||||
if user.uistate:
|
||||
InfoDialog(_('Import Statistics'), info.info_text(),
|
||||
parent=user.parent)
|
||||
InfoDialog(_('Import Statistics'), info.info_text(), parent=user.parent)
|
||||
else:
|
||||
return ImportInfo({_("Results"): _("done")})
|
||||
|
||||
@ -207,9 +211,9 @@ class ProgenOptions(ManagedWindow):
|
||||
self.fail = True
|
||||
|
||||
# initial values
|
||||
fname = os.path.basename(filename).split('\\')[-1]
|
||||
date = time.strftime("%Y-%m-%d", time.localtime())
|
||||
text = "Pro-Gen Import"
|
||||
fname = os.path.basename(filename).split('\\')[-1]
|
||||
date = time.strftime('%Y-%m-%d', time.localtime())
|
||||
|
||||
# add import source title/confidence
|
||||
# citation page/confidence/privacy/attribute
|
||||
@ -230,10 +234,10 @@ class ProgenOptions(ManagedWindow):
|
||||
self.tagobj_status = True
|
||||
self.tagobj_values, self.tagobj_methods = {}, {}
|
||||
self.tagtext_methods = {}
|
||||
self.tagfile_status, self.tagfile_methods = True, {}
|
||||
self.tagfname_status, self.tagfname_methods = True, {}
|
||||
self.tagdate_status, self.tagdate_methods = True, {}
|
||||
for obj in libprogen.TAGOBJECTS:
|
||||
self.tagobj_values[obj] = ImportTagText(text, fname, date)
|
||||
self.tagobj_values[obj] = ImportTagText(self.default_values)
|
||||
|
||||
# add primary object values
|
||||
self.primobj_values, self.primobj_methods = {}, {}
|
||||
@ -259,17 +263,24 @@ class ProgenOptions(ManagedWindow):
|
||||
|
||||
def __on_source_button_toggled(self, widget):
|
||||
""" compute the source button and toggle the 'Sensitive' attribute """
|
||||
obj_state = widget.get_active()
|
||||
for obj in ['title', 'priv']:
|
||||
obj_source_state = widget.get_active()
|
||||
for obj in ['priv', 'title', 'attr']:
|
||||
imp_obj = self.glade.get_object('imp_source_%s' % obj)
|
||||
imp_obj.set_sensitive(obj_state)
|
||||
imp_obj.set_sensitive(obj_source_state)
|
||||
|
||||
# Check if Source enabled and syncronizing Citation
|
||||
self.glade.get_object('imp_citation_btn').set_active(obj_source_state)
|
||||
self.glade.get_object('imp_citation_btn').set_sensitive(obj_source_state)
|
||||
|
||||
def __on_citation_button_toggled(self, widget):
|
||||
""" compute the citation button and toggle the 'Sensitive' attribute """
|
||||
obj_state = widget.get_active()
|
||||
for obj in ['page', 'attr', 'conf', 'priv']:
|
||||
# Check if Source enabled and syncronizing Citation
|
||||
obj_source_state = self.glade.get_object('imp_source_btn').get_active()
|
||||
|
||||
obj_citation_state = widget.get_active() and obj_source_state
|
||||
for obj in ['priv', 'conf', 'page', 'attr']:
|
||||
imp_obj = self.glade.get_object('imp_citation_%s' % obj)
|
||||
imp_obj.set_sensitive(obj_state)
|
||||
imp_obj.set_sensitive(obj_citation_state)
|
||||
|
||||
def __on_import_entry_keyrelease(self, widget, event, data=None):
|
||||
""" activated on all return's of an entry"""
|
||||
@ -293,13 +304,13 @@ class ProgenOptions(ManagedWindow):
|
||||
obj_name = Gtk.Buildable.get_name(widget)
|
||||
obj_name = obj_name.split('_', 1)[1].split('_', 1)[0]
|
||||
|
||||
for obj in ['file', 'date', 'text']:
|
||||
for obj in ['text', 'fname', 'date']:
|
||||
tag_obj = self.glade.get_object('tag_%s_%s' % (obj_name, obj))
|
||||
tag_obj.set_sensitive(obj_state)
|
||||
|
||||
def __on_text_button_clicked(self, widget=None):
|
||||
""" compute all primary objects and flush the 'text' field """
|
||||
self.__on_tagtext_entry_resume(default=True) # Resume tag text
|
||||
self.__on_tagtext_entry_resume() # Resume tag text
|
||||
|
||||
def __on_tagtext_entry_keyrelease(self, widget, event, data=None):
|
||||
""" activated on all return's of an entry """
|
||||
@ -313,44 +324,42 @@ class ProgenOptions(ManagedWindow):
|
||||
libprogen.TAGOBJECTS[obj_index])
|
||||
obj_next.grab_focus()
|
||||
|
||||
def __on_tagtext_entry_resume(self, default=True):
|
||||
def __on_tagtext_entry_resume(self):
|
||||
""" resume new tagtext from old + file & date variables"""
|
||||
for obj in libprogen.TAGOBJECTS:
|
||||
tag_obj = self.glade.get_object('tag_%s_text' % obj)
|
||||
if not tag_obj.get_sensitive():
|
||||
continue
|
||||
|
||||
if default:
|
||||
obj_entry = self.default_values.dflt_text.get_entry()
|
||||
else:
|
||||
obj_entry = self.tagobj_values[obj].act_text
|
||||
self.tagobj_values[obj].set_tagtext(obj_entry)
|
||||
obj_entry = self.tagobj_values[obj].get_dflttext()
|
||||
self.tagobj_values[obj].tag_text.set_entry(obj_entry)
|
||||
self.tagtext_methods[obj].update()
|
||||
|
||||
def __on_file_button_clicked(self, widget=None):
|
||||
def __on_fname_button_clicked(self, widget=None):
|
||||
""" compute all primary objects and toggle the 'file' attribute """
|
||||
self.tagfile_status = not self.tagfile_status
|
||||
self.tagfname_status = not self.tagfname_status
|
||||
|
||||
for obj in libprogen.TAGOBJECTS:
|
||||
tag_obj = self.glade.get_object('tag_%s_file' % obj)
|
||||
tag_obj = self.glade.get_object('tag_%s_fname' % obj)
|
||||
if not tag_obj.get_sensitive():
|
||||
continue
|
||||
|
||||
self.tagfile_methods[obj].set_val(self.tagfile_status)
|
||||
tag_obj.set_active(self.tagfile_status)
|
||||
self.tagfname_methods[obj].set_val(self.tagfname_status)
|
||||
tag_obj.set_active(self.tagfname_status)
|
||||
|
||||
self.__on_tagtext_entry_resume(default=False) # Resume tag text
|
||||
self.__on_tagtext_entry_resume() # Resume tag text
|
||||
|
||||
def __on_file_button_toggled(self, widget):
|
||||
def __on_fname_button_toggled(self, widget):
|
||||
""" compute the primary object and toggle the 'Sensitive' attribute """
|
||||
self.__on_tagtext_entry_resume(default=False)
|
||||
self.__on_tagtext_entry_resume()
|
||||
|
||||
# switch focus forward
|
||||
obj_name = Gtk.Buildable.get_name(widget)
|
||||
obj_name = obj_name.split('_', 1)[1].split('_', 1)[0]
|
||||
obj_index = libprogen.TAGOBJECTS.index(obj_name)
|
||||
if obj_index < len(libprogen.TAGOBJECTS) -1:
|
||||
obj_index = obj_index +1
|
||||
obj_next = self.glade.get_object('tag_%s_file' % \
|
||||
obj_next = self.glade.get_object('tag_%s_fname' % \
|
||||
libprogen.TAGOBJECTS[obj_index])
|
||||
obj_next.grab_focus()
|
||||
|
||||
@ -366,12 +375,13 @@ class ProgenOptions(ManagedWindow):
|
||||
self.tagdate_methods[obj].set_val(self.tagdate_status)
|
||||
tag_obj.set_active(self.tagdate_status)
|
||||
|
||||
self.__on_tagtext_entry_resume(default=False) # Resume tag text
|
||||
self.__on_tagtext_entry_resume() # Resume tag text
|
||||
|
||||
def __on_date_button_toggled(self, widget):
|
||||
""" compute the primary object and toggle the 'Sensitive' attribute """
|
||||
self.__on_tagtext_entry_resume(default=False)
|
||||
self.__on_tagtext_entry_resume()
|
||||
|
||||
# switch focus forward
|
||||
obj_name = Gtk.Buildable.get_name(widget)
|
||||
obj_name = obj_name.split('_', 1)[1].split('_', 1)[0]
|
||||
obj_index = libprogen.TAGOBJECTS.index(obj_name)
|
||||
@ -462,7 +472,7 @@ class ProgenOptions(ManagedWindow):
|
||||
get_import = eval('self.imp_values.%s.get_value' % obj)
|
||||
self.import_methods[obj] = MonitoredCheckbox(\
|
||||
widget, widget, set_import, get_import, self.dbase.readonly)
|
||||
for obj in ('source_title', 'citation_page', 'citation_attr'):
|
||||
for obj in ('source_title', 'source_attr', 'citation_page', 'citation_attr'):
|
||||
widget = self.glade.get_object('imp_%s' % obj)
|
||||
set_import = eval('self.imp_values.%s.set_entry' % obj)
|
||||
get_import = eval('self.imp_values.%s.get_entry' % obj)
|
||||
@ -488,10 +498,10 @@ class ProgenOptions(ManagedWindow):
|
||||
widget, get_import, self.dbase.readonly)
|
||||
|
||||
# Text (w. Defaults) for Tags
|
||||
for obj in ('text', 'file'):
|
||||
for obj in ('text', 'fname'):
|
||||
widget = self.glade.get_object('tag_default_%s' % obj)
|
||||
set_import = eval('self.default_values.dflt_%s.set_entry' % obj)
|
||||
get_import = eval('self.default_values.dflt_%s.get_entry' % obj)
|
||||
set_import = eval('self.default_values.%s.set_entry' % obj)
|
||||
get_import = eval('self.default_values.%s.get_entry' % obj)
|
||||
self.default_methods[obj] = MonitoredEntry(\
|
||||
widget, set_import, get_import, self.dbase.readonly)
|
||||
date = Today()
|
||||
@ -502,7 +512,6 @@ class ProgenOptions(ManagedWindow):
|
||||
self.glade.get_object('tag_default_date_btn'),
|
||||
datebase.get_date_object(),
|
||||
self.uistate, [], self.dbase.readonly)
|
||||
self.default_values.set_dfltdate(date)
|
||||
|
||||
for obj in libprogen.TAGOBJECTS:
|
||||
# populate object fields with values
|
||||
@ -512,12 +521,12 @@ class ProgenOptions(ManagedWindow):
|
||||
self.tagobj_values[obj].tag_obj.get_value)
|
||||
widget = self.glade.get_object('tag_%s_text' % obj)
|
||||
self.tagtext_methods[obj] = MonitoredEntry(widget,
|
||||
self.tagobj_values[obj].set_tagtext,
|
||||
self.tagobj_values[obj].get_tagtext)
|
||||
widget = self.glade.get_object('tag_%s_file' % obj)
|
||||
self.tagfile_methods[obj] = MonitoredCheckbox(widget, widget,
|
||||
self.tagobj_values[obj].tag_file.set_value,
|
||||
self.tagobj_values[obj].tag_file.get_value)
|
||||
self.tagobj_values[obj].tag_text.set_entry,
|
||||
self.tagobj_values[obj].tag_text.get_entry)
|
||||
widget = self.glade.get_object('tag_%s_fname' % obj)
|
||||
self.tagfname_methods[obj] = MonitoredCheckbox(widget, widget,
|
||||
self.tagobj_values[obj].tag_fname.set_value,
|
||||
self.tagobj_values[obj].tag_fname.get_value)
|
||||
widget = self.glade.get_object('tag_%s_date' % obj)
|
||||
self.tagdate_methods[obj] = MonitoredCheckbox(widget, widget,
|
||||
self.tagobj_values[obj].tag_date.set_value,
|
||||
@ -550,8 +559,8 @@ class ProgenOptions(ManagedWindow):
|
||||
"on_object_button_clicked" : self.__on_object_button_clicked,
|
||||
"on_object_button_toggled" : self.__on_object_button_toggled,
|
||||
"on_text_button_clicked" : self.__on_text_button_clicked,
|
||||
"on_file_button_clicked" : self.__on_file_button_clicked,
|
||||
"on_file_button_toggled" : self.__on_file_button_toggled,
|
||||
"on_fname_button_clicked" : self.__on_fname_button_clicked,
|
||||
"on_fname_button_toggled" : self.__on_fname_button_toggled,
|
||||
"on_date_button_clicked" : self.__on_date_button_clicked,
|
||||
"on_date_button_toggled" : self.__on_date_button_toggled,
|
||||
"on_primobj_button_toggled" : self.__on_primobj_button_toggled,
|
||||
@ -576,27 +585,52 @@ class ProgenOptions(ManagedWindow):
|
||||
def _collect(self):
|
||||
""" collect all options """
|
||||
|
||||
self.option['imp_source_title'] = self.imp_values.source_title.get_entry() \
|
||||
if self.imp_values.source_btn.get_value() else ''
|
||||
self.option['imp_source'] = self.imp_values.source_btn.get_value()
|
||||
self.option['imp_source_priv'] = self.imp_values.source_priv.get_privacy() \
|
||||
if self.imp_values.source_btn.get_value() else False
|
||||
self.option['imp_citation_page'] = self.imp_values.citation_page.get_entry() \
|
||||
if self.imp_values.citation_btn.get_value() else ''
|
||||
self.option['imp_citation_attr'] = self.imp_values.citation_attr.get_entry() \
|
||||
if self.imp_values.citation_btn.get_value() else ''
|
||||
if self.option['imp_source'] else False
|
||||
if self.option['imp_source']:
|
||||
self.option['imp_source_title'] = self.imp_values.source_title.get_entry()
|
||||
sourceattr = self.imp_values.source_attr.get_entry()
|
||||
# Expand if exists possible strftime directives
|
||||
if ('%Y' or '%m' or '%d' or '%H' or '%M' or '%S') in sourceattr:
|
||||
sourceattr = time.strftime(sourceattr)
|
||||
self.option['imp_source_attr'] = sourceattr
|
||||
else:
|
||||
self.option['imp_source_title'] = ''
|
||||
self.option['imp_source_attr'] = ''
|
||||
|
||||
self.option['imp_citation'] = self.imp_values.citation_btn.get_value()
|
||||
self.option['imp_citation_conf'] = self.imp_values.citation_conf.get_value() \
|
||||
if self.imp_values.citation_btn.get_value() else Citation.CONF_HIGH
|
||||
if self.option['imp_citation'] else Citation.CONF_HIGH
|
||||
self.option['imp_citation_priv'] = self.imp_values.citation_priv.get_privacy() \
|
||||
if self.imp_values.citation_btn.get_value() else False
|
||||
if self.option['imp_citation'] else False
|
||||
if self.option['imp_citation']:
|
||||
citationpage = self.imp_values.citation_page.get_entry()
|
||||
if ('%Y' or '%m' or '%d' or '%H' or '%M' or '%S') in citationpage:
|
||||
citationpage = time.strftime(citationpage)
|
||||
self.option['imp_citation_page'] = citationpage
|
||||
citationattr = self.imp_values.citation_attr.get_entry()
|
||||
if ('%Y' or '%m' or '%d' or '%H' or '%M' or '%S') in citationattr:
|
||||
citationattr = time.strftime(citationattr)
|
||||
self.option['imp_citation_attr'] = citationattr
|
||||
else:
|
||||
self.option['imp_citation_page'] = ''
|
||||
self.option['imp_citation_attr'] = ''
|
||||
|
||||
for obj in libprogen.TAGOBJECTS:
|
||||
self.option['tag_%s' % obj] = self.tagobj_values[obj].get_tagtext() \
|
||||
if self.tagobj_values[obj].tag_text else ''
|
||||
if self.tagobj_values[obj].tag_obj.get_value():
|
||||
tagtext = self.tagobj_values[obj].tag_text.get_entry()
|
||||
if ('%Y' or '%m' or '%d' or '%H' or '%M' or '%S') in tagtext:
|
||||
tagtext = time.strftime(tagtext)
|
||||
self.option['tag_{}'.format(obj)] = tagtext
|
||||
else:
|
||||
self.option['tag_{}'.format(obj)] = ''
|
||||
|
||||
for obj in libprogen.PRIMOBJECTS:
|
||||
self.option['prim_%s' % obj] = self.primobj_values[obj].get_value()
|
||||
|
||||
self.option['prim_{}'.format(obj)] = \
|
||||
self.primobj_values[obj].get_value()
|
||||
for obj in libprogen.OPTOBJECTS:
|
||||
self.option['opt_%s' % obj] = self.option_values[obj].get_value()
|
||||
self.option['opt_{}'.format(obj)] = \
|
||||
self.option_values[obj].get_value()
|
||||
|
||||
self.fail = False # Pro-Gen import proceed
|
||||
|
@ -192,18 +192,17 @@ def _get_defname(fname):
|
||||
Get the name of the PG30.DEF file by looking at the user DEF file.
|
||||
"""
|
||||
# Return the name of the DEF file. <fname> is expected to be somewhere in
|
||||
# the PG30 tree. Contents of <fname> is something like:
|
||||
# the PG30 tree. Contents of <fname> is always something like:
|
||||
# => \\0
|
||||
# => C:\\PG30\\NL\\PG30-1.DEF
|
||||
|
||||
# We will strip the C: and convert the rest to a native pathname. Next,
|
||||
# this pathname is compared with <fname>.
|
||||
|
||||
with open(fname) as file_:
|
||||
with open(fname, buffering=1, encoding='cp437', errors='strict') as file_:
|
||||
lines = file_.readlines()
|
||||
if not lines[0].startswith(r'\0') or len(lines) < 2:
|
||||
ProgenError(_("Not a Pro-Gen file"))
|
||||
return None, '?'
|
||||
if not lines[0].startswith(r'\0') or len(lines) != 2:
|
||||
return None, fname
|
||||
|
||||
defname = lines[1]
|
||||
defname = defname.strip()
|
||||
@ -434,14 +433,10 @@ class PG30Def(object):
|
||||
# tables=2
|
||||
|
||||
def __init__(self, fname):
|
||||
fname, dname = _get_defname(fname)
|
||||
if not fname:
|
||||
raise ProgenError(_("Cannot find DEF file: %(dname)s") % locals())
|
||||
|
||||
# Read the DEF file (maybe throw a IOError)
|
||||
# Read the main DEF file (maybe throw a IOError)
|
||||
lines = None
|
||||
with open(fname, buffering=1, encoding='cp437', errors='strict') as frme:
|
||||
lines = frme.readlines()
|
||||
with open(fname, buffering=1, encoding='cp437', errors='strict') as frame:
|
||||
lines = frame.readlines()
|
||||
|
||||
# Analyse the DEF lines
|
||||
lines = [l.strip() for l in lines]
|
||||
@ -490,6 +485,15 @@ class ProgenParser(UpdateCallback):
|
||||
# Nothing to import
|
||||
return None
|
||||
|
||||
# Read the stub DEF file (maybe throw a IOError)
|
||||
self.fname, dname = _get_defname(self.fname)
|
||||
if not self.fname:
|
||||
error_msg = ProgenError(_("Not a (right) DEF file: %(dname)s") % locals())
|
||||
self.user.notify_error(_("Pro-Gen data error"), str(error_msg))
|
||||
# close feedback about import progress (GUI)!
|
||||
if self.uistate: self.progress.close()
|
||||
return None
|
||||
|
||||
# start feedback about import progress (GUI / TXT)
|
||||
self.__display_message(_('Initializing.'), _('Import from Pro-Gen'))
|
||||
self.def_ = PG30Def(self.fname)
|
||||
@ -510,7 +514,9 @@ class ProgenParser(UpdateCallback):
|
||||
# Raise a error message
|
||||
error_msg = ProgenError(_("Not a supported Pro-Gen import file language"))
|
||||
self.user.notify_error(_("Pro-Gen data error"), str(error_msg))
|
||||
return
|
||||
# close feedback about import progress (GUI)
|
||||
if self.uistate: self.progress.close()
|
||||
return None
|
||||
|
||||
self.mems = _read_mem(self.bname)
|
||||
self.pers = _read_recs(self.def_['Table_1'], self.bname, self.mems)
|
||||
@ -534,9 +540,8 @@ class ProgenParser(UpdateCallback):
|
||||
self.dbase.enable_signals()
|
||||
self.dbase.request_rebuild()
|
||||
|
||||
# close feedback about import progress (GUI / TXT)
|
||||
if self.uistate:
|
||||
self.progress.close()
|
||||
# close feedback about import progress (GUI)
|
||||
if self.uistate: self.progress.close()
|
||||
|
||||
return self.info
|
||||
|
||||
@ -850,27 +855,18 @@ class ProgenParser(UpdateCallback):
|
||||
return place
|
||||
|
||||
def __get_or_create_citation(self, source_title, date_text,
|
||||
page_text='', page_ref='',
|
||||
confidence=3, note_text=None, attr_text=None):
|
||||
page_text='', page_ref=''):
|
||||
"""
|
||||
Finds or creates a Citation based on:
|
||||
Finds or creates Source & Citation based on:
|
||||
Source, Name, Date, Page, Note, Attribute.
|
||||
"""
|
||||
if not source_title:
|
||||
return None
|
||||
|
||||
# process Volume/Page
|
||||
page = source_title
|
||||
if page_text or page_ref:
|
||||
page = '%s %s' % (page_text, page_ref)
|
||||
|
||||
# process Attribute
|
||||
if attr_text:
|
||||
sattr = SrcAttribute()
|
||||
sattr.set_type(_("Source"))
|
||||
sattr.set_value(attr_text)
|
||||
|
||||
# process Source
|
||||
if not self.option['imp_source']: # No Source enabled
|
||||
return None
|
||||
|
||||
if source_title in self.skeys: # source exists
|
||||
source = self.dbase.get_source_from_handle(self.skeys[source_title])
|
||||
else: # create a new source
|
||||
@ -881,7 +877,10 @@ class ProgenParser(UpdateCallback):
|
||||
self.__add_tag('source', source) # add tag to 'Source'
|
||||
|
||||
# process Attribute
|
||||
if attr_text:
|
||||
if self.option['imp_source_attr']:
|
||||
sattr = SrcAttribute()
|
||||
sattr.set_type(_("Source"))
|
||||
sattr.set_value(self.option['imp_source_attr'])
|
||||
source.add_attribute(sattr)
|
||||
|
||||
self.dbase.add_source(source, self.trans) # add & commit ...
|
||||
@ -892,6 +891,14 @@ class ProgenParser(UpdateCallback):
|
||||
self.info.add('new-object', SOURCE_KEY, None)
|
||||
|
||||
# process Citation
|
||||
if not self.option['imp_citation']: # No Citation enabled
|
||||
return None
|
||||
|
||||
# process Volume/Page
|
||||
page = source_title
|
||||
if page_text or page_ref:
|
||||
page = '%s %s' % (page_text, page_ref)
|
||||
|
||||
if page in self.ckeys: # citation exists
|
||||
citation = self.dbase.get_citation_from_handle(self.ckeys[page])
|
||||
else: # create a new citation
|
||||
@ -907,7 +914,7 @@ class ProgenParser(UpdateCallback):
|
||||
citation.set_date_object(date)
|
||||
|
||||
# process Confidence
|
||||
citation.set_confidence_level(confidence)
|
||||
citation.set_confidence_level(self.option['imp_citation_conf'])
|
||||
|
||||
# process Page (substitute string directives)
|
||||
if ('%Y' or '%m' or '%d' or '%H' or '%M' or '%S') in page:
|
||||
@ -915,13 +922,18 @@ class ProgenParser(UpdateCallback):
|
||||
citation.set_page('%s' % page)
|
||||
|
||||
# process Note
|
||||
note = self.__create_note(note_text, NoteType.CUSTOM,
|
||||
_("Pro-Gen Import"))
|
||||
if note and note.handle:
|
||||
citation.add_note(note.handle)
|
||||
imp_citation_note = '' # Not yet used
|
||||
if imp_citation_note:
|
||||
note = self.__create_note(imp_citation_note, NoteType.CUSTOM,
|
||||
_("Pro-Gen Import"))
|
||||
if note and note.handle:
|
||||
citation.add_note(note.handle)
|
||||
|
||||
# process Attribute
|
||||
if attr_text:
|
||||
if self.option['imp_citation_attr']:
|
||||
sattr = SrcAttribute()
|
||||
sattr.set_type(_("Citation"))
|
||||
sattr.set_value(self.option['imp_citation_attr'])
|
||||
citation.add_attribute(sattr)
|
||||
|
||||
self.dbase.add_citation(citation, self.trans) # add & commit ...
|
||||
@ -1159,7 +1171,8 @@ class ProgenParser(UpdateCallback):
|
||||
for tagobj in TAGOBJECTS:
|
||||
tagname = 'tag_%s' % tagobj
|
||||
if self.option[tagname]:
|
||||
tagname = '%s %s' % (_(tagobj).capitalize(),
|
||||
# process tagname (substitute string directives)
|
||||
tagname = '%s %s' % (_(tagobj).capitalize(), \
|
||||
self.option[tagname])
|
||||
tag = self.dbase.get_tag_from_name(tagname)
|
||||
if not tag:
|
||||
@ -1262,9 +1275,7 @@ class ProgenParser(UpdateCallback):
|
||||
citation = self.__get_or_create_citation \
|
||||
(self.option['imp_source_title'],
|
||||
recflds[person_ix[2]], # F02: INDI CHAN DATE
|
||||
self.option['imp_citation_page'], pageref,
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
self.option['imp_citation_page'], pageref)
|
||||
if citation and citation.handle:
|
||||
person.add_citation(citation.handle)
|
||||
name.add_citation(citation.handle)
|
||||
@ -1420,9 +1431,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[person_ix[30]] # F30: ... SOUR TEXT
|
||||
info = recflds[person_ix[31]] # F31: INDI ... NOTE
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[person_ix[25]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[person_ix[25]], source_refn)
|
||||
|
||||
if birth_date or place or info or citation:
|
||||
desc = source_text
|
||||
@ -1450,9 +1459,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[person_ix[38]] # F38: ... SOUR TEXT
|
||||
info = recflds[person_ix[39]] # F39: ... NOTE
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[person_ix[32]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[person_ix[32]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
dummy, chris_ref = self.__create_event_and_ref \
|
||||
@ -1466,9 +1473,7 @@ class ProgenParser(UpdateCallback):
|
||||
citation = None
|
||||
if source != religion:
|
||||
citation = self.__get_or_create_citation \
|
||||
(religion, recflds[person_ix[32]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(religion, recflds[person_ix[32]], source_refn)
|
||||
dummy, reli_ref = self.__create_event_and_ref \
|
||||
(EventType.RELIGION, '', date, '', citation)
|
||||
if reli_ref:
|
||||
@ -1487,9 +1492,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[person_ix[45]] # F45: ... SOUR TEXT
|
||||
info = recflds[person_ix[46]] # F46: ... NOTE
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[person_ix[40]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[person_ix[40]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
desc = source_text
|
||||
@ -1529,9 +1532,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[person_ix[51]] # F51: ... SOUR TEXT
|
||||
info = recflds[person_ix[52]] # F52: ... INFO
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[person_ix[47]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[person_ix[47]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
dummy, cremation_ref = self.__create_event_and_ref \
|
||||
@ -1552,9 +1553,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[person_ix[57]] # F51: ... SOUR TEXT
|
||||
info = recflds[person_ix[58]] # F58: ... INFO
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[person_ix[53]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[person_ix[53]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
dummy, buri_ref = self.__create_event_and_ref \
|
||||
@ -1664,9 +1663,7 @@ class ProgenParser(UpdateCallback):
|
||||
citation = self.__get_or_create_citation \
|
||||
(self.option['imp_source_title'],
|
||||
recflds[family_ix[2]], # F02: FAM CHAN DATE
|
||||
self.option['imp_citation_page'], pageref,
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
self.option['imp_citation_page'], pageref)
|
||||
if citation and citation.handle:
|
||||
family.add_citation(citation.handle)
|
||||
|
||||
@ -1686,9 +1683,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[family_ix[12]] # F12: ... SOUR TEXT
|
||||
info = recflds[family_ix[13]] # F13: ... NOTE
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[family_ix[8]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[family_ix[8]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
evt_type = _('Civil union')
|
||||
@ -1722,9 +1717,7 @@ class ProgenParser(UpdateCallback):
|
||||
# F20: ... NOTE
|
||||
info = recflds[family_ix[20]]
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[family_ix[14]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[family_ix[14]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
desc = source_text
|
||||
@ -1754,9 +1747,7 @@ class ProgenParser(UpdateCallback):
|
||||
source_text = recflds[family_ix[26]]
|
||||
info = recflds[family_ix[27]] # F27: ... NOTE
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[family_ix[21]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[family_ix[21]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
desc = source_text
|
||||
@ -1794,9 +1785,7 @@ class ProgenParser(UpdateCallback):
|
||||
# F35 ... INFO
|
||||
info = recflds[family_ix[35]]
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[family_ix[28]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[family_ix[28]], source_refn)
|
||||
|
||||
if wedding_date or place or info or citation:
|
||||
desc = [_f for _f in [church, source_text] if _f]
|
||||
@ -1880,9 +1869,7 @@ class ProgenParser(UpdateCallback):
|
||||
# F41: ... INFO
|
||||
info = recflds[family_ix[41]]
|
||||
citation = self.__get_or_create_citation \
|
||||
(source, recflds[family_ix[36]], source_refn, '',
|
||||
self.option['imp_citation_conf'], '',
|
||||
self.option['imp_citation_attr'])
|
||||
(source, recflds[family_ix[36]], source_refn)
|
||||
|
||||
if date or place or info or citation:
|
||||
desc = source_text
|
||||
|
Loading…
Reference in New Issue
Block a user