|
|
|
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(
|
|
|
|
name="Home",
|
|
|
|
url_segment='',
|
|
|
|
build=pages.BrowsePage,
|
|
|
|
),
|
|
|
|
|
|
|
|
rio.ComponentPage(
|
|
|
|
name="SettingsPage",
|
|
|
|
url_segment='settings-page',
|
|
|
|
build=pages.SettingsPage,
|
|
|
|
),
|
|
|
|
|
|
|
|
rio.ComponentPage(
|
|
|
|
name="AddPage",
|
|
|
|
url_segment='add',
|
|
|
|
build=pages.AddPage,
|
|
|
|
),
|
|
|
|
rio.ComponentPage(
|
|
|
|
name="AddLocationPage",
|
|
|
|
url_segment='addlocation',
|
|
|
|
build=pages.AddLocationPage,
|
|
|
|
),
|
|
|
|
rio.ComponentPage(
|
|
|
|
name="ItemPage",
|
|
|
|
url_segment='item',
|
|
|
|
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",
|
|
|
|
)
|
|
|
|
|