Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from enum import Enum, unique
- @unique
- class State(Enum):
- """Definition of the current state"""
- unknown = 1
- ok = 2
- working = 3
- disconnect = 4
- error = 5
- style = {ok: "background-color: rgba(0, 255, 0, 200);",
- working: "background-color: rgb(237, 145, 53, 200);",
- disconnect: "background-color: rgba(0, 0, 255, 200);",
- error: "background-color: rgba(255, 0, 0, 200);",
- unknown: "background-color: rgba(125, 125, 125, 200);"}
- text = {ok: "OK",
- working: "WORKING",
- disconnect: "DISCONNECT",
- error: "ERROR",
- unknown: "UNKNOWN"}
- def get_stylesheet(self):
- """
- """
- try:
- return self.style[self.value]
- except TypeError as e:
- for key, value in list(self.style.items()):
- print("{}: {}".format(key, value))
- print(self.value)
- return "background-color: rgba(255, 255, 255, 200);"
- def get_text(self):
- """
- """
- try:
- return State.text[self.value]
- except TypeError as e:
- return "WHAT"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement