My plugin triggers different light signals depending on the printers status e.g White light on when connected, dimmed while printing, green on print complete etc.
I am adding a feature to allow users to add additional signals for any other state they are interested in. It would make the users life easier if i could present them with a select box instead of requiring them to look it up then type it. I'd also like to avoid, if possible, hardcoding the possible states manually from the list in the documentation.
So as per the title, is there a way to pull a list of available printer states programatically?
Dear Gina,
is there a state-documentation where I can see how the state is changing on which conditions from each other?
And when I look to code in comm.py:
if state == self.STATE_NONE:
return "Offline"
elif state == self.STATE_OPEN_SERIAL:
return "Opening serial connection"
elif state == self.STATE_DETECT_SERIAL:
return "Detecting serial connection"
elif state == self.STATE_CONNECTING:
return "Connecting"
elif state == self.STATE_OPERATIONAL:
return "Operational"
elif state == self.STATE_STARTING:
if self.isSdFileSelected():
return "Starting print from SD"
elif self.isStreaming():
return "Starting to send file to SD"
else:
return "Starting"
elif state == self.STATE_PRINTING:
if self.isSdFileSelected():
return "Printing from SD"
elif self.isStreaming():
return "Sending file to SD"
else:
return "Printing"
elif state == self.STATE_CANCELLING:
return "Cancelling"
elif state == self.STATE_PAUSING:
return "Pausing"
elif state == self.STATE_PAUSED:
return "Paused"
elif state == self.STATE_RESUMING:
return "Resuming"
elif state == self.STATE_FINISHING:
return "Finishing"
elif state == self.STATE_CLOSED:
return "Offline"
elif state == self.STATE_ERROR:
return "Error"
elif state == self.STATE_CLOSED_WITH_ERROR:
return "Offline after error"
elif state == self.STATE_TRANSFERING_FILE:
return "Transferring file to SD"
return "Unknown State ({})".format(self._state)
what is differnce between STATE_TRANSFERING_FILE and STATE_PRINTING && is.streaming? (near line 930)
br Thomas