diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index b6231ae7b..28077c22b 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2003-08-05 Tim Waugh + * src/Report.py, src/TextDoc.py, src/DrawDoc.py: Adjusted the way + that 'Print Report' is handled. + * src/docgen/OpenOfficeDoc.py, src/docgen/PSDrawDoc.py: Likewise. + * src/plugins/AncestorChart.py: Undo previous change to do with + printing reports. + 2003-08-04 Alex Roitman * src/plugins/GraphViz.py (make_doc_menu): Add paper option to the menu. * src/GenericFilter.py: Fixes for existing filters (ancestors and diff --git a/gramps2/src/DrawDoc.py b/gramps2/src/DrawDoc.py index f5748fed2..1fcb87f0f 100644 --- a/gramps2/src/DrawDoc.py +++ b/gramps2/src/DrawDoc.py @@ -126,6 +126,10 @@ class DrawDoc: self.style_list = styles.get_styles() self.draw_styles = {} self.name = "" + self.print_req = 0 + + def print_requested (self): + self.print_req = 1 def get_usable_width(self): return self.width - (self.rmargin + self.lmargin) diff --git a/gramps2/src/Report.py b/gramps2/src/Report.py index cebbcfb49..a035109a2 100644 --- a/gramps2/src/Report.py +++ b/gramps2/src/Report.py @@ -1274,6 +1274,8 @@ class TextReportDialog(ReportDialog): """Create a document of the type requested by the user.""" self.doc = self.format(self.selected_style,self.paper, self.template_name,self.orien) + if self.print_report.get_active (): + self.doc.print_requested () #------------------------------------------------------------------------ # diff --git a/gramps2/src/TextDoc.py b/gramps2/src/TextDoc.py index 13a64c41f..d23df9c3e 100644 --- a/gramps2/src/TextDoc.py +++ b/gramps2/src/TextDoc.py @@ -979,6 +979,10 @@ class TextDoc: self.cell_styles = {} self.name = "" self.photo_list = [] + self.print_req = 0 + + def print_requested (self): + self.print_req = 1 def set_owner(self,owner): """ @@ -1056,9 +1060,6 @@ class TextDoc: "Closes the document" pass - def print_report(self): - pass - def line_break(self): "Forces a line break within a paragraph" pass diff --git a/gramps2/src/docgen/OpenOfficeDoc.py b/gramps2/src/docgen/OpenOfficeDoc.py index 09b8baff2..8e106f102 100644 --- a/gramps2/src/docgen/OpenOfficeDoc.py +++ b/gramps2/src/docgen/OpenOfficeDoc.py @@ -243,6 +243,9 @@ class OpenOfficeDoc(TextDoc.TextDoc): self._write_manifest() self._write_meta_file() self._write_zip() + if self.print_req: + os.environ["FILE"] = self.filename + os.system ('/usr/bin/oowriter "$FILE" &') def add_photo(self,name,pos,x_cm,y_cm): @@ -617,5 +620,10 @@ class OpenOfficeDoc(TextDoc.TextDoc): self.f.write('\n') self.f.close() -Plugins.register_text_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw") +print_label = None +if os.access ("/usr/bin/oowriter", os.X_OK): + print_label = _("Open in OpenOffice.org") + +Plugins.register_text_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1, + ".sxw",print_label) Plugins.register_book_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw") diff --git a/gramps2/src/docgen/PSDrawDoc.py b/gramps2/src/docgen/PSDrawDoc.py index 9547d7950..e5e544615 100644 --- a/gramps2/src/docgen/PSDrawDoc.py +++ b/gramps2/src/docgen/PSDrawDoc.py @@ -124,9 +124,8 @@ class PSDrawDoc(DrawDoc.DrawDoc): self.f.write('%d\n' % self.page) self.f.write('%%EOF\n') self.f.close() - - def print_report(self): - return run_print_dialog (self.filename) + if self.print_req: + run_print_dialog (self.filename) def start_paragraph(self,style_name): pass diff --git a/gramps2/src/plugins/AncestorChart.py b/gramps2/src/plugins/AncestorChart.py index b4afc78e3..25022406a 100644 --- a/gramps2/src/plugins/AncestorChart.py +++ b/gramps2/src/plugins/AncestorChart.py @@ -257,8 +257,6 @@ class AncestorChartDialog(Report.DrawReportDialog): MyReport = AncestorChart(self.db, self.person, self.target_path, self.max_gen, self.doc, self.report_text) MyReport.write_report() - if self.print_report.get_active (): - self.doc.print_report() except Errors.ReportError, msg: (m1,m2) = msg.messages() ErrorDialog(m1,m2)