Skip to content

Commit

Permalink
Features/antares xpansion ui (#254)
Browse files Browse the repository at this point in the history
* First version of antares-xpansion-ui

* update font for console display
remove QThread

* refactor

* add steps and simulation name support

* save value of last installed and antares study directory

* check if path define to init simulation name combobox

* sonarcloud smell code for python variable rename

* remove definition of install directory in ui + add BUILD_UI option

* add nb core definition

* update ui

* add keepMps option

* rename method and attributes

* rename requirements-gui.txt to requirements-ui.txt

* add ui generation in Gitlab CI

* correction of command of resources.py generation

* removed unused github workflow

* update doc

* Correction of run if keepMps not checked and small refactor

* change to UTF8 encoding

* add line at end of file

* dos2unix for requirements-tests.txt and requirements-ui.txt

* Convert requirements.txt to ASCII

Using iconv and dos2unix

Co-authored-by: Florian OMNES <[email protected]>
  • Loading branch information
jmkerloch and flomnes authored Oct 20, 2021
1 parent 054c081 commit 6ced974
Show file tree
Hide file tree
Showing 25 changed files with 364 additions and 151 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/centos7-system-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- name: Install dependencies
run: |
pip3 install -r requirements-tests.txt
pip3 install -r requirements-ui.txt
- name: Configure
run: |
Expand All @@ -57,7 +58,7 @@ jobs:
source /opt/rh/rh-git227/enable
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
cmake3 -B _build -S . -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install
cmake3 -B _build -S . -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/centos7-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ jobs:
- name: Install dependencies
run: |
pip3 install -r requirements-tests.txt
pip3 install -r requirements-ui.txt
- name: Configure
run: |
source /opt/rh/devtoolset-7/enable
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
cmake3 -B _build -S . -DDEPS_INSTALL_DIR=/rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF
cmake3 -B _build -S . -DDEPS_INSTALL_DIR=/rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF -DBUILD_UI=ON
- name: Build
run: |
Expand Down
140 changes: 0 additions & 140 deletions .github/workflows/centos7-system_boost_1_75.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .github/workflows/releases-centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,14 @@ jobs:
- name: Install dependencies
run: |
pip3 install -r requirements-tests.txt
pip3 install -r requirements-ui.txt
- name: Configure
run: |
source /opt/rh/devtoolset-7/enable
export LD_LIBRARY_PATH=/usr/lib64/openmpi/lib:$LD_LIBRARY_PATH
export PATH=/usr/lib64/openmpi/bin:$PATH
cmake3 -B _build -S . -DDEPS_INSTALL_DIR=/rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF
cmake3 -B _build -S . -DDEPS_INSTALL_DIR=/rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/releases-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-tests.txt
pip install -r requirements-ui.txt
- name: Get release
id: get_release
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
- name: Configure
run: |
cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF
cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/releases-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -r requirements-tests.txt
pip install -r requirements-ui.txt
- name: Get release
id: get_release
Expand Down Expand Up @@ -105,7 +106,7 @@ jobs:
- name: Configure with VCPKG
run: |
$pwd=Get-Location
cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DCMAKE_PREFIX_PATH="$pwd\rte-antares-${{steps.antares-version.outputs.prop}}-installer-64bits" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF
cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DCMAKE_PREFIX_PATH="$pwd\rte-antares-${{steps.antares-version.outputs.prop}}-installer-64bits" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu-system-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip3 install -r requirements-tests.txt
pip3 install -r requirements-ui.txt
- name: Install libraries
run: |
Expand All @@ -52,7 +53,7 @@ jobs:

- name: Configure
run: |
cmake -B _build -S . -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install
cmake -B _build -S . -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/ubuntu-system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip3 install -r requirements-tests.txt
pip3 install -r requirements-ui.txt
- name: Install libraries
run: |
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:

- name: Configure
run: |
cmake -B _build -S . -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF
cmake -B _build -S . -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows-vcpkg-deps-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ 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
Expand Down Expand Up @@ -82,7 +83,7 @@ jobs:
- name: Configure
run: |
$pwd=Get-Location
cmake -B _build -S . -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=true -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install
cmake -B _build -S . -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=true -DCMAKE_TOOLCHAIN_FILE="vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_UI=ON
- name: Build
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/windows-vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ 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
Expand Down Expand Up @@ -106,7 +107,7 @@ jobs:
- name: Configure
run: |
$pwd=Get-Location
cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DCMAKE_PREFIX_PATH="$pwd\rte-antares-${{steps.antares-version.outputs.prop}}-installer-64bits" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF
cmake -B _build -S . -DDEPS_INSTALL_DIR=rte-antares-deps-Release -DCMAKE_PREFIX_PATH="$pwd\rte-antares-${{steps.antares-version.outputs.prop}}-installer-64bits" -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Release -DUSE_MPI=ON -DCMAKE_TOOLCHAIN_FILE="${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} -DCMAKE_INSTALL_PREFIX=_install -DBUILD_not_system=OFF -DBUILD_antares_solver=OFF -DBUILD_UI=ON
- name: Build
run: |
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ endif(COIN_OR)
# ===========================================================================
# Targets
# ===========================================================================
option(BUILD_UI "Build antares-xpansion ui" OFF)
option(BUILD_TESTING "Activates unit tests building" OFF)

if(WIN32)
Expand Down
1 change: 1 addition & 0 deletions docs/build/3-Build.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Here is a list of available CMake configure option :
|`BUILD_ALL`|`OFF`|Enable build of ALL external librairies|
|`DEPS_INSTALL_DIR`|`../rte-antares-deps-<CMAKE_BUILD_TYPE>`|Define dependencies libraries install directory|
|`BUILD_TESTING`|`OFF`|Enable test build|
|`BUILD_UI`|`OFF`|Enable UI build|

Additionnal options for windows

Expand Down
19 changes: 19 additions & 0 deletions docs/build/6-ui-creation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# User Interface creation
A PyQt5 User Interface (UI) is available : `src\python\antares-xpansion-ui.py`

To generate needed resources `BUILD_UI` option must be enabled.

## Install requirements
```
pip3 install -r requirements-ui.txt
```

## 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
```

1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ nav:
- 'Dependencies install': 'build/2-Dependencies-install.md'
- 'Build': 'build/3-Build.md'
- 'Tests': 'build/4-Tests.md'
- 'UI creation': 'build/6-ui-creation.md'
- 'Installer creation': 'build/5-Installer-creation.md'
- 'Changelog': 'CHANGELOG.md'

Expand Down
Binary file modified requirements-tests.txt
Binary file not shown.
2 changes: 2 additions & 0 deletions requirements-ui.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r requirements.txt
PyQt5
Binary file modified requirements.txt
Binary file not shown.
16 changes: 14 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,30 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/python/config.yaml.in ${CMAKE_CURRENT
#use file generator to define xpansion executable name with $<TARGET_FILE_NAME:exe> : need to be done with generate instead of configure because values are not available at configure time
file(GENERATE OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/python/config.yaml INPUT ${CMAKE_CURRENT_SOURCE_DIR}/python/config.yaml)

if (BUILD_UI)
execute_process(COMMAND pyrcc5 images.qrc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/python/
OUTPUT_FILE resources.py)

#configure file to define install directory
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/python/config-ui.yaml.in ${CMAKE_CURRENT_SOURCE_DIR}/python/config-ui.yaml)
endif()

find_program(PYINSTALLER "pyinstaller")

#if pyinstaller available add compiled version of python scripts
if (PYINSTALLER)


if (MSVC)
install(CODE "execute_process(COMMAND ${PYINSTALLER} -F ${CMAKE_CURRENT_SOURCE_DIR}/python/launch.py -n antares-xpansion-launcher --add-data \"${CMAKE_CURRENT_SOURCE_DIR}/python/config.yaml;.\")" )
else()
install(CODE "execute_process(COMMAND ${PYINSTALLER} -F ${CMAKE_CURRENT_SOURCE_DIR}/python/launch.py -n antares-xpansion-launcher --add-data \"${CMAKE_CURRENT_SOURCE_DIR}/python/config.yaml:.\")" )
endif()

if (BUILD_UI)
install(CODE "execute_process(COMMAND ${PYINSTALLER} -F ${CMAKE_CURRENT_SOURCE_DIR}/python/antares-xpansion-ui.py -n antares-xpansion-ui)" )
endif()

#code is executed in CMAKE_BINARY_DIR
install(DIRECTORY ${CMAKE_BINARY_DIR}/dist/
DESTINATION .
Expand All @@ -45,5 +57,5 @@ else ()
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/python/"
DESTINATION xpansion-launcher
USE_SOURCE_PERMISSIONS)

endif()
Loading

0 comments on commit 6ced974

Please sign in to comment.