本文整理汇总了Python中gramps.gen.lib.Citation.set_date_object方法的典型用法代码示例。如果您正苦于以下问题:Python Citation.set_date_object方法的具体用法?Python Citation.set_date_object怎么用?Python Citation.set_date_object使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gramps.gen.lib.Citation
的用法示例。
在下文中一共展示了Citation.set_date_object方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: CensusEditor
# 需要导入模块: from gramps.gen.lib import Citation [as 别名]
# 或者: from gramps.gen.lib.Citation import set_date_object [as 别名]
#.........这里部分代码省略.........
self.gallery_list = GalleryTab(self.dbstate,
self.uistate,
self.track,
self.citation.get_media_list())
self._add_tab(notebook, self.gallery_list)
vbox.pack_start(tab, expand=False, fill=True, padding=10)
vbox.pack_start(notebook, expand=True, fill=True, padding=0)
vbox.pack_end(button_box, expand=False, fill=True, padding=10)
root.add(vbox)
root.show_all()
notebook.set_current_page(0)
return root
def __populate_gui(self, event):
"""
Populate the GUI for a given census event.
"""
census_combo = self.widgets['census_combo']
for pos, row in enumerate(census_combo.get_model()):
if row[0] == self.citation.get_reference_handle():
census_combo.set_active(pos)
date_text = self.widgets['date_text']
date_text.set_text(get_date(event))
def __census_changed(self, combo):
"""
Called when the user selects a new census from the combo box.
"""
model = combo.get_model()
index = combo.get_active()
census_id = model[index][2]
# Set date
census_date = get_census_date(census_id)
date_text = self.widgets['date_text']
date_text.set_text(displayer.display(census_date))
self.event.set_date_object(census_date)
self.citation.set_date_object(census_date)
# Set source
self.citation.set_reference_handle(model[index][0])
# Set new columns
columns = get_census_columns(census_id)
report_columns = get_report_columns(census_id)
self.details.create_table(columns, report_columns)
heading_list = get_census_headings(census_id)
self.headings.create_table(heading_list)
def save(self, button):
"""
Called when the user clicks the OK button.
"""
if self.widgets['census_combo'].get_active() == -1:
ErrorDialog(_('Census Editor'),
_('Cannot save this census. First select '
'a census from the drop-down list.'))
return
with DbTxn(self.get_menu_title(), self.db) as trans:
if not self.event.get_handle():
self.db.add_event(self.event, trans)
self.headings.save()
self.details.save(trans)
citation_handle = self.citation.get_handle()
if not citation_handle:
citation_handle = self.db.add_citation(self.citation, trans)
self.event.add_citation(citation_handle)
else:
self.db.commit_citation(self.citation, trans)
self.db.commit_event(self.event, trans)
self.close()
def close(self, *args):
"""
Close the editor window.
"""
(width, height) = self.window.get_size()
self._config.set('interface.census-width', width)
self._config.set('interface.census-height', height)
self._config.save()
self.details.entry_grid.clean_up()
self.details.clean_up()
self.gallery_list.clean_up()
ManagedWindow.close(self)
def help_clicked(self, obj):
"""
Display the relevant portion of GRAMPS manual
"""
display_help(webpage='Census_Addons')