You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

78 lines
2.1 KiB
Python

4 months ago
from __future__ import annotations
from pathlib import Path
from typing import * # type: ignore
import rio
from . import pages
from . import components as comps
from db_classes import *
# Define a theme for Rio to use.
#
# You can modify the colors here to adapt the appearance of your app or website.
# The most important parameters are listed, but more are available! You can find
# them all in the docs
#
# https://rio.dev/docs/api/theme
theme = rio.Theme.from_colors(
secondary_color=rio.Color.from_hex("004990ff"),
primary_color=rio.Color.from_hex("004990ff"),
neutral_color=rio.Color.from_hex("b1cad8FF"),
light=True,
)
init()
# Create a dataclass that inherits from rio.UserSettings. This indicates to
# Rio that these are settings and should be persisted.
# Create the Rio app
app = rio.App(
name='Inventory',
default_attachments=[
comps.Settings(),
],
pages=[
rio.ComponentPage(
4 months ago
name="Home",
url_segment='',
4 months ago
build=pages.BrowsePage,
),
rio.ComponentPage(
name="SettingsPage",
url_segment='settings-page',
build=pages.SettingsPage,
4 months ago
),
rio.ComponentPage(
4 months ago
name="AddPage",
url_segment='add',
4 months ago
build=pages.AddPage,
),
rio.ComponentPage(
name="AddLocationPage",
url_segment='addlocation',
build=pages.AddLocationPage,
),
rio.ComponentPage(
4 months ago
name="ItemPage",
url_segment='item',
4 months ago
build=pages.ItemPage,
),
],
# You can optionally provide a root component for the app. By default,
# a simple `rio.PageView` is used. By providing your own component, you
# can create components which stay put while the user navigates between
# pages, such as a navigation bar or footer.
#
# When you do this, make sure your component contains a `rio.PageView`
# so the currently active page is still visible.
build=pages.RootPage,
theme=theme,
assets_dir=Path(__file__).parent / "assets",
)