-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexternal_component.py
43 lines (33 loc) · 1.18 KB
/
external_component.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
"""
(A script is imported only once, automatically, before its component is first used.)
"""
from quasargui import *
this_dir = dirname(__file__)
class MyComponent(Component):
script_sources = [join(this_dir, 'external_script.js')]
style_sources = [join(this_dir, 'external_style.css')]
defaults = {
'classes': 'my-component'
}
class MyWrappedComponent(ComponentWithModel):
script_sources = [join(this_dir, 'external_script.js')]
style_sources = [join(this_dir, 'external_style.css')]
component = 'my-custom-component'
class MySingleFileComponent(SingleFileComponent):
vue_source = join(this_dir, 'external_vue.vue')
model = Model(3)
layout = QLayout([
QPage([
MyComponent([
Heading(5, 'MyComponent', classes='q-my-sm'),
'written in python, also importing some external script.',
Div([
'value of externalValue: ',
JSRaw('externalValue'),
' (externalValue is a variable in external_script.js)'])
]),
MyWrappedComponent(model),
MySingleFileComponent(props={'value': model})
])
])
run(layout, title='External component demonstration')