Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/kliment/Printrun.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorD1plo1d <d1plo1d@d1plo1d.com>2013-06-11 06:34:33 +0400
committerD1plo1d <d1plo1d@d1plo1d.com>2013-06-11 06:34:33 +0400
commit00e43ae9cfe7be617ef7f49c5e3610de4fac24f2 (patch)
tree68cbf18547ed921bcff8620a507400bfd95a5130 /pronsole.py
parentc942bc6ebff2de9d77a7e9810ff872fb0d83190f (diff)
Refactoring set temp to work with the prontserve logError exceptions
Diffstat (limited to 'pronsole.py')
-rwxr-xr-xpronsole.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/pronsole.py b/pronsole.py
index af41705..b71f4fc 100755
--- a/pronsole.py
+++ b/pronsole.py
@@ -1082,25 +1082,27 @@ class pronsole(cmd.Cmd):
self.log(_("Read the extruder and bed temperature."))
def do_settemp(self, l):
+ l = l.lower().replace(", ",".")
+ for i in self.temps.keys():
+ l = l.replace(i, self.temps[i])
try:
- l = l.lower().replace(", ",".")
- for i in self.temps.keys():
- l = l.replace(i, self.temps[i])
- f = float(l)
- if f>=0:
- if f > 250:
- print _("%s is a high temperature to set your extruder to. Are you sure you want to do that?") % f
- if not confirm():
- return
- if self.p.online:
- self.p.send_now("M104 S"+l)
- self.log(_("Setting hotend temperature to %s degrees Celsius.") % f)
- else:
- self.logError(_("Printer is not online."))
- else:
- self.logError(_("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."))
+ f = float(l)
except:
self.logError(_("You must enter a temperature."))
+ return
+
+ if f>=0:
+ if f > 250:
+ print _("%s is a high temperature to set your extruder to. Are you sure you want to do that?") % f
+ if not confirm():
+ return
+ if self.p.online:
+ self.p.send_now("M104 S"+l)
+ self.log(_("Setting hotend temperature to %s degrees Celsius.") % f)
+ else:
+ self.logError(_("Printer is not online."))
+ else:
+ self.logError(_("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0."))
def help_settemp(self):
self.log(_("Sets the hotend temperature to the value entered."))