Skip to content

Commit 0fa5758

Browse files
committed
Addressed review comments.
1 parent 5abeebb commit 0fa5758

File tree

3 files changed

+17
-12
lines changed

3 files changed

+17
-12
lines changed

src/blocks/mrc_none.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222

2323

2424
import * as Blockly from 'blockly';
25+
import { MRC_STYLE_NONE } from '../themes/styles'
2526
import { Order, PythonGenerator } from 'blockly/python';
26-
import { createFieldNonEditableText } from '../fields/FieldNonEditableText';
2727

2828
export const BLOCK_NAME = 'mrc_none';
2929

@@ -32,8 +32,8 @@ export function setup() {
3232
init: function() {
3333
this.setOutput(true); // no type for None
3434
this.appendDummyInput()
35-
.appendField(createFieldNonEditableText(Blockly.Msg.NONE));
36-
this.setStyle('logic_blocks');
35+
.appendField(Blockly.Msg.NONE);
36+
this.setStyle(MRC_STYLE_NONE);
3737
this.setTooltip(Blockly.Msg.NONE_TOOLTIP);
3838
},
3939
};
@@ -45,3 +45,11 @@ export function pythonFromBlock(
4545
): [string, Order] {
4646
return ['None', Order.ATOMIC];
4747
}
48+
49+
export function createNoneShadowValue(): any {
50+
return {
51+
'shadow': {
52+
'type': 'mrc_none',
53+
},
54+
}
55+
}

src/blocks/utils/value.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
import { getAlias } from './python';
2323
import * as variable from './variable';
24+
import { createNoneShadowValue } from '../mrc_none';
2425

2526

2627
export function valueForFunctionArgInput(argType: string, argDefaultValue: string): any {
@@ -103,11 +104,3 @@ export function createBooleanShadowValue(boolValue: boolean): any {
103104
},
104105
}
105106
}
106-
107-
export function createNoneShadowValue(): any {
108-
return {
109-
'shadow': {
110-
'type': 'mrc_none',
111-
},
112-
}
113-
}

src/themes/styles.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export const MRC_STYLE_ENUM = 'mrc_style_enum';
2626
export const MRC_STYLE_VARIABLES = 'mrc_style_variables';
2727
export const MRC_STYLE_COMMENTS = 'mrc_style_comments';
2828
export const MRC_STYLE_MISC = 'mrc_style_misc';
29+
export const MRC_STYLE_NONE = 'mrc_style_none';
2930
export const MRC_STYLE_CLASS_BLOCKS = 'mrc_style_class_blocks';
3031
export const MRC_CATEGORY_STYLE_METHODS = 'mrc_category_style_methods';
3132
export const MRC_STYLE_MECHANISMS = 'mrc_style_mechanisms';
@@ -38,6 +39,7 @@ export const MRC_CATEGORY_STYLE_COMPONENTS = 'mrc_category_style_components';
3839
export const add_mrc_styles = function (theme: Blockly.Theme): Blockly.Theme {
3940
const procedureStyle = theme.blockStyles['procedure_blocks'];
4041
const variableStyle = theme.blockStyles['variable_blocks'];
42+
const logicStyle = theme.blockStyles['logic_blocks'];
4143

4244
theme.setBlockStyle(MRC_STYLE_FUNCTIONS, {
4345
...procedureStyle
@@ -74,12 +76,14 @@ export const add_mrc_styles = function (theme: Blockly.Theme): Blockly.Theme {
7476
colourTertiary: "#494984",
7577
hat: ""
7678
});
79+
theme.setBlockStyle(MRC_STYLE_NONE, {
80+
...logicStyle
81+
});
7782
theme.setBlockStyle(MRC_STYLE_MECHANISMS, {
7883
colourPrimary: "#5b61a5",
7984
colourSecondary: "#dedfed",
8085
colourTertiary: "#494e84",
8186
hat: ""
82-
8387
});
8488
theme.setBlockStyle(MRC_STYLE_COMPONENTS, {
8589
colourPrimary: "#5b80a5",

0 commit comments

Comments
 (0)