2003-08-05 Tim Waugh <twaugh@redhat.com>

* 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.


svn: r1962
This commit is contained in:
Tim Waugh 2003-08-05 17:01:47 +00:00
parent b563b8ea77
commit a5ee260def
7 changed files with 28 additions and 9 deletions

View File

@ -1,3 +1,10 @@
2003-08-05 Tim Waugh <twaugh@redhat.com>
* 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 <shura@alex.neuro.umn.edu> 2003-08-04 Alex Roitman <shura@alex.neuro.umn.edu>
* src/plugins/GraphViz.py (make_doc_menu): Add paper option to the menu. * src/plugins/GraphViz.py (make_doc_menu): Add paper option to the menu.
* src/GenericFilter.py: Fixes for existing filters (ancestors and * src/GenericFilter.py: Fixes for existing filters (ancestors and

View File

@ -126,6 +126,10 @@ class DrawDoc:
self.style_list = styles.get_styles() self.style_list = styles.get_styles()
self.draw_styles = {} self.draw_styles = {}
self.name = "" self.name = ""
self.print_req = 0
def print_requested (self):
self.print_req = 1
def get_usable_width(self): def get_usable_width(self):
return self.width - (self.rmargin + self.lmargin) return self.width - (self.rmargin + self.lmargin)

View File

@ -1274,6 +1274,8 @@ class TextReportDialog(ReportDialog):
"""Create a document of the type requested by the user.""" """Create a document of the type requested by the user."""
self.doc = self.format(self.selected_style,self.paper, self.doc = self.format(self.selected_style,self.paper,
self.template_name,self.orien) self.template_name,self.orien)
if self.print_report.get_active ():
self.doc.print_requested ()
#------------------------------------------------------------------------ #------------------------------------------------------------------------
# #

View File

@ -979,6 +979,10 @@ class TextDoc:
self.cell_styles = {} self.cell_styles = {}
self.name = "" self.name = ""
self.photo_list = [] self.photo_list = []
self.print_req = 0
def print_requested (self):
self.print_req = 1
def set_owner(self,owner): def set_owner(self,owner):
""" """
@ -1056,9 +1060,6 @@ class TextDoc:
"Closes the document" "Closes the document"
pass pass
def print_report(self):
pass
def line_break(self): def line_break(self):
"Forces a line break within a paragraph" "Forces a line break within a paragraph"
pass pass

View File

@ -243,6 +243,9 @@ class OpenOfficeDoc(TextDoc.TextDoc):
self._write_manifest() self._write_manifest()
self._write_meta_file() self._write_meta_file()
self._write_zip() 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): def add_photo(self,name,pos,x_cm,y_cm):
@ -617,5 +620,10 @@ class OpenOfficeDoc(TextDoc.TextDoc):
self.f.write('</office:document-meta>\n') self.f.write('</office:document-meta>\n')
self.f.close() 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") Plugins.register_book_doc(_("OpenOffice.org Writer"),OpenOfficeDoc,1,1,1,".sxw")

View File

@ -124,9 +124,8 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f.write('%d\n' % self.page) self.f.write('%d\n' % self.page)
self.f.write('%%EOF\n') self.f.write('%%EOF\n')
self.f.close() self.f.close()
if self.print_req:
def print_report(self): run_print_dialog (self.filename)
return run_print_dialog (self.filename)
def start_paragraph(self,style_name): def start_paragraph(self,style_name):
pass pass

View File

@ -257,8 +257,6 @@ class AncestorChartDialog(Report.DrawReportDialog):
MyReport = AncestorChart(self.db, self.person, self.target_path, MyReport = AncestorChart(self.db, self.person, self.target_path,
self.max_gen, self.doc, self.report_text) self.max_gen, self.doc, self.report_text)
MyReport.write_report() MyReport.write_report()
if self.print_report.get_active ():
self.doc.print_report()
except Errors.ReportError, msg: except Errors.ReportError, msg:
(m1,m2) = msg.messages() (m1,m2) = msg.messages()
ErrorDialog(m1,m2) ErrorDialog(m1,m2)