Skip to content

Product name change and bugfixes #21

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 15 commits into from
Nov 21, 2022
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
7 changes: 1 addition & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,5 @@ 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.
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.

9 changes: 5 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const { app, BrowserWindow, Menu, ipcMain, dialog } = require('electron')
const path = require('path')
const fs = require('fs')
const join = require('path').join
const openAboutWindow = require('about-window').default

let win = null // main window
Expand All @@ -20,6 +19,8 @@ function listFolder(folder) {
let filePath = path.resolve(folder, f)
return !fs.lstatSync(filePath).isDirectory()
})
// Filter out dot files
files = files.filter(f => f.indexOf('.') !== 0)
return files
}

Expand Down Expand Up @@ -160,7 +161,7 @@ const template = [
{ role: 'togglefullscreen' },
...(isDev ? [
{ type: 'separator' },
{ role: 'toggleDevTools' },
{ role: 'toggleDevTools' },
]:[
])
]
Expand Down Expand Up @@ -201,8 +202,8 @@ const template = [
label:'Info about this app',
click: () => {
openAboutWindow({
icon_path: join(__dirname, 'ui/arduino/assets/about_image.png'),
css_path: join(__dirname, 'ui/arduino/about.css'),
icon_path: path.join(__dirname, 'ui/arduino/assets/about_image.png'),
css_path: path.join(__dirname, 'ui/arduino/about.css'),
copyright: '© Arduino SA 2022',
package_json_dir: __dirname,
bug_report_url: "https://github.com/arduino/lab-micropython-editor/issues",
Expand Down
12 changes: 9 additions & 3 deletions micropython.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ function sleep(millis) {
})
}

function escape_string(string) {
string = string.replace(/"""/g, `\\"\\"\\"`)
string = string.replace(/\'/g, `\\'`)
string = string.replace(/\"/g, `\\"`)
return string
}

class MicroPythonBoard {
constructor() {
this.device = null
Expand Down Expand Up @@ -221,7 +228,7 @@ class MicroPythonBoard {
for (let i = 0; i < content.length; i+=128) {
let slice = content.slice(i, i+128)
slice = slice.toString()
slice = slice.replace(/"""/g, `\\"\\"\\"`)
slice = escape_string(slice)
await this.serial.write(`w("""${slice}""")`)
await this.serial.write(`\x04`)
await sleep(100)
Expand All @@ -243,8 +250,7 @@ class MicroPythonBoard {
for (let i = 0; i < content.length; i+=64) {
let slice = content.slice(i, i+64)
slice = slice.toString()
slice = slice.replace(/"""/g, `\\"\\"\\"`)
// slice = slice.replace(//g, ``)
slice = escape_string(slice)
await this.serial.write(`w("""${slice}""")\n`)
await this.serial.write(`\x04`)
await sleep(50)
Expand Down
Loading