printrun-src/printrun/eventhandler.py

Wed, 20 Jan 2021 10:15:13 +0100

author
mdd
date
Wed, 20 Jan 2021 10:15:13 +0100
changeset 46
cce0af6351f0
permissions
-rw-r--r--

updated and added new files for printrun

46
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
1 # This file is part of the Printrun suite.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
2 #
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
3 # Printrun is free software: you can redistribute it and/or modify
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
4 # it under the terms of the GNU General Public License as published by
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
5 # the Free Software Foundation, either version 3 of the License, or
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
6 # (at your option) any later version.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
7 #
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
8 # Printrun is distributed in the hope that it will be useful,
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
11 # GNU General Public License for more details.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
12 #
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
13 # You should have received a copy of the GNU General Public License
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
14 # along with Printrun. If not, see <http://www.gnu.org/licenses/>.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
15
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
16 class PrinterEventHandler:
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
17 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
18 Defines a skeletton of an event-handler for printer events. It
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
19 allows attaching to the printcore and will be triggered for
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
20 different events.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
21 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
22 def __init__(self):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
23 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
24 Constructor.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
25 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
26 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
27
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
28 def on_init(self):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
29 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
30 Called whenever a new printcore is initialized.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
31 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
32 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
33
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
34 def on_send(self, command, gline):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
35 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
36 Called on every command sent to the printer.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
37
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
38 @param command: The command to be sent.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
39 @param gline: The parsed high-level command.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
40 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
41 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
42
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
43 def on_recv(self, line):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
44 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
45 Called on every line read from the printer.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
46
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
47 @param line: The data has been read from printer.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
48 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
49 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
50
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
51
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
52 def on_connect(self):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
53 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
54 Called whenever printcore is connected.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
55 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
56 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
57
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
58 def on_disconnect(self):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
59 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
60 Called whenever printcore is disconnected.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
61 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
62 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
63
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
64 def on_error(self, error):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
65 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
66 Called whenever an error occurs.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
67
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
68 @param error: The error that has been triggered.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
69 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
70 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
71
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
72 def on_online(self):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
73 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
74 Called when printer got online.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
75 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
76 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
77
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
78 def on_temp(self, line):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
79 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
80 Called for temp, status, whatever.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
81
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
82 @param line: Line of data.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
83 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
84 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
85
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
86 def on_start(self, resume):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
87 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
88 Called when printing is started.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
89
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
90 @param resume: If true, the print is resumed.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
91 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
92 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
93
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
94 def on_end(self):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
95 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
96 Called when printing ends.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
97 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
98 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
99
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
100 def on_layerchange(self, layer):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
101 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
102 Called on layer changed.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
103
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
104 @param layer: The new layer.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
105 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
106 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
107
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
108 def on_preprintsend(self, gline, index, mainqueue):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
109 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
110 Called pre sending printing command.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
111
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
112 @param gline: Line to be send.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
113 @param index: Index in the mainqueue.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
114 @param mainqueue: The main queue of commands.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
115 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
116 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
117
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
118 def on_printsend(self, gline):
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
119 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
120 Called whenever a line is sent to the printer.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
121
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
122 @param gline: The line send to the printer.
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
123 '''
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
124 pass
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
125
cce0af6351f0 updated and added new files for printrun
mdd
parents:
diff changeset
126

mercurial