small improvements in octoprint plugin
* octoprint sometimes returns additional information a the 3d printer is offline. so, it's better to check if the octoprint job state starts with "Offline". * in case the returned job state is really long, truncate it.
This commit is contained in:
parent
58bbcf2ac5
commit
c339a16365
1 changed files with 9 additions and 2 deletions
|
@ -85,8 +85,15 @@ class Module(core.module.Module):
|
||||||
core.input.register(self, button=core.input.LEFT_MOUSE, cmd=self.__show_popup)
|
core.input.register(self, button=core.input.LEFT_MOUSE, cmd=self.__show_popup)
|
||||||
|
|
||||||
def octoprint_status(self, widget):
|
def octoprint_status(self, widget):
|
||||||
if self.__octoprint_state == "Offline" or self.__octoprint_state == "Unknown":
|
if (
|
||||||
return self.__octoprint_state
|
self.__octoprint_state.startswith("Offline")
|
||||||
|
or self.__octoprint_state == "Unknown"
|
||||||
|
):
|
||||||
|
return (
|
||||||
|
(self.__octoprint_state[:25] + "...")
|
||||||
|
if len(self.__octoprint_state) > 25
|
||||||
|
else self.__octoprint_state
|
||||||
|
)
|
||||||
return (
|
return (
|
||||||
self.__octoprint_state
|
self.__octoprint_state
|
||||||
+ " | B: "
|
+ " | B: "
|
||||||
|
|
Loading…
Reference in a new issue