Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.21 #15

Merged
merged 2 commits into from
Apr 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 0 additions & 16 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <module>
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...
Expand Down
2 changes: 1 addition & 1 deletion stm32pio/app.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-

__version__ = '1.20'
__version__ = '1.21'

import argparse
import logging
Expand Down
11 changes: 5 additions & 6 deletions stm32pio_gui/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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]

Expand Down Expand Up @@ -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())
8 changes: 4 additions & 4 deletions stm32pio_gui/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ ApplicationWindow {

Labs.SystemTrayIcon {
id: sysTrayIcon
icon.source: 'icons/icon.svg'
icon.source: './icons/icon.svg'
visible: settings.get('notifications')
}

Expand All @@ -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
}
Expand Down Expand Up @@ -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: "<b>Hint:</b> add your project using this button or drag'n'drop it into the window"
Expand All @@ -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()
}
}
Expand Down