Documentation/Source/eric6.WebBrowser.Tools.FilePrinter.html

changeset 5191
b7471cf89b07
child 5253
57276f763bf6
equal deleted inserted replaced
5190:65a2234c6789 5191:b7471cf89b07
1 <!DOCTYPE html>
2 <html><head>
3 <title>eric6.WebBrowser.Tools.FilePrinter</title>
4 <meta charset="UTF-8">
5 <style>
6 body {
7 background: #EDECE6;
8 margin: 0em 1em 10em 1em;
9 color: black;
10 }
11
12 h1 { color: white; background: #85774A; }
13 h2 { color: white; background: #85774A; }
14 h3 { color: white; background: #9D936E; }
15 h4 { color: white; background: #9D936E; }
16
17 a { color: #BA6D36; }
18
19 </style>
20 </head>
21 <body><a NAME="top" ID="top"></a>
22 <h1>eric6.WebBrowser.Tools.FilePrinter</h1>
23 <p>
24 Module implementing an object for printing of files.
25 </p>
26 <h3>Global Attributes</h3>
27 <table>
28 <tr><td>_FilePrintJobs</td></tr>
29 </table>
30 <h3>Classes</h3>
31 <table>
32 <tr>
33 <td><a href="#FilePrinter">FilePrinter</a></td>
34 <td>Class implementing methods for printing on *nix systems.</td>
35 </tr>
36 </table>
37 <h3>Functions</h3>
38 <table>
39 <tr>
40 <td><a href="#isCupsAvailable">isCupsAvailable</a></td>
41 <td>Static method to test the availability of CUPS.</td>
42 </tr><tr>
43 <td><a href="#printFile">printFile</a></td>
44 <td>Static method to print a file.</td>
45 </tr>
46 </table>
47 <hr /><hr />
48 <a NAME="FilePrinter" ID="FilePrinter"></a>
49 <h2>FilePrinter</h2>
50 <p>
51 Class implementing methods for printing on *nix systems.
52 </p>
53 <h3>Derived from</h3>
54 object
55 <h3>Class Attributes</h3>
56 <table>
57 <tr><td>ApplicationDeletesFiles</td></tr><tr><td>ApplicationSelectsPages</td></tr><tr><td>SystemDeletesFiles</td></tr><tr><td>SystemSelectsPages</td></tr>
58 </table>
59 <h3>Class Methods</h3>
60 <table>
61 <tr><td>None</td></tr>
62 </table>
63 <h3>Methods</h3>
64 <table>
65 <tr>
66 <td><a href="#FilePrinter.__init__">FilePrinter</a></td>
67 <td>Constructor</td>
68 </tr><tr>
69 <td><a href="#FilePrinter.__doCleanup">__doCleanup</a></td>
70 <td>Private method to perform some internal cleanup actions.</td>
71 </tr><tr>
72 <td><a href="#FilePrinter.__processError">__processError</a></td>
73 <td>Private slot handling process errors.</td>
74 </tr><tr>
75 <td><a href="#FilePrinter.__processFinished">__processFinished</a></td>
76 <td>Private slot handling the end of the process.</td>
77 </tr><tr>
78 <td><a href="#FilePrinter._copies">_copies</a></td>
79 <td>Protected method to assemble the number of copies arguments.</td>
80 </tr><tr>
81 <td><a href="#FilePrinter._cupsOptions">_cupsOptions</a></td>
82 <td>Protected method to assemble the CUPS specific arguments.</td>
83 </tr><tr>
84 <td><a href="#FilePrinter._deleteFile">_deleteFile</a></td>
85 <td>Protected method to assemble the jobname arguments.</td>
86 </tr><tr>
87 <td><a href="#FilePrinter._destination">_destination</a></td>
88 <td>Protected method to assemble the printer destination arguments.</td>
89 </tr><tr>
90 <td><a href="#FilePrinter._doPrintFile">_doPrintFile</a></td>
91 <td>Protected method to print a file</td>
92 </tr><tr>
93 <td><a href="#FilePrinter._jobname">_jobname</a></td>
94 <td>Protected method to assemble the jobname arguments.</td>
95 </tr><tr>
96 <td><a href="#FilePrinter._mediaPageSize">_mediaPageSize</a></td>
97 <td>Protected method to get the page size argument.</td>
98 </tr><tr>
99 <td><a href="#FilePrinter._mediaPaperSource">_mediaPaperSource</a></td>
100 <td>Protected method to get the paper source argument.</td>
101 </tr><tr>
102 <td><a href="#FilePrinter._optionCollateCopies">_optionCollateCopies</a></td>
103 <td>Protected method to assemble the collate copies arguments.</td>
104 </tr><tr>
105 <td><a href="#FilePrinter._optionCupsProperties">_optionCupsProperties</a></td>
106 <td>Protected method to assemble the CUPS properties arguments.</td>
107 </tr><tr>
108 <td><a href="#FilePrinter._optionDoubleSidedPrinting">_optionDoubleSidedPrinting</a></td>
109 <td>Protected method to assemble the double sided printing arguments.</td>
110 </tr><tr>
111 <td><a href="#FilePrinter._optionMedia">_optionMedia</a></td>
112 <td>Protected method to assemble the print media arguments.</td>
113 </tr><tr>
114 <td><a href="#FilePrinter._optionPageOrder">_optionPageOrder</a></td>
115 <td>Protected method to assemble the page order arguments.</td>
116 </tr><tr>
117 <td><a href="#FilePrinter._pages">_pages</a></td>
118 <td>Protected method to assemble the page range(s) arguments.</td>
119 </tr><tr>
120 <td><a href="#FilePrinter._printArguments">_printArguments</a></td>
121 <td>Protected method to assemble the command line arguments for the print command.</td>
122 </tr>
123 </table>
124 <h3>Static Methods</h3>
125 <table>
126 <tr><td>None</td></tr>
127 </table>
128 <a NAME="FilePrinter.__init__" ID="FilePrinter.__init__"></a>
129 <h4>FilePrinter (Constructor)</h4>
130 <b>FilePrinter</b>(<i></i>)
131 <p>
132 Constructor
133 </p><a NAME="FilePrinter.__doCleanup" ID="FilePrinter.__doCleanup"></a>
134 <h4>FilePrinter.__doCleanup</h4>
135 <b>__doCleanup</b>(<i>deleteFile</i>)
136 <p>
137 Private method to perform some internal cleanup actions.
138 </p><dl>
139 <dt><i>deleteFile</i> (bool)</dt>
140 <dd>
141 flag indicating to delete the print file
142 </dd>
143 </dl><a NAME="FilePrinter.__processError" ID="FilePrinter.__processError"></a>
144 <h4>FilePrinter.__processError</h4>
145 <b>__processError</b>(<i>error</i>)
146 <p>
147 Private slot handling process errors.
148 </p><dl>
149 <dt><i>error</i> (QProcess.ProcessError)</dt>
150 <dd>
151 error value
152 </dd>
153 </dl><a NAME="FilePrinter.__processFinished" ID="FilePrinter.__processFinished"></a>
154 <h4>FilePrinter.__processFinished</h4>
155 <b>__processFinished</b>(<i>exitCode, exitStatus</i>)
156 <p>
157 Private slot handling the end of the process.
158 </p><dl>
159 <dt><i>exitCode</i> (int)</dt>
160 <dd>
161 exit code of the process
162 </dd><dt><i>exitStatus</i> (QProcess.ExitStatus)</dt>
163 <dd>
164 exit status of the process
165 </dd>
166 </dl><a NAME="FilePrinter._copies" ID="FilePrinter._copies"></a>
167 <h4>FilePrinter._copies</h4>
168 <b>_copies</b>(<i>printer, variant</i>)
169 <p>
170 Protected method to assemble the number of copies arguments.
171 </p><dl>
172 <dt><i>printer</i> (QPrinter)</dt>
173 <dd>
174 reference to the printer to print to
175 </dd><dt><i>variant</i> (str)</dt>
176 <dd>
177 string identifying the print command variant
178 </dd>
179 </dl><dl>
180 <dt>Returns:</dt>
181 <dd>
182 assembled number of copies arguments
183 </dd>
184 </dl><dl>
185 <dt>Return Type:</dt>
186 <dd>
187 list of str
188 </dd>
189 </dl><a NAME="FilePrinter._cupsOptions" ID="FilePrinter._cupsOptions"></a>
190 <h4>FilePrinter._cupsOptions</h4>
191 <b>_cupsOptions</b>(<i>printer</i>)
192 <p>
193 Protected method to assemble the CUPS specific arguments.
194 </p><dl>
195 <dt><i>printer</i> (QPrinter)</dt>
196 <dd>
197 reference to the printer to print to
198 </dd>
199 </dl><dl>
200 <dt>Returns:</dt>
201 <dd>
202 assembled CUPS arguments
203 </dd>
204 </dl><dl>
205 <dt>Return Type:</dt>
206 <dd>
207 list of str
208 </dd>
209 </dl><a NAME="FilePrinter._deleteFile" ID="FilePrinter._deleteFile"></a>
210 <h4>FilePrinter._deleteFile</h4>
211 <b>_deleteFile</b>(<i>printer, fileDeletePolicy, variant</i>)
212 <p>
213 Protected method to assemble the jobname arguments.
214 </p><dl>
215 <dt><i>printer</i> (QPrinter)</dt>
216 <dd>
217 reference to the printer to print to
218 </dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt>
219 <dd>
220 policy determining who deletes the file to be
221 printed (application or system)
222 </dd><dt><i>variant</i> (str)</dt>
223 <dd>
224 string identifying the print command variant
225 </dd>
226 </dl><dl>
227 <dt>Returns:</dt>
228 <dd>
229 assembled jobname arguments
230 </dd>
231 </dl><dl>
232 <dt>Return Type:</dt>
233 <dd>
234 list of str
235 </dd>
236 </dl><a NAME="FilePrinter._destination" ID="FilePrinter._destination"></a>
237 <h4>FilePrinter._destination</h4>
238 <b>_destination</b>(<i>printer, variant</i>)
239 <p>
240 Protected method to assemble the printer destination arguments.
241 </p><dl>
242 <dt><i>printer</i> (QPrinter)</dt>
243 <dd>
244 reference to the printer to print to
245 </dd><dt><i>variant</i> (str)</dt>
246 <dd>
247 string identifying the print command variant
248 </dd>
249 </dl><dl>
250 <dt>Returns:</dt>
251 <dd>
252 assembled printer destination arguments
253 </dd>
254 </dl><dl>
255 <dt>Return Type:</dt>
256 <dd>
257 list of str
258 </dd>
259 </dl><a NAME="FilePrinter._doPrintFile" ID="FilePrinter._doPrintFile"></a>
260 <h4>FilePrinter._doPrintFile</h4>
261 <b>_doPrintFile</b>(<i>printer, fileName, fileDeletePolicy, pageSelectPolicy, pageRange</i>)
262 <p>
263 Protected method to print a file
264 </p><dl>
265 <dt><i>printer</i> (QPrinter)</dt>
266 <dd>
267 reference to the printer to print to
268 </dd><dt><i>fileName</i> (str)</dt>
269 <dd>
270 name (path) of the file to be printed
271 </dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt>
272 <dd>
273 policy determining who deletes the file to be
274 printed (application or system)
275 </dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt>
276 <dd>
277 policy determining who selects the pages to be
278 printed (application or system)
279 </dd><dt><i>pageRange</i> (str)</dt>
280 <dd>
281 string determining the page range(s) to be printed, if
282 SystemSelectsPages was given for pageSelectPolicy and user chose
283 Selection in print dialog
284 </dd>
285 </dl><dl>
286 <dt>Returns:</dt>
287 <dd>
288 flag indicating successful print job submission
289 </dd>
290 </dl><dl>
291 <dt>Return Type:</dt>
292 <dd>
293 bool
294 </dd>
295 </dl><a NAME="FilePrinter._jobname" ID="FilePrinter._jobname"></a>
296 <h4>FilePrinter._jobname</h4>
297 <b>_jobname</b>(<i>printer, variant</i>)
298 <p>
299 Protected method to assemble the jobname arguments.
300 </p><dl>
301 <dt><i>printer</i> (QPrinter)</dt>
302 <dd>
303 reference to the printer to print to
304 </dd><dt><i>variant</i> (str)</dt>
305 <dd>
306 string identifying the print command variant
307 </dd>
308 </dl><dl>
309 <dt>Returns:</dt>
310 <dd>
311 assembled jobname arguments
312 </dd>
313 </dl><dl>
314 <dt>Return Type:</dt>
315 <dd>
316 list of str
317 </dd>
318 </dl><a NAME="FilePrinter._mediaPageSize" ID="FilePrinter._mediaPageSize"></a>
319 <h4>FilePrinter._mediaPageSize</h4>
320 <b>_mediaPageSize</b>(<i>printer</i>)
321 <p>
322 Protected method to get the page size argument.
323 </p><dl>
324 <dt><i>printer</i> (QPrinter)</dt>
325 <dd>
326 reference to the printer to print to
327 </dd>
328 </dl><dl>
329 <dt>Returns:</dt>
330 <dd>
331 page size argument
332 </dd>
333 </dl><dl>
334 <dt>Return Type:</dt>
335 <dd>
336 str
337 </dd>
338 </dl><a NAME="FilePrinter._mediaPaperSource" ID="FilePrinter._mediaPaperSource"></a>
339 <h4>FilePrinter._mediaPaperSource</h4>
340 <b>_mediaPaperSource</b>(<i>printer</i>)
341 <p>
342 Protected method to get the paper source argument.
343 </p><dl>
344 <dt><i>printer</i> (QPrinter)</dt>
345 <dd>
346 reference to the printer to print to
347 </dd>
348 </dl><dl>
349 <dt>Returns:</dt>
350 <dd>
351 paper source argument
352 </dd>
353 </dl><dl>
354 <dt>Return Type:</dt>
355 <dd>
356 str
357 </dd>
358 </dl><a NAME="FilePrinter._optionCollateCopies" ID="FilePrinter._optionCollateCopies"></a>
359 <h4>FilePrinter._optionCollateCopies</h4>
360 <b>_optionCollateCopies</b>(<i>printer</i>)
361 <p>
362 Protected method to assemble the collate copies arguments.
363 </p><dl>
364 <dt><i>printer</i> (QPrinter)</dt>
365 <dd>
366 reference to the printer to print to
367 </dd>
368 </dl><dl>
369 <dt>Returns:</dt>
370 <dd>
371 assembled collate copies arguments
372 </dd>
373 </dl><dl>
374 <dt>Return Type:</dt>
375 <dd>
376 list of str
377 </dd>
378 </dl><a NAME="FilePrinter._optionCupsProperties" ID="FilePrinter._optionCupsProperties"></a>
379 <h4>FilePrinter._optionCupsProperties</h4>
380 <b>_optionCupsProperties</b>(<i>printer</i>)
381 <p>
382 Protected method to assemble the CUPS properties arguments.
383 </p><dl>
384 <dt><i>printer</i> (QPrinter)</dt>
385 <dd>
386 reference to the printer to print to
387 </dd>
388 </dl><dl>
389 <dt>Returns:</dt>
390 <dd>
391 assembled CUPS properties arguments
392 </dd>
393 </dl><dl>
394 <dt>Return Type:</dt>
395 <dd>
396 list of str
397 </dd>
398 </dl><a NAME="FilePrinter._optionDoubleSidedPrinting" ID="FilePrinter._optionDoubleSidedPrinting"></a>
399 <h4>FilePrinter._optionDoubleSidedPrinting</h4>
400 <b>_optionDoubleSidedPrinting</b>(<i>printer</i>)
401 <p>
402 Protected method to assemble the double sided printing arguments.
403 </p><dl>
404 <dt><i>printer</i> (QPrinter)</dt>
405 <dd>
406 reference to the printer to print to
407 </dd>
408 </dl><dl>
409 <dt>Returns:</dt>
410 <dd>
411 assembled double sided printing arguments
412 </dd>
413 </dl><dl>
414 <dt>Return Type:</dt>
415 <dd>
416 list of str
417 </dd>
418 </dl><a NAME="FilePrinter._optionMedia" ID="FilePrinter._optionMedia"></a>
419 <h4>FilePrinter._optionMedia</h4>
420 <b>_optionMedia</b>(<i>printer</i>)
421 <p>
422 Protected method to assemble the print media arguments.
423 </p><dl>
424 <dt><i>printer</i> (QPrinter)</dt>
425 <dd>
426 reference to the printer to print to
427 </dd>
428 </dl><dl>
429 <dt>Returns:</dt>
430 <dd>
431 assembled print media arguments
432 </dd>
433 </dl><dl>
434 <dt>Return Type:</dt>
435 <dd>
436 list of str
437 </dd>
438 </dl><a NAME="FilePrinter._optionPageOrder" ID="FilePrinter._optionPageOrder"></a>
439 <h4>FilePrinter._optionPageOrder</h4>
440 <b>_optionPageOrder</b>(<i>printer</i>)
441 <p>
442 Protected method to assemble the page order arguments.
443 </p><dl>
444 <dt><i>printer</i> (QPrinter)</dt>
445 <dd>
446 reference to the printer to print to
447 </dd>
448 </dl><dl>
449 <dt>Returns:</dt>
450 <dd>
451 assembled page order arguments
452 </dd>
453 </dl><dl>
454 <dt>Return Type:</dt>
455 <dd>
456 list of str
457 </dd>
458 </dl><a NAME="FilePrinter._pages" ID="FilePrinter._pages"></a>
459 <h4>FilePrinter._pages</h4>
460 <b>_pages</b>(<i>printer, pageSelectPolicy, pageRange, useCupsOptions, variant</i>)
461 <p>
462 Protected method to assemble the page range(s) arguments.
463 </p><dl>
464 <dt><i>printer</i> (QPrinter)</dt>
465 <dd>
466 reference to the printer to print to
467 </dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt>
468 <dd>
469 policy determining who selects the pages to be
470 printed (application or system)
471 </dd><dt><i>pageRange</i> (str)</dt>
472 <dd>
473 string determining the page range(s) to be printed, if
474 SystemSelectsPages was given for pageSelectPolicy and user chose
475 Selection in print dialog
476 </dd><dt><i>useCupsOptions</i> (bool)</dt>
477 <dd>
478 flag indicating to assemble the arguments for
479 CUPS
480 </dd><dt><i>variant</i> (str)</dt>
481 <dd>
482 string identifying the print command variant
483 </dd>
484 </dl><dl>
485 <dt>Returns:</dt>
486 <dd>
487 assembled page range(s) arguments
488 </dd>
489 </dl><dl>
490 <dt>Return Type:</dt>
491 <dd>
492 list of str
493 </dd>
494 </dl><a NAME="FilePrinter._printArguments" ID="FilePrinter._printArguments"></a>
495 <h4>FilePrinter._printArguments</h4>
496 <b>_printArguments</b>(<i>printer, fileDeletePolicy, pageSelectPolicy, useCupsOptions, pageRange, variant</i>)
497 <p>
498 Protected method to assemble the command line arguments for the print
499 command.
500 </p><dl>
501 <dt><i>printer</i> (QPrinter)</dt>
502 <dd>
503 reference to the printer to print to
504 </dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt>
505 <dd>
506 policy determining who deletes the file to be
507 printed (application or system)
508 </dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt>
509 <dd>
510 policy determining who selects the pages to be
511 printed (application or system)
512 </dd><dt><i>useCupsOptions</i> (bool)</dt>
513 <dd>
514 flag indicating to assemble the arguments for
515 CUPS
516 </dd><dt><i>pageRange</i> (str)</dt>
517 <dd>
518 string determining the page range(s) to be printed, if
519 SystemSelectsPages was given for pageSelectPolicy and user chose
520 Selection in print dialog
521 </dd><dt><i>variant</i> (str)</dt>
522 <dd>
523 string identifying the print command variant
524 </dd>
525 </dl><dl>
526 <dt>Returns:</dt>
527 <dd>
528 assembled command line arguments for the print command
529 </dd>
530 </dl><dl>
531 <dt>Return Type:</dt>
532 <dd>
533 list of str
534 </dd>
535 </dl>
536 <div align="right"><a href="#top">Up</a></div>
537 <hr /><hr />
538 <a NAME="isCupsAvailable" ID="isCupsAvailable"></a>
539 <h2>isCupsAvailable</h2>
540 <b>isCupsAvailable</b>(<i></i>)
541 <p>
542 Static method to test the availability of CUPS.
543 </p><dl>
544 <dt>Returns:</dt>
545 <dd>
546 flag indicating the availability of CUPS
547 </dd>
548 </dl><dl>
549 <dt>Return Type:</dt>
550 <dd>
551 bool
552 </dd>
553 </dl>
554 <div align="right"><a href="#top">Up</a></div>
555 <hr /><hr />
556 <a NAME="printFile" ID="printFile"></a>
557 <h2>printFile</h2>
558 <b>printFile</b>(<i>printer, fileName, fileDeletePolicy=FilePrinter.ApplicationDeletesFiles, pageSelectPolicy=FilePrinter.ApplicationSelectsPages, pageRange=""</i>)
559 <p>
560 Static method to print a file.
561 </p><p>
562 Note: Only CUPS and LPR on *nix systems is supported.
563 </p><dl>
564 <dt><i>printer</i> (QPrinter)</dt>
565 <dd>
566 reference to the printer to print to
567 </dd><dt><i>fileName</i> (str)</dt>
568 <dd>
569 name (path) of the file to be printed
570 </dd><dt><i>fileDeletePolicy</i> (int (0 or 1))</dt>
571 <dd>
572 policy determining who deletes the file to be
573 printed (application or system)
574 </dd><dt><i>pageSelectPolicy</i> (int (0 or 1))</dt>
575 <dd>
576 policy determining who selects the pages to be
577 printed (application or system)
578 </dd><dt><i>pageRange</i> (str)</dt>
579 <dd>
580 string determining the page range(s) to be printed, if
581 SystemSelectsPages was given for pageSelectPolicy and user chose
582 Selection in print dialog
583 </dd>
584 </dl>
585 <div align="right"><a href="#top">Up</a></div>
586 <hr />
587 </body></html>

eric ide

mercurial