Skip to content

Commit

Permalink
move data to home/documents (#82)
Browse files Browse the repository at this point in the history
change local
start release
  • Loading branch information
jgirardet authored Aug 30, 2020
1 parent 3ed4a25 commit 67f2325
Show file tree
Hide file tree
Showing 10 changed files with 134 additions and 46 deletions.
118 changes: 83 additions & 35 deletions .github/workflows/test_and_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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'
Expand All @@ -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
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[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'
author_email = "[email protected]"

[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',
Expand Down
Binary file added src/data/icons/appicon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/data/icons/appicon.ico
Binary file not shown.
Binary file added src/data/icons/appicon.xcf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/data/icons/droits.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
sac à dos : <a href="https://fr.freepik.com/vecteurs/cadre">Cadre vecteur créé par brgfx - fr.freepik.com</a>
hache : <a href='https://fr.freepik.com/vecteurs/arbre'>Arbre vecteur créé par macrovector - fr.freepik.com</a>
4 changes: 3 additions & 1 deletion src/mycartable/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
QStandardPaths,
QSettings,
QCoreApplication,
QLocale,
)

# from fbs_runtime.application_context.PySide2 import ApplicationContext
Expand Down Expand Up @@ -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([])
Expand All @@ -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
Expand Down
22 changes: 17 additions & 5 deletions src/mycartable/package/files_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 23 additions & 2 deletions tests/python/test_file_path.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,40 @@
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)
rrr = 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)
Expand Down
3 changes: 3 additions & 0 deletions tests/qml_tests/tst_MovingText.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 67f2325

Please sign in to comment.