One more post about setting up a GUI with JeeMon…
I wanted to have a basic real-time display of all the readings coming in, sorted by source. Like this:
(the size of this screen shot was reduced to fit this post)
Everything in this window is dynamic: rows get added when new sources start reporting their data, and columns get added when new parameter types are reported. I’m not storing any information persistently yet, which is why this status window looks as follows right after starting up JeeMon:
Not very exciting, but all you have to do is wait …
Let’s see what it took to create this GUI. First, I added a generic “Notifier” rig to JeeMon, and a “Reading” method for all sketches to use. The rooms sketch, for example, now reports its incoming results as follows:
Similar changes were made to the ookRelay and RF12demo “host.tcl” sources.
The rest of the GUI code is in “statusWindow.tcl”:
The tabular display is based on a very nice Tcl/Tk open source package called Tablelist by Csaba Nemethi, which has been added to the JeeMon core library.
The coupling with the rest of the system is accomplished by the “Notifier attach readings * …” call at the end of the setup code. This registers a callback which will be invoked when anything in the “readings” notification group changes. Notifiers are going to be used a lot in JeeMon because they provide such a manageable way to glue independent parts of an application together.
And lastly, adding the following line to the main application starts the ball rolling:
There’s quite a bit going on here which I won’t go into. I just wanted to illustrate how little code it takes to create a basic, fully dynamic, cross-platform, self-updating status display window. There – how’s that for adjectives!