[Panel-devel] Connection of Sensor and Meter

Ryan Nickell p0z3r at earthlink.net
Tue Sep 20 00:45:38 CEST 2005


On Monday 19 September 2005 04:05, Vinay Khaitan wrote:
> Sorry, once more I am starting the thread of Sensor and meter.
>
> In old karamba, we use something like
>
> bar x=0 y=0 w=10 h=200 vertical=true path="img.png" sensor=cpu
>
> the bar is connected to sensor cpu. In the new karamba, we will certainly
> have the name of the meter to refernce it.
>
> what about something like this... (writing in old theme format)
>
> bar name="parentbar" x=0 y=0 w=10 h=200 vertical=true path="img.png"
> sensor=cpu
> graph name="childgraph" x=0 y=0 w=200 h=60 points=100 meter=parentbar
>
> This way, a meter can be connected to a meter. whenever the parentbar is
> updated, it emits a signal which updates childgraph too.

Having a parent/child relationship between meters sounds like just another way 
to do what we are already doing according to your example.  Currently people 
create those items in a certain order to have them display the way they like, 
i.e. bar image first, and graph image second.

>
> It is very simple to implement.
> You can find the analogies with Qt signal-slot mechanism in which primarily
> Signal-slot connection happens. but optionally SIGNAL-SIGNAL connection is
> possible.

My general thought on how this will work is in this fashion:
1) Meter connects to a Sensor, which has some default interval for reporting 
data
2) Sensor reports new data to Meter using qt signals/slots
3) Meter redraws/refreshes its display when it received data from Sensor
4) Meter waits while there is no data to change(saving cpu usage by not 
redrawing, unlike how SK currently is implemented)

No need for a separate interval for Meters.


On a side note, since Meters will be qwidgets, they will have to be able to 
handle events such as mouse clicks to replace the current clickArea 
functionality, and keyboard presses to replace the keyPressed functionality.

All this is trying to be in line with how a GUI updates.  Things are event 
driven and only update when there is a change in state or appearance.  Things 
like QButtons disable/enable and depress only when they are interacted with 
by either the user or the system.  There are more examples but this is the 
first one that sprang to mind.

cheers,
-Ryan


More information about the Panel-devel mailing list