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
9a453bf8
Commit
9a453bf8
authored
Aug 08, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update printcore
parent
46b1fb7e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
77 additions
and
56 deletions
+77
-56
printcore.py
printcore.py
+77
-0
printcore.py
printrun/printcore.py
+0
-56
No files found.
printcore.py
0 → 100644
View file @
9a453bf8
#!/usr/bin/env python
# This file is part of the Printrun suite.
#
# Printrun is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Printrun is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Printrun. If not, see <http://www.gnu.org/licenses/>.
import
time
import
getopt
import
sys
from
printrun.printcore
import
printcore
from
printrun
import
gcoder
if
__name__
==
'__main__'
:
baud
=
115200
loud
=
False
statusreport
=
False
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"h,b:,v,s"
,
[
"help"
,
"baud"
,
"verbose"
,
"statusreport"
])
except
getopt
.
GetoptError
,
err
:
print
str
(
err
)
sys
.
exit
(
2
)
for
o
,
a
in
opts
:
if
o
in
(
'-h'
,
'--help'
):
# FIXME: Fix help
print
"Opts are: --help, -b --baud = baudrate, -v --verbose,
\
-s --statusreport"
sys
.
exit
(
1
)
if
o
in
(
'-b'
,
'--baud'
):
baud
=
int
(
a
)
if
o
in
(
'-v'
,
'--verbose'
):
loud
=
True
elif
o
in
(
'-s'
,
'--statusreport'
):
statusreport
=
True
if
len
(
args
)
>
1
:
port
=
args
[
-
2
]
filename
=
args
[
-
1
]
print
"Printing:
%
s on
%
s with baudrate
%
d"
%
(
filename
,
port
,
baud
)
else
:
print
"Usage: python [-h|-b|-v|-s] printcore.py /dev/tty[USB|ACM]x filename.gcode"
sys
.
exit
(
2
)
p
=
printcore
(
port
,
baud
)
p
.
loud
=
loud
time
.
sleep
(
2
)
gcode
=
[
i
.
strip
()
for
i
in
open
(
filename
)]
gcode
=
gcoder
.
GCode
(
gcode
)
p
.
startprint
(
gcode
)
try
:
if
statusreport
:
p
.
loud
=
False
sys
.
stdout
.
write
(
"Progress: 00.0
%
\r
"
)
sys
.
stdout
.
flush
()
while
p
.
printing
:
time
.
sleep
(
1
)
if
statusreport
:
sys
.
stdout
.
write
(
"Progress:
%02.1
f
%%
\r
"
%
(
100
*
float
(
p
.
queueindex
)
/
len
(
p
.
mainqueue
),))
sys
.
stdout
.
flush
()
p
.
disconnect
()
sys
.
exit
(
0
)
except
:
p
.
disconnect
()
printrun/core.py
→
printrun/
print
core.py
View file @
9a453bf8
...
@@ -20,7 +20,6 @@ from select import error as SelectError
...
@@ -20,7 +20,6 @@ from select import error as SelectError
from
threading
import
Thread
,
Lock
from
threading
import
Thread
,
Lock
from
Queue
import
Queue
,
Empty
as
QueueEmpty
from
Queue
import
Queue
,
Empty
as
QueueEmpty
import
time
import
time
import
getopt
import
sys
import
sys
import
platform
import
platform
import
os
import
os
...
@@ -31,7 +30,6 @@ import re
...
@@ -31,7 +30,6 @@ import re
from
functools
import
wraps
from
functools
import
wraps
from
collections
import
deque
from
collections
import
deque
from
printrun.GCodeAnalyzer
import
GCodeAnalyzer
from
printrun.GCodeAnalyzer
import
GCodeAnalyzer
from
printrun
import
gcoder
from
printrun.printrun_utils
import
install_locale
from
printrun.printrun_utils
import
install_locale
install_locale
(
'pronterface'
)
install_locale
(
'pronterface'
)
...
@@ -571,57 +569,3 @@ class printcore():
...
@@ -571,57 +569,3 @@ class printcore():
except
RuntimeError
as
e
:
except
RuntimeError
as
e
:
print
_
(
"Socket connection broken, disconnected. ({0}): {1}"
)
.
format
(
e
.
errno
,
e
.
strerror
)
print
_
(
"Socket connection broken, disconnected. ({0}): {1}"
)
.
format
(
e
.
errno
,
e
.
strerror
)
self
.
writefailures
+=
1
self
.
writefailures
+=
1
if
__name__
==
'__main__'
:
baud
=
115200
loud
=
False
statusreport
=
False
try
:
opts
,
args
=
getopt
.
getopt
(
sys
.
argv
[
1
:],
"h,b:,v,s"
,
[
"help"
,
"baud"
,
"verbose"
,
"statusreport"
])
except
getopt
.
GetoptError
,
err
:
print
str
(
err
)
sys
.
exit
(
2
)
for
o
,
a
in
opts
:
if
o
in
(
'-h'
,
'--help'
):
# FIXME: Fix help
print
"Opts are: --help, -b --baud = baudrate, -v --verbose,
\
-s --statusreport"
sys
.
exit
(
1
)
if
o
in
(
'-b'
,
'--baud'
):
baud
=
int
(
a
)
if
o
in
(
'-v'
,
'--verbose'
):
loud
=
True
elif
o
in
(
'-s'
,
'--statusreport'
):
statusreport
=
True
if
len
(
args
)
>
1
:
port
=
args
[
-
2
]
filename
=
args
[
-
1
]
print
"Printing:
%
s on
%
s with baudrate
%
d"
%
(
filename
,
port
,
baud
)
else
:
print
"Usage: python [-h|-b|-v|-s] printcore.py /dev/tty[USB|ACM]x filename.gcode"
sys
.
exit
(
2
)
p
=
printcore
(
port
,
baud
)
p
.
loud
=
loud
time
.
sleep
(
2
)
gcode
=
[
i
.
strip
()
for
i
in
open
(
filename
)]
gcode
=
gcoder
.
GCode
(
gcode
)
p
.
startprint
(
gcode
)
try
:
if
statusreport
:
p
.
loud
=
False
sys
.
stdout
.
write
(
"Progress: 00.0
%
\r
"
)
sys
.
stdout
.
flush
()
while
p
.
printing
:
time
.
sleep
(
1
)
if
statusreport
:
sys
.
stdout
.
write
(
"Progress:
%02.1
f
%%
\r
"
%
(
100
*
float
(
p
.
queueindex
)
/
len
(
p
.
mainqueue
),))
sys
.
stdout
.
flush
()
p
.
disconnect
()
sys
.
exit
(
0
)
except
:
p
.
disconnect
()
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