S
Solara

general

Thanks how could I programatically set

TTao8/8/2023
Thanks ! how could I programatically set theme from Python side ?
MMaartenBreddels8/9/2023
ok, this is going to be messy 🙂 I suggest you open an issue or discussions so we can iron some of this.. i'm gonna give you the code, since i just arrived at a new location, and don't have much time if you have questions, i can take another look tomorrow or the day after, or @mariobuikhuizen can fill in
import ipyvuetify.Themes as themes

import solara
from solara.components.non_visual import NonVisual

dark = solara.reactive(False)

try:
# the default ctor gets in the way, we should fix
# this in ipyvuetify
del themes.Theme.__init__
except AttributeError:
pass


@solara.component
def Page():

with solara.AppBar():
solara.Button(icon_name="mdi-palette", icon=True, dark=True)
solara.Checkbox(label="Dark", value=dark)
# solara.ColorPicker()
with solara.Column():
solara.Info("This in information")
solara.Warning("This is a warning")
solara.Button("This is a button", color="primary")
with NonVisual():
# inside NonVisual we can create non-dom widget elements
themes.Theme.element(dark=dark.value)
themes.ThemeColors.element(
_theme_name="light",
primary="#f00",
secondary="#424242",
accent="#82B1FF",
error="#FF5252",
info="#2196F3",
success="#4CAF50",
warning="#FB8C00",
)
import ipyvuetify.Themes as themes

import solara
from solara.components.non_visual import NonVisual

dark = solara.reactive(False)

try:
# the default ctor gets in the way, we should fix
# this in ipyvuetify
del themes.Theme.__init__
except AttributeError:
pass


@solara.component
def Page():

with solara.AppBar():
solara.Button(icon_name="mdi-palette", icon=True, dark=True)
solara.Checkbox(label="Dark", value=dark)
# solara.ColorPicker()
with solara.Column():
solara.Info("This in information")
solara.Warning("This is a warning")
solara.Button("This is a button", color="primary")
with NonVisual():
# inside NonVisual we can create non-dom widget elements
themes.Theme.element(dark=dark.value)
themes.ThemeColors.element(
_theme_name="light",
primary="#f00",
secondary="#424242",
accent="#82B1FF",
error="#FF5252",
info="#2196F3",
success="#4CAF50",
warning="#FB8C00",
)
this needs NonVisual.. which is
from typing import Callable, Dict, Optional, Tuple, cast

import ipyvuetify as vy
import ipywidgets as widgets
import reacton.core
import traitlets

import solara
import solara.lab


class NonVisualWidget(vy.VuetifyTemplate):
template_file = (__file__, "non_visual.vue")
children = traitlets.List().tag(sync=True, **widgets.widget_serialization)


@solara.component
def NonVisual(children: reacton.core.Element = []):
return NonVisualWidget.element(children=children)
from typing import Callable, Dict, Optional, Tuple, cast

import ipyvuetify as vy
import ipywidgets as widgets
import reacton.core
import traitlets

import solara
import solara.lab


class NonVisualWidget(vy.VuetifyTemplate):
template_file = (__file__, "non_visual.vue")
children = traitlets.List().tag(sync=True, **widgets.widget_serialization)


@solara.component
def NonVisual(children: reacton.core.Element = []):
return NonVisualWidget.element(children=children)
<template>
<span style="display: none"></span>
</template>
<template>
<span style="display: none"></span>
</template>
(last file is non_visual.vue) quick and dirty, but it works

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
it seems to be functional not sure Iit seems to be functional. not sure I understand the downside of my current approach. but fixing any3 what s the best way to implement `push3. what's the best way to implement `push notification` ? is it something like this ? and is it run 2 when I create a module level reactive2. when I create a module level reactive var like `x = solara.reactive(None)`, is it application widcouple of questions around sessioncouple of questions around session management: 1. I found Solara manages session via cookie which isI m not sure what you mean but changingI'm not exactly sure what you mean, but changing the value from the backend would look something likhey solara team looking into statehey solara team looking into state documentation. It seems solara.reactive is session based as in ifhope to know when we will get this fixedhope to know when we will get this fixed. I am developing some demo with Solara and don't want to seThe timer thread is an infinte loop ThatThe timer thread is an infinte loop. That's the only loop I know of. And the timer isn't a problem I m trying to run Solara as Embedding inI'm trying to run Solara as "Embedding in an existing Starlette application" and when I go to `/solaAren't all these the responsibility of the browser to fetch stuff from the CDN?Good afternoon! Can Solara run on a read-only file system? I tried running it on AWS Lambda and it cwhat did you use for thatwhat did you use for that?btw working with Layout and routes was abtw, working with Layout and routes was a pain in my case. One problem was it didn't use the LayoQuestion regarding the `component vue` IQuestion regarding the `component_vue` - I'm trying to create a Box component that will auto scroHi I’ve been trying to add backgroundHi. I’ve been trying to add background image to my page. I created a CSS.py script which contain a tAnother question I m trying to attachAnother question, I'm trying to attach `keydown` listener to TextArea (so that I can submit when "EnI m using IntelliJI'm using IntelliJ`````` from typing import List, cast import plotly import solara df = plotly.data.gapminder() columnNo error populates to python itself butNo error populates to python itself, but I get a bunch in console. I ran into a similar issue when tDeploy beta testersPretty quiet this week on core solara this week, but @mariobuikhuizen and I have been working on a whttps panel holoviz org gallery glaciershttps://panel.holoviz.org/gallery/glaciers.html I want to open files into Xarray datasets, rasteriz