diff --git a/.github/workflows/test_and_build.yml b/.github/workflows/test_and_build.yml index 10fe81f6..f6113e8c 100644 --- a/.github/workflows/test_and_build.yml +++ b/.github/workflows/test_and_build.yml @@ -22,8 +22,9 @@ jobs: strategy: matrix: # os : [ubuntu-16.04, ubuntu-20.04] - os : [ubuntu-16.04, ubuntu-20.04, windows-2019] -# os : [ubuntu-16.04, windows-2019] +# os : [ubuntu-16.04, ubuntu-20.04] +# os : [ubuntu-16.04, ubuntu-20.04, windows-2019] + os : [windows-2019] # os : [ubuntu-latest, ubuntu-18.04, windows-2019, windows-latest] python: [3.8] env: @@ -50,7 +51,6 @@ jobs: if: runner.os == 'Windows' run: | choco install libreoffice-fresh -y - choco install wixtoolset -y - name: Tests python on ${{ matrix.os }} run: python run.py test_python - name: Install Qt on Linux @@ -108,12 +108,27 @@ jobs: # if: runner.os == 'Windows' # shell: cmd # run: python run.py test_binary_as_dir - - name: upload on ${{ matrix.os }} binary in artifact +# - name: upload on ${{ matrix.os }} binary in artifact +# if: runner.os == 'Windows' +# uses: actions/upload-artifact@v1 +# with: +# path: windows +# name: MyCartable-${{runner.os}}64 + + - name: upload on Windows binary in artifact if: runner.os == 'Windows' - uses: actions/upload-artifact@v1 + uses: actions/upload-artifact@v2 with: + name: MyCartable-windows path: windows - name: MyCartable-${{runner.os}}64 + # - name: upload on Windows binary in artifact + # if: runner.os == 'Windows' +# uses: actions/upload-artifact@v2 +# with: +# name: "MyCartable" +# path: | +# windows/MyCartable +# windows/MyCartable*.msi - name: upload on ${{ matrix.os }} binary in artifact if: runner.os == 'Linux' @@ -123,32 +138,65 @@ jobs: name: MyCartable-${{runner.os}}64 Create_release: - needs: TestAndBuild - runs-on: ubuntu-latest - steps: - - name: Download artifact binary - uses: actions/download-artifact@v2 - - name: zip release - run: | - python -m zipfile -c MyCartable-Linux64.zip MyCartable-Linux64 - python -m zipfile -c MyCartable-Windows64.zip MyCartable-Windows64 - - name: new latest release on master - uses: "marvinpinto/action-automatic-releases@latest" - if: github.ref == 'refs/heads/master' - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - automatic_release_tag: "latest" - title: "MyCartable Latest" - files: | - MyCartable-Linux64.zip - MyCartable-Windows64.zip - - name: new tag release - uses: "marvinpinto/action-automatic-releases@latest" - if: contains(github.ref, '/tags/') - with: - repo_token: "${{ secrets.GITHUB_TOKEN }}" - prerelease: false - files: | - MyCartable-Linux64.zip - MyCartable-Windows64.zip + needs: TestAndBuild + runs-on: ubuntu-latest + steps: + - name: Download artifact binary + uses: actions/download-artifact@v2 + with: + path: . + - name: new latest release on master + uses: "marvinpinto/action-automatic-releases@latest" + if: github.ref == 'refs/heads/master' + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + automatic_release_tag: "latest" + title: "MyCartable Latest" + files: | + MyCartable-windows/MyCartable*.msi +# artifact/MyCartable*.AppImage + - name: Display structure of downloaded files + run: ls -R + working-directory: . + - name: new tag release + uses: "marvinpinto/action-automatic-releases@latest" + if: contains(github.ref, '/tags/') + with: + repo_token: "${{ secrets.GITHUB_TOKEN }}" + prerelease: false + files: | + MyCartable-windows/MyCartable*.msi +# artifact/MyCartable*.AppImage + +# +# Create_release: +# needs: TestAndBuild +# runs-on: ubuntu-latest +# steps: +# - name: Download artifact binary +# uses: actions/download-artifact@v2 +# - name: zip release +# run: | +# python -m zipfile -c MyCartable-Linux64.zip MyCartable-Linux64 +# python -m zipfile -c MyCartable-Windows64.zip MyCartable-Windows64 +# - name: new latest release on master +# uses: "marvinpinto/action-automatic-releases@latest" +# if: github.ref == 'refs/heads/master' +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# prerelease: false +# automatic_release_tag: "latest" +# title: "MyCartable Latest" +# files: | +# MyCartable-Linux64.zip +# MyCartable-Windows64.zip +# - name: new tag release +# uses: "marvinpinto/action-automatic-releases@latest" +# if: contains(github.ref, '/tags/') +# with: +# repo_token: "${{ secrets.GITHUB_TOKEN }}" +# prerelease: false +# files: | +# MyCartable-Linux64.zip +# MyCartable-Windows64.zip diff --git a/pyproject.toml b/pyproject.toml index 83d4312d..e6aeba2f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [tool.briefcase] project_name = "MyCartable" bundle = "coding.cacahuete" -version = "0.0.1" +version = "0.9.0" url = "https://github.com/jgirardet/MyCartable" license = "GNU General Public License v3 (GPLv3)" author = 'Jimmy Girardet' @@ -9,8 +9,8 @@ author_email = "ijkl@netc.fr" [tool.briefcase.app.mycartable] formal_name = "MyCartable" -description = "My first application" -#icon = "src/mycartable/resources/mycartable" +description = "Toute le travail de l'école, à un seul endroit !!" +icon = "src/data/icons/appicon" sources = ['src/mycartable'] requires = ['pyside2==5.15.0', 'pony>=0.7.11,<0.8', diff --git a/src/data/icons/appicon-512.png b/src/data/icons/appicon-512.png new file mode 100644 index 00000000..8df6627e Binary files /dev/null and b/src/data/icons/appicon-512.png differ diff --git a/src/data/icons/appicon.ico b/src/data/icons/appicon.ico new file mode 100644 index 00000000..c81e2b8b Binary files /dev/null and b/src/data/icons/appicon.ico differ diff --git a/src/data/icons/appicon.xcf b/src/data/icons/appicon.xcf new file mode 100644 index 00000000..7ddaaaea Binary files /dev/null and b/src/data/icons/appicon.xcf differ diff --git a/src/data/icons/droits.txt b/src/data/icons/droits.txt new file mode 100644 index 00000000..643e35ab --- /dev/null +++ b/src/data/icons/droits.txt @@ -0,0 +1,2 @@ +sac à dos : Cadre vecteur créé par brgfx - fr.freepik.com +hache : Arbre vecteur créé par macrovector - fr.freepik.com diff --git a/src/mycartable/main.py b/src/mycartable/main.py index cec5cab8..f4d0dac6 100755 --- a/src/mycartable/main.py +++ b/src/mycartable/main.py @@ -9,6 +9,7 @@ QStandardPaths, QSettings, QCoreApplication, + QLocale, ) # from fbs_runtime.application_context.PySide2 import ApplicationContext @@ -133,6 +134,7 @@ def main(filename=None): # global settings QCoreApplication.setApplicationName(APPNAME) QCoreApplication.setOrganizationName(ORGNAME) + QLocale.setDefault(QLocale(QLocale.French, QLocale.France)) # create de app app = QApplication([]) @@ -141,7 +143,7 @@ def main(filename=None): main_init_database(filename=filename, prod=prod) # create instance de ce qui sera des singleton dans qml - databaseObject, ui_manager = create_singleton_instance() + databaseObject, ui_manager = create_singleton_instance(prod) app.dao = databaseObject # register les new qml type diff --git a/src/mycartable/package/files_path.py b/src/mycartable/package/files_path.py index c1321d59..81192823 100644 --- a/src/mycartable/package/files_path.py +++ b/src/mycartable/package/files_path.py @@ -3,11 +3,23 @@ from PySide2.QtCore import QStandardPaths from loguru import logger from package.constantes import APPNAME - - -def root_data(): - r = Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)) - if not r.is_dir(): +from package import get_prod + + +def root_data(create=True): + prod = get_prod() + if prod: + r = ( + Path(QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)) + / APPNAME + ) + else: + r = Path( + QStandardPaths.writableLocation(QStandardPaths.AppDataLocation), APPNAME + ) + # en attendant le vrai systeme de sauvegarde + # r = Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)) + if not r.is_dir() and create: r.mkdir(parents=True) logger.info(f"Root data set to {r}") return r diff --git a/tests/python/test_file_path.py b/tests/python/test_file_path.py index 78a00b65..137daf0a 100644 --- a/tests/python/test_file_path.py +++ b/tests/python/test_file_path.py @@ -1,12 +1,19 @@ import shutil from pathlib import Path +from unittest.mock import patch +import pytest from package.files_path import root_data, files, tmp_files from PySide2.QtCore import QStandardPaths -def test_root_data(): - appdata = Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)) +def test_root_data_en_test(): + appdata = ( + Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)) + / "MyCartable" + ) + # desactive en attendant la sauvegarde + # appdata = Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)) rrr = root_data() assert rrr == appdata shutil.rmtree(rrr) @@ -14,6 +21,20 @@ def test_root_data(): assert rrr.is_dir() +def test_root_data_en_prod(): + with patch("package.files_path.get_prod", return_value=True): + + appdata = ( + Path(QStandardPaths.writableLocation(QStandardPaths.DocumentsLocation)) + / "MyCartable" + ) + # desactive en attendant la sauvegarde + # appdata = Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation)) + rrr = root_data(create=False) + print(rrr) + assert rrr == appdata + + def test_files(): root = root_data() (root / "files").mkdir(parents=True) diff --git a/tests/qml_tests/tst_MovingText.qml b/tests/qml_tests/tst_MovingText.qml index 08eb1b35..e799c595 100644 --- a/tests/qml_tests/tst_MovingText.qml +++ b/tests/qml_tests/tst_MovingText.qml @@ -49,6 +49,9 @@ Item { } function test_start_animation_and_stop() { + if (Qt.platform.os == "windows") + skip("ne marche pas sur windows"); + tested.text = "azeraezrtrerter"; // moveTextLeft.duration = 5; verify(tested.truncated == true);