Customize auto-generated GUIs with custom widgets
In a TASTE system you can instruct the tool to generate a stub for a function that you have not implemented yet. Select the GUI language on a function that does not contain any synchronous interface:
The code for the stub will be generated in Python and will interact with the rest of the system using a standard Unix message queue. By default a fully-featured GUI will appear with interfaces allowing you to send and receive messages, display MSCs, and interact with databases.
In some cases however you may want to provide your own home-made user interface, in order for example to group data in the way you like or simply add better-looking widgets.
This is possible with TASTE and this page explains step by step how to proceed.
The example shown in this page is located in the following folder:
Build the system
When you have designed your system with at least a GUI component, build it:
Then go into the binary folder
$ cd work/binaries
You will see that a subfolder has been created for each GUI component of the system (here, the function is named user):
Inside this folder, a user-customizable file has been generated: UserWidgets.py
It contains all the necessary interface to create your own widgets, that you can associate to all the PIs and RIs connected to this function.
Add widgets: step by step
Name your classes and expose them
You will create one class (at least) per PI and RI to handle all the messages. Give them a name and expose them by adding them to the __all__ module variable:
Create the classes
The class need to inherit either from UserWidgetsCommon.TC or UserWidgetsCommon.TM, for exanmple:
Let's now explore the content of such a class:
In the editorIsApplicable method, you can associate one specific TC to this class. editor.messageName is the name of the required interface.
In the __init__ function you can create your layout and add widgets at will. The self.parent variable is the ASN.1 Value Editor that appears on the GUI, which allows you to send the TC to the system (via the call to self.parent.sendTC).
The TM work similarly:
Run the system and activate the custom widgets
When you are done with your custom design you may run the main GUI and from there you will see the custom widgets: