Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
26c17440
Commit
26c17440
authored
Jun 28, 2011
by
kliment
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Continue on exceptions in callback functions
parent
ea35ea0e
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
8 deletions
+28
-8
printcore.py
printcore.py
+28
-8
No files found.
printcore.py
View file @
26c17440
...
...
@@ -80,25 +80,36 @@ class printcore():
if
(
len
(
line
)
>
1
):
self
.
log
+=
[
line
]
if
self
.
recvcb
is
not
None
:
try
:
self
.
recvcb
(
line
)
except
:
pass
if
self
.
loud
:
print
"RECV: "
,
line
.
rstrip
()
if
(
line
.
startswith
(
'start'
)
or
line
.
startswith
(
'ok'
)):
self
.
clear
=
True
if
(
line
.
startswith
(
'start'
)
or
line
.
startswith
(
'ok'
)
or
"T:"
in
line
):
if
(
not
self
.
online
or
line
.
startswith
(
'start'
))
and
self
.
onlinecb
is
not
None
:
try
:
self
.
onlinecb
()
except
:
pass
self
.
online
=
True
if
(
line
.
startswith
(
'ok'
)):
#self.resendfrom=-1
#put temp handling here
if
"T:"
in
line
and
self
.
tempcb
is
not
None
:
try
:
self
.
tempcb
(
line
)
except
:
pass
#callback for temp, status, whatever
elif
(
line
.
startswith
(
'Error'
)):
if
self
.
errorcb
is
not
None
:
try
:
self
.
errorcb
(
line
)
except
:
pass
#callback for errors
pass
if
"resend"
in
line
.
lower
()
or
"rs"
in
line
:
...
...
@@ -172,11 +183,17 @@ class printcore():
def
_print
(
self
):
#callback for printing started
if
self
.
startcb
is
not
None
:
try
:
self
.
startcb
()
except
:
pass
while
(
self
.
printing
and
self
.
printer
and
self
.
online
):
self
.
_sendnext
()
if
self
.
endcb
is
not
None
:
try
:
self
.
endcb
()
except
:
pass
#callback for printing done
def
_sendnext
(
self
):
...
...
@@ -225,7 +242,10 @@ class printcore():
if
self
.
loud
:
print
"SENT: "
,
command
if
self
.
sendcb
is
not
None
:
try
:
self
.
sendcb
(
command
)
except
:
pass
self
.
printer
.
write
(
command
+
"
\n
"
)
if
__name__
==
'__main__'
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment