Skip to content

Commit

Permalink
Merge pull request #1287 from zauberzeug/quasar_config
Browse files Browse the repository at this point in the history
Move Quasar config to Python
  • Loading branch information
falkoschindler authored Aug 1, 2023
2 parents 56a8e9f + b17d8a4 commit 3b602ab
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
1 change: 1 addition & 0 deletions nicegui/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def build_response(self, request: Request, status_code: int = 200) -> Response:
'vue_scripts': '\n'.join(vue_scripts),
'imports': json.dumps(imports),
'js_imports': '\n'.join(js_imports),
'quasar_config': json.dumps(globals.quasar_config),
'title': self.page.resolve_title(),
'viewport': self.page.resolve_viewport(),
'favicon_url': get_favicon_url(self.page, prefix),
Expand Down
10 changes: 9 additions & 1 deletion nicegui/globals.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ class State(Enum):
socket_io_js_extra_headers: Dict = {}
endpoint_documentation: Literal['none', 'internal', 'page', 'all'] = 'none'
socket_io_js_transports: List[Literal['websocket', 'polling']] = ['websocket', 'polling']

_socket_id: Optional[str] = None
slot_stacks: Dict[int, List['Slot']] = {}
clients: Dict[str, 'Client'] = {}
index_client: 'Client'
quasar_config: Dict = {
'brand': {
'primary': '#5898d4',
},
'loadingBar': {
'color': 'primary',
'skipHijack': False,
},
}

page_routes: Dict[Callable[..., Any], str] = {}

Expand Down
9 changes: 1 addition & 8 deletions nicegui/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -308,14 +308,7 @@
}
},
}).use(Quasar, {
config: {
brand: {
primary: '#5898d4',
},
loadingBar: {
color: 'primary'
},
}
config: {{ quasar_config | safe }}
});

{{ js_imports | safe }}
Expand Down

0 comments on commit 3b602ab

Please sign in to comment.