Project

General

Profile

Signals and slots » History » Version 7

Ohlsson, Staffan, 15/02/2012 03:59 PM

1 1 Ohlsson, Staffan
h1. Signals and slots
2 1 Ohlsson, Staffan
3 2 Ohlsson, Staffan
The Framework uses a _signals_ and _slots_ mechanism, similar to the one used by Qt, for communication between [[Info_Bricks|Bricks]] and [[Control_Objects|Control Objects]].
4 1 Ohlsson, Staffan
5 2 Ohlsson, Staffan
Each Brick or Control Object can have several signals, which can be emitted, and slots, corresponding to methods which are exposed to the framework.
6 1 Ohlsson, Staffan
7 4 Ohlsson, Staffan
The framework ensures that a Brick and a Control Object signals and slots match when creating a GUI. 
8 4 Ohlsson, Staffan
9 4 Ohlsson, Staffan
h2. Matching signals and slots between Bricks and Control Objects
10 4 Ohlsson, Staffan
11 6 Ohlsson, Staffan
Each *Brick* has one or more *connection definitions*
12 4 Ohlsson, Staffan
13 4 Ohlsson, Staffan
Example: 
14 4 Ohlsson, Staffan
<pre>
15 4 Ohlsson, Staffan
    connections = {"command_executor": Connection("Command Executor",
16 4 Ohlsson, Staffan
                                          [],
17 4 Ohlsson, Staffan
                                          [ Slot("get_vars"), Slot("do_it") ],
18 4 Ohlsson, Staffan
                                          "executor_connected")}
19 4 Ohlsson, Staffan
</pre>
20 4 Ohlsson, Staffan
Here there are no Signals and 2 Slots
21 4 Ohlsson, Staffan
22 4 Ohlsson, Staffan
23 5 Ohlsson, Staffan
Each *Control Object* declares which signals and slots it has.
24 4 Ohlsson, Staffan
25 4 Ohlsson, Staffan
Example of Control Object corresponding to the Brick above:
26 4 Ohlsson, Staffan
<pre>
27 4 Ohlsson, Staffan
    signals = []
28 4 Ohlsson, Staffan
...
29 4 Ohlsson, Staffan
    slots = [ Slot('get_vars'), Slot('do_it') ]
30 4 Ohlsson, Staffan
</pre>
31 7 Ohlsson, Staffan
32 7 Ohlsson, Staffan
33 7 Ohlsson, Staffan
h3. A more complicated matching