Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-think design of interface for block parameters #121

Closed
MobsyaBot opened this issue Apr 18, 2018 · 1 comment
Closed

Re-think design of interface for block parameters #121

MobsyaBot opened this issue Apr 18, 2018 · 1 comment

Comments

@MobsyaBot
Copy link
Collaborator

Issue by stephanemagnenat
Tuesday Jul 11, 2017 at 18:58 GMT
Originally opened as aseba-community/thymio-vpl2#104


Currently, blocks inherit from BlockDefinition. They must provide two components, editor and miniature, that both must provide a params property and a getParams() method. In addition, they must feel the defaultParams property.

This poses several problems:

  1. If a block uses a complex object for storing its parameters, such as MusicScore, it is hard to avoid binding to a single instance of this object, leading to a shared object for all instances of the block.
  2. Typically, the params properties of both editor and miniature are manually set to defaultParams, which is confusing. And, as a property is set, it prevents the instantiation of an object pragmatically, which would be necessary to avoid the shared object explained in point 1.

We should improve that. The least is to document the interface, in particular when params should be assigned and by whom. Also, maybe having a method of BlockDefinition that returns default parameters would be better than having a property, to allow for dynamically-created objects.

@MobsyaBot MobsyaBot added the VPL2 label Apr 18, 2018
@MobsyaBot
Copy link
Collaborator Author

Comment by stephanemagnenat
Wednesday Jul 12, 2017 at 15:33 GMT


Based on my recent experiments, it seems that the cleanest way to implement the current interface is to create a QML file with the actual editor, having a params property and a getParams() method, and in the block QML file, embed these editors in components, and set the params property to defaultParams, itself set to a JSON object describing default parameters.

@mbonani mbonani added this to the VPL2: add or improve blocks milestone May 16, 2018
@mbonani mbonani closed this as completed Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants