Update eggbot.py

Closes #133
pull/134/head
Windell Oskay 2020-04-11 17:22:23 -07:00
rodzic c24a2f352d
commit f412b1ef90
1 zmienionych plików z 8 dodań i 8 usunięć

Wyświetl plik

@ -190,14 +190,14 @@ class EggBot(inkex.Effect):
self.options.setupType = self.options.setupType.strip("\"")
self.options.manualType = self.options.manualType.strip("\"")
if self.options.tab in ['"Help"', '"options"', '"timing"']:
if self.options.tab in ["Help", "options", "timing"]:
pass
else:
self.serialPort = ebb_serial.openPort()
if self.serialPort is None:
inkex.errormsg(gettext.gettext("Failed to connect to EggBot. :("))
if self.options.tab == '"splash"':
if self.options.tab == "splash":
self.allLayers = True
self.plotCurrentLayer = True
self.svgNodeCount = 0
@ -206,7 +206,7 @@ class EggBot(inkex.Effect):
self.svgLayer = 12345 # indicate that we are plotting all layers.
self.plotToEggBot()
elif self.options.tab == '"resume"':
elif self.options.tab == "resume":
unused_button = ebb_motion.QueryPRGButton(self.serialPort) # Query if button pressed
self.resumePlotSetup()
if self.resumeMode:
@ -216,7 +216,7 @@ class EggBot(inkex.Effect):
else:
inkex.errormsg(gettext.gettext("Truly sorry, there does not seem to be any in-progress plot to resume."))
elif self.options.tab == '"layers"':
elif self.options.tab == "layers":
self.allLayers = False
self.plotCurrentLayer = False
self.LayersPlotted = 0
@ -228,10 +228,10 @@ class EggBot(inkex.Effect):
if self.LayersPlotted == 0:
inkex.errormsg(gettext.gettext("Truly sorry, but I did not find any numbered layers to plot."))
elif self.options.tab == '"setup"':
elif self.options.tab == "setup":
self.setupCommand()
elif self.options.tab == '"manual"':
elif self.options.tab == "manual":
if self.options.manualType == "strip-data":
for node in self.svg.xpath('//svg:WCB', namespaces=inkex.NSS):
self.svg.remove(node)
@ -1015,7 +1015,7 @@ class EggBot(inkex.Effect):
if not self.resumeMode: # or if we're resuming.
ebb_motion.sendPenUp(self.serialPort, self.options.penUpDelay)
if self.options.penUpDelay > 15:
if self.options.tab != '"manual"':
if self.options.tab != "manual":
time.sleep(float(self.options.penUpDelay - 10) / 1000.0) # pause before issuing next command
self.bPenIsUp = True
@ -1028,7 +1028,7 @@ class EggBot(inkex.Effect):
self.engraverOn() # will check self.enableEngraver
ebb_motion.sendPenDown(self.serialPort, self.options.penDownDelay)
if self.options.penUpDelay > 15:
if self.options.tab != '"manual"':
if self.options.tab != "manual":
time.sleep(float(self.options.penDownDelay - 10) / 1000.0) # pause before issuing next command
def engraverOff(self):