Commit d3b4bc34 authored by Guillaume Seguin's avatar Guillaume Seguin

Merge pull request #410 from funflin/master

Cleanup whitespaces
parents 5f043f94 c45b2b60
...@@ -94,7 +94,7 @@ class printcore(): ...@@ -94,7 +94,7 @@ class printcore():
self.xy_feedrate = None self.xy_feedrate = None
self.z_feedrate = None self.z_feedrate = None
self.pronterface = None self.pronterface = None
@locked @locked
def disconnect(self): def disconnect(self):
"""Disconnects from printer and pauses the print """Disconnects from printer and pauses the print
...@@ -333,7 +333,7 @@ class printcore(): ...@@ -333,7 +333,7 @@ class printcore():
self.print_thread.start() self.print_thread.start()
return True return True
# run a simple script if it exists, no multithreading # run a simple script if it exists, no multithreading
def runSmallScript(self, filename): def runSmallScript(self, filename):
if filename == None: return if filename == None: return
f = None f = None
...@@ -348,22 +348,22 @@ class printcore(): ...@@ -348,22 +348,22 @@ class printcore():
l = l[:l.find(";")] #remove comment l = l[:l.find(";")] #remove comment
self.send_now(l) self.send_now(l)
f.close() f.close()
def pause(self): def pause(self):
"""Pauses the print, saving the current position. """Pauses the print, saving the current position.
""" """
if not self.printing: return False if not self.printing: return False
self.paused = True self.paused = True
self.printing = False self.printing = False
# try joining the print thread: enclose it in try/except because we might be calling it from the thread itself # try joining the print thread: enclose it in try/except because we might be calling it from the thread itself
try: try:
self.print_thread.join() self.print_thread.join()
except: except:
pass pass
self.print_thread = None self.print_thread = None
# saves the status # saves the status
self.pauseX = self.analyzer.x-self.analyzer.xOffset; self.pauseX = self.analyzer.x-self.analyzer.xOffset;
self.pauseY = self.analyzer.y-self.analyzer.yOffset; self.pauseY = self.analyzer.y-self.analyzer.yOffset;
...@@ -379,7 +379,7 @@ class printcore(): ...@@ -379,7 +379,7 @@ class printcore():
if self.paused: if self.paused:
#restores the status #restores the status
self.send_now("G90") # go to absolute coordinates self.send_now("G90") # go to absolute coordinates
xyFeedString = "" xyFeedString = ""
zFeedString = "" zFeedString = ""
if self.xy_feedrate != None: xyFeedString = " F" + str(self.xy_feedrate) if self.xy_feedrate != None: xyFeedString = " F" + str(self.xy_feedrate)
...@@ -388,11 +388,11 @@ class printcore(): ...@@ -388,11 +388,11 @@ class printcore():
self.send_now("G1 X" + str(self.pauseX) + " Y" + str(self.pauseY) + xyFeedString) self.send_now("G1 X" + str(self.pauseX) + " Y" + str(self.pauseY) + xyFeedString)
self.send_now("G1 Z" + str(self.pauseZ) + zFeedString) self.send_now("G1 Z" + str(self.pauseZ) + zFeedString)
self.send_now("G92 E" + str(self.pauseE)) self.send_now("G92 E" + str(self.pauseE))
if self.pauseRelative: self.send_now("G91") # go back to relative if needed if self.pauseRelative: self.send_now("G91") # go back to relative if needed
#reset old feed rate #reset old feed rate
self.send_now("G1 F" + str(self.pauseF)) self.send_now("G1 F" + str(self.pauseF))
self.paused = False self.paused = False
self.printing = True self.printing = True
self.print_thread = Thread(target = self._print, kwargs = {"resuming": True}) self.print_thread = Thread(target = self._print, kwargs = {"resuming": True})
...@@ -453,7 +453,7 @@ class printcore(): ...@@ -453,7 +453,7 @@ class printcore():
self.pronterface.pause(None) self.pronterface.pause(None)
else: else:
self.pause() self.pause()
def _sendnext(self): def _sendnext(self):
if not self.printer: if not self.printer:
return return
...@@ -497,7 +497,7 @@ class printcore(): ...@@ -497,7 +497,7 @@ class printcore():
self.queueindex += 1 self.queueindex += 1
self.clear = True self.clear = True
return return
tline = tline.split(";")[0] tline = tline.split(";")[0]
if len(tline) > 0: if len(tline) > 0:
self._send(tline, self.lineno, True) self._send(tline, self.lineno, True)
......
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