Skip to content

Added new input fields / blocks and changed renderer - #9

Merged
Eddykasp merged 9 commits into
kieler:mainfrom
Tokessa:input_fields
Aug 4, 2026
Merged

Eddykasp merged 9 commits into
kieler:mainfrom
Tokessa:input_fields

Conversation

@Tokessa

@Tokessa Tokessa commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Added new input fields and blocks:

  • reached/passed input fields for ContactWait-/ConditionalStatement
  • number ranges for Point-/LightStatement (translate to numbers from start to end inclusive)
  • added warning for the number input being outside of the constraints
  • added warning for passed in ConditionalStatement since it is currently not implemented in railsl
  • moved warnings to be displayed bundled at the parent block level and not the inputs

Changed renderer to zelos:

  • added new custom renderer for octagon connector shape

@CrazyDiamond-75

Copy link
Copy Markdown
Contributor

Cool!

Comment thread frontend/dynamic_blocks.js
Comment thread frontend/main.js Outdated
Comment thread frontend/main.js Outdated
Comment thread frontend/main.js Outdated
Comment thread frontend/main.js Outdated
Comment thread frontend/main.js Outdated
Comment thread locales/de/de_tokens.js Outdated
Comment thread locales/en/en_tokens.js Outdated
@CrazyDiamond-75

CrazyDiamond-75 commented Jul 28, 2026 •

Copy link
Copy Markdown
Contributor

One thing I noticed randomly reading through this pull request:
It might be smarter to use Validators to check if some certain user inputs are valid or not.
This would have the advantage, that the real check for the warning would not have to be defined in the main.js file, but in the field or block definition.
An approach like this could declutter the field-check implementation a bit.
Maybe we could even use Validators to improve how the other warnings are currently implemented.

There is another big advantage to using Validators though: It can not only be used to check if an input is correct, it can also be used, to correct the user input, if it is not a valid input.
This would have the advantage, that the user gets direct feedback, if they provide a wrong input, as the validator check would automatically trim or trash it, instead of just hinting that something is wrong using a warning.
Validators even colour the input red on default, if it is incorrect, and the dev didn't specify how to fix the input.

This could look something like this for, e.g., point ranges:

// When -5 is entered, the range is invalidated and corrected!
-[-5, 10]
+[0, 10]

// When 10 is entered, the field detects, that 20 > 10, and swaps them!
-[20, 10]
+[10, 20]

when validating and correcting, or

// Tooltip on hover: Range is invalid!
-[-5, 10]

when just validating.
You could even implement, that hovering above displays a text explaining what is wrong.

Edit: You can even use validators to add warnings to a block: https://blocklycodelabs.dev/codelabs/validation-and-warnings/index.html

Comment thread frontend/dynamic_blocks.js Outdated
Comment on lines +93 to +95
// if (index !== 0) {
// input.appendField(new Blockly.FieldLabel(' ')) // empty placeholder
// }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is no longer required, I suggest removing it

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is still required. I just forgot to remove the // after testing.

Comment thread frontend/dynamic_blocks.js Outdated
domToMutation,

updateShape: function () {
// get current status for recreation after +-

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

get current status for block recreation after clicking the +- buttons

Comment thread frontend/dynamic_blocks.js Outdated
domToMutation,

updateShape: function () {
// get current status for recreation after +-

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above. although I'm not sure this comment is necessary, the code is fairly clear to understand

Comment thread locales/de/de_tokens.js Outdated
RAILBLOCKS_NUMBER_RANGE_TEXT: '%1 bis %2',
RAILBLOCKS_NUMBER_RANGE_TOOLTIP: 'Erstellt eine Reihe von Nummern.',
RAILBLOCKS_INT_RANGE_TEXT: '%1 bis %2',
RAILBLOCKS_INT_RANGE_TOOLTIP: 'Erstellt eine Reihe von Nummern.',

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nummern klingt irgendwie komisch. Ja, es sind Nummern weil es Ids sind, aber allgemein würde ich glaube ich eher Zahlen sagen

@Eddykasp
Eddykasp merged commit dfa1e2e into kieler:main Aug 4, 2026
1 check passed
@Tokessa
Tokessa deleted the input_fields branch September 10, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants