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
ee5e41bc
Commit
ee5e41bc
authored
Aug 03, 2012
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More cleanup
parent
a21ff31c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
24 deletions
+22
-24
printcore.py
printrun/printcore.py
+22
-24
No files found.
printrun/printcore.py
View file @
ee5e41bc
...
...
@@ -228,47 +228,45 @@ class printcore():
self
.
print_thread
=
Thread
(
target
=
self
.
_print
)
self
.
print_thread
.
start
()
def
send
(
self
,
command
,
wait
=
0
):
def
send
(
self
,
command
,
wait
=
0
):
"""Adds a command to the checksummed main command queue if printing, or sends the command immediately if not printing
"""
if
(
self
.
online
)
:
if
(
self
.
printing
)
:
self
.
mainqueue
+=
[
command
]
if
self
.
online
:
if
self
.
printing
:
self
.
mainqueue
.
append
(
command
)
else
:
while
not
self
.
clear
:
while
self
.
printer
and
self
.
printing
and
not
self
.
clear
:
time
.
sleep
(
0.001
)
if
(
wait
==
0
and
self
.
wait
>
0
)
:
if
wait
==
0
and
self
.
wait
>
0
:
wait
=
self
.
wait
if
(
wait
>
0
)
:
self
.
clear
=
False
self
.
_send
(
command
,
self
.
lineno
,
True
)
self
.
lineno
+
=
1
while
(
(
wait
>
0
)
and
not
self
.
clear
)
:
if
wait
>
0
:
self
.
clear
=
False
self
.
_send
(
command
,
self
.
lineno
,
True
)
self
.
lineno
+
=
1
while
(
wait
>
0
)
and
self
.
printer
and
self
.
printing
and
not
self
.
clear
:
time
.
sleep
(
0.001
)
wait
-=
1
wait
-=
1
else
:
print
"Not connected to printer."
def
send_now
(
self
,
command
,
wait
=
0
):
def
send_now
(
self
,
command
,
wait
=
0
):
"""Sends a command to the printer ahead of the command queue, without a checksum
"""
if
(
self
.
online
or
force
)
:
if
(
self
.
printing
)
:
self
.
priqueue
+=
[
command
]
if
self
.
online
or
force
:
if
self
.
printing
:
self
.
priqueue
.
append
(
command
)
else
:
while
not
self
.
clear
:
while
self
.
printer
and
self
.
printing
and
not
self
.
clear
:
time
.
sleep
(
0.001
)
if
(
wait
==
0
and
self
.
wait
>
0
)
:
if
wait
==
0
and
self
.
wait
>
0
:
wait
=
self
.
wait
if
(
wait
>
0
)
:
self
.
clear
=
False
if
wait
>
0
:
self
.
clear
=
False
self
.
_send
(
command
)
while
(
(
wait
>
0
)
and
not
self
.
clear
)
:
while
(
wait
>
0
)
and
self
.
printer
and
self
.
printing
and
not
self
.
clear
:
time
.
sleep
(
0.001
)
wait
-=
1
#callback for command sent
wait
-=
1
else
:
print
"Not connected to printer."
...
...
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