Commit d26d566e authored by Guillaume Seguin's avatar Guillaume Seguin

Please flake8/pep8

parent 2a2d63c1
...@@ -68,13 +68,16 @@ class printcore(): ...@@ -68,13 +68,16 @@ class printcore():
self.baud = None self.baud = None
self.port = None self.port = None
self.analyzer = gcoder.GCode() self.analyzer = gcoder.GCode()
self.printer = None # Serial instance connected to the printer, # Serial instance connected to the printer, should be None when
# should be None when disconnected # disconnected
self.clear = 0 # clear to send, enabled after responses self.printer = None
self.online = False # The printer has responded to the initial command # clear to send, enabled after responses
# and is active # FIXME: should probably be changed to a sliding window approach
self.printing = False # is a print currently running, true if printing self.clear = 0
# , false if paused # The printer has responded to the initial command and is active
self.online = False
# is a print currently running, true if printing, false if paused
self.printing = False
self.mainqueue = None self.mainqueue = None
self.priqueue = Queue(0) self.priqueue = Queue(0)
self.queueindex = 0 self.queueindex = 0
...@@ -298,7 +301,7 @@ class printcore(): ...@@ -298,7 +301,7 @@ class printcore():
if line.startswith(tuple(self.greetings)) or line.startswith('ok'): if line.startswith(tuple(self.greetings)) or line.startswith('ok'):
self.clear = True self.clear = True
if line.startswith('ok') and "T:" in line and self.tempcb: if line.startswith('ok') and "T:" in line and self.tempcb:
#callback for temp, status, whatever # callback for temp, status, whatever
try: self.tempcb(line) try: self.tempcb(line)
except: traceback.print_exc() except: traceback.print_exc()
elif line.startswith('Error'): elif line.startswith('Error'):
...@@ -313,7 +316,6 @@ class printcore(): ...@@ -313,7 +316,6 @@ class printcore():
try: try:
toresend = int(linewords.pop(0)) toresend = int(linewords.pop(0))
self.resendfrom = toresend self.resendfrom = toresend
#print str(toresend)
break break
except: except:
pass pass
...@@ -473,7 +475,7 @@ class printcore(): ...@@ -473,7 +475,7 @@ class printcore():
self._stop_sender() self._stop_sender()
try: try:
if self.startcb: if self.startcb:
#callback for printing started # callback for printing started
try: self.startcb(resuming) try: self.startcb(resuming)
except: except:
self.logError(_("Print start callback failed with:") + self.logError(_("Print start callback failed with:") +
...@@ -484,7 +486,7 @@ class printcore(): ...@@ -484,7 +486,7 @@ class printcore():
self.log.clear() self.log.clear()
self.sent = [] self.sent = []
if self.endcb: if self.endcb:
#callback for printing done # callback for printing done
try: self.endcb() try: self.endcb()
except: except:
self.logError(_("Print end callback failed with:") + self.logError(_("Print end callback failed with:") +
......
...@@ -291,10 +291,6 @@ class BuildDimensionsSetting(wxSetting): ...@@ -291,10 +291,6 @@ class BuildDimensionsSetting(wxSetting):
self.value = "%.02fx%.02fx%.02f%+.02f%+.02f%+.02f%+.02f%+.02f%+.02f" % tuple(values) self.value = "%.02fx%.02fx%.02f%+.02f%+.02f%+.02f%+.02f%+.02f%+.02f" % tuple(values)
class Settings(object): class Settings(object):
#def _temperature_alias(self): return {"pla":210, "abs":230, "off":0}
#def _temperature_validate(self, v):
# if v < 0: raise ValueError("You cannot set negative temperatures. To turn the hotend off entirely, set its temperature to 0.")
#def _bedtemperature_alias(self): return {"pla":60, "abs":110, "off":0}
def _baudrate_list(self): return ["2400", "9600", "19200", "38400", "57600", "115200", "250000"] def _baudrate_list(self): return ["2400", "9600", "19200", "38400", "57600", "115200", "250000"]
def __init__(self, root): def __init__(self, root):
...@@ -587,7 +583,7 @@ class pronsole(cmd.Cmd): ...@@ -587,7 +583,7 @@ class pronsole(cmd.Cmd):
promptstr = self.promptstrs["online"] promptstr = self.promptstrs["online"]
else: else:
promptstr = self.promptstrs["fallback"] promptstr = self.promptstrs["fallback"]
if not "%" in promptstr: if "%" not in promptstr:
return promptstr return promptstr
else: else:
specials = {} specials = {}
...@@ -948,9 +944,9 @@ class pronsole(cmd.Cmd): ...@@ -948,9 +944,9 @@ class pronsole(cmd.Cmd):
if rci is not None: if rci is not None:
rci.close() rci.close()
rco.close() rco.close()
#if definition != "": # if definition != "":
# self.log("Saved '"+key+"' to '"+self.rc_filename+"'") # self.log("Saved '"+key+"' to '"+self.rc_filename+"'")
#else: # else:
# self.log("Removed '"+key+"' from '"+self.rc_filename+"'") # self.log("Removed '"+key+"' from '"+self.rc_filename+"'")
except Exception, e: except Exception, e:
self.logError("Saving failed for ", key + ":", str(e)) self.logError("Saving failed for ", key + ":", str(e))
...@@ -1349,7 +1345,7 @@ class pronsole(cmd.Cmd): ...@@ -1349,7 +1345,7 @@ class pronsole(cmd.Cmd):
self.log(_("Starting print")) self.log(_("Starting print"))
self.p.send_now("M24") self.p.send_now("M24")
self.sdprinting = 1 self.sdprinting = 1
#self.recvlisteners.remove(self.waitforsdresponse) # self.recvlisteners.remove(self.waitforsdresponse)
return return
if "Done printing file" in l: if "Done printing file" in l:
self.log(l) self.log(l)
...@@ -1357,7 +1353,7 @@ class pronsole(cmd.Cmd): ...@@ -1357,7 +1353,7 @@ class pronsole(cmd.Cmd):
self.recvlisteners.remove(self.waitforsdresponse) self.recvlisteners.remove(self.waitforsdresponse)
return return
if "SD printing byte" in l: if "SD printing byte" in l:
#M27 handler # M27 handler
try: try:
resp = l.split() resp = l.split()
vals = resp[-1].split("/") vals = resp[-1].split("/")
...@@ -1606,7 +1602,6 @@ class pronsole(cmd.Cmd): ...@@ -1606,7 +1602,6 @@ class pronsole(cmd.Cmd):
if self.sdprinting: if self.sdprinting:
self.p.send_now("M27") self.p.send_now("M27")
time.sleep(interval) time.sleep(interval)
#print (self.tempreadings.replace("\r", "").replace("T", "Hotend").replace("B", "Bed").replace("\n", "").replace("ok ", ""))
if self.p.printing: if self.p.printing:
preface = _("Print progress: ") preface = _("Print progress: ")
progress = 100 * float(self.p.queueindex) / len(self.p.mainqueue) progress = 100 * float(self.p.queueindex) / len(self.p.mainqueue)
......
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