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
197f0ac1
Commit
197f0ac1
authored
Feb 13, 2013
by
kliment
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #330 from colah/confirmation
Confirmation on exit
parents
9f0cabae
c20b270b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
3 deletions
+22
-3
pronsole.py
pronsole.py
+22
-3
No files found.
pronsole.py
View file @
197f0ac1
...
...
@@ -131,6 +131,14 @@ def estimate_duration(g):
#print "Total Duration: " #, time.strftime('%H:%M:%S', time.gmtime(totalduration))
return
"{0:d} layers, "
.
format
(
int
(
layercount
))
+
str
(
datetime
.
timedelta
(
seconds
=
int
(
totalduration
)))
def
confirm
():
y_or_n
=
raw_input
(
"y/n: "
)
if
y_or_n
==
"y"
:
return
True
elif
y_or_n
!=
"n"
:
return
confirm
()
return
False
class
Settings
:
#def _temperature_alias(self): return {"pla":210, "abs":230, "off":0}
#def _temperature_validate(self, v):
...
...
@@ -956,6 +964,10 @@ class pronsole(cmd.Cmd):
l
=
l
.
replace
(
i
,
self
.
temps
[
i
])
f
=
float
(
l
)
if
f
>=
0
:
if
f
>
250
:
print
f
,
" is a high temperature to set your extruder to. Are you sure you want to do that?"
if
not
confirm
():
return
if
self
.
p
.
online
:
self
.
p
.
send_now
(
"M104 S"
+
l
)
print
"Setting hotend temperature to "
,
f
,
" degrees Celsius."
...
...
@@ -1140,8 +1152,14 @@ class pronsole(cmd.Cmd):
print
"Setting bed temp to 0"
self
.
p
.
send_now
(
"M140 S0.0"
)
print
"Disconnecting from printer..."
self
.
p
.
disconnect
()
print
self
.
p
.
printing
if
self
.
p
.
printing
:
print
"Are you sure you want to exit while printing?"
print
"(this will terminate the print)."
if
not
confirm
():
return
False
print
"Exiting program. Goodbye!"
self
.
p
.
disconnect
()
return
True
def
help_exit
(
self
):
...
...
@@ -1331,7 +1349,8 @@ class pronsole(cmd.Cmd):
line
=
raw_input
(
self
.
prompt
)
except
EOFError
:
print
""
self
.
do_exit
(
""
)
should_exit
=
self
.
do_exit
(
""
)
if
should_exit
:
exit
()
except
KeyboardInterrupt
:
print
""
...
...
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