-
-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(dependencies): update various libraries; deprecate NiceGUI (#888)
* deprecate nicegui; move app/tray.py dependencies to app/__init__.py * remove bind; update README * Fix: wrap raw SQL queries in `text()` to prevent ArgumentError * black * noqa
- Loading branch information
Showing
35 changed files
with
1,373 additions
and
969 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,114 @@ | ||
"""Package for the GUI. | ||
"""openadapt.app module. | ||
Module: __init__.py | ||
This module provides core functionality for the OpenAdapt application. | ||
""" | ||
|
||
from datetime import datetime | ||
import multiprocessing | ||
import pathlib | ||
import time | ||
|
||
from openadapt.record import record | ||
from openadapt.utils import WrapStdout | ||
|
||
__all__ = [ | ||
"RecordProc", | ||
"record_proc", | ||
"stop_record", | ||
"is_recording", | ||
"quick_record", | ||
"FPATH", | ||
] | ||
|
||
# Define FPATH | ||
FPATH = pathlib.Path(__file__).parent | ||
|
||
|
||
class RecordProc: | ||
"""Class to manage the recording process.""" | ||
|
||
def __init__(self) -> None: | ||
"""Initialize the RecordProc class.""" | ||
self.terminate_processing = multiprocessing.Event() | ||
self.terminate_recording = multiprocessing.Event() | ||
self.record_proc: multiprocessing.Process = None | ||
self.has_initiated_stop = False | ||
|
||
def set_terminate_processing(self) -> multiprocessing.Event: | ||
"""Set the terminate event.""" | ||
return self.terminate_processing.set() | ||
|
||
def terminate(self) -> None: | ||
"""Terminate the recording process.""" | ||
self.record_proc.terminate() | ||
|
||
def reset(self) -> None: | ||
"""Reset the recording process.""" | ||
self.terminate_processing.clear() | ||
self.terminate_recording.clear() | ||
self.record_proc = None | ||
self.has_initiated_stop = False | ||
|
||
def wait(self) -> None: | ||
"""Wait for the recording process to finish.""" | ||
while True: | ||
if self.terminate_recording.is_set(): | ||
self.record_proc.terminate() | ||
return | ||
time.sleep(0.1) | ||
|
||
def is_running(self) -> bool: | ||
"""Check if the recording process is running.""" | ||
if self.record_proc is not None and not self.record_proc.is_alive(): | ||
self.reset() | ||
return self.record_proc is not None | ||
|
||
def start(self, func: callable, args: tuple, kwargs: dict) -> None: | ||
"""Start the recording process.""" | ||
self.record_proc = multiprocessing.Process( | ||
target=WrapStdout(func), | ||
args=args, | ||
kwargs=kwargs, | ||
) | ||
self.record_proc.start() | ||
|
||
|
||
record_proc = RecordProc() | ||
|
||
|
||
def stop_record() -> None: | ||
"""Stop the current recording session.""" | ||
global record_proc | ||
if record_proc.is_running() and not record_proc.has_initiated_stop: | ||
record_proc.set_terminate_processing() | ||
|
||
# wait for process to terminate | ||
record_proc.wait() | ||
record_proc.reset() | ||
|
||
|
||
def is_recording() -> bool: | ||
"""Check if a recording session is currently active.""" | ||
global record_proc | ||
return record_proc.is_running() | ||
|
||
|
||
def quick_record( | ||
task_description: str | None = None, | ||
status_pipe: multiprocessing.connection.Connection | None = None, | ||
) -> None: | ||
"""Run a recording session.""" | ||
global record_proc | ||
task_description = task_description or datetime.now().strftime("%d/%m/%Y %H:%M:%S") | ||
record_proc.start( | ||
record, | ||
( | ||
task_description, | ||
record_proc.terminate_processing, | ||
record_proc.terminate_recording, | ||
status_pipe, | ||
), | ||
{ | ||
"log_memory": False, | ||
}, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
"""API endpoints for the dashboard.""" | ||
|
||
|
||
from pathlib import Path | ||
import os | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
Module: capture.py | ||
""" | ||
|
||
import sys | ||
|
||
if sys.platform == "darwin": | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
usage: see bottom of file | ||
""" | ||
|
||
from datetime import datetime | ||
from sys import platform | ||
import os | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,13 @@ def show_alert() -> None: | |
msg = QMessageBox() | ||
msg.setIcon(QMessageBox.Warning) | ||
msg.setWindowIcon(QIcon(ICON_PATH)) | ||
msg.setText(""" | ||
msg.setText( | ||
""" | ||
An error has occurred. The development team has been notified. | ||
Please join the discord server to get help or send an email to | ||
[email protected] | ||
""") | ||
""" | ||
) | ||
discord_button = QPushButton("Join the discord server") | ||
discord_button.clicked.connect( | ||
lambda: webbrowser.open("https://discord.gg/yF527cQbDG") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
"""Init file for spacy_model_helpers package.""" | ||
|
||
|
||
from .download_model import download_spacy_model | ||
|
||
__all__ = ["download_spacy_model"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
"""Spacy model init file.""" | ||
|
||
|
||
from pathlib import Path | ||
|
||
from spacy.language import Language | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
Usage: | ||
python3 -m openadapt.start | ||
""" | ||
|
||
import subprocess | ||
|
||
from openadapt.app.main import run_app | ||
|
Oops, something went wrong.