예제 #1
0
def my_print():
    job = gnomeprint.Job(gnomeprint.config_default())
    gpc = job.get_context()

    my_draw(gpc)

    job.close()
    job.print_()
예제 #2
0
def show_preview(dialog):
    job = gnomeprint.Job(dialog.get_config())
    render_to_job(job)
    w = gnomeprint.ui.JobPreview(job, "Print Preview")
    w.set_property('allow-grow', 1)
    w.set_property('allow-shrink', 1)
    w.set_transient_for(dialog)
    w.show_all()
예제 #3
0
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_()
예제 #4
0
def my_print():
    config = my_config_load_from_file()
    job = gnomeprint.Job(config)
    dialog = gnomeprint.ui.Dialog(job, "Example 09 print dialog", 0)
    response = dialog.run()
    if response == gnomeprint.ui.DIALOG_RESPONSE_CANCEL:
        print "Printing was canceled, config not saved"
        return

    print "Config saved to \"%s\"" % CONFIG_FILE
    my_config_save_to_file(config)
예제 #5
0
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
예제 #6
0
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_()
예제 #7
0
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()
예제 #8
0
def my_print_cb(widget):
    # Create the objects
    job = gnomeprint.Job(app.active_doc.config)
    dialog = gnomeprint.ui.Dialog(
        job, "Sample print dialog",
        gnomeprint.ui.DIALOG_RANGE | gnomeprint.ui.DIALOG_COPIES)
    dialog.construct_range_page(
        gnomeprint.ui.RANGE_ALL | gnomeprint.ui.RANGE_SELECTION, 1, 2, "A",
        "Lines")

    response = dialog.run()

    if response == gnomeprint.ui.DIALOG_RESPONSE_PRINT:
        my_print(job, False)

    elif response == gnomeprint.ui.DIALOG_RESPONSE_PREVIEW:
        my_print(job, True)
예제 #9
0
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)
예제 #10
0
def my_print_preview_cb(widget):
    job = gnomeprint.Job(app.active_doc.config)
    my_print(job, True)