mirror of
https://github.com/rio-labs/rio.git
synced 2026-02-12 16:48:59 -06:00
Merge pull request #288 from ilya-pevzner/on-resize
a minor fix and a build speedup
This commit is contained in:
@@ -126,7 +126,7 @@ PYTHONPATH = "."
|
||||
[[tool.hatch.build.hooks.build-scripts.scripts]]
|
||||
commands = [
|
||||
"npm install",
|
||||
"uvx --with-requirements pyproject.toml python -m scripts.build",
|
||||
"uvx python -m scripts.build",
|
||||
]
|
||||
|
||||
[tool.ruff]
|
||||
|
||||
10
rio/app.py
10
rio/app.py
@@ -431,7 +431,7 @@ class App:
|
||||
|
||||
# Nope, get it
|
||||
try:
|
||||
icon_blob, _ = await self._icon.fetch_as_bytes()
|
||||
icon_blob = await self._icon.fetch_as_bytes()
|
||||
|
||||
input_buffer = io.BytesIO(icon_blob)
|
||||
output_buffer = io.BytesIO()
|
||||
@@ -442,17 +442,17 @@ class App:
|
||||
self._icon_as_png_blob = output_buffer.getvalue()
|
||||
|
||||
# Loading has failed. Use the default icon.
|
||||
except Exception:
|
||||
except Exception as e:
|
||||
if isinstance(self._icon, assets.PathAsset):
|
||||
logging.error(
|
||||
f"Could not fetch the app's icon from {self._icon.path.absolute()}"
|
||||
f"Could not fetch the app's icon from {self._icon.path.absolute()}: {e}"
|
||||
)
|
||||
elif isinstance(self._icon, assets.UrlAsset):
|
||||
logging.error(
|
||||
f"Could not fetch the app's icon from {self._icon.url}"
|
||||
f"Could not fetch the app's icon from {self._icon.url}: {e}"
|
||||
)
|
||||
else:
|
||||
logging.error("Could not fetch the app's icon")
|
||||
logging.error(f"Could not fetch the app's icon: {e}")
|
||||
|
||||
assert DEFAULT_ICON_PATH.suffix == ".png", (
|
||||
"The default icon must be PNG"
|
||||
|
||||
@@ -3883,13 +3883,14 @@ a.remove();
|
||||
"""
|
||||
Called by the client when a component is resized.
|
||||
"""
|
||||
component = self._weak_components_by_id[component_id]
|
||||
resize_event = rio.ComponentResizeEvent(new_width, new_height)
|
||||
component = self._weak_components_by_id.get(component_id)
|
||||
if component:
|
||||
resize_event = rio.ComponentResizeEvent(new_width, new_height)
|
||||
|
||||
for handler, _ in component._rio_event_handlers_[
|
||||
rio.event.EventTag.ON_RESIZE
|
||||
]:
|
||||
self._call_event_handler_sync(handler, component, resize_event)
|
||||
for handler, _ in component._rio_event_handlers_[
|
||||
rio.event.EventTag.ON_RESIZE
|
||||
]:
|
||||
self._call_event_handler_sync(handler, component, resize_event)
|
||||
|
||||
@unicall.local(name="onFullscreenChange")
|
||||
async def _on_fullscreen_change(self, fullscreen: bool) -> None:
|
||||
|
||||
Reference in New Issue
Block a user