diff --git a/pyproject.toml b/pyproject.toml index 36b9d56..5bbcdc0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -18,6 +18,7 @@ dependencies = [ bedit-graphviz = "bedit_util.graphviz:main" bedit-simulate = "bedit_util.simulate:main" bedit = "bedit_gui.application:main" +bedit-sim = "bedit_gui.simulation_application:main" [project.optional-dependencies] dev = [ diff --git a/src/bedit_gui/resources/icons/media-playback-stop.png b/src/bedit_gui/resources/icons/media-playback-stop.png new file mode 100644 index 0000000..650874f Binary files /dev/null and b/src/bedit_gui/resources/icons/media-playback-stop.png differ diff --git a/src/bedit_gui/resources/icons/media-skip-backward.png b/src/bedit_gui/resources/icons/media-skip-backward.png new file mode 100644 index 0000000..bcf2376 Binary files /dev/null and b/src/bedit_gui/resources/icons/media-skip-backward.png differ diff --git a/src/bedit_gui/resources/resources.qrc b/src/bedit_gui/resources/resources.qrc index d29af27..f1004e4 100644 --- a/src/bedit_gui/resources/resources.qrc +++ b/src/bedit_gui/resources/resources.qrc @@ -1,5 +1,7 @@ + icons/media-skip-backward.png + icons/media-playback-stop.png icons/edit-delete.png icons/dialog-close.png icons/list-remove.png diff --git a/src/bedit_gui/simulation_application.py b/src/bedit_gui/simulation_application.py new file mode 100644 index 0000000..3a5b218 --- /dev/null +++ b/src/bedit_gui/simulation_application.py @@ -0,0 +1,31 @@ +from __future__ import annotations + +import sys +import argparse + +def parse_arguments(): + parser = argparse.ArgumentParser(exit_on_error=False) + + parser.add_argument( + "-f", "--file", type=str, help="Path to a BEditor BEsim file to open", default=None, required=False + ) + parser.add_argument( + "-c", "--component", type=str, help="Component path in BEdit file to simulate", default=None, required=False + ) + parser.add_argument( + "-s", "--simulation", type=str, help="Simulation name in BEdit file to simulate", default=None, required=False + ) + + return parser.parse_args(), parser + +def main() -> int: + try: + args, parser = parse_arguments() + # TODO check if file is a BEditor file (.beb or .json) + if args.file and not (args.component or args.simulation): + parser.error("Component or Simulation required when opening a BEdit file") + except argparse.ArgumentError as e: + print(e.message) + return 1 + + return 0 \ No newline at end of file diff --git a/src/bedit_gui/simulation_models.py b/src/bedit_gui/simulation_models.py new file mode 100644 index 0000000..6a95d99 --- /dev/null +++ b/src/bedit_gui/simulation_models.py @@ -0,0 +1,11 @@ +from __future__ import annotations + +from collections.abc import Mapping +from dataclasses import dataclass, field +from enum import Enum +from typing import Any + +@dataclass +class SimulationRoot: + format_version: int = 1 + model_file_path: str | None # The file path of the BEdit file if there is one \ No newline at end of file diff --git a/src/bedit_gui/ui/forms/main_window.ui b/src/bedit_gui/ui/forms/main_window.ui index 533333d..57b43c4 100644 --- a/src/bedit_gui/ui/forms/main_window.ui +++ b/src/bedit_gui/ui/forms/main_window.ui @@ -72,6 +72,7 @@ Help + @@ -460,6 +461,11 @@ QAction::MenuRole::NoRole + + + About + + diff --git a/src/bedit_gui/ui/forms/simulation_window.ui b/src/bedit_gui/ui/forms/simulation_window.ui new file mode 100644 index 0000000..e857e8f --- /dev/null +++ b/src/bedit_gui/ui/forms/simulation_window.ui @@ -0,0 +1,309 @@ + + + SimulationWindow + + + + 0 + 0 + 800 + 600 + + + + MainWindow + + + + + + + 0 + + + + Tab 1 + + + + + + + + + + 0 + 0 + 800 + 22 + + + + + File + + + + + + + + Simulation + + + + + + + + + + Edit + + + + + + + + + Tools + + + + + Help + + + + + + + + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + + + toolBar + + + TopToolBarArea + + + false + + + + + + + + + Log + + + 8 + + + + + + + + + + + + Signals + + + 1 + + + + + + + false + + + + 1 + + + + + + + + + + + :/icons/icons/media-playback-start.png:/icons/icons/media-playback-start.png + + + Run Simulation + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/media-playback-stop.png:/icons/icons/media-playback-stop.png + + + Stop Simulation + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/media-skip-backward.png:/icons/icons/media-skip-backward.png + + + Restart Simulation + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/configure.png:/icons/icons/configure.png + + + Simulation Options + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/document-new.png:/icons/icons/document-new.png + + + New Simulation Run + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/document-open.png:/icons/icons/document-open.png + + + Open Simulation Run + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/document-save.png:/icons/icons/document-save.png + + + Save Simulation Run + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/edit-undo.png:/icons/icons/edit-undo.png + + + Undo + + + Ctrl+Z + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/edit-redo.png:/icons/icons/edit-redo.png + + + Redo + + + Ctrl+Y + + + QAction::MenuRole::NoRole + + + + + + :/icons/icons/preferences-system.png:/icons/icons/preferences-system.png + + + Settings + + + QAction::MenuRole::NoRole + + + + + About + + + + + About QT + + + + + + + +