Skip to content

Commit 498a2df

Browse files
lizlooneyalan412
andauthored
Make warning bubbles visible. (#192)
* Make warning bubbles visible. * Fix typescript errors --------- Co-authored-by: Alan Smith <[email protected]>
1 parent acbfc1f commit 498a2df

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

src/blocks/mrc_call_python_function.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,7 @@ const CALL_PYTHON_FUNCTION = {
705705
// Add a warnings to the block.
706706
const warningText = warnings.join('\n\n');
707707
this.setWarningText(warningText, WARNING_ID_FUNCTION_CHANGED);
708+
this.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true);
708709
this.bringToFront();
709710
} else {
710711
// Clear the existing warning on the block.

src/blocks/mrc_event.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ const EVENT = {
207207
// If we end up here it shouldn't be allowed
208208
block.unplug(true);
209209
blockBlock.setWarningText('Events can only go in the events section of the robot or mechanism');
210+
blockBlock.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true);
210211
}
211212
},
212213
getEvent: function (this: EventBlock): commonStorage.Event {

src/blocks/mrc_event_handler.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ const EVENT_HANDLER = {
204204
// Add a warnings to the block.
205205
const warningText = warnings.join('\n\n');
206206
this.setWarningText(warningText, WARNING_ID_EVENT_CHANGED);
207+
this.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true);
207208
this.bringToFront();
208209
} else {
209210
// Clear the existing warning on the block.

src/blocks/mrc_get_parameter.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const GET_PARAMETER_BLOCK = {
9090
// If we end up here it shouldn't be allowed
9191
block.unplug(true);
9292
blockBlock.setWarningText(Blockly.Msg.PARAMETERS_CAN_ONLY_GO_IN_THEIR_METHODS_BLOCK);
93+
blockBlock.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true);
9394
}
9495
},
9596
};

src/blocks/mrc_mechanism.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ const MECHANISM = {
210210
// Add a warnings to the block.
211211
const warningText = warnings.join('\n\n');
212212
this.setWarningText(warningText, WARNING_ID_MECHANISM_CHANGED);
213+
this.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true);
213214
this.bringToFront();
214215
} else {
215216
// Clear the existing warning on the block.

0 commit comments

Comments
 (0)