Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/ast/ast_AnnAssign.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Blockly.Blocks['ast_AnnAssignFull'] = {
this.setColour(BlockMirrorTextToBlocks.COLOR.VARIABLES);
this.initialized_ = true;
this.updateShape_();
this.setHelpUrl('https://docs.python.org/3/reference/simple_stmts.html#assignment-statements');
},
/**
* Create XML to represent list inputs.
Expand Down Expand Up @@ -74,6 +75,7 @@ Blockly.Blocks['ast_AnnAssign'] = {
this.setColour(BlockMirrorTextToBlocks.COLOR.VARIABLES);
this.strAnnotations_ = false;
this.initialized_ = true;
this.setHelpUrl('https://docs.python.org/3/reference/simple_stmts.html#assignment-statements');
},
/**
* Create XML to represent list inputs.
Expand Down
1 change: 1 addition & 0 deletions src/ast/ast_Assign.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Blockly.Blocks['ast_Assign'] = {
this.simpleTarget_ = true;
this.updateShape_();
Blockly.Extensions.apply("contextMenu_variableSetterGetter", this, false);
this.setHelpUrl('https://docs.python.org/3/reference/simple_stmts.html#assignment-statements');
},
updateShape_: function () {
if (!this.getInput('VALUE')) {
Expand Down
312 changes: 312 additions & 0 deletions src/ast/ast_Call.js

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions src/ast/ast_ClassDef.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Blockly.Blocks['ast_ClassDef'] = {
this.setNextStatement(true, null);
this.setColour(BlockMirrorTextToBlocks.COLOR.OO);
this.updateShape_();
this.setTooltip('Class Definition');
this.setHelpUrl('https://docs.python.org/3/tutorial/classes.html');
},
// TODO: Not mutable currently
updateShape_: function () {
Expand Down
8 changes: 8 additions & 0 deletions src/ast/ast_Comp.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ Blockly.Blocks['ast_Comp_create_with_container'] = {
.appendField(' For clause');
this.appendStatementInput('STACK');
this.contextMenu = false;
this.setTooltip('Comparison Operation');
this.setHelpUrl('https://docs.python.org/3/reference/expressions.html#comparisons');
}
};

Expand All @@ -49,6 +51,8 @@ Blockly.Blocks['ast_Comp_create_with_for'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.contextMenu = false;
this.setTooltip('Comparison Operation');
this.setHelpUrl('https://docs.python.org/3/reference/expressions.html#comparisons');
}
};

Expand All @@ -64,6 +68,8 @@ Blockly.Blocks['ast_Comp_create_with_if'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.contextMenu = false;
this.setTooltip('Comparison Operation');
this.setHelpUrl('https://docs.python.org/3/reference/expressions.html#comparisons');
}
};

Expand Down Expand Up @@ -94,6 +100,8 @@ BlockMirrorTextToBlocks.COMP_SETTINGS = {
this.updateShape_();
this.setOutput(true);
this.setMutator(new Blockly.Mutator(['ast_Comp_create_with_for', 'ast_Comp_create_with_if']));
this.setTooltip('Comparison Operation');
this.setHelpUrl('https://docs.python.org/3/reference/expressions.html#comparisons');
},
/**
* Create XML to represent dict inputs.
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Blockly.Blocks['ast_Delete'] = {
this.appendDummyInput()
.appendField("delete");
this.updateShape_();
this.setTooltip('Deletion is recursively defined very similar to the way assignment is defined');
this.setHelpUrl('https://docs.python.org/3/reference/simple_stmts.html#the-del-statement');
},
updateShape_: function () {
// Add new inputs.
Expand Down
8 changes: 8 additions & 0 deletions src/ast/ast_Dict.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Blockly.Blocks['ast_DictItem'] = {
this.setInputsInline(true);
this.setOutput(true, "DictPair");
this.setColour(BlockMirrorTextToBlocks.COLOR.DICTIONARY);
this.setTooltip('A dict is a mapping object which maps hashable values to arbitrary objects');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#mapping-types-dict');
}
};

Expand All @@ -22,6 +24,8 @@ Blockly.Blocks['ast_Dict'] = {
this.updateShape_();
this.setOutput(true, 'Dict');
this.setMutator(new Blockly.Mutator(['ast_Dict_create_with_item']));
this.setTooltip('A dict is a mapping object which maps hashable values to arbitrary objects');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#mapping-types-dict');
},
/**
* Create XML to represent dict inputs.
Expand Down Expand Up @@ -173,6 +177,8 @@ Blockly.Blocks['ast_Dict_create_with_container'] = {
.appendField('Add new dict elements below');
this.appendStatementInput('STACK');
this.contextMenu = false;
this.setTooltip('A dict is a mapping object which maps hashable values to arbitrary objects');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#mapping-types-dict');
}
};

Expand All @@ -188,6 +194,8 @@ Blockly.Blocks['ast_Dict_create_with_item'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.contextMenu = false;
this.setTooltip('A dict is a mapping object which maps hashable values to arbitrary objects');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#mapping-types-dict');
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_FunctionDef.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Blockly.Blocks['ast_FunctionDef'] = {
this.updateShape_();
this.setMutator(new Blockly.Mutator(['ast_FunctionMutantParameter',
'ast_FunctionMutantParameterType']));
this.setTooltip('A user defined function');
this.setHelpUrl('https://docs.python.org/3/tutorial/controlflow.html#function-examples');
},
/**
* Create XML to represent list inputs.
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Global.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Blockly.Blocks['ast_Global'] = {
this.appendDummyInput('GLOBAL')
.appendField("make global", "START_GLOBALS");
this.updateShape_();
this.setTooltip('The global statement is a declaration which holds for the entire current code block');
this.setHelpUrl('https://docs.python.org/3/reference/simple_stmts.html#grammar-token-global-stmt');
},
updateShape_: function () {
let input = this.getInput("GLOBAL");
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_If.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Blockly.Blocks['ast_If'] = {
this.setNextStatement(true, null);
this.setColour(BlockMirrorTextToBlocks.COLOR.LOGIC);
this.updateShape_();
this.setTooltip('The if statement is used for conditional execution');
this.setHelpUrl('https://docs.python.org/3/reference/compound_stmts.html#the-if-statement');
},
// TODO: Not mutable currently
updateShape_: function () {
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Import.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Blockly.Blocks['ast_Import'] = {
this.setNextStatement(true, null);
this.setColour(BlockMirrorTextToBlocks.COLOR.PYTHON);
this.updateShape_();
this.setTooltip('Python code in one module gains access to the code in another module by the process of importing it');
this.setHelpUrl('https://docs.python.org/3/reference/import.html');
},
// TODO: Not mutable currently
updateShape_: function () {
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Blockly.Blocks['ast_Lambda'] = {
this.setOutput(true);
this.setColour(BlockMirrorTextToBlocks.COLOR.FUNCTIONS);
this.updateShape_();
this.setTooltip('Lambdas are small anonymous functions can be created with the lambda keyword');
this.setHelpUrl('https://docs.python.org/3/tutorial/controlflow.html#lambda-expressions');
},
mutationToDom: Blockly.Blocks['ast_FunctionDef'].mutationToDom,
domToMutation: Blockly.Blocks['ast_FunctionDef'].domToMutation,
Expand Down
7 changes: 6 additions & 1 deletion src/ast/ast_List.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ Blockly.Blocks['ast_List'] = {
* @this Blockly.Block
*/
init: function () {
this.setHelpUrl(Blockly.Msg['LISTS_CREATE_WITH_HELPURL']);
this.setColour(BlockMirrorTextToBlocks.COLOR.LIST);
this.itemCount_ = 3;
this.updateShape_();
this.setOutput(true, 'List');
this.setMutator(new Blockly.Mutator(['ast_List_create_with_item']));
this.setTooltip('Lists are mutable sequences, typically used to store collections of homogeneous items');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#list');
},
/**
* Create XML to represent list inputs.
Expand Down Expand Up @@ -143,6 +144,8 @@ Blockly.Blocks['ast_List_create_with_container'] = {
.appendField('Add new list elements below');
this.appendStatementInput('STACK');
this.contextMenu = false;
this.setTooltip('Lists are mutable sequences, typically used to store collections of homogeneous items');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#list');
}
};

Expand All @@ -158,6 +161,8 @@ Blockly.Blocks['ast_List_create_with_item'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.contextMenu = false;
this.setTooltip('Lists are mutable sequences, typically used to store collections of homogeneous items');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#list');
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Raise.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ Blockly.Blocks['ast_Raise'] = {
this.appendDummyInput()
.appendField("raise");
this.updateShape_();
this.setTooltip('The raise statement allows the programmer to force a specified exception to occur.');
this.setHelpUrl('https://docs.python.org/3/tutorial/errors.html#raising-exceptions');
},
updateShape_: function () {
if (this.exc_ && !this.getInput('EXC')) {
Expand Down
6 changes: 6 additions & 0 deletions src/ast/ast_Set.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Blockly.Blocks['ast_Set'] = {
this.updateShape_();
this.setOutput(true, 'Set');
this.setMutator(new Blockly.Mutator(['ast_Set_create_with_item']));
this.setTooltip('Sets are unordered collections of unique elements');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset');
},
/**
* Create XML to represent set inputs.
Expand Down Expand Up @@ -141,6 +143,8 @@ Blockly.Blocks['ast_Set_create_with_container'] = {
.appendField('Add new set elements below');
this.appendStatementInput('STACK');
this.contextMenu = false;
this.setTooltip('Sets are unordered collections of unique elements');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset');
}
};

Expand All @@ -156,6 +160,8 @@ Blockly.Blocks['ast_Set_create_with_item'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.contextMenu = false;
this.setTooltip('Sets are unordered collections of unique elements');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#set-types-set-frozenset');
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Subscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Blockly.Blocks['ast_Subscript'] = {
this.appendDummyInput('CLOSE_BRACKET')
.appendField("]",);
this.updateShape_();
this.setTooltip('A subscription selects an item of a sequence');
this.setHelpUrl('https://docs.python.org/3/reference/expressions.html#subscriptions');
},
setExistence: function (label, exist, isDummy) {
if (exist && !this.getInput(label)) {
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_Try.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Blockly.Blocks['ast_Try'] = {
this.setNextStatement(true, null);
this.setColour(BlockMirrorTextToBlocks.COLOR.EXCEPTIONS);
this.updateShape_();
this.setTooltip('The try statement specifies exception handlers and/or cleanup code for a group of statements');
this.setHelpUrl('https://docs.python.org/3/reference/compound_stmts.html#try');
},
// TODO: Not mutable currently
updateShape_: function () {
Expand Down
6 changes: 6 additions & 0 deletions src/ast/ast_Tuple.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Blockly.Blocks['ast_Tuple'] = {
this.updateShape_();
this.setOutput(true, 'Tuple');
this.setMutator(new Blockly.Mutator(['ast_Tuple_create_with_item']));
this.setTooltip('Tuples are immutable sequences, typically used to store collections of heterogeneous data');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#tuple');
},
/**
* Create XML to represent tuple inputs.
Expand Down Expand Up @@ -146,6 +148,8 @@ Blockly.Blocks['ast_Tuple_create_with_container'] = {
.appendField('Add new tuple elements below');
this.appendStatementInput('STACK');
this.contextMenu = false;
this.setTooltip('Tuples are immutable sequences, typically used to store collections of heterogeneous data');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#tuple');
}
};

Expand All @@ -161,6 +165,8 @@ Blockly.Blocks['ast_Tuple_create_with_item'] = {
this.setPreviousStatement(true);
this.setNextStatement(true);
this.contextMenu = false;
this.setTooltip('Tuples are immutable sequences, typically used to store collections of heterogeneous data');
this.setHelpUrl('https://docs.python.org/3/library/stdtypes.html#tuple');
}
};

Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_While.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Blockly.Blocks['ast_While'] = {
this.setNextStatement(true, null);
this.setColour(BlockMirrorTextToBlocks.COLOR.CONTROL);
this.updateShape_();
this.setTooltip('The while statement is used for repeated execution as long as an expression is true');
this.setHelpUrl('https://docs.python.org/3/reference/compound_stmts.html#the-while-statement');
},
// TODO: Not mutable currently
updateShape_: function () {
Expand Down
2 changes: 2 additions & 0 deletions src/ast/ast_With.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Blockly.Blocks['ast_With'] = {
this.setNextStatement(true, null);
this.setColour(BlockMirrorTextToBlocks.COLOR.CONTROL);
this.updateShape_();
this.setTooltip('The with statement is used to wrap the execution of a block with methods defined by a context manager');
this.setHelpUrl('https://docs.python.org/3/reference/compound_stmts.html#with');
},
/**
* Create XML to represent list inputs.
Expand Down