Skip to content

Commit

Permalink
Merge pull request #14 from ussserrr/dev
Browse files Browse the repository at this point in the history
v1.20
  • Loading branch information
ussserrr committed Apr 18, 2020
2 parents e3252df + a967b9e commit 8cd9fe5
Show file tree
Hide file tree
Showing 29 changed files with 2,135 additions and 1,453 deletions.
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,3 +195,36 @@
- Changed: separate `Stm32pio` arguments onto 2 categories: project parameters and instance options and use dictionaries for them. First one has now the same form as the project config `configparser.ConfigParser` and merging into the default and file settings on the project creation. Instance options are more related to the programmatic instance itself and contains currently 2 options - `logger` and `save_on_destruction`
- Changed: use `append()` instead of `insert()` to modify `sys.path`
- Changed: when raising the exceptions use more elegant expressions (e.g. `raise FileNotFoundError(file)` instead of `raise FileNotFoundError("file FILE was not found")`). Use `pathlib.Path().resolve(strict=True)` where appropriate to shorten the code

## ver. 1.20 (18.04.20)
- New: GUI. System tray notifications when the main window is not in the foreground (can be turned off in the settings)
- New: GUI. Drag-and-drop folder(s) to add
- New: GUI. README, screenshots, diagrams
- New: GUI. Catch projects duplication on appending
- New: GUI. Mark the list item when the action is done and it is not a current item
- New: GUI. Highlight the actions that were picked for the series
- New: GUI. setuptools `extras` option to install the GUI version via pip
- New: GUI. Wrap imports into `try...catch`
- New: GUI. Reset settings feature
- New: GUI. New `ProjectListItem` members: `_from_startup` flag, `_current_action` string with corresponding properties and signals
- New: GUI. More extensive use of the `typing` annotations
- New: GUI. Allow to pass extra setter functions to the `Settings` which will be called on the value change
- New: allow to specify the `.ioc` file instead of the directory. Check that `.ioc` is a non-empty text file
- Fixed: GUI. Projects are not destructed until the app shutdown
- Fixed: GUI. Settings dialog doesn't correctly represents the parameters
- Fixed: GUI. Settings on Windows (case-sensitive vs insensitive situation)
- Fixed: GUI. List item loader
- Fixed: GUI. Flaws when index changes
- Changed: GUI. Clean the logs too when invoking the 'Clean' action
- Changed: GUI. Stop the chain of commands if someone drops -1 or an exception
- Changed: GUI. Use Qt StateMachine to control the visual appearance of the project action button
- Changed: GUI. Rename the module `stm32pio-gui` -> `stm32pio_gui`
- Changed: GUI. Better printing of exception messages
- Changed: GUI. Revised finalizer (similar to core version)
- Changed: GUI. Cache `state` and `state.current_stage` both for back- and frontend to reduce IO operations
- Changed: GUI. rename `ProjectActionWorker` -> `Worker` (as it is used for the variety of tasks) and some of its internals
- Changed: GUI. Pass `Settings` prefix as an argument for the constructor
- Changed: GUI. Move more stuff inside the `main()` function, less global variables
- Changed: exclude screenshots from the setuptools bundle
- Changed: restructure TODO.md into sections
- Changed: remove `from __future__ import annotations` statements
9 changes: 4 additions & 5 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
include .gitignore
include CHANGELOG
include CHANGELOG.md
include LICENSE
include MANIFEST.in
include README.md
include TODO.md
recursive-include screenshots *
recursive-include stm32pio-test-project *
include stm32pio-gui/main.qml
include stm32pio-gui/README.md
recursive-include stm32pio-gui/icons *
include stm32pio_gui/main.qml
include stm32pio_gui/README.md
recursive-include stm32pio_gui/icons *
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ Small cross-platform Python app that can create and update [PlatformIO](https://

It uses STM32CubeMX to generate a HAL-framework-based code and alongside creates PlatformIO project with compatible parameters to stick them both together.

The [GUI version](/stm32pio_gui) is available, too.

![Logo](/screenshots/logo.png)


Expand Down Expand Up @@ -68,10 +70,10 @@ $ pip uninstall stm32pio

## Usage
Basically, you need to follow such a pattern:
1. Create CubeMX project (.ioc file), set-up your hardware configuration, save
1. Create CubeMX project (.ioc file), set-up your hardware configuration, save with the compatible parameters
2. Run the stm32pio that automatically invokes CubeMX to generate the code, creates PlatformIO project, patches a `platformio.ini` file and so on
3. Work on the project in your editor as usual, compile/upload/debug etc.
4. Edit the configuration in CubeMX when necessary, then run stm32pio to re-generate the code.
4. Edit the configuration in CubeMX when necessary, then run stm32pio to re-generate the code

Refer to Example section on more detailed steps. If you face off with some error try to enable a verbose output to get more information about a problem:
```shell script
Expand Down Expand Up @@ -111,7 +113,7 @@ You can also use stm32pio as an ordinary Python package and embed it in your own

![Project tab](/screenshots/tab_Project.png)

4. Use a copied string as a `-d` argument for stm32pio. So it is assumed that the name of the project folder matches the name of `.ioc` file. (`-d` argument can be omitted if your current working directory is already a project directory)
4. Use a copied string (project folder) as a `-d` argument for stm32pio (can be omitted if your current working directory is already a project directory).
5. Run `platformio boards` (`pio boards`) or go to [boards](https://docs.platformio.org/en/latest/boards) to list all supported devices. Pick one and use its ID as a `-b` argument (for example, `nucleo_f031k6`)
6. All done! You can now run
```shell script
Expand Down
78 changes: 63 additions & 15 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,80 @@
# TODOs

## Business logic, business features
- [ ] Issues guide for the GitHub (OS, content of the config, project tree, enable verbose)
- [ ] GitHub CHANGELOG - separate New, Fixed, Changed into paragraphs
- [ ] Middleware support (FreeRTOS, etc.)
- [ ] Arduino framework support (needs research to check if it is possible)
- [ ] Add more checks, for example when updating the project (`generate` command), check for boards matching and so on...
- [ ] GUI. Tests (research approaches and patterns)
- [ ] GUI. Reduce number of calls to 'state' (many IO operations)
- [ ] GUI. Drag and drop the new folder into the app window
- [ ] GUI. Implement some other methods for Qt abstract models
- [ ] GUI. Warning on 'Clean' action
- [ ] GUI. On 'Clean' clean the log too
- [ ] GUI. Stop the chain of commands if someone drops -1 or an exception
- [ ] Create VSCode plugin
- [x] Remove casts to string where we can use path-like objects (related to Python version as new ones receive path-like objects arguments)

## GUI version
- [ ] Handle the initialization error (when boards are receiving)
- [ ] Maybe `data()` `QAbstractListModel` method can be used instead of custom `get()`
- [ ] Can probably detect Ctrl and Shift clicks without moving the mouse first
- [ ] Notify the user that the 'board' parameter is empty
- [ ] Mac: sometimes auto turned off shift highlighting after action (hide-restore helps)
- [ ] Some visual flaws when the window have got resized (e.g. 'Add' button position doesn't change until the list gets focus, 'Log' area crawls onto the status bar)
- [ ] Gray out "stage" line in all projects except current
- [ ] Tests (research approaches and patterns)
- [ ] Test performance with a large number of projects in the model. First test was made:
1. Some projects occasionally change `initLoading` by itself (probably Loader unloads the content) (hence cannot click on them, busy indicator appearing)

Note: Delegates are instantiated as needed and may be destroyed at any time. They are parented to ListView's contentItem, not to the view itself. State should never be stored in a delegate.

Use `id()` in `setInitInfo()`. Or do not use ListView at all (replace by Repeater, for example) as it can reset our "notifications"
2. Some projects show OK even after its deletion (only the app restart helps)
- [ ] Test with different timings
- [ ] Divide on multiple modules (both Python and QML)
- [ ] Implement other methods for Qt abstract models
- [ ] Warning on 'Clean' action (maybe the window with a checkbox "Do not ask in the future" (QSettings parameter))
- [ ] 2 types of logging formatters for 2 verbosity levels
- [ ] `TypeError: Cannot read property 'actionRunning' of null` (deconstruction order) (on project deletion only)
- [ ] QML logging - pass to Python' `logging` and establish a similar format. Distinguish between `console.log()`, `console.error()` and so on
- [ ] Lost log box autoscroll when manually scrolling between the actions
- [ ] Crash on shutdown in Win and Linux (errors such as `[QML] CRITICAL QThread: Destroyed while thread is still running Process finished with exit code 1073741845`)
- [ ] 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...
- [x] Remove casts to string where we can use path-like objects (related to Python version as new ones receive path-like objects arguments while old ones aren't)
- [ ] We look for some snippets of strings in logs and output for the testing code but we hard-code them and this is not good, probably (e.g. 'DEBUG')
- [ ] Store a folder initial content in .ini config and ignore it on clean-up process. Allow the user to modify such list (i.e. list of exclusion)
- [ ] Store a folder initial content in .ini config and ignore it on clean-up process. Allow the user to modify such list (i.e. list of exclusion) in the config file. Mb some integration with `.gitignore`
- [ ] at some point check for all tools (CubeMX, ...) to be present in the system (both CLI and GUI) (global `--check` command (as `--version`), also before execution of the full cycle (no sense to start if some tool doesn't exist))
- [ ] generate code docs (help user to understand an internal mechanics, e.g. for embedding). Can be uploaded to the GitHub Wiki
- [ ] colored logs, maybe...
- [ ] colored logs, maybe (brakes zero-dependency principle)
- [ ] check logging work when embed stm32pio lib in a third-party stuff (no logging setup at all)
- [ ] merge subprocess pipes to one where suitable (i.e. `stdout` and `stderr`)
- [ ] redirect subprocess pipes to `DEVNULL` where suitable to suppress output (tests)
- [ ] Two words about a synchronous nature of the lib and user's responsibility of async wrapping (if needed). Also, maybe migrate to async/await approach in the future
- [ ] `__init__`' `parameters` dict argument schema (Python 3.8 feature).
- [ ] See https://docs.python.org/3/howto/logging-cookbook.html#context-info to maybe remade current logging schema (current is, perhaps, a cause of the strange error while testing (in the logging thread))
- [ ] UML diagrams (core, GUI back- and front-ends)
- [ ] CI is possible (Arch's AUR has the STM32CubeMX package, also there is a direct link). Deploy Docker in Azure Pipelines, basic at Travis CI
- [ ] See https://docs.python.org/3/howto/logging-cookbook.html#context-info to maybe remade current logging schema (current is, perhaps, a cause of the strange error while testing (in the logging thread), also modifies global settings (log message factory))
- [ ] UML diagrams (core, GUI back- and front-ends, thread flows, events, etc.)
- [ ] CI is possible (Arch's AUR has the STM32CubeMX package, also there is a direct link). Deploy Docker one in Azure Pipelines, basic at Travis CI
- [ ] Test preserving user files and folders on regeneration and mb other operations
- [ ] Move special formatters inside the library. It is an implementation detail actually that we use subprocesses and so on
- [ ] Mb store the last occurred exception traceback in .ini file and show on some CLI command (so we don't necessarily need to turn on the verbose mode). And, in general, we should show the error reason right off
- [ ] 'verbose' and 'non-verbose' tests as `subTest` (also `should_log_error_...`)
- [ ] the lib sometimes raising, sometimes returning the code and it is not consistent. While the reasons behind such behaviour are clear, would be great to always return a result code and raise the exceptions in the outer scope, if there is need to
- [ ] the lib sometimes raising, sometimes returning the code and it is not consistent. While the reasons behind such behavior are clear, would be great to always return a result code and raise the exceptions in the outer scope, if there is need to
- [ ] check board (no sense to go further on 'new' if the board in config.ini is not correct)
- [ ] check if `platformio.ini` config will be successfully parsed when there are interpolation and/or empty parameters
- [x] check if `.ioc` file is a text file on project initialization. Let `_find_ioc_file()` method to use explicitly provided file (useful for GUI). Maybe let user specify it via CLI
- [ ] mb add CLI command for starting the GUI version (for example, `stm32pio --gui`)
- [ ] test using virtualenv
12 changes: 11 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'tests'
]
),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3 :: Only",
"License :: OSI Approved :: MIT License",
Expand All @@ -50,10 +51,19 @@
setup_requires=[
'wheel'
],
include_package_data=True,
# GUI module (stm32pio_gui) will be installed in any case (because find_packages() will find it) but its
# dependencies will be installed only when this option is given
extras_require={
'GUI': [
'PySide2'
]
},
entry_points={
'console_scripts': [
'stm32pio = stm32pio.app:main'
],
'gui_scripts': [
'stm32pio_gui = stm32pio_gui.app:main [GUI]'
]
}
)
15 changes: 0 additions & 15 deletions stm32pio-gui/README.md

This file was deleted.

Loading

0 comments on commit 8cd9fe5

Please sign in to comment.