From fcac4766cea6dbb9b3cc9b4b01e2dc9381e4ac68 Mon Sep 17 00:00:00 2001 From: Abdoulbari Zakir Date: Wed, 11 Dec 2024 15:14:16 +0100 Subject: [PATCH] remove ui --- .github/workflows/build_oracle8.yml | 1 - .github/workflows/build_ubuntu.yml | 2 - .github/workflows/build_windows.yml | 2 - .../workflows/ubuntu-system-deps-build.yml | 2 - .../workflows/windows-vcpkg-deps-build.yml | 3 +- .gitignore | 1 - CMakeLists.txt | 1 - README.md | 5 - .../install_from_sources/0-INSTALL.md | 5 +- .../install_from_sources/3-Build.md | 1 - ...er-creation.md => 5-Installer-creation.md} | 0 .../install_from_sources/5-ui-creation.md | 26 -- .../{7-Xpress.md => 6-Xpress.md} | 0 .../get-started/launching-optimization.md | 4 - requirements-ui.txt | 2 - src/python/antares-xpansion-ui.py | 332 ------------------ 16 files changed, 3 insertions(+), 384 deletions(-) rename docs/developer-guide/install_from_sources/{6-Installer-creation.md => 5-Installer-creation.md} (100%) delete mode 100644 docs/developer-guide/install_from_sources/5-ui-creation.md rename docs/developer-guide/install_from_sources/{7-Xpress.md => 6-Xpress.md} (100%) delete mode 100644 requirements-ui.txt delete mode 100644 src/python/antares-xpansion-ui.py diff --git a/.github/workflows/build_oracle8.yml b/.github/workflows/build_oracle8.yml index 0ab49eac4..7eda7e2f9 100644 --- a/.github/workflows/build_oracle8.yml +++ b/.github/workflows/build_oracle8.yml @@ -136,7 +136,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=_install \ -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/deps;${{env.ORTOOLS_DIR}}/install" \ - -DBUILD_UI=OFF \ -DALLOW_RUN_AS_ROOT=ON \ -DVCPKG_TARGET_TRIPLET=x64-linux-release \ -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake diff --git a/.github/workflows/build_ubuntu.yml b/.github/workflows/build_ubuntu.yml index 0c7dbf26d..f20f73899 100644 --- a/.github/workflows/build_ubuntu.yml +++ b/.github/workflows/build_ubuntu.yml @@ -63,7 +63,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-tests.txt - pip install -r requirements-ui.txt - name: Set-up Xpress with pip for Ubuntu shell: bash @@ -142,7 +141,6 @@ jobs: -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=_install \ -DCMAKE_PREFIX_PATH="${{ github.workspace }}/deps;${{env.ORTOOLS_DIR}}/install" \ - -DBUILD_UI=ON \ -DVCPKG_TARGET_TRIPLET=x64-linux-release \ -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 45c695e70..3da760ab0 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -52,7 +52,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-tests.txt - pip install -r requirements-ui.txt - name: Set-up Xpress with pip shell: bash @@ -121,7 +120,6 @@ jobs: -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DPython3_EXECUTABLE="${{ env.Python3_ROOT_DIR }}/python.exe" - -DBUILD_UI=ON - name: Build run: | diff --git a/.github/workflows/ubuntu-system-deps-build.yml b/.github/workflows/ubuntu-system-deps-build.yml index b54157050..52f916054 100644 --- a/.github/workflows/ubuntu-system-deps-build.yml +++ b/.github/workflows/ubuntu-system-deps-build.yml @@ -36,7 +36,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-tests.txt - pip install -r requirements-ui.txt - name: Install mandatory system libraries run: | @@ -94,7 +93,6 @@ jobs: -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_INSTALL_PREFIX=_install \ - -DBUILD_UI=ON \ -DVCPKG_TARGET_TRIPLET=x64-linux-release \ -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake diff --git a/.github/workflows/windows-vcpkg-deps-build.yml b/.github/workflows/windows-vcpkg-deps-build.yml index b9b8c78bb..af97b6562 100644 --- a/.github/workflows/windows-vcpkg-deps-build.yml +++ b/.github/workflows/windows-vcpkg-deps-build.yml @@ -39,7 +39,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements-tests.txt - pip install -r requirements-ui.txt - name: Pre-requisites shell: cmd @@ -75,7 +74,7 @@ jobs: - name: Configure run: | $pwd=Get-Location - cmake -B _build -S . -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON + cmake -B _build -S . -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install - name: Cache vcpkg binary dir if: always() diff --git a/.gitignore b/.gitignore index 89d88ecaa..9b787456c 100644 --- a/.gitignore +++ b/.gitignore @@ -44,7 +44,6 @@ CMakeFiles/* src/python/config.yaml src/python/antares_xpansion/__version__.py src/python/resources.py -config-ui.yaml build_config.yaml # Tests diff --git a/CMakeLists.txt b/CMakeLists.txt index 8bf1ff759..f67736238 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -255,7 +255,6 @@ endif (COIN_OR) # =========================================================================== # Targets # =========================================================================== -option(BUILD_UI "Build antares-xpansion ui" OFF) option(BUILD_TESTING "Activates unit tests building" OFF) if (WIN32) diff --git a/README.md b/README.md index b880f59f2..05e307cae 100644 --- a/README.md +++ b/README.md @@ -96,11 +96,6 @@ where `x.y.z` is the version number. ``` - -### Graphical user interface - -Antares-Xpansion comes with a GUI. The GUI can be launched by running `antares-xpansion-ui.exe`. For now, this GUI is in the experimental phase. - ## Technologies Antares-Xpansion is developed mainly in **C++** and uses a **Python** runner to drive the execution of multiple executables. diff --git a/docs/developer-guide/install_from_sources/0-INSTALL.md b/docs/developer-guide/install_from_sources/0-INSTALL.md index e4fad0faf..fd12fc3e4 100644 --- a/docs/developer-guide/install_from_sources/0-INSTALL.md +++ b/docs/developer-guide/install_from_sources/0-INSTALL.md @@ -18,9 +18,8 @@ Follow this [link][Doxygen_Code_Documentation] for Doxygen code documentation. - [Dependencies](2-Dependencies-install.md) - [Build](3-Build.md) - [Tests](4-Tests.md) -- [UI creation](5-ui-creation.md) -- [Installer creation](6-Installer-creation.md) -- [Xpress integration](7-Xpress.md) +- [Installer creation](5-Installer-creation.md) +- [Xpress integration](6-Xpress.md) [ubuntu_system_svg]: https://github.com/AntaresSimulatorTeam/antares-xpansion/actions/workflows/ubuntu-system-deps-build.yml/badge.svg?query=branch%3Adevelop [ubuntu_system_link]: https://github.com/AntaresSimulatorTeam/antares-xpansion/actions/workflows/ubuntu-system-deps-build.yml?query=branch%3Adevelop diff --git a/docs/developer-guide/install_from_sources/3-Build.md b/docs/developer-guide/install_from_sources/3-Build.md index ea64bdd47..4810e6f52 100644 --- a/docs/developer-guide/install_from_sources/3-Build.md +++ b/docs/developer-guide/install_from_sources/3-Build.md @@ -42,7 +42,6 @@ Here is a list of available CMake configure options: |`BUILD_not_system`|`ON`|Enable build of external librairies not available on system package manager.| |`BUILD_ALL`|`OFF`|Enable build of ALL external librairies.| |`BUILD_TESTING`|`OFF`|Enable test build.| -|`BUILD_UI`|`OFF`|Enable UI build.| |`ALLOW_RUN_AS_ROOT`|`OFF`|allow mpi to run as root for centOs docker.| Additionnal vcpkg options: diff --git a/docs/developer-guide/install_from_sources/6-Installer-creation.md b/docs/developer-guide/install_from_sources/5-Installer-creation.md similarity index 100% rename from docs/developer-guide/install_from_sources/6-Installer-creation.md rename to docs/developer-guide/install_from_sources/5-Installer-creation.md diff --git a/docs/developer-guide/install_from_sources/5-ui-creation.md b/docs/developer-guide/install_from_sources/5-ui-creation.md deleted file mode 100644 index 0e940a4e0..000000000 --- a/docs/developer-guide/install_from_sources/5-ui-creation.md +++ /dev/null @@ -1,26 +0,0 @@ -# User interface creation -A PyQt5 user interface (UI) is available: `src\python\antares-xpansion-ui.py` To build the UI, the option `BUILD_UI` must be enabled at [configure time](3-Build.md#configure). - -## Install requirements - -=== "Windows" - ``` - pip3 install -r requirements-ui.txt - ``` -=== "Centos" - ``` - pip3 install -r requirements-ui.txt - ``` -=== "Ubuntu" - - ``` - sudo apt install python3-pyqt5 - ``` - -## Force new generation for resource file -A `resource.py` python module is created when configuring CMake. To force the regeneration of this file if images are changed, use `pyrcc5`. -``` -cd src\python -pyrcc5 images.qrc > resources.py -``` - diff --git a/docs/developer-guide/install_from_sources/7-Xpress.md b/docs/developer-guide/install_from_sources/6-Xpress.md similarity index 100% rename from docs/developer-guide/install_from_sources/7-Xpress.md rename to docs/developer-guide/install_from_sources/6-Xpress.md diff --git a/docs/user-guide/get-started/launching-optimization.md b/docs/user-guide/get-started/launching-optimization.md index 8523bf655..929cfd9e3 100644 --- a/docs/user-guide/get-started/launching-optimization.md +++ b/docs/user-guide/get-started/launching-optimization.md @@ -94,10 +94,6 @@ Show the Antares-Xpansion version. Show the Antares-Simulator version (used in the `antares` step). -## Graphical user interface - -Since v0.6.0, Antares-Xpansion comes with a GUI. The GUI can be launched by running `antares-xpansion-ui.exe`. For now, this GUI is in the experimental phase. - ![](../../assets/media/ui.png) ## Output of Antares-Xpansion diff --git a/requirements-ui.txt b/requirements-ui.txt deleted file mode 100644 index 7984510f3..000000000 --- a/requirements-ui.txt +++ /dev/null @@ -1,2 +0,0 @@ --r requirements.txt -PyQt5 diff --git a/src/python/antares-xpansion-ui.py b/src/python/antares-xpansion-ui.py deleted file mode 100644 index 9e0c4735b..000000000 --- a/src/python/antares-xpansion-ui.py +++ /dev/null @@ -1,332 +0,0 @@ -import os -import psutil -import sys -import yaml - -from PyQt5.QtCore import Qt -from PyQt5.QtGui import QFont, QMovie, QIcon -from PyQt5.QtWidgets import QApplication, QLabel, QLineEdit, QPushButton, QVBoxLayout, \ - QHBoxLayout, QWidget, QFileDialog, QRadioButton, QSpacerItem, QSizePolicy, QPlainTextEdit, QMessageBox, QGridLayout, \ - QComboBox, QGroupBox, QSpinBox, QCheckBox -from PyQt5.QtCore import QProcess, QByteArray, QSettings -from pathlib import Path - -import resources - -STEPS = ["full", "antares", "problem_generation", - "benders", "study_update", "sensitivity", "resume"] -STEP_WITH_SIMULATION_NAME = ["problem_generation", - "benders", "study_update", "sensitivity", "resume"] -NEW_SIMULATION_NAME = "New" -LAST_ANTARES_STUDY_DIR = "last_antares_study_dir" - - -class MainWidget(QWidget): - - def __init__(self, parent=None): - QWidget.__init__(self, parent=parent) - - self.setWindowTitle('antares-xpansion-ui') - - self._define_install_dir() - - self._settings = QSettings("pyqt_settings.ini", QSettings.IniFormat) - - self._define_launcher_name() - self._main_layout = QVBoxLayout() - - self._init_antares_study_selection_widget() - self._init_antares_xpansion_run_widget() - self._init_log_widget() - - self.setLayout(self._main_layout) - - self._check_run_availability() - - def _define_install_dir(self): - self._install_dir = None - - if Path('config-ui.yaml').is_file(): - with open('config-ui.yaml') as file: - content = yaml.full_load(file) - if content is not None: - self._install_dir = content.get('INSTALL_DIR', "bin") - - def _define_launcher_name(self): - self._launcher_name = "antares-xpansion-launcher" - if sys.platform.startswith("win32"): - self._launcher_name += ".exe" - - def _init_log_widget(self): - log_layout = QHBoxLayout() - self._log_text_edit = QPlainTextEdit() - self._log_text_edit.setReadOnly(True) - font = QFont() - font.setFamily("DejaVu Sans Mono") - self._log_text_edit.setFont(font) - log_layout.addWidget(self._log_text_edit) - self._main_layout.addLayout(log_layout) - - def _init_antares_xpansion_run_widget(self): - - self._xpansion_config_layout = QHBoxLayout() - - self._init_step_selection_widget() - self._init_xpansion_config_widget() - - self._xpansion_config_layout.addSpacerItem( - QSpacerItem(1, 1, QSizePolicy.Expanding, QSizePolicy.Fixed)) - self._init_xpansion_run_widget() - - self._main_layout.addLayout(self._xpansion_config_layout) - - def _init_xpansion_config_widget(self): - - method_layout = QHBoxLayout() - self._sequential_radio_button = QRadioButton('Sequential') - self._sequential_radio_button.setChecked(True) - self._sequential_radio_button.toggled.connect(self._method_changed) - method_layout.addWidget(self._sequential_radio_button) - self._mpibenders_radio_button = QRadioButton('Parallel') - self._mpibenders_radio_button.toggled.connect(self._method_changed) - method_layout.addWidget(self._mpibenders_radio_button) - method_layout.addWidget(QLabel("core number")) - self._nb_core_edit = QSpinBox() - self._nb_core_edit.setMinimum(2) - self._nb_core_edit.setMaximum(128) - cpu_count = psutil.cpu_count(logical=False) - self._nb_core_edit.setValue(cpu_count) - self._nb_core_edit.setEnabled(False) - method_layout.addWidget(self._nb_core_edit) - nb_cpu_label = QLabel( - "available physical cores {nb_cpu}".format( - nb_cpu=cpu_count)) - nb_cpu_label.setTextInteractionFlags(Qt.LinksAccessibleByMouse) - nb_cpu_label.linkActivated.connect(self._use_available_core) - method_layout.addWidget(nb_cpu_label) - method_gb = QGroupBox("Method") - method_gb.setLayout(method_layout) - self._xpansion_config_layout.addWidget(method_gb) - - option_gb = QGroupBox("Options") - option_layout = QVBoxLayout() - self._keep_mps_checkbox = QCheckBox("Keep intermediate files") - self._keep_mps_checkbox.setChecked(False) - option_layout.addWidget(self._keep_mps_checkbox) - option_gb.setLayout(option_layout) - self._xpansion_config_layout.addWidget(option_gb) - - def _init_xpansion_run_widget(self): - self._running_label = QLabel() - self.movie = QMovie(":/images/loading.gif", QByteArray()) - self._running_label.setMovie(self.movie) - self.movie.start() - self._running_label.setVisible(False) - self._xpansion_config_layout.addWidget(self._running_label) - self._run_process = QProcess() - self._run_process.readyReadStandardOutput.connect(self._handle_stdout) - self._run_process.readyReadStandardError.connect(self._handle_stderr) - self._run_process.stateChanged.connect(self._handle_state) - self._run_process.finished.connect(self._cleanup_run_process) - self._run_button = QPushButton('Run') - self._set_run_label() - self._run_button.clicked.connect(self._run_or_stop) - self._xpansion_config_layout.addWidget(self._run_button) - - def _init_antares_study_selection_widget(self): - layout_study_path = QGridLayout() - - layout_study_path.addWidget(QLabel('Antares study path'), 0, 0) - self._study_path_text_edit = QLineEdit( - self._settings.value(LAST_ANTARES_STUDY_DIR)) - layout_study_path.addWidget(self._study_path_text_edit, 0, 1) - select_button = QPushButton('...') - select_button.clicked.connect(self._select_study_path) - layout_study_path.addWidget(select_button, 0, 2) - - self._combo_simulation_name = QComboBox() - self._combo_simulation_name.currentTextChanged.connect( - self._simulation_name_changed) - layout_study_path.addWidget(QLabel('Simulation name'), 1, 0) - layout_study_path.addWidget(self._combo_simulation_name, 1, 1) - self._init_simulation_name_combo( - self._settings.value(LAST_ANTARES_STUDY_DIR)) - - self._main_layout.addLayout(layout_study_path) - - def _init_step_selection_widget(self): - step_layout = QHBoxLayout() - - self._step_buttons = {} - for step in STEPS: - self._step_buttons[step] = QRadioButton(step) - self._step_buttons[step].setEnabled( - step not in STEP_WITH_SIMULATION_NAME) - step_layout.addWidget(self._step_buttons[step]) - - self._step_buttons["full"].setChecked(True) - - self._step_gb = QGroupBox("Steps") - self._step_gb.setLayout(step_layout) - self._xpansion_config_layout.addWidget(self._step_gb) - - def set_study_path(self, study_path: str): - self._settings.setValue(LAST_ANTARES_STUDY_DIR, study_path) - self._study_path_text_edit.setText(study_path) - self._init_simulation_name_combo(study_path) - self._check_run_availability() - - def _init_simulation_name_combo(self, study_path: str): - if study_path: - self._combo_simulation_name.blockSignals(True) - self._combo_simulation_name.clear() - self._combo_simulation_name.addItem(NEW_SIMULATION_NAME) - self._insert_study_simulation_in_combobox(study_path) - self._combo_simulation_name.blockSignals(False) - - def _insert_study_simulation_in_combobox(self, study_path): - output_path = Path(study_path) / 'output' - if output_path.is_dir(): - for directory in sorted(output_path.iterdir(), key=os.path.getmtime, reverse=True): - if (output_path / directory).is_dir(): - self._combo_simulation_name.addItem(directory.name) - - def _select_study_path(self): - self.set_study_path( - QFileDialog.getExistingDirectory(self, 'Select study folder', self._study_path_text_edit.text())) - - def _check_run_availability(self): - study_path = self._study_path_text_edit.text() - run_available = Path(study_path).is_dir() - self._run_button.setEnabled(run_available) - self._step_gb.setEnabled(run_available) - - def _get_method(self): - if self._mpibenders_radio_button.isChecked(): - return "mpibenders" - if self._sequential_radio_button.isChecked(): - return "sequential" - - def _get_step(self): - for step in self._step_buttons: - if self._step_buttons[step].isChecked(): - return step - - def _get_nb_core(self): - return self._nb_core_edit.value() - - def _get_keep_mps(self): - return self._keep_mps_checkbox.isChecked() - - def _handle_stdout(self): - data = self._run_process.readAllStandardOutput() - stdout = bytes(data).decode("utf8") - self._add_text_to_log(stdout) - - def _handle_stderr(self): - data = self._run_process.readAllStandardError() - stderr = bytes(data).decode("utf8") - self._add_text_to_log(stderr) - - def _handle_state(self, state): - if state == QProcess.NotRunning: - self._set_run_label() - if self._get_step() not in STEP_WITH_SIMULATION_NAME: - self._init_simulation_name_combo( - self._study_path_text_edit.text()) - else: - self._set_stop_label() - - def _method_changed(self): - self._nb_core_edit.setEnabled( - self._mpibenders_radio_button.isChecked()) - - def _use_available_core(self): - cpu_count = psutil.cpu_count(logical=False) - self._nb_core_edit.setValue(cpu_count) - - def _set_stop_label(self): - self._run_button.setText("Stop") - self._run_button.setIcon(QIcon(":/images/stop-48.png")) - self._running_label.setVisible(True) - - def _set_run_label(self): - self._run_button.setText("Run") - self._run_button.setIcon(QIcon(":/images/play-48.png")) - self._running_label.setVisible(False) - - def _simulation_name_changed(self, text): - for step in self._step_buttons: - if text == NEW_SIMULATION_NAME: - self._step_buttons[step].setEnabled( - step not in STEP_WITH_SIMULATION_NAME) - else: - self._step_buttons[step].setEnabled( - step in STEP_WITH_SIMULATION_NAME) - - def _add_text_to_log(self, s): - self._log_text_edit.appendPlainText(s.rstrip('\r\n')) - - def _cleanup_run_process(self): - self._run_process.close() - - def _run_or_stop(self): - if self._run_process and self._run_process.isOpen(): - qm = QMessageBox() - ret = qm.question(self, "Stop simulation", - "Do you want to stop current simulation ?") - if ret == qm.Yes: - self._run_process.close() - else: - self._run() - - def _run(self): - self._log_text_edit.clear() - study_path = self._study_path_text_edit.text() - if study_path: - if Path(study_path).is_dir(): - self._run_study(study_path) - else: - self._add_text_to_log("Study path is not a directory") - else: - self._add_text_to_log("No study path defined") - - def _run_study(self, study_path): - commands = [ - "--dataDir", str(study_path), - "--method", self._get_method(), - "--step", self._get_step(), - "-n", str(self._get_nb_core())] - program_in_python_package = None - install_dir_full = None - if self._install_dir is not None and Path(self._install_dir).is_dir(): - install_dir_full = str(Path(self._install_dir).resolve()) - - program_in_python_package = Path(os.path.abspath( - __file__)).parent / self._launcher_name - commands.extend(["--installDir", install_dir_full]) - - program_in_single_package = Path( - sys.executable).parent / self._launcher_name - - if self._get_keep_mps(): - commands.append("--keepMps") - if not self._step_buttons["full"].isChecked(): - commands.append("--simulationName") - commands.append(self._combo_simulation_name.currentText()) - if Path("launch.py").is_file(): - commands.insert(0, "launch.py") - program = str(Path(sys.executable)) - elif program_in_python_package is not None and program_in_python_package.is_dir(): - program = str(program_in_python_package) - else: - program = str(program_in_single_package) - self._run_process.start(program, commands) - self._set_stop_label() - - -app = QApplication([]) - -window = MainWidget() -window.show() -app.exec()