Skip to content

v0.9.0 #112

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

Merged
merged 146 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
74c2d24
Simple tooltips, tabs and code editor scaffold
murilopolese Oct 25, 2023
da1cea0
Loading test to editor on creation
murilopolese Oct 25, 2023
8562643
Indent with tabs
murilopolese Oct 25, 2023
c199406
Default editor keyboard shortcuts
murilopolese Oct 25, 2023
abf2393
Connection dialog
murilopolese Oct 30, 2023
f68a1df
Connect, REPL and code execution
murilopolese Oct 30, 2023
2e7e572
Visual cue for disabled/disconnected REPL
murilopolese Oct 31, 2023
73fcba3
WIP: Switching tabs make terminal disapear
murilopolese Nov 1, 2023
4087a47
WIP: Switching tabs make terminal disapear
murilopolese Nov 1, 2023
5e24ed3
WIP: Switching tabs make terminal disapear
murilopolese Nov 1, 2023
fa6ee0b
Tabs initial implementation
murilopolese Nov 1, 2023
4572ab6
File manager UI
murilopolese Nov 2, 2023
d2eace9
WIP implementing modeled architecture
murilopolese Nov 9, 2023
9fe5722
WIP editor and file manager views
murilopolese Nov 15, 2023
98e2282
Small style adjustment
murilopolese Nov 15, 2023
be4ab49
Temporary global app overlays
murilopolese Nov 15, 2023
68acd04
Saving and deleting
murilopolese Nov 15, 2023
d5c1c5d
Board navigation
murilopolese Nov 16, 2023
91b88be
Fix transferring update
murilopolese Nov 16, 2023
4804376
Fix saving bug
murilopolese Nov 23, 2023
ed1d9fb
Close button on inactive tabs
murilopolese Nov 23, 2023
12bc525
Update style
murilopolese Nov 29, 2023
c59b007
Fix font weight on tabs
murilopolese Nov 29, 2023
d4b5d57
New file
murilopolese Dec 4, 2023
b4e2238
pinned Python version to prevent build failure on Mac OS
ubidefeo Dec 15, 2023
0c44315
Merge pull request #70 from arduino/main
ubidefeo Jan 7, 2024
b27c2e4
Modeling diagrams inside documentation folder
murilopolese Jan 9, 2024
d543d61
Design reference
murilopolese Jan 9, 2024
ff30269
fixed board disconnect
ubidefeo Jan 9, 2024
b9925cb
updated content of new created file to remove reference to arduino fr…
ubidefeo Jan 9, 2024
118d98c
updated file open icon
ubidefeo Jan 9, 2024
9f30b6e
Merge pull request #71 from arduino/feature/tabs-and-file-manager
murilopolese Jan 10, 2024
b5be9b8
Merge branch 'arduino:main' into bugfix/board-disconnect
ubidefeo Jan 10, 2024
86e6ecd
Merge pull request #73 from ubidefeo/bugfix/board-disconnect
ubidefeo Jan 10, 2024
9498495
Merge pull request #74 from ubidefeo/feature/new-open-icon
ubidefeo Jan 10, 2024
0dbeaa4
Merge pull request #75 from ubidefeo/feature/new-file-content
ubidefeo Jan 10, 2024
ac61629
force lib folder creation in root
ubidefeo Jan 10, 2024
4326183
Merge pull request #76 from ubidefeo/bugfix/root-lib-folder
ubidefeo Jan 10, 2024
e756e10
new files get created at top of list for both board and disk
ubidefeo Jan 10, 2024
4744146
Merge pull request #77 from ubidefeo/bugfix/new-file-on-top
ubidefeo Jan 10, 2024
c1f2af2
fixed file sorting for disk
ubidefeo Jan 9, 2024
a944016
fixed sorting for both disk and board
ubidefeo Jan 10, 2024
de48c03
Watching DOM changes with mutation observer
murilopolese Jan 10, 2024
c1e9773
amended last commit to cleanup comments and rename function
ubidefeo Jan 10, 2024
39ea89c
Merge pull request #78 from ubidefeo/bugfix/file-sorting
ubidefeo Jan 10, 2024
8256bd2
Merge pull request #79 from murilopolese/bugfix/autofocus-input
murilopolese Jan 10, 2024
bfcd9d6
Fix typo
murilopolese Jan 11, 2024
c1f0284
Compare also parent folders when verifying if file is already open
murilopolese Jan 11, 2024
1ed2a41
Merge pull request #82 from murilopolese/bugfix/tab-names
murilopolese Jan 11, 2024
42e8aae
Making full path visible
murilopolese Jan 11, 2024
408285c
Update padding
murilopolese Jan 11, 2024
9e90be7
Merge pull request #83 from murilopolese/bugfix/display-navigation-fu…
murilopolese Jan 12, 2024
3789385
Bump micropython.js version
murilopolese Jan 12, 2024
e0650ce
Merge pull request #84 from murilopolese/bugfix/bump-micropythonjs-ve…
murilopolese Jan 12, 2024
ed3aede
relocated onKeyDown event into DiskFileList and BoardFileList
ubidefeo Jan 14, 2024
ca143a5
Merge pull request #86 from ubidefeo/feature/new-file-key-events
ubidefeo Jan 17, 2024
a9bf064
Use `getNavigationPath` instead of `getFullPath`
murilopolese Jan 17, 2024
6bdcff0
Merge pull request #87 from murilopolese/bugfix/folder-navigation
murilopolese Jan 18, 2024
4dc1543
amended confirmation dialogs removed useless wrapper
ubidefeo Jan 18, 2024
e03afad
removed last occurrence of confirmDialog
ubidefeo Jan 19, 2024
82d5211
Binding `onKeyEvent` to the input
murilopolese Jan 19, 2024
cffccd4
Do not disconnect observer after first focus
murilopolese Jan 19, 2024
510ccb3
confirmAction initialised as const as per request on PR
ubidefeo Jan 19, 2024
c9a98ee
Merge pull request #90 from murilopolese/bugfix/new-file-input
murilopolese Jan 19, 2024
941989d
Merge pull request #88 from ubidefeo/feature/copy-delete-confirmation
murilopolese Jan 19, 2024
4600dca
updated version number to 0.9.0
ubidefeo Jan 21, 2024
7cf9e80
TEST-ONLY: workflow changes. might break.
ubidefeo Jan 21, 2024
368278d
refined windows artifact name
ubidefeo Jan 21, 2024
8a0c387
added package-lock.json
ubidefeo Jan 26, 2024
c975c91
Merge pull request #91 from arduino/github/workflow-update
ubidefeo Jan 30, 2024
2d8b3bd
Merge pull request #92 from ubidefeo/version-update
ubidefeo Jan 31, 2024
dcd76b3
Brings in micropython.js#v1.4.4 to fix binary transfers
ubidefeo Mar 10, 2024
78e0d34
CSS minor fix on item height
ubidefeo Mar 11, 2024
5a5b424
Merge pull request #93 from arduino/bugfix/binary-transfer
ubidefeo Mar 20, 2024
cf585e8
Remove checkbox on file list
murilopolese Mar 20, 2024
771d7bc
Navigate to folders with double click and make folder selectable
murilopolese Mar 20, 2024
5716f94
Make a generator for DiskFileList and BoardFileList
murilopolese Mar 20, 2024
8883d74
New selection
murilopolese Mar 20, 2024
5469aec
Missing logs on store
murilopolese Mar 21, 2024
d0b2f3a
Reset the navigation path when changing the navigation root
murilopolese Mar 21, 2024
4c2c55a
Use `board` instead of `serial`
murilopolese Mar 21, 2024
dea70c5
Create folder
murilopolese Mar 21, 2024
2c2fa89
Recursively remove folders
murilopolese Mar 21, 2024
104cd69
Adjust styles of overflowing names
murilopolese Mar 25, 2024
1f07317
Upload and download entire folders
murilopolese Mar 25, 2024
9f9d564
Replacing `substr` because it's deprecated
murilopolese Mar 26, 2024
2e9953a
Cleanup and logic improvement
murilopolese Mar 26, 2024
0290c9c
Adjust cursor on item of file list
murilopolese Mar 26, 2024
0728cb2
Fix python helper to remove all files and folder
murilopolese Mar 26, 2024
eddad74
Fix naming conflict
murilopolese Mar 26, 2024
a6fcbc6
Improved alerts to remove and overwrite
murilopolese Mar 26, 2024
748a1f4
Renaming files
murilopolese Mar 27, 2024
4d80af5
Fix timing of waiting state
murilopolese Mar 27, 2024
ef1c588
Cursor SVG icon
murilopolese Mar 27, 2024
4556f2d
Check overwrites on rename operation
murilopolese Mar 27, 2024
88ca1fb
Fix imperceptible bug on file removal alert
murilopolese Mar 27, 2024
5dc7ba6
Creates api for checking if file exists on disk and board
murilopolese Mar 28, 2024
bb7b367
Implement overwritting checks on saving
murilopolese Mar 28, 2024
0a73f68
Group all file names on a single alert when removing files
murilopolese Mar 28, 2024
45aac82
Implement overwritting checks on creating files and folders
murilopolese Mar 28, 2024
44270ff
Merge pull request #97 from arduino/feature/file-manager
murilopolese Apr 2, 2024
dea7844
File input font matches the file item
murilopolese Apr 2, 2024
092e5ab
Alert about overwriting files on upload and download
murilopolese Apr 2, 2024
62101a7
Fix wrong comment
murilopolese Apr 2, 2024
0cbd145
Merge branch 'development' into rename-test
murilopolese Apr 2, 2024
fe9ad32
Fix merge issues
murilopolese Apr 2, 2024
71285cb
Fix renaming alerts
murilopolese Apr 2, 2024
7c043c7
Merge pull request #98 from arduino/feature/overwrite-alerts
murilopolese Apr 2, 2024
bf20272
Merge branch 'development' into feature/rename-files
murilopolese Apr 2, 2024
1e43d2d
Merge pull request #99 from arduino/feature/rename-files
murilopolese Apr 3, 2024
da22e5d
Verbose attempt to implement renaming tabs
murilopolese Apr 8, 2024
cd21d6e
Defining `renamingTab` on state
murilopolese Apr 8, 2024
3be4792
Cleanup and covering more edge cases
murilopolese Apr 9, 2024
6a25c8a
Update flowchart and design reference
murilopolese Apr 9, 2024
0b68c94
Officially swapping from old UI
murilopolese Apr 9, 2024
03b5afe
Changing UI package name
murilopolese Apr 9, 2024
8a0641d
Fix UI helper path
murilopolese Apr 9, 2024
e89a65f
Merge pull request #102 from arduino/feature/rename-tab2
murilopolese Apr 9, 2024
3cf9075
Merge pull request #103 from arduino/chore/remove-old-ui
murilopolese Apr 9, 2024
b5d809e
Style CodeMirror's search panel
murilopolese Apr 10, 2024
196904c
Remove `!important`
murilopolese Apr 10, 2024
0dab66a
Remove unused style rule
murilopolese Apr 10, 2024
1629d10
Local fonts
murilopolese Apr 10, 2024
40e3c75
Nicer transitions
murilopolese Apr 10, 2024
9b9115c
Merge pull request #104 from arduino/feature/style-search-panel
murilopolese Apr 10, 2024
ab3d557
Panel resizing
murilopolese Apr 10, 2024
0bcf212
Merge branch 'development' into feature/resize-panel
murilopolese Apr 10, 2024
2ac39df
Stop resizing on certain situations
murilopolese Apr 11, 2024
d08ecaa
Merge pull request #105 from arduino/feature/resize-panel
murilopolese Apr 11, 2024
da87d75
Sorting files
murilopolese Apr 11, 2024
7cfa26f
Merge pull request #106 from arduino/feature/file-sorting
murilopolese Apr 15, 2024
f25b5d0
Update readme
murilopolese Apr 15, 2024
a2a118d
Remove unused components
murilopolese Apr 15, 2024
f9ad4f5
Update text line-height
murilopolese Apr 15, 2024
c688247
Add image to readme
murilopolese Apr 15, 2024
36c473f
Alert user before closing tab with unsaved changes
murilopolese Apr 15, 2024
88f3b93
Transparent overlay instead of DOM overwrite
murilopolese Apr 15, 2024
a13ffdc
Merge pull request #107 from arduino/chore/docs
murilopolese Apr 15, 2024
54524d1
Merge pull request #108 from arduino/feature/alert-unsaved
murilopolese Apr 15, 2024
2893099
Merge pull request #109 from arduino/feature/overlay
murilopolese Apr 15, 2024
a21c792
Remove unused dependencies
murilopolese Apr 16, 2024
f542eb7
Getting prompt before performing serial operations (saving)
murilopolese Apr 16, 2024
4c5fe4f
Fix camel case
murilopolese Apr 16, 2024
801d7b1
Merge pull request #110 from arduino/bugfix/saving
murilopolese Apr 16, 2024
38a204b
Fix image urls
murilopolese Apr 16, 2024
4ef45c9
Merge pull request #111 from arduino/bugfix/readme
murilopolese Apr 16, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Arduino MicroPython Lab
name: Arduino Lab for MicroPython

on:
push:
Expand Down Expand Up @@ -96,15 +96,15 @@ jobs:
matrix:
artifact:
- path: "*-linux_x64.zip"
name: Linux_X86-64
name: Arduino-Lab-for-MicroPython_Linux_X86-64
- path: "*-mac_x64.zip"
name: macOS
name: Arduino-Lab-for-MicroPython_macOS_X86-64
# - path: "*Windows_64bit.exe"
# name: Windows_X86-64_interactive_installer
# - path: "*Windows_64bit.msi"
# name: Windows_X86-64_MSI
- path: "*-win_x64.zip"
name: Windows_X86-64_zip
name: Arduino-Lab-for-MicroPython_Windows_X86-64

steps:
- name: Download job transfer artifact
Expand Down
44 changes: 21 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# Arduino Lab for MicroPython

Arduino Lab for MicroPython is a lightweight editor for MicroPython programs, supporting connection with a board, code upload, file transfer, interactive REPL shell.
This project is sponsored by Arduino, based on original work by Murilo Polese. This is an experimental pre-release software, please direct any questions only to Github issues.
<p align="center">

<img src="https://github.com/arduino/lab-micropython-editor/blob/development/ui/arduino/documents/Screenshot%20from%202024-04-15%2009-48-25.png?raw=true" width="50%" />

</p>

Arduino Lab for MicroPython is a lightweight editor for MicroPython programs, supporting connection with a board, code upload, file transfer and interactive REPL shell.
This project is sponsored by Arduino, based on original work by [Murilo Polese](http://www.murilopolese.com). This is an experimental pre-release software, please direct any questions only to Github issues.

## Features
- MicroPython's Read Eval Print Loop (REPL)
- Enter paste mode
- Enter raw repl
- Software reset
- Tab to autocomplete
- File system management (Disk and MicroPython File System)
- Create
- Rename
- Multiple file and folder selection
- Remove
- Upload
- Download
- Text editor with Python syntax highlight
- Code execution controls
- Text editor
- Python syntax highlight and autocomplete
- Multiple tabs
- Rename tabs
- Code execution
- Run what's on text editor
- Stop (keyboard interrupt)
- Soft reset

## Technical
## Technical overview

Arduino Lab for MicroPython is an [Electron](https://www.electronjs.org/) app that has its main purpose to communicate over serial with a microprocessor running [MicroPython](https://micropython.org/). All Electron code is at `/index.js`.

Expand All @@ -36,33 +47,21 @@ At the root of the repository you will find:

- `/.github`: Github's workflow configuration.
- `/build_resources`: Icons and other assets used during the build process.
- `/scripts`: Scripts executed during the build process.
- `/ui`: Available user interfaces.
- `/index.js`: Main Electron code.
- `/preload.js`: Creates Disk and Serial APIs on Electron's main process and exposes it to Electron's renderer process (context bridge).

## Arduino UI
- `/preload.js`: Creates Disk, Serial and Window APIs on Electron's main process and exposes it to Electron's renderer process (context bridge).

Default UI is a [choo-choo](https://github.com/choojs/choo) app. It has pre-built dependencies so no build process is required for the interface.
## User interface

The dependencies and source code are included manually in the `/ui/arduino/index.html` file.

The app is a standard [choo-choo](https://github.com/choojs/choo) app and it has:

- `/ui/arduino/app.js`: A router deciding which view to load.
- `/ui/arduino/components`: HTML templates and components.
- `/ui/arduino/store.js`: A "store" that handles events emitted by the views, change the app state and orchestrate re-rendering.
- `/ui/arduino/libs`: Prebuilt dependencies.

It can be useful to learn more about [Choo](https://github.com/choojs/choo) or the [Elm Architecture](https://guide.elm-lang.org/architecture/).
Read more at [`/ui/arduino/README.md`](./ui/arduino/README.md)

## Disk and Serial API

In order for the UI code to be independent of Electron code, there is an API defined at `/preload.js` that describes all the allowed operations.

There are 2 main operation "channels": Serial communication and local Filesystem operations. Both channels offer methods that always return promises and are used mostly through [`async`/`await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).
There are 3 main operation "channels": Serial communication, local filesystem and window operations. These channels offer methods that should always return promises and are used mostly through [`async`/`await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function).

While the serial communication is mediated by `/micropython.js`, the local filesystem operations are done through Electron's `ipcRenderer` calls. The handlers for these calls are defined at `/index.js`
While the serial communication is mediated by `/micropython.js`, the local filesystem and window operations are done through Electron's `ipcRenderer` calls. The handlers for these calls are defined at `/index.js`

## Running Arduino Lab for MicroPython from source code

Expand All @@ -73,7 +72,6 @@ While the serial communication is mediated by `/micropython.js`, the local files

Some changes on the Electron code will require reopening the app but all UI changes will only require refreshing the window (ctrl-r/cmd-r).


## Trademarks

"Python" and the Python Logo are trademarks of the Python Software Foundation.
Expand Down
51 changes: 51 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,24 @@ function ilistFolder(folder) {
return files
}

function getAllFiles(dirPath, arrayOfFiles) {
// https://coderrocketfuel.com/article/recursively-list-all-the-files-in-a-directory-using-node-js
files = ilistFolder(dirPath)
arrayOfFiles = arrayOfFiles || []
files.forEach(function(file) {
const p = path.join(dirPath, file.path)
const stat = fs.statSync(p)
arrayOfFiles.push({
path: p,
type: stat.isDirectory() ? 'folder' : 'file'
})
if (stat.isDirectory()) {
arrayOfFiles = getAllFiles(p, arrayOfFiles)
}
})
return arrayOfFiles
}

// LOCAL FILE SYSTEM ACCESS
ipcMain.handle('open-folder', async (event) => {
console.log('ipcMain', 'open-folder')
Expand All @@ -63,6 +81,12 @@ ipcMain.handle('ilist-files', async (event, folder) => {
return ilistFolder(folder)
})

ipcMain.handle('ilist-all-files', (event, folder) => {
console.log('ipcMain', 'ilist-all-files', folder)
if (!folder) return []
return getAllFiles(folder)
})

ipcMain.handle('load-file', (event, filePath) => {
console.log('ipcMain', 'load-file', filePath)
let content = fs.readFileSync(filePath)
Expand Down Expand Up @@ -98,6 +122,32 @@ ipcMain.handle('rename-file', (event, filePath, newFilePath) => {
return true
})

ipcMain.handle('create-folder', (event, folderPath) => {
console.log('ipcMain', 'create-folder', folderPath)
try {
fs.mkdirSync(folderPath, { recursive: true })
} catch(e) {
console.log('error', e)
return false
}
return true
})

ipcMain.handle('remove-folder', (event, folderPath) => {
console.log('ipcMain', 'remove-folder', folderPath)
fs.rmdirSync(folderPath, { recursive: true, force: true })
return true
})

ipcMain.handle('file-exists', (event, filePath) => {
console.log('ipcMain', 'file-exists', filePath)
try {
fs.accessSync(filePath, fs.constants.F_OK)
return true
} catch(err) {
return false
}
})
// WINDOW MANAGEMENT

ipcMain.handle('set-window-size', (event, minWidth, minHeight) => {
Expand Down Expand Up @@ -125,6 +175,7 @@ function createWindow () {
})
// and load the index.html of the app.
win.loadFile('ui/arduino/index.html')
// win.loadFile('ui/sandbox/index.html')
}

// TODO: Loading splash screen
Expand Down
Loading