Flightdeck-UI — a Cockpit on your Desktop | ||
---|---|---|
<<< Previous | Architecture of the Flightdeck-UI Library | Next >>> |
The diagram below shows the overall structure of Flightdeck-UI. Classes from the Tkinter library are shaded in blue. Style (an abstract base class) is highlighted in red. While Python has no need for explicit abstract classes, the notion of an interface is still implicitly present. The Flightdeck-UI architecture includes the Style interface to allow the generic behavior of AnalogGauge to be specialized by delegation, rather than inheritance. This makes it possible to easily provide alternative future implementations of the core gauge functionality — the specializations-via-delegation would still work with the new gauge classes.
The Style classes utilize a driver function to convert an application-specific measurement into the angle deflections of the indicator needles. The driver function is called by the update method of a Style class instance. This update method is called from AnalogGauge's own update method. The application that is making use of Flightdeck-UI is responsible for calling AnalogGauge's update.
The driver function should also return a text representation of its input value. This representation is used to set the contents of the Label instance that may be supplied to AnalogGauge via its constructor. If no such instance is supplied, the text representation is simply ignored.
Starting with version 0.1.4, AnalogGauge allows an optional PhotoImage argument (PhotoImage is part of Tkinter). This allows background images to be specified for gauge objects (a similar effect could be achieved by using the Canvas methods directly, but using an argument to AnalogGauge is a more extensible design). MVM uses the image option as part of its theme support features. The option also makes it possible to use photographs of actual instrument dials as backgrounds of Flightdeck-UI gauges.
The FDUIFactory class was introduced in version 0.1.3. Callers should now create Flightdeck-UI elements through this factory, with the exception of the AnunStatus which is just used directly. From the caller's perspective, element use after construction has not changed from the 0.02 release.
Elements since version 0.1.3 work essentially like their 0.02 counterparts, but some things have changed internally. For example, the Style classes now store some variables inside the AnalogGauge class. This arrangement allows a single Style object to drive multiple gauges, which keeps some parameters (such as the min/max markers of the VSI element) synchronized. Separate Style objects can still be synchronized via sync methods added in the 0.02 release.
Version 0.1.4 introduced several helper classes. FileEntry combines a Tkinter textbox (Entry class) with a tkFileDialog (which is also part of Tkinter). This allows the user to enter a filename via the textbox directly, or bring up the dialog box instead. The filename selected in the dialog will then be automatically entered into the textbox. By default, a click of the right mouse button brings up the dialog (this can be changed).
FileEntry also handles lists of filenames (the comma is the default separator). In the case of a list, the user can position the cursor on the filename that needs to be changed before bringing up the dialog. The other filenames in the list will then be left untouched.
The ColorEntry class works similarly to FileEntry, but the Tkinter tkColorChooser dialog is used instead. This allows a textbox containing a color name (or a list of color names) to be edited with a combination of direct text entry and choices via the color chooser dialog.
Another helper class is SimpleDropBox. This implements a single-select drop-down box, which is not available in Tkinter. While other implementations of drop-down boxes already exist, Flightdeck-UI provides one as a convenience, so that the user does not have to download a whole additional library just to get this one control. In particular, the MVM application uses SimpleDropBox and the other helper classes heavily.
In this release of Flightdeck-UI (0.1.5), a reset feature has been added to GhostNeedleDriver. The initialization of the "ghost" needles has also been improved, as was the initialization of the min/max markers in VSpeed. The new initialization methods result in accurate starting positions of these elements regardless of the value generated during the first sample.
<<< Previous | Home | Next >>> |
Architecture of the Flightdeck-UI Library | Up | Source Code Files |