update to RIO 0.11.1

This commit is contained in:
Cole Deck
2025-09-29 18:51:32 +00:00
parent 145a215305
commit 65f6052903
11 changed files with 28 additions and 20 deletions

View File

@@ -8,5 +8,6 @@ RUN ./venv/bin/pip install --no-cache-dir -r requirements.txt
COPY *.py *.txt *.toml ./ COPY *.py *.txt *.toml ./
COPY inventory ./inventory COPY inventory ./inventory
#ENV PYTHONPATH=/inventory #ENV PYTHONPATH=/inventory
CMD ["./venv/bin/python3", "-m", "rio", "run", "--release", "--public", "--port", "8000"] # CMD ["./venv/bin/python3", "-m", "rio", "run", "--release", "--public", "--port", "8000"]
CMD ["./venv/bin/python3", "run.py"]
EXPOSE 8000 EXPOSE 8000

View File

@@ -1,6 +1,5 @@
from peewee import * from peewee import *
import importlib
importlib.import_module('meilisearch')
from search import InventorySearch as ivs from search import InventorySearch as ivs
from playhouse.shortcuts import ReconnectMixin from playhouse.shortcuts import ReconnectMixin

View File

@@ -8,7 +8,7 @@ import rio
from . import pages from . import pages
from . import components as comps from . import components as comps
from db_classes import * from db_classes import init
# Define a theme for Rio to use. # Define a theme for Rio to use.
# #
@@ -22,7 +22,7 @@ theme = rio.Theme.from_colors(
primary_color=rio.Color.from_hex("#84329B"), primary_color=rio.Color.from_hex("#84329B"),
#neutral_color=rio.Color.from_hex("#a850f480"), #neutral_color=rio.Color.from_hex("#a850f480"),
neutral_color=rio.Color.from_hex("#D0A2F7"), neutral_color=rio.Color.from_hex("#D0A2F7"),
light=True, mode='light',
) )
init() init()

View File

@@ -7,7 +7,7 @@ import rio
from .. import components as comps from .. import components as comps
from db_classes import * # from db_classes import *
class Item(rio.Component): class Item(rio.Component):

View File

@@ -29,7 +29,7 @@ class Navbar(rio.Component):
#print(self.office) #print(self.office)
await self.force_refresh() self.force_refresh()
checkpage: str = "in" checkpage: str = "in"

View File

@@ -7,7 +7,8 @@ import rio
import datetime import datetime
from mac_vendor_lookup import AsyncMacLookup from mac_vendor_lookup import AsyncMacLookup
from db_classes import * # from db_classes import *
from db_classes import get_location_id, create_item
from .. import components as comps from .. import components as comps
import asyncio import asyncio

View File

@@ -63,7 +63,7 @@ class BrowsePage(rio.Component):
self.items = search_item(query, self.filters) self.items = search_item(query, self.filters)
mid = time() mid = time()
self.loading_text = "Loading data..." self.loading_text = "Loading data..."
await self.force_refresh() self.force_refresh()
end = time() end = time()
self.loading_text = "" self.loading_text = ""
render = str(int((end - mid) * 1000)) + "ms" render = str(int((end - mid) * 1000)) + "ms"
@@ -121,16 +121,16 @@ class BrowsePage(rio.Component):
async def _close_info_popup(self): async def _close_info_popup(self):
self.edit_show = False self.edit_show = False
self.info_show = False self.info_show = False
await self.force_refresh() self.force_refresh()
async def _close_edit_popup(self): async def _close_edit_popup(self):
await self._open_info_popup(self.ibarcode) await self._open_info_popup(self.ibarcode)
await self.force_refresh() self.force_refresh()
async def _save_edit_popup(self): async def _save_edit_popup(self):
self.edit_show = False self.edit_show = False
self.info_show = True self.info_show = True
await self.force_refresh() self.force_refresh()
await self._add_part_button() await self._add_part_button()
await asyncio.sleep(1) await asyncio.sleep(1)
await self._open_info_popup(self.ibarcode, skip_display=True) await self._open_info_popup(self.ibarcode, skip_display=True)
@@ -145,7 +145,7 @@ class BrowsePage(rio.Component):
async def _delete_edit_popup(self): async def _delete_edit_popup(self):
self.edit_show = False self.edit_show = False
self.info_show = True self.info_show = True
await self.force_refresh() self.force_refresh()
await delete_item_id(self.ibarcode) await delete_item_id(self.ibarcode)
await self._search() await self._search()
await asyncio.sleep(1) await asyncio.sleep(1)
@@ -292,7 +292,9 @@ class BrowsePage(rio.Component):
#color=self.popup_color, #color=self.popup_color,
is_open=self.info_show, is_open=self.info_show,
min_width=40, min_width=40,
#position='fullscreen', position='fullscreen',
user_closable=True,
modal=True,
#align_y = 1, #align_y = 1,
color=rio.Color.TRANSPARENT, color=rio.Color.TRANSPARENT,
content=rio.Card( content=rio.Card(
@@ -327,8 +329,9 @@ class BrowsePage(rio.Component):
#color=self.popup_color, #color=self.popup_color,
is_open=self.edit_show, is_open=self.edit_show,
min_width=40, min_width=40,
#position='fullscreen', position='fullscreen',
#align_y = 1, user_closable=False,
modal=True,
color=rio.Color.TRANSPARENT, color=rio.Color.TRANSPARENT,
content=rio.Card( content=rio.Card(
rio.Column( rio.Column(

View File

@@ -20,7 +20,7 @@ class ItemPage(rio.Component):
self.itm = find_item(self.barcode) self.itm = find_item(self.barcode)
#print(find_item(self.barcode)) #print(find_item(self.barcode))
#print(self.itm) #print(self.itm)
await self.force_refresh() self.force_refresh()
def build(self) -> rio.Component: def build(self) -> rio.Component:
if 'barcode' in self.itm: if 'barcode' in self.itm:

View File

@@ -1,6 +1,7 @@
peewee peewee
pymysql pymysql
rio-ui==0.10.4 #rio-ui==0.10.4
rio-ui==0.11.1
meilisearch #==0.31.5 meilisearch #==0.31.5
mac-vendor-lookup mac-vendor-lookup

3
run.py Normal file
View File

@@ -0,0 +1,3 @@
from inventory import app
app.run_as_web_server(host='0.0.0.0',port=8000)

View File

@@ -89,9 +89,9 @@ class InventorySearch:
:param filters: A meilisearch compatible filter statement. :param filters: A meilisearch compatible filter statement.
:returns: The search results dict. Actual results are in a list under "hits", but there are other nice values that are useful in the root element.""" :returns: The search results dict. Actual results are in a list under "hits", but there are other nice values that are useful in the root element."""
if filters: if filters:
q = self.idxref.search(query, {"filter": filters, "limit": 1000}) q = self.idxref.search(query, {"filter": filters, "limit": 10000})
else: else:
q = self.idxref.search(query) q = self.idxref.search(query, {"limit": 10000})
return q return q
def _filter_one(self, filter: str): def _filter_one(self, filter: str):