-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathuicard.py
77 lines (68 loc) · 2.68 KB
/
uicard.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# definition of the ui cards
#import os, copy
#import pandas as pd
#from trame.app import get_server
#from trame.ui.vuetify import SinglePageWithDrawerLayout
#from trame.ui.vuetify import SinglePageLayout
from trame.widgets import vuetify
from trame.app import get_server
server = get_server(client_type='vue2')
#state, ctrl = server.state, server.controller
# Logging function
from logger import log
# Main definition of the card for all gittree items.
# note that "active_ui" points to a state change
# the active_ui is set in the main su2gui in def actives_change(ids)
def ui_card(title, ui_name):
log("info", f"##### def ui_card = {ui_name}")
with vuetify.VCard(v_show=f"active_ui == '{ui_name}'"):
vuetify.VCardTitle(
title,
classes="grey lighten-1 py-1 grey--text text--darken-3",
style="user-select: none; cursor: pointer",
hide_details=True,
dense=True,
)
content = vuetify.VCardText(classes="py-2")
return content
# subcard, appearing below the main card. Visible depending on the
# selection in the main card
# note that "active_sub_ui" points to a state change
def ui_subcard(title, sub_ui_name):
log("info", f"##### def ui_subcard = {sub_ui_name}")
with vuetify.VCard(v_show=f"active_sub_ui == '{sub_ui_name}'"):
vuetify.VCardTitle(
title,
classes="grey lighten-1 py-1 grey--text text--darken-3",
style="user-select: none; cursor: pointer",
hide_details=True,
dense=True,
)
content = vuetify.VCardText(classes="py-2")
return content
# show the card only for children of a head/parent node
def ui_card_children_only(title, parent_ui_name):
log("info", f"##### def ui_card_children_only = {parent_ui_name}")
with vuetify.VCard(v_show=f"active_parent_ui == '{parent_ui_name}'"):
vuetify.VCardTitle(
title,
classes="grey lighten-1 py-1 grey--text text--darken-3",
style="user-select: none; cursor: pointer",
hide_details=True,
dense=True,
)
content = vuetify.VCardText(classes="py-2")
return content
# show the card only for head/parent node
def ui_card_parent_only(title, parent_ui_name):
log("info", f"##### def ui_card_parent_only = {parent_ui_name}")
with vuetify.VCard(v_show=f"active_head_ui == '{parent_ui_name}'"):
vuetify.VCardTitle(
title,
classes="grey lighten-1 py-1 grey--text text--darken-3",
style="user-select: none; cursor: pointer",
hide_details=True,
dense=True,
)
content = vuetify.VCardText(classes="py-2")
return content