Skip to content

Commit de91850

Browse files
authored
fix(build): remove deprecated modules; remove numpy2 from poetry.lock
* fix: Fix build issues due to numpy * fix: Fix broken imports * chore: Remove uses of nicegui and clean up files
1 parent 02cb0fe commit de91850

File tree

9 files changed

+5
-1176
lines changed

9 files changed

+5
-1176
lines changed

openadapt/app/dashboard/api/recordings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
from fastapi import APIRouter, WebSocket
66

7-
from openadapt.app import cards
87
from openadapt.custom_logger import logger
98
from openadapt.db import crud
9+
from openadapt.deprecated.app import cards
1010
from openadapt.events import get_events
1111
from openadapt.models import Recording
1212
from openadapt.plotting import display_event

openadapt/deprecated/app/cards.py

Lines changed: 1 addition & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
"""openadapt.app.cards module.
1+
"""openadapt.deprecated.app.cards module.
22
33
This module provides functions for managing UI cards in the OpenAdapt application.
44
"""
@@ -7,10 +7,6 @@
77
import multiprocessing
88
import time
99

10-
from nicegui import ui
11-
12-
from openadapt.app.objects.local_file_picker import LocalFilePicker
13-
from openadapt.app.util import get_scrub, set_dark, set_scrub, sync_switch
1410
from openadapt.record import record
1511
from openadapt.utils import WrapStdout
1612

@@ -67,55 +63,6 @@ def start(self, func: callable, args: tuple, kwargs: dict) -> None:
6763
record_proc = RecordProc()
6864

6965

70-
def settings(dark_mode: bool) -> None:
71-
"""Display the settings dialog.
72-
73-
Args:
74-
dark_mode (bool): Current dark mode setting.
75-
"""
76-
with ui.dialog() as settings, ui.card():
77-
dark_switch = ui.switch(
78-
"Dark mode", on_change=lambda: set_dark(dark_mode, dark_switch.value)
79-
)
80-
sync_switch(dark_switch, dark_mode)
81-
82-
scrub_switch = ui.switch(
83-
"Scrubbing", on_change=lambda: set_scrub(scrub_switch.value)
84-
)
85-
sync_switch(scrub_switch, get_scrub())
86-
87-
ui.button("Close", on_click=lambda: settings.close())
88-
settings.open()
89-
90-
91-
def select_import(f: callable) -> None:
92-
"""Display the import file selection dialog.
93-
94-
Args:
95-
f (callable): Function to call when import button is clicked.
96-
"""
97-
98-
async def pick_file() -> None:
99-
result = await LocalFilePicker(".")
100-
ui.notify(f"Selected {result[0]}" if result else "No file selected.")
101-
selected_file.text = result[0] if result else ""
102-
import_button.enabled = True if result else False
103-
104-
with ui.dialog() as import_dialog, ui.card():
105-
with ui.column():
106-
ui.button("Select File", on_click=pick_file).props("icon=folder")
107-
selected_file = ui.label("")
108-
selected_file.visible = False
109-
import_button = ui.button(
110-
"Import",
111-
on_click=lambda: f(selected_file.text, delete.value),
112-
)
113-
import_button.enabled = False
114-
delete = ui.checkbox("Delete file after import")
115-
116-
import_dialog.open()
117-
118-
11966
def stop_record() -> None:
12067
"""Stop the current recording session."""
12168
global record_proc
@@ -152,60 +99,3 @@ def quick_record(
15299
"log_memory": False,
153100
},
154101
)
155-
156-
157-
def recording_prompt(options: list[str], record_button: ui.button) -> None:
158-
"""Display the recording prompt dialog.
159-
160-
Args:
161-
options (list): List of autocomplete options.
162-
record_button (nicegui.widgets.Button): Record button widget.
163-
"""
164-
if not record_proc.is_running():
165-
with ui.dialog() as dialog, ui.card():
166-
ui.label("Enter a name for the recording: ")
167-
ui.input(
168-
label="Name",
169-
placeholder="test",
170-
autocomplete=options,
171-
on_change=lambda e: result.set_text(e),
172-
)
173-
result = ui.label()
174-
175-
with ui.row():
176-
ui.button("Close", on_click=dialog.close)
177-
ui.button("Enter", on_click=lambda: on_record())
178-
179-
dialog.open()
180-
181-
def terminate() -> None:
182-
global record_proc
183-
record_proc.set_terminate_processing()
184-
185-
# wait for process to terminate
186-
record_proc.wait()
187-
ui.notify("Stopped recording")
188-
record_button._props["name"] = "radio_button_checked"
189-
record_button.on("click", lambda: recording_prompt(options, record_button))
190-
191-
record_proc.reset()
192-
193-
def begin() -> None:
194-
name = result.text.__getattribute__("value")
195-
196-
ui.notify(
197-
f"Recording {name}... Press CTRL + C in terminal window to cancel",
198-
)
199-
global record_proc
200-
record_proc.start(
201-
record,
202-
(name, record_proc.terminate_processing, record_proc.terminate_recording),
203-
)
204-
record_button._props["name"] = "stop"
205-
record_button.on("click", lambda: terminate())
206-
record_button.update()
207-
208-
def on_record() -> None:
209-
global record_proc
210-
dialog.close()
211-
begin()

openadapt/deprecated/app/main.py

Lines changed: 0 additions & 100 deletions
This file was deleted.

openadapt/deprecated/app/objects/console.py

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)