From: Dan F. <tem...@ya...> - 2005-05-05 18:40:23
|
I've been pondering on this for a while now, maybe I'm daft and can't see the obvious solution... 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? 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 is something i can easily implement since I've implemented the threading of python plugins in python :) This was much easier for me to implement and it makes the python plugin development process much more convenient because python plugins can now be developed, debugged and tested in pure python - threading and all. Anyhow, this is how a config file could look like: Widget EMULE { # This widget does not have to be visible class 'Text' # module = 'emule' # function = 'getStats' # hash/keyword/identifier/whatever = 'emule_hash' # periodicity = 1 minute (60000) expression python::threaded_exec('emule', 'getStats', 'emule_hash', 60000) prefix 'eMule ' width 22 align 'M' update 30000 } Widget EMULE_TXT { class 'Txt' expression python::get_value('emule_hash', 'most_popular_upload') length 10 direction 'E' update 30000 } Widget EMULE_BAR { class 'Bar' expression python::get_value('emule_hash', 'download_as_percentage') expression2 python::get_value('emule_hash', 'upload_as_percentage') length 10 direction 'E' update 30000 } i.e Widget EMULE_BAR and EMULE_TXT displays data retrieved by widget EMULE. Is this something you guys could live with (at least for the python section of lcd4linux, since does not affect anything else than plugin_python.c)? Or am i missing something? Maybe something like this is already exists? /dan |