diff --git a/src/blocks/tokens.ts b/src/blocks/tokens.ts index 8df70a8a..1afa5305 100644 --- a/src/blocks/tokens.ts +++ b/src/blocks/tokens.ts @@ -49,6 +49,7 @@ export function customTokens(t: (key: string) => string): typeof Blockly.Msg { ENABLED: t('BLOCKLY.ENABLED'), DISPLAY_NAME: t('BLOCKLY.DISPLAY_NAME'), DISPLAY_GROUP: t('BLOCKLY.DISPLAY_GROUP'), + NO_MECHANISM_CONTENTS: t('BLOCKLY.NO_MECHANISM_CONTENTS'), OPMODE_TYPE_TOOLTIP: t('BLOCKLY.TOOLTIP.OPMODE_TYPE_TOOLTIP'), OPMODE_ENABLED_TOOLTIP: t('BLOCKLY.TOOLTIP.OPMODE_ENABLED_TOOLTIP'), OPMODE_NAME_TOOLTIP: t('BLOCKLY.TOOLTIP.OPMODE_NAME_TOOLTIP'), diff --git a/src/i18n/locales/en/translation.json b/src/i18n/locales/en/translation.json index 5ea20dc1..faacb516 100644 --- a/src/i18n/locales/en/translation.json +++ b/src/i18n/locales/en/translation.json @@ -54,6 +54,7 @@ "DISPLAY_NAME": "Display Name", "DISPLAY_GROUP": "Display Group", "PRINT": "print", + "NO_MECHANISM_CONTENTS": "No Mechanism Contents", "TOOLTIP":{ "EVALUATE_BUT_IGNORE_RESULT": "Executes the connected block and ignores the result. Allows you to call a function and ignore the return value.", "OPMODE_TYPE": "What sort of OpMode this is", diff --git a/src/i18n/locales/es/translation.json b/src/i18n/locales/es/translation.json index 5420a0b4..94924c8e 100644 --- a/src/i18n/locales/es/translation.json +++ b/src/i18n/locales/es/translation.json @@ -54,6 +54,8 @@ "ENABLED": "Habilitado", "DISPLAY_NAME": "Nombre a Mostrar", "DISPLAY_GROUP": "Grupo a Mostrar", + "PRINT": "imprimir", + "NO_MECHANISM_CONTENTS": "Sin Contenido de Mecanismo", "TOOLTIP": { "EVALUATE_BUT_IGNORE_RESULT": "Ejecuta el bloque conectado e ignora el resultado. Te permite llamar una función e ignorar el valor de retorno.", "OPMODE_TYPE": "Qué tipo de OpMode es este", diff --git a/src/i18n/locales/he/translation.json b/src/i18n/locales/he/translation.json index e6ac9edd..461d42bf 100644 --- a/src/i18n/locales/he/translation.json +++ b/src/i18n/locales/he/translation.json @@ -54,6 +54,7 @@ "DISPLAY_NAME": "שם תצוגה", "DISPLAY_GROUP": "קבוצת תצוגה", "PRINT": "הדפס", + "NO_MECHANISM_CONTENTS": "אין תוכן מנגנון", "TOOLTIP":{ "EVALUATE_BUT_IGNORE_RESULT": "מריץ את הבלוק המחובר ומתעלם מהתוצאה. מאפשר לך לקרוא לפונקציה ולהתעלם מערך ההחזרה.", "OPMODE_TYPE": "איזה סוג של מצב פעולה זה", diff --git a/src/toolbox/hardware_category.ts b/src/toolbox/hardware_category.ts index 5d4563cd..c0c19861 100644 --- a/src/toolbox/hardware_category.ts +++ b/src/toolbox/hardware_category.ts @@ -92,7 +92,7 @@ function getRobotMechanismsCategory(currentModule: storageModule.Module): toolbo if (editor) { editor.getMechanismsFromRobot().forEach(mechanismInRobot => { - const mechanismBlocks: toolboxItems.Block[] = []; + const mechanismBlocks: toolboxItems.Item[] = []; // Add the blocks for this mechanism's methods. const mechanism = editor.getMechanism(mechanismInRobot); @@ -100,6 +100,11 @@ function getRobotMechanismsCategory(currentModule: storageModule.Module): toolbo const methodsFromMechanism = editor.getMethodsFromMechanism(mechanism); addInstanceMechanismBlocks(mechanismInRobot, methodsFromMechanism, mechanismBlocks); + if(mechanismBlocks.length === 0){ + const label : toolboxItems.Label = new toolboxItems.Label(Blockly.Msg['NO_MECHANISM_CONTENTS']); + mechanismBlocks.push( label ); + } + contents.push({ kind: 'category', name: mechanismInRobot.name,