2003-07-28 Tim Waugh <twaugh@redhat.com>

* src/Report.py, src/TextDoc.py, src/DrawDoc.py: More support for
        making printable output formats.
        * src/docgen/PSDrawDoc.py, src/docgen/PdfDrawDoc.py: Make these
        output formats printable.


svn: r1936
This commit is contained in:
Tim Waugh
2003-07-28 17:20:18 +00:00
parent 2edc3770aa
commit 3cdc0261ef
6 changed files with 45 additions and 18 deletions

View File

@@ -79,6 +79,28 @@ _template_map = {
_user_template : None
}
#-------------------------------------------------------------------------
#
# Support for printing generated files
#
#-------------------------------------------------------------------------
def get_print_dialog_app ():
"""Return the name of a program which sends stdin (or the program's
arguments) to the printer."""
for printdialog in ["/usr/bin/kprinter --stdin",
"/usr/share/printconf/util/print.py"]:
if os.access (printdialog.split (' ')[0], os.X_OK):
return printdialog
return "lpr"
def run_print_dialog (filename):
"""Send file to the printer, possibly throwing up a dialog to
ask which one etc."""
os.environ["FILE"] = filename
return os.system ('cat "$FILE" | %s &' % get_print_dialog_app ())
#-------------------------------------------------------------------------
#
# Report
@@ -765,23 +787,6 @@ class ReportDialog(BareReportDialog):
def setup_center_person(self): pass
def get_print_dialog_app (self):
"""Return the name of a program which sends stdin (or the program's
arguments) to the printer."""
for printdialog in ["/usr/bin/kprinter",
"/usr/share/printconf/util/print.py"]:
if os.access (printdialog, os.X_OK):
return printdialog
break
return "lpr"
def run_print_dialog (self, filename):
"""Send file to the printer, possibly throwing up a dialog to
ask which one etc."""
args = [self.get_print_dialog_app (), filename]
os.spawnvp (os.P_NOWAIT, args[0], args)
#------------------------------------------------------------------------
#
# Customization hooks for subclasses