gtk.PageSetup — an object that stores page setup information (new in PyGTK 2.10)
class gtk.PageSetup( |
Functionsdef gtk.print_run_page_setup_dialog(
parent
,page_setup
,settings
)def gtk.page_setup_new_from_file(
file_name
)
This class is available in PyGTK 2.10 and above.
A gtk.PageSetup
object stores the page size, orientation and margins. The idea is that
you can get one of these from the page setup dialog and then pass it to
the gtk.PrintOperation
when printing. The benefit of splitting this out of the gtk.PrintSettings
is that these affect the actual layout of the page, and thus need to be
set long before user prints.
The margins specified in this object are the "print margins", i.e. the parts of the page that the printer cannot print on. These are different from the layout margins that a word processor uses; they are typically used to determine the minimal size for the layout margins.
To obtain a gtk.PageSetup
use the gtk.PageSetup() constructor
to get the defaults, or use the gtk.print_run_page_setup_dialog
()
function to show the page setup dialog and receive the resulting page
setup. An example page setup function is:
def do_page_setup(): if settings == None: settings = gtk.PrintSettings() page_setup = gtk.print_run_page_setup_dialog(main_window, page_setup, settings)
gtk.PageSetup()
Returns : | a new gtk.PageSetup . |
This constructor is available in PyGTK 2.10 and above.
Creates a new gtk.PageSetup
.
def copy()
Returns : | a copy of this page setup |
This method is available in PyGTK 2.10 and above.
The copy
() method copies this gtk.PageSetup
.
def get_orientation()
Returns : | the page orientation |
This method is available in PyGTK 2.10 and above.
The get_orientation
() method returns
the page orientation of the gtk.PageSetup
. The
return value must be one of the GTK Page Orientation Constants.
def set_orientation(orientation
)
| one of the GTK Page Orientation Constants |
This method is available in PyGTK 2.10 and above.
The set_orientation
() method sets the
page orientation of the gtk.PageSetup
to the value specified by orientation
. The
value of orientation
must be one of the GTK Page Orientation Constants
def get_paper_size()
Returns : | the paper size |
This method is available in PyGTK 2.10 and above.
The get_paper_size
() method gets the
paper size of the gtk.PageSetup
.
def set_paper_size(size
)
| a gtk.PaperSize |
This method is available in PyGTK 2.10 and above.
The set_paper_size
() method sets the
paper size of the page setup without changing the margins. See the
set_paper_size_and_default_margins
()
method.
def get_top_margin(unit
)
| the unit for the return value - one of the GTK Unit Constants |
Returns : | the top margin |
This method is available in PyGTK 2.10 and above.
The get_top_margin
() method returns the
top margin in units of unit
.
def set_top_margin(margin
, unit
)
| the new top margin in units of
unit |
| the units for margin -
one of the GTK Unit Constants |
This method is available in PyGTK 2.10 and above.
The set_top_margin
() method sets the
top margin of the page setup to the value specified by
margin
in the units specified by
unit
.
def get_bottom_margin(unit
)
| the unit for the return value |
Returns : | the bottom margin |
This method is available in PyGTK 2.10 and above.
The get_bottom_margin
() method gets the
bottom margin in units of unit
.
def set_bottom_margin(margin
, unit
)
| the new bottom margin in units of
unit |
| the units for margin -
one of the GTK Unit Constants |
This method is available in PyGTK 2.10 and above.
The set_bottom_margin
() method sets the
bottom margin of the page setup to the value specified by
margin
using the units specified by
unit
.
def get_left_margin(unit
)
| the unit for the return value |
Returns : | the left margin |
This method is available in PyGTK 2.10 and above.
The get_left_margin
() method gets the
left margin in units of unit
.
def set_left_margin(margin
, unit
)
| the new left margin in units of
unit |
| the units for margin -
one of the GTK Unit Constants |
This method is available in PyGTK 2.10 and above.
The set_left_margin
() method sets the
left margin of the page setup to the value specified by
margin
using the units specified by
unit
.
def get_right_margin(unit
)
| the unit for the return value - one of the GTK Unit Constants |
Returns : | the right margin |
This method is available in PyGTK 2.10 and above.
The get_right_margin
() method gets the
right margin in units of unit
.
def set_right_margin(margin
, unit
)
| the new right margin in units of
unit |
| the units for margin -
one of the GTK Unit Constants |
This method is available in PyGTK 2.10 and above.
The set_right_margin
() method sets the
right margin of the page setup to the value specified by
margin
using the units specified by
unit
.
def set_paper_size_and_default_margins(size
)
| a gtk.PaperSize |
This method is available in PyGTK 2.10 and above.
The
set_paper_size_and_default_margins
() method
sets the paper size of the page setup to the value specified by
size
and modifies the margins according to the
new paper size.
def get_paper_width(unit
)
| the unit for the return value - one of the GTK Unit Constants |
Returns : | the paper width. |
This method is available in PyGTK 2.10 and above.
The get_paper_width
() method returns
the paper width in units of unit
.
Note that this function takes orientation, but not margins into
consideration. See the get_page_width()
method.
def get_paper_height(unit
)
| the unit for the return value - one of the GTK Unit Constants |
Returns : | the paper height. |
This method is available in PyGTK 2.10 and above.
The get_paper_height
() method returns
the paper height in units of unit
.
Note that this function takes orientation, but not margins into
consideration. See the get_page_height()
method.
def get_page_width(unit
)
| the unit for the return value - one of the GTK Unit Constants |
Returns : | the page width. |
This method is available in PyGTK 2.10 and above.
The get_page_width
() method returns the
page width in units of unit
.
Note that this function takes orientation and margins into
consideration. See the get_paper_width()
method.
def get_page_height(unit
)
| the unit for the return value - one of the GTK Unit Constants |
Returns : | the page height. |
This method is available in PyGTK 2.10 and above.
The get_page_height
() method returns
the page height in units of unit
.
Note that this function takes orientation and margins into
consideration. See the get_paper_height()
method.
def to_file(file_name
)
| the file to save to |
Returns : | True on success. |
This method is available in PyGTK 2.12 and above.
The to_file
() method
saves the information from setup to file_name
.
def load_file(file_name
)
| the filename to read the page setup from. |
Returns : | True on success. |
This method is available in PyGTK 2.14 and above.
The load_file
() method
Reads the page setup from the file file_name. See
to_file
.
def gtk.print_run_page_setup_dialog(parent
, page_setup
, settings
)
| transient parent, or
None |
| an existing gtk.PageSetup ,
or None |
| a gtk.PrintSettings |
Returns : | a new gtk.PageSetup |
Runs a page setup dialog, letting the user modify the values
from page_setup. If the user cancels the dialog, the returned gtk.PageSetup
is identical to the passed in page_setup, otherwise it contains the
modifications done in the dialog.
Note that this function may use a recursive mainloop to show the page setup dialog.
def gtk.page_setup_new_from_file(file_name
)
| the filename to read the page setup from. |
Returns : | The restored gtk.PageSetup |
This function is available in PyGTK 2.12 and above.
Reads the page setup from the file file_name. Returns a new
gtk.PageSetup
object with the restored page setup, or None if an error occurred. See
gtk.PageSetup.to_file.