Commit 037708c6 authored by D1plo1d's avatar D1plo1d

Overriding confirm in prontserve so that it doesn't become unresponsive. It...

Overriding confirm in prontserve so that it doesn't become unresponsive. It doesn't prompt the user like pronsole but it at least functions.
parent 00e43ae9
...@@ -49,14 +49,6 @@ except: ...@@ -49,14 +49,6 @@ except:
def dosify(name): def dosify(name):
return os.path.split(name)[1].split(".")[0][:8]+".g" return os.path.split(name)[1].split(".")[0][:8]+".g"
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
def setting_add_tooltip(func): def setting_add_tooltip(func):
@wraps(func) @wraps(func)
def decorator(self, *args, **kwargs): def decorator(self, *args, **kwargs):
...@@ -387,6 +379,14 @@ class pronsole(cmd.Cmd): ...@@ -387,6 +379,14 @@ class pronsole(cmd.Cmd):
"macro" : "%(bold)s..>%(normal)s ", "macro" : "%(bold)s..>%(normal)s ",
"online" : "%(bold)sT:%(extruder_temp_fancy)s %(progress_fancy)s >%(normal)s "} "online" : "%(bold)sT:%(extruder_temp_fancy)s %(progress_fancy)s >%(normal)s "}
def confirm(self):
y_or_n = raw_input("y/n: ")
if y_or_n == "y":
return True
elif y_or_n != "n":
return self.confirm()
return False
def log(self, *msg): def log(self, *msg):
print u"".join(unicode(i) for i in msg) print u"".join(unicode(i) for i in msg)
...@@ -1094,7 +1094,7 @@ class pronsole(cmd.Cmd): ...@@ -1094,7 +1094,7 @@ class pronsole(cmd.Cmd):
if f>=0: if f>=0:
if f > 250: if f > 250:
print _("%s is a high temperature to set your extruder to. Are you sure you want to do that?") % f print _("%s is a high temperature to set your extruder to. Are you sure you want to do that?") % f
if not confirm(): if not self.confirm():
return return
if self.p.online: if self.p.online:
self.p.send_now("M104 S"+l) self.p.send_now("M104 S"+l)
...@@ -1281,7 +1281,7 @@ class pronsole(cmd.Cmd): ...@@ -1281,7 +1281,7 @@ class pronsole(cmd.Cmd):
if self.p.printing: if self.p.printing:
print "Are you sure you want to exit while printing?" print "Are you sure you want to exit while printing?"
print "(this will terminate the print)." print "(this will terminate the print)."
if not confirm(): if not self.confirm():
return False return False
self.log(_("Exiting program. Goodbye!")) self.log(_("Exiting program. Goodbye!"))
self.p.disconnect() self.p.disconnect()
......
...@@ -467,6 +467,9 @@ class Prontserve(pronsole.pronsole, EventEmitter): ...@@ -467,6 +467,9 @@ class Prontserve(pronsole.pronsole, EventEmitter):
def write_prompt(self): def write_prompt(self):
None None
def confirm(self):
True
class PrintJobQueue(EventEmitter): class PrintJobQueue(EventEmitter):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment