From 6db7344a2b9618526bdf5ff1c3712a7452875acd Mon Sep 17 00:00:00 2001 From: Liz Looney Date: Thu, 7 Aug 2025 23:27:44 -0700 Subject: [PATCH 1/2] Make warning bubbles visible. --- src/blocks/mrc_call_python_function.ts | 1 + src/blocks/mrc_event.ts | 1 + src/blocks/mrc_event_handler.ts | 1 + src/blocks/mrc_get_parameter.ts | 1 + src/blocks/mrc_mechanism.ts | 1 + 5 files changed, 5 insertions(+) diff --git a/src/blocks/mrc_call_python_function.ts b/src/blocks/mrc_call_python_function.ts index 33da9e08..db9c9bc9 100644 --- a/src/blocks/mrc_call_python_function.ts +++ b/src/blocks/mrc_call_python_function.ts @@ -705,6 +705,7 @@ const CALL_PYTHON_FUNCTION = { // Add a warnings to the block. const warningText = warnings.join('\n\n'); this.setWarningText(warningText, WARNING_ID_FUNCTION_CHANGED); + this.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); this.bringToFront(); } else { // Clear the existing warning on the block. diff --git a/src/blocks/mrc_event.ts b/src/blocks/mrc_event.ts index 4e662322..1f3c3d59 100644 --- a/src/blocks/mrc_event.ts +++ b/src/blocks/mrc_event.ts @@ -207,6 +207,7 @@ const EVENT = { // If we end up here it shouldn't be allowed block.unplug(true); blockBlock.setWarningText('Events can only go in the events section of the robot or mechanism'); + blockBlock.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); } }, getEvent: function (this: EventBlock): commonStorage.Event { diff --git a/src/blocks/mrc_event_handler.ts b/src/blocks/mrc_event_handler.ts index 99905ad5..9167709b 100644 --- a/src/blocks/mrc_event_handler.ts +++ b/src/blocks/mrc_event_handler.ts @@ -204,6 +204,7 @@ const EVENT_HANDLER = { // Add a warnings to the block. const warningText = warnings.join('\n\n'); this.setWarningText(warningText, WARNING_ID_EVENT_CHANGED); + this.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); this.bringToFront(); } else { // Clear the existing warning on the block. diff --git a/src/blocks/mrc_get_parameter.ts b/src/blocks/mrc_get_parameter.ts index 248ce00c..6b9dd378 100644 --- a/src/blocks/mrc_get_parameter.ts +++ b/src/blocks/mrc_get_parameter.ts @@ -90,6 +90,7 @@ const GET_PARAMETER_BLOCK = { // If we end up here it shouldn't be allowed block.unplug(true); blockBlock.setWarningText(Blockly.Msg.PARAMETERS_CAN_ONLY_GO_IN_THEIR_METHODS_BLOCK); + blockBlock.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); } }, }; diff --git a/src/blocks/mrc_mechanism.ts b/src/blocks/mrc_mechanism.ts index 90e77f80..29857ada 100644 --- a/src/blocks/mrc_mechanism.ts +++ b/src/blocks/mrc_mechanism.ts @@ -210,6 +210,7 @@ const MECHANISM = { // Add a warnings to the block. const warningText = warnings.join('\n\n'); this.setWarningText(warningText, WARNING_ID_MECHANISM_CHANGED); + this.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); this.bringToFront(); } else { // Clear the existing warning on the block. From f851cc5ec93ccf70f419eb853c1631945316ce67 Mon Sep 17 00:00:00 2001 From: Alan Smith Date: Fri, 8 Aug 2025 07:40:49 -0400 Subject: [PATCH 2/2] Fix typescript errors --- src/blocks/mrc_call_python_function.ts | 2 +- src/blocks/mrc_event.ts | 2 +- src/blocks/mrc_event_handler.ts | 2 +- src/blocks/mrc_get_parameter.ts | 2 +- src/blocks/mrc_mechanism.ts | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/blocks/mrc_call_python_function.ts b/src/blocks/mrc_call_python_function.ts index db9c9bc9..c5804d66 100644 --- a/src/blocks/mrc_call_python_function.ts +++ b/src/blocks/mrc_call_python_function.ts @@ -705,7 +705,7 @@ const CALL_PYTHON_FUNCTION = { // Add a warnings to the block. const warningText = warnings.join('\n\n'); this.setWarningText(warningText, WARNING_ID_FUNCTION_CHANGED); - this.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); + this.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true); this.bringToFront(); } else { // Clear the existing warning on the block. diff --git a/src/blocks/mrc_event.ts b/src/blocks/mrc_event.ts index 1f3c3d59..0a6d6172 100644 --- a/src/blocks/mrc_event.ts +++ b/src/blocks/mrc_event.ts @@ -207,7 +207,7 @@ const EVENT = { // If we end up here it shouldn't be allowed block.unplug(true); blockBlock.setWarningText('Events can only go in the events section of the robot or mechanism'); - blockBlock.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); + blockBlock.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true); } }, getEvent: function (this: EventBlock): commonStorage.Event { diff --git a/src/blocks/mrc_event_handler.ts b/src/blocks/mrc_event_handler.ts index 9167709b..e1639802 100644 --- a/src/blocks/mrc_event_handler.ts +++ b/src/blocks/mrc_event_handler.ts @@ -204,7 +204,7 @@ const EVENT_HANDLER = { // Add a warnings to the block. const warningText = warnings.join('\n\n'); this.setWarningText(warningText, WARNING_ID_EVENT_CHANGED); - this.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); + this.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true); this.bringToFront(); } else { // Clear the existing warning on the block. diff --git a/src/blocks/mrc_get_parameter.ts b/src/blocks/mrc_get_parameter.ts index 6b9dd378..32b30b58 100644 --- a/src/blocks/mrc_get_parameter.ts +++ b/src/blocks/mrc_get_parameter.ts @@ -90,7 +90,7 @@ const GET_PARAMETER_BLOCK = { // If we end up here it shouldn't be allowed block.unplug(true); blockBlock.setWarningText(Blockly.Msg.PARAMETERS_CAN_ONLY_GO_IN_THEIR_METHODS_BLOCK); - blockBlock.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); + blockBlock.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true); } }, }; diff --git a/src/blocks/mrc_mechanism.ts b/src/blocks/mrc_mechanism.ts index 29857ada..c6cde2a3 100644 --- a/src/blocks/mrc_mechanism.ts +++ b/src/blocks/mrc_mechanism.ts @@ -210,7 +210,7 @@ const MECHANISM = { // Add a warnings to the block. const warningText = warnings.join('\n\n'); this.setWarningText(warningText, WARNING_ID_MECHANISM_CHANGED); - this.getIcon(Blockly.icons.IconType.WARNING).setBubbleVisible(true); + this.getIcon(Blockly.icons.IconType.WARNING)!.setBubbleVisible(true); this.bringToFront(); } else { // Clear the existing warning on the block.