def my_config_load_from_file(): try: file_ = file(CONFIG_FILE) except IOError: print "Config not found" return gnomeprint.config_default() return gnomeprint.config_from_string(file_.read(), 0)
def my_print(): job = gnomeprint.Job(gnomeprint.config_default()) gpc = job.get_context() my_draw(gpc) job.close() job.print_()
def my_new_doc(doc_name, gui): doc = MyDoc() doc.view = gui.get_widget(doc_name) doc.name = doc_name doc.config = gnomeprint.config_default() doc.view.connect("grab_focus", my_document_activate_cb, doc) return doc
def __init__(self, notify_hub, config): outputinfo.OutputProvider.__init__(self, notify_hub, config) self.printconfig = gnomeprint.config_default() self.printjob = gnomeprint.Job(self.printconfig) self.build_widget() self.processor = ScanJobFilePrinter(self, self.processor_input, notify_hub, 2)
def my_print(): job = gnomeprint.Job(gnomeprint.config_default()) gpc = job.get_context() my_set_names(job) my_dump_orientation(job) my_draw(gpc) job.close() job.print_()
def show_print_dialog(): job = gnomeprint.Job(gnomeprint.config_default()) dialog = gnomeprint.ui.Dialog(job, "Print...", gnomeprint.ui.DIALOG_RANGE| gnomeprint.ui.DIALOG_COPIES) flags = (gnomeprint.ui.RANGE_CURRENT |gnomeprint.ui.RANGE_ALL |gnomeprint.ui.RANGE_RANGE |gnomeprint.ui.RANGE_SELECTION) # FIXME: the current and range strings should be translated in a # "real" application dialog.construct_range_page(flags, 1, 1, "_Current", "_Range") dialog.connect('response', print_dialog_response, job) dialog.show() return dialog
def my_print(): # Create the objects job = gnomeprint.Job(gnomeprint.config_default()) dialog = gnomeprint.ui.Dialog(job, "Sample print dialog", 0) gpc = job.get_context() # Run the dialog response = dialog.run() if response == gnomeprint.ui.DIALOG_RESPONSE_CANCEL: print "Printing was canceled" return # Draw & print print "Printing ..." my_draw(gpc) job.close() job.print_()
def my_print(): # Create the objects */ job = gnomeprint.Job(gnomeprint.config_default()) dialog = gnomeprint.ui.Dialog(job, "Sample print dialog", 0) gpc = job.get_context() config = job.get_config() # Run the dialog */ response = dialog.run() if response != gnomeprint.ui.DIALOG_RESPONSE_PRINT: print "Printing was canceled" return # We don't print, we only dump the info my_draw(gpc) config.dump() job.close()
""" _idle_first = True def _idle_dlg(): global _idle_first if _idle_first: _d.iconify() _idle_first = False if time.time() < _ready: return True _d.emit("delete-event", gtk.gdk.Event(gtk.gdk.DELETE)) # give dthe dialog 8 seconds to collect printer information from Cups etc. _ready = time.time() + 8 _c = gnomeprint.config_default() _j = gnomeprint.Job(_c) _d = gnomeprint.ui.Dialog(_j, "please ignore this...") gobject.idle_add(_idle_dlg) _d.run() printerdlg = """ import sys, gnomeprint, gnomeprint.ui x = gnomeprint.config_default() j = gnomeprint.Job(x) cfg = sys.stdin.read() sys.stderr.write("--------- dlg read ------------\\\n%s\\\n" % cfg) cfg = gnomeprint.config_from_string(cfg, 0) sys.stderr.write("--------- dlg internal ---------\\\n")
def my_print(job, preview): file_ = file(TEMP_FILE, "w") config = job.get_config() width, height = gnomeprint.job_get_page_size_from_config(config) output = format % (width, height) file_.write(output) # this is marked with GNOME_PRINT_UNSTABLE_API in the public headers # OK. So this example becomes useless, I know. #job.set_file(TEMP_FILE) if not preview: job.print_() else: gnomeprint.ui.JobPreview(job, "Title goes here").show() job = gnomeprint.Job(gnomeprint.config_default()) dialog = gnomeprint.ui.Dialog(job, "Sample print dialog", 0) # Run the dialog response = dialog.run() dialog.destroy() if response == gnomeprint.ui.DIALOG_RESPONSE_PRINT: my_print(job, False) elif response == gnomeprint.ui.DIALOG_RESPONSE_PREVIEW: my_print(job, True)
file_ = file(TEMP_FILE, "w") config = job.get_config() width, height = gnomeprint.job_get_page_size_from_config(config) output = format % (width, height) file_.write(output) # this is marked with GNOME_PRINT_UNSTABLE_API in the public headers # OK. So this example becomes useless, I know. #job.set_file(TEMP_FILE) if not preview: job.print_() else: gnomeprint.ui.JobPreview(job, "Title goes here").show() job = gnomeprint.Job(gnomeprint.config_default()) dialog = gnomeprint.ui.Dialog(job, "Sample print dialog", 0) # Run the dialog response = dialog.run() dialog.destroy() if response == gnomeprint.ui.DIALOG_RESPONSE_PRINT: my_print(job, False) elif response == gnomeprint.ui.DIALOG_RESPONSE_PREVIEW: my_print(job, True)