-
-
Notifications
You must be signed in to change notification settings - Fork 435
[Toolbar] Hover style and Toggle State [ATL-1107][ATL-1045] #190
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
Changes from all commits
d04dba2
b331419
757e8d1
7e94552
8858415
cf3445a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,15 +18,21 @@ export class VerifySketch extends SketchContribution { | |
@inject(BoardsServiceProvider) | ||
protected readonly boardsServiceClientImpl: BoardsServiceProvider; | ||
|
||
verifyInProgress = false; | ||
|
||
registerCommands(registry: CommandRegistry): void { | ||
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH, { | ||
execute: () => this.verifySketch() | ||
execute: () => this.verifySketch(), | ||
isEnabled: () => !this.verifyInProgress, | ||
}); | ||
registry.registerCommand(VerifySketch.Commands.EXPORT_BINARIES, { | ||
execute: () => this.verifySketch(true) | ||
execute: () => this.verifySketch(true), | ||
isEnabled: () => !this.verifyInProgress, | ||
fstasi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
registry.registerCommand(VerifySketch.Commands.VERIFY_SKETCH_TOOLBAR, { | ||
isVisible: widget => ArduinoToolbar.is(widget) && widget.side === 'left', | ||
isEnabled: () => !this.verifyInProgress, | ||
isToggled: () => this.verifyInProgress, | ||
execute: () => registry.executeCommand(VerifySketch.Commands.VERIFY_SKETCH.id) | ||
}); | ||
} | ||
|
@@ -65,7 +71,17 @@ export class VerifySketch extends SketchContribution { | |
} | ||
|
||
async verifySketch(exportBinaries?: boolean): Promise<void> { | ||
|
||
// even with buttons disabled, better to double check if a verify is already in progress | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Why? This code should not run if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this check in order to future-proof the verify-sketch implementation: https://arduino.atlassian.net/browse/ATL-1045 reports an error (Error: Request upload failed with message: 2 UNKNOWN: exit status 1) when a verify/build is run while another is in progress. At the moment we only have buttons/menu items, but the check whether or not continue with the action should be inside the action handler itself in my opinion.. Do you have concerns about this approach? |
||
if (this.verifyInProgress) { | ||
return; | ||
} | ||
|
||
// toggle the toolbar button and menu item state. | ||
// verifyInProgress will be set to false whether the compilation fails or not | ||
this.verifyInProgress = true; | ||
const sketch = await this.sketchServiceClient.currentSketch(); | ||
|
||
if (!sketch) { | ||
return; | ||
} | ||
|
@@ -90,6 +106,8 @@ export class VerifySketch extends SketchContribution { | |
this.messageService.info('Done compiling.', { timeout: 1000 }); | ||
} catch (e) { | ||
this.messageService.error(e.toString()); | ||
} finally { | ||
this.verifyInProgress = false; | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,15 +15,24 @@ | |
background: var(--theia-arduino-toolbar-background); | ||
} | ||
|
||
.p-TabBar-toolbar .item.arduino-tool-item > div:hover { | ||
background: (--theia-arduino-toolbar-hoverBackground); | ||
.p-TabBar-toolbar .item.arduino-tool-item:hover > div { | ||
background: white; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We cannot use hard-coded color so neither
Here is the Theia doc: https://github.com/eclipse-theia/theia/pull/6475/files#diff-06572a96a58dc510037d5efa622f9bec8519bc1beab13c9f251e97e657a9d4ed |
||
} | ||
|
||
.arduino-verify-sketch--toolbar, | ||
.arduino-upload-sketch--toolbar { | ||
border-radius: 12px; | ||
} | ||
|
||
.item.arduino-tool-item.toggled { | ||
background-color: unset; | ||
opacity: 1; | ||
} | ||
|
||
.item.arduino-tool-item.toggled .arduino-verify-sketch--toolbar { | ||
background-color: rgb(255,204,0) !important; | ||
} | ||
|
||
.arduino-tool-icon { | ||
height: 24px; | ||
width: 24px; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be a
protected
field, not apublic
mutable property. Same for the upload part.