1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
|
<?xml version="1.0" standalone="no"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
<refentry id="class-gtkprintjob">
<refnamediv>
<refname>gtkunixprint.PrintJob</refname>
<refpurpose>an object that represents a print job (new in PyGTK
2.10)</refpurpose>
</refnamediv>
<refsect1>
<title>Synopsis</title>
<classsynopsis language="python">
<ooclass><classname>gtkunixprint.PrintJob</classname></ooclass>
<ooclass><classname><link linkend="class-gobject">gobject.GObject</link></classname></ooclass>
<constructorsynopsis language="python">
<methodname><link linkend="constructor-gtkprintjob">gtkunixprint.PrintJob</link></methodname>
<methodparam><parameter role="keyword">title</parameter></methodparam>
<methodparam><parameter role="keyword">printer</parameter></methodparam>
<methodparam><parameter role="keyword">settings</parameter></methodparam>
<methodparam><parameter role="keyword">page_setup</parameter></methodparam>
</constructorsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--get-settings">get_settings</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--get-printer">get_printer</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--get-title">get_title</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--get-status">get_status</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--set-source-file">set_source_file</link></methodname>
<methodparam><parameter role="keyword">filename</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--get-surface">get_surface</link></methodname>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--set-track-print-status">set_track_print_status</link></methodname>
<methodparam><parameter role="keyword">track_status</parameter></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--get-track-print-status">get_track_print_status</link></methodname>
<methodparam></methodparam>
</methodsynopsis>
<methodsynopsis language="python">
<methodname><link linkend="method-gtkprintjob--send">send</link></methodname>
<methodparam><parameter role="keyword">callback</parameter></methodparam>
<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
</methodsynopsis>
</classsynopsis>
</refsect1>
<refsect1>
<title>Ancestry</title>
<synopsis>+-- <link linkend="class-gobject">gobject.GObject</link>
+-- <link linkend="class-gtkprintjob">gtkunixprint.PrintJob</link>
</synopsis>
</refsect1>
<refsect1 id="properties-gtkprintjob">
<title>gtkunixprint.PrintJob Properties</title>
<blockquote role="properties">
<informaltable pgwide="1" frame="none">
<tgroup cols="3">
<colspec column="1" colwidth="1in"/>
<colspec column="2" colwidth="1in"/>
<colspec column="3" colwidth="4in"/>
<tbody>
<row valign="top">
<entry>"page-setup"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The Page Setup. Available in GTK+ 2.10.</entry>
</row>
<row valign="top">
<entry>"printer"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The Printer to print the job to. Available in GTK+
2.10.</entry>
</row>
<row valign="top">
<entry>"settings"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>The Printer Settings. Available in GTK+ 2.10.</entry>
</row>
<row valign="top">
<entry>"title"</entry>
<entry>Read-Write-Construct Only</entry>
<entry>Title of the print job. Default value:
<literal>None</literal>. Available in GTK+ 2.10.</entry>
</row>
<row valign="top">
<entry>"track-print-status"</entry>
<entry>Read-Write</entry>
<entry>if <literal>True</literal> the print job will continue
to emit status-changed signals after the print data has been
sent to the printer or print server. Available in GTK+
2.10.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</blockquote>
</refsect1>
<refsect1 id="signal-prototypes-gtkprintjob">
<title>gtkunixprint.PrintJob Signal Prototypes</title>
<para><link linkend="signal-prototypes-gobject">gobject.GObject Signal Prototypes</link></para>
<variablelist>
<varlistentry>
<term>"<link linkend="signal-gtkprintjob--status-changed">status-changed</link>"</term>
<listitem>
<methodsynopsis language="python"><methodname>callback</methodname>
<methodparam><parameter>printjob</parameter></methodparam>
<methodparam><parameter>user_param1</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Description</title>
<note>
<para>This class is available in PyGTK 2.10 and above.</para>
</note>
<para>A <link
linkend="class-gtkprintjob"><classname>gtkunixprint.PrintJob</classname></link>
object represents a job that is sent to a printer. You only need to deal
directly with print jobs if you use the non-portable <link
linkend="class-gtkprintunixdialog"><classname>gtkunixprint.PrintUnixDialog</classname></link>
API.</para>
<para>Use the <link
linkend="method-gtkprintjob--get-surface"><methodname>get_surface</methodname>()</link>
method to obtain the cairo surface onto which the pages must be
drawn. Use the <link
linkend="method-gtkprintjob--send"><methodname>send</methodname>()</link>
method to send the finished job to the printer. If you don't use cairo
<link
linkend="class-gtkprintjob"><classname>gtkunixprint.PrintJob</classname></link>
also supports printing of manually generated postscript, via the <link
linkend="method-gtkprintjob--set-source-file"><methodname>set_source_file</methodname>()</link>
method.</para>
</refsect1>
<refsect1>
<title>Constructor</title>
<refsect2 id="constructor-gtkprintjob">
<title>gtkunixprint.PrintJob</title>
<programlisting><constructorsynopsis language="python">
<methodname>gtkunixprint.PrintJob</methodname>
<methodparam><parameter role="keyword">title</parameter></methodparam>
<methodparam><parameter role="keyword">printer</parameter></methodparam>
<methodparam><parameter role="keyword">settings</parameter></methodparam>
<methodparam><parameter role="keyword">page_setup</parameter></methodparam>
</constructorsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">title</parameter> :</term>
<listitem><simpara>the job title</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">printer</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gtkprinter"><classname>gtkunixprint.Printer</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">settings</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gtkprintsettings"><classname>gtk.PrintSettings</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">page_setup</parameter> :</term>
<listitem><simpara>a <link
linkend="class-gtkpagesetup"><classname>gtk.PageSetup</classname></link></simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>a new <link
linkend="class-gtkprintjob"><classname>gtkunixprint.PrintJob</classname></link></simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This constructor is available in PyGTK 2.10 and above.</para>
</note>
<para>Creates a new <link
linkend="class-gtkprintjob"><classname>gtkunixprint.PrintJob</classname></link>.</para>
</refsect2>
</refsect1>
<refsect1>
<title>Methods</title>
<refsect2 id="method-gtkprintjob--get-settings">
<title>gtkunixprint.PrintJob.get_settings</title>
<programlisting><methodsynopsis language="python">
<methodname>get_settings</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the settings of the print
job</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>get_settings</methodname>() method returns the
<link
linkend="class-gtkprintsettings"><classname>gtk.PrintSettings</classname></link>
of the print job.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--get-printer">
<title>gtkunixprint.PrintJob.get_printer</title>
<programlisting><methodsynopsis language="python">
<methodname>get_printer</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the printer of the print
job</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>get_printer</methodname>() method returns the
<link
linkend="class-gtkprinter"><classname>gtkunixprint.Printer</classname></link>
of the print job.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--get-title">
<title>gtkunixprint.PrintJob.get_title</title>
<programlisting><methodsynopsis language="python">
<methodname>get_title</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the title of the print job</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>get_title</methodname>() method returns the
print job title.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--get-status">
<title>gtkunixprint.PrintJob.get_status</title>
<programlisting><methodsynopsis language="python">
<methodname>get_status</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the status of the print
job</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>get_status</methodname>() method returns the
status of the print job.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--set-source-file">
<title>gtkunixprint.PrintJob.set_source_file</title>
<programlisting><methodsynopsis language="python">
<methodname>set_source_file</methodname>
<methodparam><parameter role="keyword">filename</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">filename</parameter> :</term>
<listitem><simpara>the file to be printed</simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara><literal>False</literal> if an error
occurred</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>set_source_file</methodname>() method makes the
<link
linkend="class-gtkprintjob"><classname>gtkunixprint.PrintJob</classname></link>
send the existing document specified by
<parameter>filename</parameter> to the printing system. The file can
be in any format understood by the platforms printing system
(typically PostScript, but on many platforms PDF may work too).</para>
</refsect2>
<refsect2 id="method-gtkprintjob--get-surface">
<title>gtkunixprint.PrintJob.get_surface</title>
<programlisting><methodsynopsis language="python">
<methodname>get_surface</methodname>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara>the cairo surface of the print
job</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>get_surface</methodname>() method returns a
cairo surface onto which the pages of the print job should be
rendered.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--set-track-print-status">
<title>gtkunixprint.PrintJob.set_track_print_status</title>
<programlisting><methodsynopsis language="python">
<methodname>set_track_print_status</methodname>
<methodparam><parameter role="keyword">track_status</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">track_status</parameter> :</term>
<listitem><simpara>if <literal>True</literal> track the status of
the print job after sending</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>set_track_print_status</methodname>() method
enable or disables tracking of the print job status based on the value
specified by <parameter>track_status</parameter>. If
<parameter>track_status</parameter> is <literal>True</literal>, the
print job will try to continue report on the status of the print job
in the printer queues and printer. This can allow your application to
show things like "out of paper" issues, and when the print job
actually reaches the printer.</para>
<para>This method is often implemented using some form of polling, so
tracking should not be enabled unless needed.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--get-track-print-status">
<title>gtkunixprint.PrintJob.get_track_print_status</title>
<programlisting><methodsynopsis language="python">
<methodname>get_track_print_status</methodname>
<methodparam></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara><literal>True</literal> if print job status
will be reported after printing</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>get_track_print_status</methodname>() method
returns wheter jobs will be tracked after printing. For details, see
the <link
linkend="method-gtkprintjob--set-track-print-status"><methodname>set_track_print_status()</methodname></link>
method.</para>
</refsect2>
<refsect2 id="method-gtkprintjob--send">
<title>gtkunixprint.PrintJob.send</title>
<programlisting><methodsynopsis language="python">
<methodname>send</methodname>
<methodparam><parameter role="keyword">callback</parameter></methodparam>
<methodparam><parameter role="keyword">user_data</parameter><initializer>None</initializer></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter role="keyword">callback</parameter> :</term>
<listitem><simpara>the function to call when the job
completes</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter role="keyword">user_data</parameter> :</term>
<listitem><simpara>user data that gets passed to
<parameter>callback</parameter></simpara></listitem>
</varlistentry>
<varlistentry>
<term><emphasis>Returns</emphasis> :</term>
<listitem><simpara><literal>False</literal> if an error
occurred</simpara></listitem>
</varlistentry>
</variablelist>
<note>
<para>This method is available in PyGTK 2.10 and above.</para>
</note>
<para>The <methodname>send</methodname>() method sends the print job
off to the printer and registers the function specified by
<parameter>callback</parameter> ro be called when the job
completes.</para>
<para>The signature of <parameter>callback</parameter> is:</para>
<programlisting>
def callback(print_job, data, errormsg):
</programlisting>
<para>where <parameter>data</parameter> is
<parameter>user_data</parameter> and <parameter>errormsg</parameter>
is a message indicating what problem has occurred or
<literal>None</literal> if no error has occurred.</para>
</refsect2>
</refsect1>
<refsect1>
<title>Signals</title>
<refsect2 id="signal-gtkprintjob--status-changed">
<title>The "status-changed" Signal</title>
<programlisting><methodsynopsis language="python">
<methodname>callback</methodname>
<methodparam><parameter>gtkprintjob</parameter></methodparam>
<methodparam><parameter>user_param1</parameter></methodparam>
<methodparam><parameter>...</parameter></methodparam>
</methodsynopsis></programlisting>
<variablelist>
<varlistentry>
<term><parameter>gtkprintjob</parameter> :</term>
<listitem><simpara>the gtkprintjob that received the
signal</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>user_param1</parameter> :</term>
<listitem><simpara>the first user parameter (if any) specified
with the <link
linkend="method-gobject--connect"><methodname>connect</methodname>()</link>
method</simpara></listitem>
</varlistentry>
<varlistentry>
<term><parameter>...</parameter> :</term>
<listitem><simpara>additional user parameters (if
any)</simpara></listitem>
</varlistentry>
</variablelist>
<para>The "status-changed" signal is emitted when the status of a job
changes. The signal handler can use the <link
linkend="method-gtkprintjob--get-status"><methodname>get_status</methodname>()</link>
method to obtain the new status.</para>
</refsect2>
</refsect1>
</refentry>
|