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
1dfb0cd6
Commit
1dfb0cd6
authored
May 18, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup pronsole._do_load and parse gcode from there
parent
16208aec
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
pronsole.py
pronsole.py
+12
-9
pronterface.py
pronterface.py
+1
-1
No files found.
pronsole.py
View file @
1dfb0cd6
...
@@ -24,6 +24,7 @@ import argparse
...
@@ -24,6 +24,7 @@ import argparse
import
printcore
import
printcore
from
printrun.printrun_utils
import
install_locale
from
printrun.printrun_utils
import
install_locale
from
printrun
import
gcoder
install_locale
(
'pronterface'
)
install_locale
(
'pronterface'
)
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
...
@@ -146,6 +147,7 @@ class pronsole(cmd.Cmd):
...
@@ -146,6 +147,7 @@ class pronsole(cmd.Cmd):
self
.
in_macro
=
False
self
.
in_macro
=
False
self
.
p
.
onlinecb
=
self
.
online
self
.
p
.
onlinecb
=
self
.
online
self
.
f
=
None
self
.
f
=
None
self
.
fgcode
=
None
self
.
listing
=
0
self
.
listing
=
0
self
.
sdfiles
=
[]
self
.
sdfiles
=
[]
self
.
paused
=
False
self
.
paused
=
False
...
@@ -581,20 +583,21 @@ class pronsole(cmd.Cmd):
...
@@ -581,20 +583,21 @@ class pronsole(cmd.Cmd):
def
help_disconnect
(
self
):
def
help_disconnect
(
self
):
self
.
log
(
"Disconnects from the printer"
)
self
.
log
(
"Disconnects from the printer"
)
def
do_load
(
self
,
l
):
def
do_load
(
self
,
filename
):
self
.
_do_load
(
l
)
self
.
_do_load
(
filename
)
def
_do_load
(
self
,
l
):
def
_do_load
(
self
,
filename
):
if
len
(
l
)
==
0
:
if
not
filename
:
self
.
log
(
"No file name given."
)
self
.
log
(
"No file name given."
)
return
return
self
.
log
(
"Loading file:"
+
l
)
self
.
log
(
"Loading file:"
+
filename
)
if
not
(
os
.
path
.
exists
(
l
)
):
if
not
os
.
path
.
exists
(
filename
):
self
.
log
(
"File not found!"
)
self
.
log
(
"File not found!"
)
return
return
self
.
f
=
[
i
.
replace
(
"
\n
"
,
""
)
.
replace
(
"
\r
"
,
""
)
for
i
in
open
(
l
)]
self
.
f
=
[
line
.
strip
()
for
line
in
open
(
filename
)]
self
.
filename
=
l
self
.
fgcode
=
gcoder
.
GCode
(
self
.
f
)
self
.
log
(
"Loaded "
,
l
,
", "
,
len
(
self
.
f
),
" lines."
)
self
.
filename
=
filename
self
.
log
(
"Loaded
%
s,
%
d lines."
%
(
filename
,
len
(
self
.
f
)))
def
complete_load
(
self
,
text
,
line
,
begidx
,
endidx
):
def
complete_load
(
self
,
text
,
line
,
begidx
,
endidx
):
s
=
line
.
split
()
s
=
line
.
split
()
...
...
pronterface.py
View file @
1dfb0cd6
...
@@ -1311,7 +1311,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
...
@@ -1311,7 +1311,7 @@ class PronterWindow(MainWindow, pronsole.pronsole):
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
threading
.
Thread
(
target
=
self
.
loadviz
)
.
start
()
def
loadviz
(
self
):
def
loadviz
(
self
):
gcode
=
gcoder
.
GCode
(
self
.
f
)
gcode
=
self
.
fgcode
gcode
.
measure
()
gcode
.
measure
()
print
gcode
.
filament_length
(),
_
(
"mm of filament used in this print
\n
"
)
print
gcode
.
filament_length
(),
_
(
"mm of filament used in this print
\n
"
)
print
_
(
"the print goes from
%
f mm to
%
f mm in X
\n
and is
%
f mm wide
\n
"
)
%
(
gcode
.
xmin
,
gcode
.
xmax
,
gcode
.
width
)
print
_
(
"the print goes from
%
f mm to
%
f mm in X
\n
and is
%
f mm wide
\n
"
)
%
(
gcode
.
xmin
,
gcode
.
xmax
,
gcode
.
width
)
...
...
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