diff --git a/CHANGELOG.md b/CHANGELOG.md index af4fced..4dbe252 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -228,3 +228,7 @@ - Changed: exclude screenshots from the setuptools bundle - Changed: restructure TODO.md into sections - Changed: remove `from __future__ import annotations` statements + +## ver. 1.21 (19.04.20) + - Fixed: GUI. All paths are now reliably treated both for QML and Python + - Changed: README installation process actualized \ No newline at end of file diff --git a/README.md b/README.md index 2caa647..5cccc82 100644 --- a/README.md +++ b/README.md @@ -53,9 +53,11 @@ any-path/ $ python3 path/to/stm32pio-repo/stm32pio/app.py However, it's handier to install the utility to be able to run stm32pio from anywhere. Use ```shell script -stm32pio-repo/ $ pip install . +stm32pio-repo/ $ pip install wheel +stm32pio-repo/ $ python setup.py sdist bdist_wheel +stm32pio-repo/ $ pip install dist/stm32pio-X.XX-py3-none-any.whl ``` -command to launch the setup process. Now you can simply type `stm32pio` in the terminal to run the utility in any directory. +commands to launch the setup process. Now you can simply type `stm32pio` in the terminal to run the utility in any directory. Finally, the PyPI distribution (starting from v0.95) is available: ```shell script diff --git a/TODO.md b/TODO.md index 26797ab..d37f2c0 100644 --- a/TODO.md +++ b/TODO.md @@ -35,22 +35,6 @@ - [ ] Start with a folder opened if it was provided on CLI (for example, `stm32pio_gui .`) - [ ] Linux: - Not a monospace font in the log area - - [ ] Relative resource paths: - - ``` - ⌘ python3 Documents/GitHub/stm32pio/stm32pio_gui/app.py - INFO main Starting stm32pio_gui... - qt.svg: Cannot open file '/Users/chufyrev/stm32pio_gui/icons/icon.svg', because: No such file or directory - qt.svg: Cannot open file '/Users/chufyrev/stm32pio_gui/icons/icon.svg', because: No such file or directory - QQmlApplicationEngine failed to load component - file:///Users/chufyrev/stm32pio_gui/main.qml: No such file or directory - Traceback (most recent call last): - File "Documents/GitHub/stm32pio/stm32pio_gui/app.py", line 629, in - sys.exit(main()) - File "Documents/GitHub/stm32pio/stm32pio_gui/app.py", line 590, in main - main_window = engine.rootObjects()[0] - IndexError: list index out of range - ``` ## Core library - [ ] Add more checks, for example when updating the project (`generate` command), check for boards matching and so on... diff --git a/stm32pio/app.py b/stm32pio/app.py index 55b1fe8..d804308 100755 --- a/stm32pio/app.py +++ b/stm32pio/app.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- -__version__ = '1.20' +__version__ = '1.21' import argparse import logging diff --git a/stm32pio_gui/app.py b/stm32pio_gui/app.py index 54868f0..629f187 100644 --- a/stm32pio_gui/app.py +++ b/stm32pio_gui/app.py @@ -30,12 +30,14 @@ "or manually install its dependencies by yourself") sys.exit(-1) +ROOT_PATH = pathlib.Path(sys.path[0]).parent +MODULE_PATH = pathlib.Path(__file__).parent try: import stm32pio.settings import stm32pio.lib import stm32pio.util except ModuleNotFoundError: - sys.path.insert(0, str(pathlib.Path(sys.path[0]).parent)) + sys.path.insert(0, str(ROOT_PATH)) import stm32pio.settings import stm32pio.lib import stm32pio.util @@ -609,7 +611,7 @@ def qt_message_handler(mode, context, message): # Used as a settings identifier too app.setOrganizationName('ussserrr') app.setApplicationName('stm32pio') - app.setWindowIcon(QIcon('stm32pio_gui/icons/icon.svg')) + app.setWindowIcon(QIcon(str(MODULE_PATH.joinpath('icons/icon.svg')))) global settings @@ -667,7 +669,7 @@ def verbose_setter(value): engine.rootContext().setContextProperty('boardsModel', boards_model) engine.rootContext().setContextProperty('appSettings', settings) - engine.load(QUrl.fromLocalFile('stm32pio_gui/main.qml')) + engine.load(QUrl.fromLocalFile(str(MODULE_PATH.joinpath('main.qml')))) main_window = engine.rootObjects()[0] @@ -704,7 +706,4 @@ def loaded(_, success): if __name__ == '__main__': - # import os - # os.chdir(str(pathlib.Path(sys.path[0]))) - # print(pathlib.Path.cwd()) sys.exit(main()) diff --git a/stm32pio_gui/main.qml b/stm32pio_gui/main.qml index 3cacbde..5e08c4f 100644 --- a/stm32pio_gui/main.qml +++ b/stm32pio_gui/main.qml @@ -193,7 +193,7 @@ ApplicationWindow { Labs.SystemTrayIcon { id: sysTrayIcon - icon.source: 'icons/icon.svg' + icon.source: './icons/icon.svg' visible: settings.get('notifications') } @@ -212,7 +212,7 @@ ApplicationWindow { Image { id: dropPopupContent anchors.horizontalCenter: parent.horizontalCenter - source: 'icons/drop-here.svg' + source: './icons/drop-here.svg' fillMode: Image.PreserveAspectFit sourceSize.width: 64 } @@ -418,7 +418,7 @@ ApplicationWindow { text: 'Add' Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter display: AbstractButton.TextBesideIcon - icon.source: 'icons/add.svg' + icon.source: './icons/add.svg' onClicked: addProjectFolderDialog.open() ToolTip.visible: projectsListView.count === 0 && !loadingOverlay.visible // show when there is no items in the list ToolTip.text: "Hint: add your project using this button or drag'n'drop it into the window" @@ -428,7 +428,7 @@ ApplicationWindow { visible: projectsListView.currentIndex !== -1 // show only if any item is selected Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter display: AbstractButton.TextBesideIcon - icon.source: 'icons/remove.svg' + icon.source: './icons/remove.svg' onClicked: removeCurrentProject() } }