Commit Graph
683 Commits
Author SHA1 Message Date
David Lechner 7e726fffaf mpy/alerts: implement compiler error
This shows the output from mpy-cross and has a button to go to the
error.
2022-10-19 18:26:37 -05:00
David Lechner e5ab52b250 explorer/fileNameFormGroup: fix fix-it for dash in file name 2022-10-19 18:26:37 -05:00
David Lechner fc4cb8eb78 alerts: add alertsHideAlert actions
This is used instead of using toaster.dismiss() directly.
2022-10-19 18:26:37 -05:00
David Lechner 28cf87c356 alerts: allow overriding key
This adds an optional key parameter to alertsShowAlert() to allow
overriding the key. This allows us to call flashProgress using that
action instead of having to use the toaster directly.
2022-10-19 18:26:37 -05:00
David Lechner fa27649fe3 toasterTypes: change toaster to ref
Instead of rendering the toaster separate from the main index, add it
there so we can inherit all of the context providers. This requires
passing the ref object instead of the toaster instance itself, so
sagas have to be updated.
2022-10-19 18:26:37 -05:00
David Lechner be9272ca9c pybricksMicropython: implement appending imports
This implements appending compiled imported modules for the multi-mpy6
file format.
2022-10-19 18:26:37 -05:00
David Lechner 8b19ad5866 pybricksMicropython: don't allow files with dash
Since we are adding user imports, we need to make sure all file names
are valid module names, so this means we can't use a dash.
2022-10-19 18:26:37 -05:00
David Lechner 5948952174 hub: fix tooltip when download complete
The tooltip was still showing "Downloading... 100%" after downloading
was complete instead of returning to the normal tooltip.
2022-10-17 13:44:21 -05:00
David Lechner bd0b276ea5 hub/sagas: fix scaling of download progress
This was missed in 06b204dd53.

Fixes: https://github.com/pybricks/pybricks-code/issues/1219
2022-10-17 13:44:21 -05:00
David Lechner e67ae1c52b use "error" when type is Error
This renames "err" to "error" when the type is Error for consistency
(fixes redux complaints about non-serializable err).
2022-10-17 13:44:21 -05:00
David Lechner 06b204dd53 hub/sagas: fix handleDownloadAndRun slicing
Some of the math was assuming i was incremented with ++ instead += chunkSize.
2022-10-17 11:16:28 -05:00
David Lechner 960a3163ed add support for Pybricks Profile v1.2.0
This adds support to the BLE Pybricks Profile v1.2.0. This includes a
new method to download and run programs and a new file format for the
user program.

Code for the old download and run is kept for backwards compatibility.
However, the PnP ID characteristic is no longer optional, so the
minimum Pybricks Profile is now v1.1.0.
2022-10-14 16:21:18 -05:00
David Lechner db43cb3e99 remove use of deprecated DomException code property 2022-10-14 16:21:18 -05:00
David Lechner eb26bfcf1b index: ignore value action properties
This was making noise in the browser console log.
2022-10-14 16:21:18 -05:00
David Lechner 6675310390 spelling 2022-10-14 16:21:18 -05:00
189cda94b1 build(deps): bump xterm and xterm-addon-fit (#1146)
* build(deps): bump xterm and xterm-addon-fit

Bumps [xterm](https://github.com/xtermjs/xterm.js) and [xterm-addon-fit](https://github.com/xtermjs/xterm.js). These dependencies needed to be updated together.

Updates `xterm` from 4.19.0 to 5.0.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/4.19.0...5.0.0)

Updates `xterm-addon-fit` from 0.5.0 to 0.6.0
- [Release notes](https://github.com/xtermjs/xterm.js/releases)
- [Commits](https://github.com/xtermjs/xterm.js/compare/0.5...0.6)

---
updated-dependencies:
- dependency-name: xterm
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: xterm-addon-fit
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* fix breaking changes for xterm.js 5.x

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-17 18:14:24 +00:00
6c373c302c build(deps): bump pyodide from 0.21.2 to 0.21.3 (#1144)
* build(deps): bump pyodide from 0.21.2 to 0.21.3

Bumps [pyodide](https://github.com/pyodide/pyodide) from 0.21.2 to 0.21.3.
- [Release notes](https://github.com/pyodide/pyodide/releases)
- [Commits](https://github.com/pyodide/pyodide/compare/0.21.2...0.21.3)

---
updated-dependencies:
- dependency-name: pyodide
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* update patch for pyodide 0.21.3

* make use of new pyodide version export

* fix breaking change in loadPyodide indexURL

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-17 18:05:44 +00:00
David Lechner 56630ef2cf firmware/installPybricksDialog: drop support for including custom main.py
This removes the UI and internal support for selecting a file to include
as the main.py when flashing firmware. This feature was removed in the
firmware starting with firmware metadata v2.0.0 so the firmware that
ships with Pybricks code won't be able to do this in the near future.
So, it doesn't make sense to keep this feature only for old firmware.

It is still possible to replace the main.py in old firmware.zip files
and flash that way.
2022-09-14 18:12:34 -05:00
David Lechner 9811807d09 firmware: add support for firmware.metadata.json v2.0.0
This adds support for the new firmware.metadata.json v2.0.0 which drops
support for appending a main.py file to the firmware.
2022-09-14 17:58:54 -05:00
David Lechner c4d98638b1 firmware/actions: fix error type check
we need to check that it matches the error interface, not that it is
an instance of an error
2022-09-14 17:38:19 -05:00
David Lechner 0bd4a7a282 Merge remote-tracking branch 'origin/master' into dlech 2022-09-13 14:24:43 -05:00
David Lechner 7e2404d583 pybricksMicropython: add support for peer file code completion
This allows importing user-created files and getting code completion
for those imports. This is done by mirroring the dexie-based file
system used by the editor to the emscripten based file system used
by pyodide. In the future, ideally we would have some sort of shared
file system, but this works for now.

Note: completing `from ` doesn't list user files/modules because of
filters in the pybricks-jedi python package but completing
`from my_file import ` does work as expected.
2022-09-13 14:19:29 -05:00
9994e8f4b4 build(deps): bump jest and @types/jest (#1131)
* build(deps): bump jest and @types/jest

Bumps [jest](https://github.com/facebook/jest/tree/HEAD/packages/jest) and [@types/jest](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/jest). These dependencies needed to be updated together.

Updates `jest` from 28.1.3 to 29.0.3
- [Release notes](https://github.com/facebook/jest/releases)
- [Changelog](https://github.com/facebook/jest/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/jest/commits/v29.0.3/packages/jest)

Updates `@types/jest` from 28.1.8 to 29.0.1
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/jest)

---
updated-dependencies:
- dependency-name: jest
  dependency-type: direct:production
  update-type: version-update:semver-major
- dependency-name: "@types/jest"
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* update test snapshots for jest 29

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-09-13 17:06:24 +00:00
David Lechner f24db4a89b implement cache bursting based on http header version
In 096eea7, we made use of APIs that require special http headers to be
configured on the server. This had a side effect of causing the
documentation iframe to not load because the browser would cache the
headers of the iframe index.html page.

We can work around this by providing a header version to do cache
bursting via a query parameter on this page.
2022-09-09 11:33:20 -05:00
David Lechner 76462a0f4a python-worker: enable offline use
This makes the required changes to use Pyodide and Python packages
offline and use a fixed version of the Python packages instead of
fetching the latest from PyPI.

There were a number of issues encountered with Pyodide webpack
compatibility that were fixed using `yarn patch`:
- https://github.com/pyodide/pyodide/pull/3080
- https://github.com/pyodide/pyodide/pull/3085
- https://github.com/pyodide/pyodide/issues/3086
- https://github.com/pyodide/pyodide/issues/3087

Issue: https://github.com/pybricks/pybricks-code/issues/932
2022-09-08 13:43:00 -05:00
David Lechner 4e77efb34f installPybricksDialog: add feature to install custom firmware
This restores the ability to drag and drop a custom firmware file to
flash the firmware on the hub.

Fixes: https://github.com/pybricks/pybricks-code/issues/1020
2022-09-06 14:14:57 -05:00
David Lechner ebb8900efe installPybricksDialog: make use of isMounted hook
This simplifies the code a bit by using an existing hook.
2022-09-06 11:10:49 -05:00
David Lechner b447bd7a3a replace use of deprecated IToaster and IToastProps 2022-09-06 10:56:38 -05:00
David Lechner 677d285ef2 installPybricksDialog: move unsupported hubs to separate component 2022-09-03 14:06:25 -05:00
David Lechner b4e1c8293d replace use of deprecated IRef 2022-09-01 11:45:59 -05:00
David Lechner d59fe813e9 fix explorer import silently ignored when invalid file name
This finishes a TODO to handle allowing the user to rename a file
with an invalid file name when import files from the file system.

Fixes: https://github.com/pybricks/support/issues/717
2022-08-31 17:39:28 -05:00
David Lechner 122b37da29 firmware/sagas: handle usb error during dfu flash
Fixes: https://github.com/pybricks/pybricks-code/issues/1011
2022-08-12 18:00:57 -05:00
David Lechner 722fc3d8ef index: suppress nonserializable 'props.error' 2022-08-12 18:00:57 -05:00
David Lechner 359c01642e index: ignore non-serializable 'payload'
This suppresses redux-toolkit errors in the console log.
2022-08-12 18:00:57 -05:00
David Lechner 968834d84f firmware/alerts/FlashProgress: fix <div> cannot be child of <p> 2022-08-12 18:00:57 -05:00
David Lechner 5b71c7314a app/App: move firmware flash dialogs from settings
The flash firmware dialog show action can be triggered even when the
settings panel is not mounted, so we need to move the dialogs up in
the tree to the app level.

Fixes: https://github.com/pybricks/support/issues/694
2022-08-12 18:00:57 -05:00
David Lechner 92431298b2 toolbar/RunButton: enable only when active file
Before multi-file support, it was not possible to have no open file.
So we need to change the state logic to only enable the button when
there is an active file rather than when the editor "is ready".

Fixes: https://github.com/pybricks/support/issues/691
2022-08-12 18:00:57 -05:00
David Lechner 3ce644d2b3 explorer/Explorer: work around breaking changes in @testing-library/user-event
@testing-library/user-event "fixed" some hover bugs which broke our
usage, so we need to work around it.
2022-08-03 13:03:18 -05:00
6d716f8bbd build(deps): bump react-aria from 3.17.0 to 3.18.0 (#1021)
* build(deps): bump react-aria from 3.17.0 to 3.18.0

Bumps [react-aria](https://github.com/adobe/react-spectrum) from 3.17.0 to 3.18.0.
- [Release notes](https://github.com/adobe/react-spectrum/releases)
- [Commits](https://github.com/adobe/react-spectrum/compare/react-aria@3.17.0...react-aria@3.18.0)

---
updated-dependencies:
- dependency-name: react-aria
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* [dependabot skip] Fix yarn.lock

* add react-aria type override

This works around https://github.com/adobe/react-spectrum/issues/3375

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-fix <dependabot-fix@example.com>
Co-authored-by: David Lechner <david@pybricks.com>
2022-08-03 17:18:21 +00:00
David Lechner e3fece1517 toolbar/TourButton: fix test when env var set
The name depends on the environment and this test failed during release.
2022-07-28 10:32:19 -05:00
David Lechner 90b459d5db firmware/restoreOfficialDialog: add new dialog 2022-07-27 18:17:20 -05:00
David Lechner c84afea181 style: make use of more blueprint styles
https://blueprintjs.com/docs/#core/typography

Also fix wrapping license text while we are touching this.
2022-07-27 16:55:46 -05:00
David Lechner e6609b9054 firmware/installPybricksDialog: fix <div> inside <p>
fixes:

    Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.

Also some other style tweaks while we are touching this.
2022-07-27 16:22:46 -05:00
David Lechner ad774e0f7c suppress redux non-serializable error for error objects 2022-07-27 15:34:39 -05:00
David Lechner 3953816350 components/hubPicker: back state with localStorage
This saves the selected hub in localStorage. This will "remember" the
state between app launches and also synchronize the state between
various users of the component. Both of these should mean fewer clicks
required by the user.
2022-07-27 15:30:39 -05:00
David Lechner 8bece7d957 tour: add new tour component 2022-07-27 15:19:36 -05:00
David Lechner 2b7f1b1cbf firmware/sagas: show progress for BLE flashing 2022-07-27 15:19:36 -05:00
David Lechner 1148b169d5 firmware: add progress indication for DFU USB flash 2022-07-27 15:19:36 -05:00
David Lechner 8dadc8826c firmware/installPybricksDialog: increase height
This ensures the dialog doesn't change size when clicking next even
with longer translations.
2022-07-27 15:19:36 -05:00
David Lechner 4e85b5c1b8 firmware/installPybricksDialog: rename flash button
This makes it clear there are two steps, connect and then flash.
2022-07-27 15:19:36 -05:00