Commit 00e43ae9 authored by D1plo1d's avatar D1plo1d

Refactoring set temp to work with the prontserve logError exceptions

parent c942bc6e
...@@ -1082,11 +1082,15 @@ class pronsole(cmd.Cmd): ...@@ -1082,11 +1082,15 @@ class pronsole(cmd.Cmd):
self.log(_("Read the extruder and bed temperature.")) self.log(_("Read the extruder and bed temperature."))
def do_settemp(self, l): def do_settemp(self, l):
try:
l = l.lower().replace(", ",".") l = l.lower().replace(", ",".")
for i in self.temps.keys(): for i in self.temps.keys():
l = l.replace(i, self.temps[i]) l = l.replace(i, self.temps[i])
try:
f = float(l) f = float(l)
except:
self.logError(_("You must enter a temperature."))
return
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
...@@ -1099,8 +1103,6 @@ class pronsole(cmd.Cmd): ...@@ -1099,8 +1103,6 @@ class pronsole(cmd.Cmd):
self.logError(_("Printer is not online.")) self.logError(_("Printer is not online."))
else: else:
self.logError(_("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0.")) self.logError(_("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."))
except:
self.logError(_("You must enter a temperature."))
def help_settemp(self): def help_settemp(self):
self.log(_("Sets the hotend temperature to the value entered.")) self.log(_("Sets the hotend temperature to the value entered."))
......
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