[go: up one dir, main page]

Menu

[r19]: / PrintDialog.py  Maximize  Restore  History

Download this file

57 lines (40 with data), 1.3 kB

 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
#!/usr/bin/python
# -*- coding: utf-8 -*-
import wx.html
import wx
class PrettyPrinter(wx.html.HtmlEasyPrinting):
"""
PrettyPrinter
Provides the necessary functions for printing
documents.
Build the GUI and provides the appropriate controls.
"""
def __init__(self, filename, text_id, parent=None):
"""
__init__
Initializes the HtmlEasyPrinting object.
Creates the necessary dialogs.
Retrieves the content to be printed.
"""
wx.html.HtmlEasyPrinting.__init__(self)
self.parent = parent
data = wx.PrintDialogData()
data.EnableSelection(True)
data.EnablePrintToFile(True)
data.EnablePageNumbers(True)
data.SetMinPage(1)
data.SetMaxPage(5)
data.SetAllPages(True)
dlg = wx.PrintDialog(parent, data)
dlg.Destroy()
self.cur_doc = wx.FindWindowById(text_id)
self.DoPrint(filename)
def DoPrint(self,filename):
"""
DoPrint
Sets the print hedear and calls the HTML
generation function.
Sends the output to HtmlEasyPrinting object for printing.
"""
self.SetHeader(filename)
self.PrintText(self.cur_doc.ToHTML(), filename)