Hi Dan,
> Ok, i got this plugin that communicates with a remote process, lets say
> eMule as an example.
> It is threaded and it returns a set of values every other minute.
>
> How do i make use of these values in multiple widgets, i.e how to i use
> them i one text only widget e.g "Upload 6KB, Download 10KB" and two bar
> widgets at the same time without having to duplicate the "information
> retrieval" thread?
Well, good point, I just didn't think of this until now :-)
> The only solution i can find is to let the widget that actually runs the
> thread to be "named" and that other widgets can refer its data by that
> name (or hash if you prefer) as a reference.
This would be a possible solution, especially when the python expression
returns a lot of values.
Another solution for the simpler issue "use a single value for text and
bar" would be the use of variables. This is possibel because all plugins
share a common namespace in the evaluator:
Widget Text {
Expression my_var=python::exec('something')
}
Widget Bar {
Expression my_var
}
Keep in mind that every widget can have its own update interval, which
won't make things easier... in the above example, if the text widget
will update every second, but the bar every 50 msec, the bar value will
change only every second, too.
Another drawback would be that if for any reason the text widget is not
displayed (because it's not visible at the moment, which may happen
sometime when scrolling is implemented), the variable will not be
updated :-(
Another solution may be a "data collection handler", which can be
implemented as a timer event (not implemented now). It will run every
second or so, and update one or more variables, which can be used in a
set of widgets.
bye, Michael
--
Michael Reinelt <re...@eu...>
http://home.pages.at/reinelt
GPG-Key 0xDF13BA50
ICQ #288386781
|