return code colouring
This commit is contained in:
parent
7ca69fdb24
commit
ae169fa9f5
2 changed files with 7 additions and 8 deletions
|
@ -12,17 +12,14 @@ selected = []
|
|||
|
||||
[[arguments]]
|
||||
name = "name"
|
||||
enabled = true
|
||||
enabled = false
|
||||
inline = true
|
||||
boolean = false
|
||||
options = [
|
||||
"gui.py",
|
||||
"nonexistent.py",
|
||||
"test",
|
||||
"meer",
|
||||
]
|
||||
selected = [
|
||||
"gui.py",
|
||||
"nonexistent.py",
|
||||
]
|
||||
|
||||
[environment]
|
||||
|
|
|
@ -289,10 +289,12 @@ class SubprocessUI:
|
|||
|
||||
@ui.refreshable_method
|
||||
def ui(self):
|
||||
card_class = "bg-teal" if self.sc.is_running() else ("bg-warning" if self.sc.return_code() and math.abs(self.sc.return_code()) != 15 else "bg-gray")
|
||||
exit_code = self.sc.return_code()
|
||||
erroneous_exit = exit_code and abs(exit_code) != 15
|
||||
card_class = "bg-teal" if self.sc.is_running() else ("bg-warning" if erroneous_exit else "bg-gray")
|
||||
with ui.card().classes(card_class):
|
||||
with ui.row(align_items="stretch").classes('w-full'):
|
||||
if self.sc.return_code():
|
||||
if erroneous_exit:
|
||||
ui.label(f'⚠').classes('text-h5')
|
||||
|
||||
ui.label(f'{self.sc.name}').tooltip(str(self.sc.filename)).classes('text-h5')
|
||||
|
@ -303,7 +305,7 @@ class SubprocessUI:
|
|||
ui.button('↺', on_click=self.sc.restart, color='red' if self.sc.is_stale() else "primary")
|
||||
|
||||
|
||||
ui.label(f'Running: {self.sc.is_running()}' + f"({self.sc.return_code()})")
|
||||
ui.label(f'Running: {self.sc.is_running()}' + (f" ({self.sc.return_code()})" if self.sc.return_code() is not None else ""))
|
||||
ui.code(f'{" ".join(self.sc.cmd)}')
|
||||
ui.code(self.sc.as_bash_string())
|
||||
ui.separator()
|
||||
|
|
Loading…
Reference in a new issue