Skip to content

Feature/new file management #49

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 48 commits into from
Jun 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
f4c8f5c
Switch to disk device when disconnected
murilopolese May 18, 2023
8200fca
Upgrade `micropython.js`
murilopolese May 18, 2023
221c0e4
Update toolbar and file management UI
murilopolese May 18, 2023
87fd32f
Prevent executing empty string command
murilopolese May 18, 2023
283c63e
Update `micropython.js`
murilopolese May 23, 2023
8c02450
Listing folders
murilopolese May 23, 2023
b02c179
Folder navigation
murilopolese May 23, 2023
4c0b826
Loading, creating, removing and renaming files
murilopolese May 23, 2023
0951048
Clean navigation path
murilopolese May 23, 2023
ebe9c3a
Cleaning paths and updating download and upload actions
murilopolese May 24, 2023
6604bd9
Update enabled state of remove buttons
murilopolese May 24, 2023
3f4e9f0
Deselect file when navigating on selected device
murilopolese May 24, 2023
eca3388
Waiting before updating files to workaround racing conditions
murilopolese May 24, 2023
006bed1
Bugfix with creation of files on board
murilopolese May 24, 2023
ad9835c
Design fixes
murilopolese May 25, 2023
031a40d
Adding a blocking UI element
murilopolese May 25, 2023
c299d6c
Unblocking if override confirmations are negative
murilopolese May 25, 2023
61d2716
Blocking interface on disk operations too
murilopolese May 30, 2023
5f69e04
Remove unused component
murilopolese May 30, 2023
0f043ec
Improve blocking UI
murilopolese May 30, 2023
ba2a699
Hidden big file names with an ellipsis
murilopolese May 30, 2023
f1162b0
Bugfix renaming file
murilopolese May 30, 2023
f407318
Displays message while waits for renaming
murilopolese May 30, 2023
d4c889c
Fixing renaming message
murilopolese May 30, 2023
0bd5e52
Clean characters
murilopolese May 30, 2023
2112aa7
Clean characters on upload and download
murilopolese May 30, 2023
3a0d4a3
Disconnect from serial
murilopolese May 31, 2023
6b801cb
No action if there is no file name change
murilopolese May 31, 2023
4f820e5
Make sure there is a lib folder on connect
murilopolese May 31, 2023
f3e89db
Bump `micropython.js` version
murilopolese May 31, 2023
71c7c41
Prompt on code change
murilopolese May 31, 2023
2d1ec1e
Update package-lock
murilopolese May 31, 2023
cf9f21e
Prevent "code change" flag to be set when interface is blocked
murilopolese Jun 1, 2023
82c3423
Progress on saving files
murilopolese Jun 7, 2023
1648e6a
Configure chunk sizes
murilopolese Jun 7, 2023
17bc255
Improve message
murilopolese Jun 7, 2023
9f8fc5a
Fix bug renaming files inside folders
murilopolese Jun 7, 2023
8ba776f
Exit raw repl on connect
murilopolese Jun 8, 2023
b2be81f
Bump micropython.js version
murilopolese Jun 13, 2023
f99c746
Update package-lock
murilopolese Jun 14, 2023
f3fb7f4
Don't check whether board is on raw repl
murilopolese Jun 14, 2023
1fd1383
Light refactoring
murilopolese Jun 14, 2023
0ee8055
Make sure cursor changes without having to move the mouse
murilopolese Jun 14, 2023
324da86
Adjust api to match new micropython.js
murilopolese Jun 22, 2023
64bcd06
use micropython.js run
murilopolese Jun 22, 2023
72a05cf
Progress on renaming to a new file
murilopolese Jun 22, 2023
967a2cd
Update micropython.js version
murilopolese Jun 22, 2023
f511561
Bump version
murilopolese Jun 22, 2023
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: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This project is sponsored by Arduino, based on original work by Murilo Polese. T

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`.

All operations over serial are abstracted and packaged on `/micropython.js` which is an attempt of porting `pyboard.py`. The port has its [own repository](https://github.com/murilopolese/micropython.js) but for the sake of simplicity and transparency, `micropython.js` is committed as source code.
All operations over serial are abstracted and packaged on `/micropython.js` which is an attempt of porting `pyboard.py`. The port has its [own repository](https://github.com/arduino/micropython.js) but for the sake of simplicity and transparency, `micropython.js` is committed as source code.

The User Interface (UI) source code stays inside `/ui` folder and is completely independent of the Electron code.

Expand All @@ -39,7 +39,6 @@ At the root of the repository you will find:
- `/scripts`: Scripts executed during the build process.
- `/ui`: Available user interfaces.
- `/index.js`: Main Electron code.
- `/micropython.js`: Serial connection abstraction.
- `/preload.js`: Creates Disk and Serial APIs on Electron's main process and exposes it to Electron's renderer process (context bridge).

## Arduino UI
Expand Down Expand Up @@ -82,4 +81,3 @@ Some changes on the Electron code will require reopening the app but all UI chan
## Disclaimer

This software is provided “as is” and we make no express or implied warranties whatsoever with respect to its functionality, operability, or use, including, without limitation, any implied warranties of merchantability, fitness for a particular purpose, or infringement. We expressly disclaim any liability whatsoever for any direct, indirect, consequential, incidental or special damages, including, without limitation, lost revenues, lost profits, losses resulting from business interruption or loss of data, regardless of the form of action or legal theory under which the liability may be asserted, even if advised of the possibility or likelihood of such damages.

25 changes: 25 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ function listFolder(folder) {
return files
}

function ilistFolder(folder, filesOnly) {
let files = fs.readdirSync(path.resolve(folder))
files = files.map(f => {
let filePath = path.resolve(folder, f)
return {
path: f,
type: fs.lstatSync(filePath).isDirectory() ? 'folder' : 'file'
}
})
// Filter out directories
if (filesOnly) {
files = files.filter(f => f.type === 'file')
}
// Filter out dot files
files = files.filter(f => f.path.indexOf('.') !== 0)
return files
}


// LOCAL FILE SYSTEM ACCESS
ipcMain.handle('open-folder', async (event) => {
console.log('ipcMain', 'open-folder')
Expand All @@ -39,6 +58,12 @@ ipcMain.handle('list-files', async (event, folder) => {
return listFolder(folder)
})

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

ipcMain.handle('load-file', (event, folder, filename) => {
console.log('ipcMain', 'load-file', folder, filename )
let filePath = path.resolve(folder, filename)
Expand Down
Loading