From 09e86586db1ffa57bd089d9b58b5cda3fe999f72 Mon Sep 17 00:00:00 2001 From: Doug Blank Date: Sat, 22 Dec 2007 01:23:52 +0000 Subject: [PATCH] 2007-12-21 Douglas S. Blank * src/plugins/lineage.py: moved to new quick view format * src/docgen/TextBufDoc.py: fixed transient window issue svn: r9558 --- ChangeLog | 4 ++++ src/docgen/TextBufDoc.py | 33 +++++++++++++++++++++++---------- src/plugins/lineage.py | 33 ++++++++++++++------------------- 3 files changed, 41 insertions(+), 29 deletions(-) diff --git a/ChangeLog b/ChangeLog index 076636d25..c03626fd4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2007-12-21 Douglas S. Blank + * src/plugins/lineage.py: moved to new quick view format + * src/docgen/TextBufDoc.py: fixed transient window issue + 2007-12-21 Gary Burton * src/Editors/_EditEventRef.py: swap around delete/share buttons, bug #1477 diff --git a/src/docgen/TextBufDoc.py b/src/docgen/TextBufDoc.py index e540c2585..c4de86869 100644 --- a/src/docgen/TextBufDoc.py +++ b/src/docgen/TextBufDoc.py @@ -40,6 +40,7 @@ from PluginUtils import register_text_doc import const import Errors import Utils +import ManagedWindow try: import pangocairo @@ -59,18 +60,30 @@ def pixels(cm): LEFT,RIGHT,CENTER = 'LEFT','RIGHT','CENTER' _WIDTH_IN_CHARS = 72 - -class DisplayBuf: - # FIXME: make a managed window now that we have uistate +class DisplayBuf(ManagedWindow.ManagedWindow): def __init__(self, title, document): - g = gtk.glade.XML(const.GLADE_FILE,'scrollmsg') - self.top = g.get_widget('scrollmsg') - document.text_view = g.get_widget('msg') + self.title = title + ManagedWindow.ManagedWindow.__init__(self, document.uistate, [], + document) + self.set_window(gtk.Dialog("",document.uistate.window, + gtk.DIALOG_DESTROY_WITH_PARENT, + (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)), + None, title) + self.window.set_size_request(600,400) + scrolled_window = gtk.ScrolledWindow() + scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) + document.text_view = gtk.TextView() document.text_view.set_buffer(document.buffer) - g.get_widget('close').connect('clicked', self.close) + self.window.connect('response', self.close) + scrolled_window.add(document.text_view) + self.window.vbox.add(scrolled_window) + self.window.show_all() - def close(self, obj): - self.top.destroy() + def build_menu_names(self, obj): + return ('View', 'Quick View') + + def get_title(self): + return self.title #------------------------------------------------------------------------ # @@ -138,7 +151,7 @@ class TextBufDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc): self.tag_table.add(tag) self.buffer = gtk.TextBuffer(self.tag_table) - DisplayBuf('',self) + DisplayBuf('Quick View',self) return #-------------------------------------------------------------------- diff --git a/src/plugins/lineage.py b/src/plugins/lineage.py index c31b28c94..2f1282b58 100644 --- a/src/plugins/lineage.py +++ b/src/plugins/lineage.py @@ -32,7 +32,7 @@ Display a person's father or mother lineage #------------------------------------------------------------------------- import gen.lib -from Simple import SimpleAccess, SimpleDoc +from Simple import SimpleAccess, SimpleDoc, SimpleTable from gettext import gettext as _ from PluginUtils import register_quick_report from ReportBase import CATEGORY_QR_PERSON @@ -57,13 +57,10 @@ def run_father(database, document, person): " People in this lineage all share the same Y-chromosone." )) sd.paragraph("") - - sd.header2(__FMT %(_("Name Father"), _("Birth Date"), _("Death Date"))) - sd.paragraph("") - - make_details(gen.lib.Person.MALE, person, sa, sd, database) - - sd.paragraph("") + stab = SimpleTable(sa, sd) + stab.columns(_("Name Father"), _("Birth Date"), _("Death Date"), _("Remark")) + make_details(gen.lib.Person.MALE, person, sa, sd, database, stab) + stab.write() sd.paragraph("") if person.gender == gen.lib.Person.FEMALE : @@ -91,12 +88,10 @@ def run_mother(database, document, person): )) sd.paragraph("") - sd.header2(__FMT %(_("Name Mother"), _("Birth"), _("Death Date"))) - sd.paragraph("") - - make_details(gen.lib.Person.FEMALE, person, sa, sd, database) - - sd.paragraph("") + stab = SimpleTable(sa, sd) + stab.columns(_("Name Mother"), _("Birth"), _("Death Date"), _("Remark")) + make_details(gen.lib.Person.FEMALE, person, sa, sd, database, stab) + stab.write() sd.paragraph("") if person.gender == gen.lib.Person.MALE : @@ -107,7 +102,7 @@ def run_mother(database, document, person): make_details_child(gen.lib.Person.FEMALE, person, sa, sd, database) -def make_details(gender, person, sa, sd, database) : +def make_details(gender, person, sa, sd, database, stab) : """ Function writing one line of ancestry on the document in direct lineage """ @@ -118,10 +113,10 @@ def make_details(gender, person, sa, sd, database) : rem_str = "" while person: person_handle = person.handle - sd.paragraph(__FMT % (sa.name(person), sa.birth_date(person), - sa.death_date(person))) - if rem_str: - sd.paragraph(__FMT_REM % (_("Remark"), rem_str)) + stab.row(person, sa.birth_date(person), + sa.death_date(person), rem_str) + #if rem_str: + # sd.paragraph(__FMT_REM % (_("Remark"), rem_str)) personsprinted += 1 if personsprinted > __MAX_GEN :