Hi Derek, I'm forwarding this bug to you from the Debian BTS. Please let us know what you think, and keep the CC to 548327-forwar...@bugs.debian.org in your reply. You can also view it at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=548327.
Package: xword Version: 1.0-4 Severity: wishlist xword's printed output is very nice, so it's useful to have a command-line option to generate a postscript file from .puz input. This means, for example, you can have a cron job that: - downloads a crossword - uses xword to generate a printable version - prints out the crossword so it's ready when you wake up :) I've attached a patch to do this, but it's a patch on top of my previous patch from bug #539756, since it needs the OptionParser change. many thanks, mark -- System Information: Debian Release: lenny/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') Architecture: i386 (i686) Kernel: Linux 2.6.26-1-486 Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8) (ignored: LC_ALL set to en_GB.UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages xword depends on: ii python 2.5.2-1 An interactive high-level object-o ii python-gtk2 2.14.1-3 Python bindings for the GTK+ widge xword recommends no packages. -- debconf-show failed
--- xword 2009-09-25 14:22:04.000000000 +0100 +++ xword-print-option 2009-09-25 14:25:33.000000000 +0100 @@ -37,12 +37,16 @@ import gtk.gdk import gobject +has_print = False +has_print_ui = False + try: import gnomeprint - import gnomeprint.ui has_print = True + import gnomeprint.ui + has_print_ui = True except: - has_print = False + pass import pango import sys @@ -742,6 +746,15 @@ dialog.set_transient_for(win) dialog.show() + def print_puzzle_to_file(self,postscript_file): + config = gnomeprint.config_default() + job = gnomeprint.Job(config) + job.print_to_file(postscript_file) + self.gpc = job.get_context() + self.draw(config) + job.close() + job.print_() + class PuzzleWidget: def __init__(self, puzzle, control): self.puzzle = puzzle @@ -1784,7 +1797,7 @@ dlg.destroy() def print_puzzle(self): - if has_print: + if has_print_ui: pr = PuzzlePrinter(self.puzzle) pr.print_puzzle(self.win) else: @@ -1824,14 +1837,25 @@ parser = OptionParser(usage="Usage: %prog [OPTIONS] [PUZZLE-FILENAME]") parser.add_option('-u', '--utf8', dest="utf8", action="store_true", default=False, help="Try UTF-8 decoding of clues first.") + parser.add_option('-p', dest="postscript_file", + help="Output a postscript version of the crossword") options,args = parser.parse_args() try_utf_8_first = options.utf8 if len(args) == 0: p = None + if options.postscript_file: + print "Warning: ignoring the -p parameter" elif len(args) == 1: p = Puzzle(args[0]) + if options.postscript_file: + if not has_print: + print "The Python wrapper for gnomeprint must be installed in order to output to postscript" + sys.exit(2) + pp = PuzzlePrinter(p) + pp.print_puzzle_to_file(options.postscript_file) + sys.exit(0) else: parser.print_help() sys.exit(1)
Thanks, -- -John Sullivan -http://wjsullivan.net -GPG Key: AE8600B6