Skip to content

Fix/stop on filemanager switch #183

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 4 commits into from
Apr 11, 2025
Merged
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
2 changes: 0 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -65,11 +65,9 @@ app.on('ready', () => {
createWindow()

win.on('focus', () => {
console.log("win focus")
})

win.on('blur', () => {
console.log("win blur")
})

})
14 changes: 5 additions & 9 deletions ui/arduino/store.js
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@ async function confirmDialog(msg, cancelMsg, confirmMsg) {
cancelId: 1,
message: msg
})
console.log('confirm', response)
return Promise.resolve(response)
}

@@ -103,14 +102,17 @@ async function store(state, emitter) {
}
emitter.emit('render')
})

emitter.on('change-view', (view) => {

if (state.view === 'file-manager') {
if (view != state.view) {
state.selectedFiles = []
}
emitter.emit('refresh-files')
}
if(view === 'file-manager') {
emitter.emit('stop')
}
state.view = view
emitter.emit('render')
updateMenu()
@@ -158,7 +160,6 @@ async function store(state, emitter) {
cancelId: 0,
message: "Could not connect to the board. Reset it and try again."
})
console.log('Reset request acknowledged', response)
emitter.emit('connection-timeout')
}, 3500)
try {
@@ -1194,7 +1195,6 @@ async function store(state, emitter) {
&& f.source == selectedFile.source
&& f.parentFolder == selectedFile.parentFolder
})
console.log('already open', alreadyOpen)

if (!alreadyOpen) {
// This file is not open yet,
@@ -1544,19 +1544,16 @@ async function store(state, emitter) {

function filterDoubleRun(onlySelected = false) {
if (preventDoubleRun) return
console.log('>>> RUN CODE ACTUAL <<<')
emitter.emit('run', onlySelected)
timedReset()
}

function runCode() {
console.log('>>> RUN CODE REQUEST <<<')
if (canExecute({ view: state.view, isConnected: state.isConnected })) {
filterDoubleRun()
}
}
function runCodeSelection() {
console.log('>>> RUN CODE REQUEST <<<')
if (canExecute({ view: state.view, isConnected: state.isConnected })) {
filterDoubleRun(true)
}
@@ -1629,13 +1626,12 @@ async function store(state, emitter) {
}
const tabExists = state.openFiles.find(f => f.parentFolder === newFile.parentFolder && f.fileName === newFile.fileName && f.source === newFile.source)
if (tabExists || fullPathExists) {
const confirmation = confirmDialog(`File ${newFile.fileName} already exists on ${source}. Please choose another name.`, 'OK')
const confirmation = await confirmDialog(`File ${newFile.fileName} already exists on ${source}. Please choose another name.`, 'OK')
return false
}
// LEAK > listeners keep getting added and not removed when tabs are closed
// additionally I found that closing a tab has actually added an extra listener
newFile.editor.onChange = function() {
console.log('editor has changes')
newFile.hasChanges = true
emitter.emit('render')
}