openSUSE:YaST development Misc YDialogSpy
YDialogSpy: An Interactive YaST Dialog Debugger
The YaST UI engine now features an interactive dialog debugger: YDialogSpy. This is useful for non-trival dialogs such as this:
(YCP UI example)
In the Qt UI and in the Gtk UI, hit the magic key combination
and you will get a YDialogSpy window like this:
This shows the widget hierarchy of the original dialog as a tree. Clicking around in that tree, you can highlight the corresponding widget (and its child widgets) in the original dialog (move the YDialogSpy window to the side first):
This can also make widgets visible you normally can't see such as H/VSpacing, H/VStretch etc., and it shows the extent of alignment widgets (left, right, top, bottom) as well as layout boxes (H/VBox):
With the "Properties >>>" button you can expand the YDialogSpy dialog to show the widget properties of the currently selected widget in the tree:
This shows the complete list of properties for that widget. This might come in handy if you can't remember the exact name of a certain property; it might be quicker to just look it up in the YDialogSpy rather than searching the UI reference documentation.
For properties with simple data types the value is displayed (string, integer, boolean). Others are displayed as "???"; that are those properties that would require non-trivial data conversion to display (selection widget items, trees in tree widgets, etc.).
Some fields of YWidget (the base class of all widgets) were added to the properties mostly for the reason that they can be easily shown here. As a side benefit, they can now be queried and set with UI::QueryWidget() or UI::ChangeWidget(), respectively:
Plans for the Future
- Edit properties? At least for layout weights or the sizes of spacings and margins that would be very useful.
- Add a handler for the "other" properties whose values are currently displayed as "???"; the handler for those of course exists, but in a different part of the UI, in the ycp-ui-bindings (YCPPropertyHandler.cc). Maybe a function pointer and a function that just uses YCPValue::toString() (the debug output) could be used.
Most of this is written in plain C++ in the libyui, the abstract UI level. The concrete UI (yast2-qt, yast2-ncurses, yast2-gtk) has to provide a key combination to open it and a highlight() function that can somehow highlight the currently selected widget.
- Qt UI: Yes, hit Ctrl-Shift-Alt-Y
- Gtk UI: Yes, hit Ctrl-Shift-Alt-Y
- NCurses UI: hit Ctrl-D Shift-Y (limitations: the YDialogSpy window cannot be moved, the corresponding widgets are not highlighted)