Skip to content

Commit 7f7b3c0

Browse files
authored
update repos for deprecation warnings (#117)
* update repos for deprecation warnings * get rid of some more deprec warning * do more
1 parent f0c576c commit 7f7b3c0

File tree

47 files changed

+178
-51
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+178
-51
lines changed

account_management_dashboard/rxconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
config = rx.Config(
44
app_name="account_management_dashboard",
5-
plugins=[rx.plugins.TailwindV3Plugin()],
5+
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
66
)

admin_dashboard/admin_dashboard/states/navigation_state.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ class NavigationState(rx.State):
77
@rx.var
88
def current_page(self) -> str:
99
"""Get the current page route."""
10-
return self.router.page.path
10+
return self.router.url.path

admin_dashboard/rxconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
config = rx.Config(
44
app_name="admin_dashboard",
5-
plugins=[rx.plugins.TailwindV3Plugin()],
5+
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
66
)

admin_panel/rxconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
config = rx.Config(
44
app_name="admin_panel",
5-
plugins=[rx.plugins.TailwindV3Plugin()],
5+
plugins=[rx.plugins.SitemapPlugin(), rx.plugins.TailwindV3Plugin()],
66
)

ai_image_gen/ai_image_gen/backend/generation.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ class GeneratorState(rx.State):
3232
upscaled_image: str = ""
3333
is_downloading: bool = False
3434

35+
@rx.event
36+
def set_output_image(self, value: str):
37+
self.output_image = value
38+
3539
@rx.event(background=True)
3640
async def generate_image(self):
3741
try:
@@ -240,7 +244,7 @@ async def copy_image(self):
240244
)
241245
if image_url == DEFAULT_IMAGE:
242246
image_url = (
243-
self.router.page.full_raw_path + DEFAULT_IMAGE[1:]
247+
self.router.url.removesuffix("/") + DEFAULT_IMAGE
244248
) # Remove the /
245249
yield rx.set_clipboard(image_url)
246250
except Exception as e:

ai_image_gen/ai_image_gen/backend/options.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,30 @@ def set_num_outputs(self, value: list):
7676
def set_steps(self, value: list):
7777
self.steps = value[0]
7878

79+
@rx.event
80+
def set_prompt(self, value: str):
81+
self.prompt = value
82+
83+
@rx.event
84+
def set_negative_prompt(self, value: str):
85+
self.negative_prompt = value
86+
87+
@rx.event
88+
def set_scheduler(self, value: str):
89+
self.scheduler = value
90+
7991
@rx.event
8092
def set_guidance_scale(self, value: list):
8193
self.guidance_scale = value[0]
8294

95+
@rx.event
96+
def set_selected_style(self, value: str):
97+
self.selected_style = value
98+
99+
@rx.event
100+
def set_advanced_options_open(self, value: bool):
101+
self.advanced_options_open = value
102+
83103
@rx.event
84104
def randomize_prompt(self):
85105
self.prompt = random.choice(prompt_list)

ai_image_gen/ai_image_gen/components/options_ui.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def prompt_input() -> rx.Component:
6767
color=rx.color("gray", 10),
6868
cursor="pointer",
6969
_hover={"opacity": "0.8"},
70-
on_click=OptionsState.setvar("prompt", ""),
70+
on_click=OptionsState.set_prompt(""),
7171
),
7272
),
7373
rx.tooltip(
@@ -252,7 +252,7 @@ def _style_preview(style_preset: list) -> rx.Component:
252252
height="auto",
253253
cursor="pointer",
254254
background=rx.color("accent", 9),
255-
on_click=OptionsState.setvar("selected_style", ""),
255+
on_click=OptionsState.set_selected_style(""),
256256
),
257257
content=style_preset[0],
258258
),
@@ -270,7 +270,7 @@ def _style_preview(style_preset: list) -> rx.Component:
270270
height="auto",
271271
cursor="pointer",
272272
background=rx.color("accent", 9),
273-
on_click=OptionsState.setvar("selected_style", style_preset[0]),
273+
on_click=OptionsState.set_selected_style(style_preset[0]),
274274
),
275275
content=style_preset[0],
276276
),
@@ -293,7 +293,7 @@ def style_selector() -> rx.Component:
293293
color=rx.color("gray", 10),
294294
cursor="pointer",
295295
_hover={"opacity": "0.8"},
296-
on_click=OptionsState.setvar("selected_style", ""),
296+
on_click=OptionsState.set_selected_style(""),
297297
),
298298
spacing="4",
299299
align="center",
@@ -345,7 +345,7 @@ def _negative_prompt() -> rx.Component:
345345
color=rx.color("gray", 10),
346346
cursor="pointer",
347347
_hover={"opacity": "0.8"},
348-
on_click=OptionsState.setvar("negative_prompt", ""),
348+
on_click=OptionsState.set_negative_prompt(""),
349349
),
350350
),
351351
spacing="4",
@@ -382,7 +382,7 @@ def _seed_input() -> rx.Component:
382382
color=rx.color("gray", 10),
383383
cursor="pointer",
384384
_hover={"opacity": "0.8"},
385-
on_click=OptionsState.setvar("seed", 0),
385+
on_click=OptionsState.set_seed("0"),
386386
),
387387
),
388388
spacing="4",
@@ -545,7 +545,7 @@ def advanced_options() -> rx.Component:
545545
width="100%",
546546
cursor="pointer",
547547
_hover={"opacity": "0.8"},
548-
on_click=OptionsState.setvar("advanced_options_open", False),
548+
on_click=OptionsState.set_advanced_options_open(False),
549549
),
550550
rx.hstack(
551551
rx.icon(
@@ -559,7 +559,7 @@ def advanced_options() -> rx.Component:
559559
width="100%",
560560
cursor="pointer",
561561
_hover={"opacity": "0.8"},
562-
on_click=OptionsState.setvar("advanced_options_open", True),
562+
on_click=OptionsState.set_advanced_options_open(True),
563563
),
564564
),
565565
rx.cond(

ai_image_gen/ai_image_gen/pages/index.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def _image_list_item(image: str) -> rx.Component:
6464
max_width="5em",
6565
cursor="pointer",
6666
background=rx.color("accent", 9),
67-
on_click=GeneratorState.setvar("output_image", image),
67+
on_click=GeneratorState.set_output_image(image),
6868
),
6969
loading=GeneratorState.is_generating | GeneratorState.is_upscaling,
7070
)

ai_image_gen/rxconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
config = rx.Config(
44
app_name="ai_image_gen",
5-
tailwind=None,
5+
plugins=[rx.plugins.SitemapPlugin()],
66
)

api_admin_panel/api_admin_panel/states/queries.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import uuid
22

33
import httpx
4+
import reflex as rx
45

56
from api_admin_panel.states.base import BaseState
67

@@ -43,24 +44,33 @@ class QueryState(BaseState):
4344
total_pages: int = 1
4445
formatted_headers: dict
4546

47+
@rx.event
48+
def set_req_url(self, url: str):
49+
self.req_url = url
50+
51+
@rx.event
4652
def get_request(self, method: str):
4753
self.current_req = method
4854

55+
@rx.event
4956
def add_header(self):
5057
self.headers.append(
5158
{"id": str(uuid.uuid4()), "identifier": "headers", "key": "", "value": ""}
5259
)
5360

61+
@rx.event
5462
def add_body(self):
5563
self.body.append(
5664
{"id": str(uuid.uuid4()), "identifier": "body", "key": "", "value": ""}
5765
)
5866

67+
@rx.event
5968
def add_cookies(self):
6069
self.cookies.append(
6170
{"id": str(uuid.uuid4()), "identifier": "cookies", "key": "", "value": ""}
6271
)
6372

73+
@rx.event
6474
def remove_entry(self, data: dict[str, str]):
6575
if data["identifier"] == "headers":
6676
self.headers = [item for item in self.headers if item["id"] != data["id"]]
@@ -71,6 +81,7 @@ def remove_entry(self, data: dict[str, str]):
7181
if data["identifier"] == "cookies":
7282
self.cookies = [item for item in self.cookies if item["id"] != data["id"]]
7383

84+
@rx.event
7485
async def update_attribute(self, data: dict[str, str], attribute: str, value: str):
7586
data[attribute] = value
7687

@@ -89,9 +100,11 @@ async def update_attribute(self, data: dict[str, str], attribute: str, value: st
89100
data if item["id"] == data["id"] else item for item in self.cookies
90101
]
91102

103+
@rx.event
92104
async def update_keyy(self, key: str, data: dict[str, str]):
93105
await self.update_attribute(data, "key", key)
94106

107+
@rx.event
95108
async def update_value(self, value: str, data: dict[str, str]):
96109
await self.update_attribute(data, "value", value)
97110

0 commit comments

Comments
 (0)