-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
This is based on the review with @hacst on the phone.
Our goal is to keep the backend frontend interface as simple as possible, with the following design rationals:
- new functionality in the frontend or backend should not result in the creation of new frontend / backend interface methods.
- the number of interface methods should be kept to a minimum.
- all partners in the frontend backend interface should know as little about the events they are handling as possible, best everything should be treated equally.
GUI class changes:
We only introduce the following functions:
-
LogicItem.__init__(self, data):constructur should take meta-data dict, nothing else. -
LogicItem.update(self, data):data being the meta-data dict. This update handles position changes, new connections, disconnects, logic-state changes, etc. The function itself it called by the registry, that listens on updates from the backend and distributes them. -
GridScene.on_new_instance(self, data):slot handling the creation of new instances listening on the registry signal instantiated. -
GridScene.on_delete_instance(self, data):slot handling the deletion of instances listening on the registry signal deleted.
New registry functions:
-
ItemRegistry.get_all_guids(guid):a function that returns all available guids from the backend. -
ItemRegistry.instanciate_element(self, guid):returns an instance of LogicItem that is not part of any scene and without any backend element. It is a fully functioning LogicItem (QGraphicsItem) initialized with the default meta-data, that can be added to scenes temporarily or persistently. It might already contain a 64-bit random id to allow later communication with the backend. If an item is added to a scene (or changes from temporary to non-temporary) it by itself (in LogicItem.itemChange) tells the backend that it now should be instanciated also in the backend.
(the names are not completely fixed)
Open questions from my side:
- From my side it makes sense to treat logic-items and line-trees in the same way. If yes, we should create a common base type for both elements and implement the update function in that one.
Metadata
Metadata
Assignees
Labels
No labels