gtk.PrintSettings — Stores print settings (new in PyGTK 2.10)
class gtk.PrintSettings( |
Functions
def gtk.print_settings_new_from_file(file_name
)
A gtk.PrintSettings
object represents the settings of a print dialog in a system-independent
way. The main use for this object is that once you've printed you can
get a settings object that represents the settings the user chose, and
the next time you print you can pass that object in so that the user
doesn't have to re-set all his settings.
Its also possible to enumerate the settings so that you can easily save the settings for the next time your app runs, or even store them in a document. The predefined keys try to use shared values as much as possible so that moving such a document between systems still works.
Printing support was added in GTK+ 2.10.
gtk.PrintSettings()
Returns : | a new gtk.PrintSettings
object |
This constructor is available in PyGTK 2.10 and above.
Creates a new gtk.PrintSettings
object.
def copy()
Returns : | a newly allocated copy of the print settings |
This method is available in PyGTK 2.10 and above.
Returns a copy of this gtk.PrintSettings
object.
def has_key(key
)
| a key |
Returns : | True , if
key has a value |
This method is available in PyGTK 2.10 and above.
Returns True
, if a value is associated with
key
.
def get(key
)
| a key |
Returns : | the string value for
key |
This method is available in PyGTK 2.10 and above.
Looks up the string value associated with
key
.
def set(key
, value
)
| a key |
| a string value, or
None |
This method is available in PyGTK 2.10 and above.
Associates value
with
key
.
def unset(key
)
| a key |
This method is available in PyGTK 2.10 and above.
Removes any value associated with key
.
This has the same effect as setting the value to
None
.
def foreach(func
, user_data
=None)
| the function to call |
| user data for
func |
This method is available in PyGTK 2.10 and above.
Calls func
for each key-value pair.
The signature of func
is:
def func(key, value, data):
where key
and
value
are the key-value pair and
data
is
user_data
.
def get_bool(key
)
| a key |
Returns : | True , if
key maps to a true
value. |
This method is available in PyGTK 2.10 and above.
Returns the boolean represented by the value that is associated
with key
.
def set_bool(key
, value
)
| a key |
| a boolean |
This method is available in PyGTK 2.10 and above.
Sets key
to the boolean value specified
by value
..
def get_double(key
)
| a key |
Returns : | the double value of
key |
This method is available in PyGTK 2.10 and above.
Returns the double value associated with
key
, or 0.
def get_double_with_default(key
, def
)
| a key |
| the default value |
Returns : | the floating point number associated with
key |
This method is available in PyGTK 2.10 and above.
Returns the floating point number represented by the value that
is associated with key
, or
def
if the value does not represent a floating
point number.
def set_double(key
, value
)
| a key |
| a double value |
This method is available in PyGTK 2.10 and above.
Sets key
to the given double
value.
def get_length(key
, unit
)
| a key |
| the unit of the return value |
Returns : | the length value of key ,
converted to unit |
This method is available in PyGTK 2.10 and above.
Returns the value associated with key
,
interpreted as a length. The returned value is converted to the units
specified by unit
.
def set_length(key
, value
, unit
)
| a key |
| a length |
| the unit of
length |
This method is available in PyGTK 2.10 and above.
Associates a length in units of unit
with
key
.
def get_int(key
)
| a key |
Returns : | the integer value of
key |
This method is available in PyGTK 2.10 and above.
Returns the integer value of key
, or
0.
def get_int_with_default(key
, def
)
| a key |
| the default value |
Returns : | the integer value of
key |
This method is available in PyGTK 2.10 and above.
Returns the value of key
, interpreted as
an integer, or the default value specified by
def
.
def set_int(key
, value
)
| a key |
| an integer |
This method is available in PyGTK 2.10 and above.
Sets key
to the given integer
value.
def get_printer()
Returns : | the printer name |
This method is available in PyGTK 2.10 and above.
Convenience method to obtain the value of the "printer" key.
def set_printer(printer
)
| the printer name |
This method is available in PyGTK 2.10 and above.
Convenience function to set the "printer" key the value
specified by printer
.
def get_orientation()
Returns : | the orientation |
This method is available in PyGTK 2.10 and above.
Get the value of the "orientation" key, converted to one of the GTK Page Orientation Constants.
def set_orientation(orientation
)
| a page orientation |
This method is available in PyGTK 2.10 and above.
Sets the value of the "orientation" key to one of the GTK Page Orientation Constants specified by
orientation
.
def get_paper_size()
Returns : | the paper size |
This method is available in PyGTK 2.10 and above.
Gets the value of the "paper-format" key, converted to a gtk.PaperSize
.
def set_paper_size(paper_size
)
| a paper size |
This method is available in PyGTK 2.10 and above.
Sets the value of the "paper-format", "paper-width" and
"paper-height" keys using the gtk.PaperSize
specified by paper_size
.
def get_paper_width(unit
)
| the unit for the return value |
Returns : | the paper width, in units of
unit |
This method is available in PyGTK 2.10 and above.
Retuens the value of the "printer-width" key converted to the
units specified by unit
.
def set_paper_width(width
, unit
)
| the paper width |
| the units of width |
This method is available in PyGTK 2.10 and above.
Sets the value of the "printer-width" key using the units
specified by unit
.
def get_paper_height(unit
)
| the units for the return value |
Returns : | the paper height, in units of
unit |
This method is available in PyGTK 2.10 and above.
Gets the value of the "paper-height" key converted to the units
specified by unit
.
def set_paper_height(height
, unit
)
| the paper height |
| the units of
height |
This method is available in PyGTK 2.10 and above.
Sets the value of the "paper-height" key using the units
specified by unit
.
def get_use_color()
Returns : | whether to use color |
This method is available in PyGTK 2.10 and above.
Returns the value of the "use-color" key. If
True
color will be used when printing.
def set_use_color(use_color
)
| if True use
color |
This method is available in PyGTK 2.10 and above.
Sets the value of the "use-color" key to the value specified by
use_color
. If use_color
is True
color will be used when printing.
def get_collate()
Returns : | True if the printed pages
are to be collated |
This method is available in PyGTK 2.10 and above.
Returns the value of the "collate" key.
def set_collate(collate
)
| if True , collate the
output |
This method is available in PyGTK 2.10 and above.
Sets the value of the "collate" key. If
collate
is True
the output
pages will be collated.
def get_reverse()
Returns : | True if the order of the
printed pages shoudl be reversed. |
This method is available in PyGTK 2.10 and above.
Returns the value of the "reverse" key.
def set_reverse(reverse
)
| if True reverse the
output |
This method is available in PyGTK 2.10 and above.
Sets the value of the "reverse" key. If
reverse
is True
the output
pages willl be reversed.
def get_duplex()
Returns : | the "duplex" key. |
This method is available in PyGTK 2.10 and above.
Returns the value of the "duplex" key - one of the GTK Print Duplex Constants.
def set_duplex(duplex
)
| one of the GTK Print Duplex Constants |
This method is available in PyGTK 2.10 and above.
Sets the value of the "duplex"
key. duplexp
must be one of the GTK Print Duplex Constants
def get_quality()
Returns : | the print quality |
This method is available in PyGTK 2.10 and above.
Returns the value of the "quality" key.
def set_quality(quality
)
| one of the GTK Print Quality Constants |
This method is available in PyGTK 2.10 and above.
Sets the value of the "quality"
key. quality
must be one of the GTK Print Quality Constants.
def get_n_copies()
Returns : | the number of copies to print |
This method is available in PyGTK 2.10 and above.
Returns the value of the "n-copies" key.
def set_n_copies(num_copies
)
| the number of copies |
This method is available in PyGTK 2.10 and above.
Sets the value of the "n-copies" key to the value specified by
num_copies
.
def get_number_up()
Returns : | the number of pages per sheet |
This method is available in PyGTK 2.10 and above.
Returns the value of the "number-up" key which specifies the number of pages per sheet.
def set_number_up(number_up
)
| the number of pages per sheet |
This method is available in PyGTK 2.10 and above.
Sets the value of the "number-up"
key. number_up
specifies the number of document
pages to be printed per sheet.
def get_resolution()
Returns : | the resolution in dpi |
This method is available in PyGTK 2.10 and above.
Returns the value of the "resolution" key in dpi.
def set_resolution(resolution
)
| the resolution in dpi |
This method is available in PyGTK 2.10 and above.
Sets the value of the "resolution" key in dpi.
def get_scale()
Returns : | the scale in percent |
This method is available in PyGTK 2.10 and above.
Returns the value of the "scale" key as a float number.
def set_scale(scale
)
| the scale in percent |
This method is available in PyGTK 2.10 and above.
Sets the value of the "scale" key using the float number
specified by scale
.
def get_print_pages()
Returns : | which pages to print |
This method is available in PyGTK 2.10 and above.
Returns the value of the "print-pages" key as one if the GTK Print Pages Constants.
def set_print_pages(pages
)
| one if the GTK Print Pages Constants |
This method is available in PyGTK 2.10 and above.
Sets the value of the "print-pages" key to one of the GTK Print Pages Constants.
def get_page_ranges()
Returns : | a list of [age ranges as 2-tuples |
This method is available in PyGTK 2.10 and above.
Returns the value of the "page-ranges" key as a list of 2-tuples containing the start and end page numbers of each range.
def set_page_ranges(page_ranges
, num_ranges
)
| a sequence of page range 2-tuples |
This method is available in PyGTK 2.10 and above.
Sets the value of the "page-ranges" key to the value of
page_ranges
which should be a sequence of
2-tuples containing the start and end page numbers of each page
range.
def get_page_set()
Returns : | the set of pages to print |
This method is available in PyGTK 2.10 and above.
Returns the value of the "page-set" key which is one of the GTK Page Set Constants.
def set_page_set(page_set
)
| one of the GTK Page Set Constants |
This method is available in PyGTK 2.10 and above.
Sets the value of the "page-set" key to the value specified by
page_set
which should be one of the GTK Page Set Constants.
def get_default_source()
Returns : | the default source |
This method is available in PyGTK 2.10 and above.
Returns the value of the "default-source" key.
def set_default_source(default_source
)
| the default source |
This method is available in PyGTK 2.10 and above.
Sets the value of the "default-source" key to the string
specified by default_source
.
def get_media_type()
Returns : | the media type |
This method is available in PyGTK 2.10 and above.
Returns the value of the "media-type" key.
The set of media types is defined in PWG 5101.1-2002 PWG.
def set_media_type(media_type
)
| the media type |
This method is available in PyGTK 2.10 and above.
Sets the value of the "media-type" key.
The set of media types is defined in PWG 5101.1-2002 PWG.
def get_dither()
Returns : | the dithering that is used |
This method is available in PyGTK 2.10 and above.
Returns the value of the "dither" key.
def set_dither(dither
)
| the dithering that is used |
This method is available in PyGTK 2.10 and above.
Sets the value of the "dither" key to the string specified by
dither
.
def get_finishings()
Returns : | the finishings |
This method is available in PyGTK 2.10 and above.
Returns the value of the "finishings" key.
def set_finishings(finishings
)
| the finishings |
This method is available in PyGTK 2.10 and above.
Sets the value of the "finishings" key to the string specified
by finishings
.
def get_output_bin()
Returns : | the output bin |
This method is available in PyGTK 2.10 and above.
Returns the value of the "output-bin" key.
def set_output_bin(output_bin
)
| the output bin |
This method is available in PyGTK 2.10 and above.
Sets the value of the "output-bin" key to the value specified by
output_bin
.
def to_file(file_name
)
| the file to save to. |
Returns : | True on sucess. |
This method is available in PyGTK 2.12 and above.
This function saves the print settings from settings to file_name
.
def get_number_up_layout()
Returns : | layout of page in number-up mode. |
This method is available in PyGTK 2.16 and above.
def set_number_up_layout(number_up_layout
)
| a
GtkNumberUpLayout
constant value. |
This method is available in PyGTK 2.16 and above.
Sets the value of GtkNumberUpLayout.
def load_file(file_name
)
| the filename to read the settings from. |
Returns : | True on success. |
This method is available in PyGTK 2.16 and above.
Reads the print settings from file_name. See
gtk.PrintSettings.to_file
.
def get_resolution_x()
Returns : | the horizontal resolution in dpi. |
This method is available in PyGTK 2.16 and above.
The get_resolution_x
() method gets the value of
gtk.PRINT_SETTINGS_RESOLUTION_X
.
def get_resolution_y()
Returns : | the vertical resolution in dpi. |
This method is available in PyGTK 2.16 and above.
The get_resolution_y
() method gets the value of
gtk.PRINT_SETTINGS_RESOLUTION_Y
.
def set_resolution_xy(resolution_x
, resolution_y
)
| the horizontal resolution in dpi. |
| the vertical resolution in dpi. |
This method is available in PyGTK 2.16 and above.
The set_resolution_xy
() method sets the values of
gtk.PRINT_SETTINGS_RESOLUTION
, gtk.PRINT_SETTINGS_RESOLUTION_X
and gtk.PRINT_SETTINGS_RESOLUTION_Y
.
def gtk.print_settings_new_from_file(file_name
)
| the filename to read the settings from. |
Returns : | the restored
gtk.PrintSettings
|
This function is available in PyGTK 2.12 and above.
Reads the print settings from filename. Returns a new
gtk.PrintSettings
object with the restored settings, or None
if an error occurred. See
gtk.PrintSettings.to_file
().