From: Michael R. <re...@eu...> - 2006-08-13 13:48:50
|
Hi Till, > I am currently writing a kvv plugin. KVV is the "Karlsruher Verkehrsverbund" > and you can get access via web interface to the train/bus timings usually > displayed at the stations (things like "Linie 3, Karlsruhe Hbf. in 5 > Minuten"). I am extracting this information and use it to reconstruct > this again for use on my LED display. You can then specify the interesting > station in lcd4linux.conf and have the next 4 trains displayed in real > time just like the real display at the station does. Well, *now* I understand what your huge display is for :-) This sounds very cool. *Please* add a picture to the wiki when it's finished... > Now my question: My plugin currently returns single strings for > each line (like kvv(0) will return the train that will arrive next, > kvv(1) the train that will arive second etc ect). Can i somehow include > color information in this? I'd like to specify an additional time > (the time it takes me to get to the station) and then have the trains > displayed in red (if i can't reach them anymore) in yellow (if i have > to hurry) and green (if i'll reach them easily). How would this be done? First, are you writing the plugin in an asynchronous way? LCD4Linux doesn't like delays in plugins very much; that's why you should use threads when a plugin may take some time to get the needed information. Take a look at the 'exec' plugin for how to handle that... Now for your question: I'd use two different funtions in the plugin: One for the "name" of the next train, one for the departure time (or for 'minutes until departure' or whatever you'll find handy here). IIRC the color attributes of the text widget should re-evaluate on every update (if not, I'm gonna change them; should be easy with the new 'dynamic properties'). I think the config could look like this Widget Train1 { expression KVV:name(0) foreground KVV:time(0) < 2 ? FF0000 : KVV:time(0) < 5 ? FFFF00 : 00FF00 } you got the point? bye, Michael -- Michael Reinelt <re...@eu...> http://home.pages.at/reinelt GPG-Key 0xDF13BA50 ICQ #288386781 |