I has been trying today to customize a bit the help dialog of the
Partitioner, which is based on CWM:Dialog, which is then based on the
ubiquitous Yast::Wizard.

I'm collecting my findings here so other with more knowledge can point
where I'm wrong. So take all this with a grain of salt, is meant for
corrections.

TL;DR
The only reasonable option of having a good control on how the help
pop-up behaves in a Yast::Wizard is defining from scratch all the wizard
buttons like it's done here:
https://github.com/yast/yast-services-manager/blob/b00e038670d2381ac38bb726b515865badc73c60/src/lib/services-manager/dialogs/services_manager.rb#L121

Now, the longer version pulling the thread from the Partitioner and
CWM::Dialog.

By default, CWM::Dialog just calls Yast::Wizard.CreateDialog which
offers zero possibilities regarding how to customize the behavior of the
help button.

The standard help button provided by most kinds of Wizard-based dialogs
opens a pop-up whose shape and behavior is defined by the QY2HelpDialog
class. That class comes straight from libyui. I didn't find any
reasonable mechanism to customize how QY2HelpDialog works (eg. adding
the possibility to do something if the user clicks in some hyperlink
within the help text).

In theory, one could use Yast::Wizard.OpenCustomDialog instead of
CreateDialog. But that functionality is currently broken. Is based on
the existence of a replace point called "helpSpace" that is not present
in the Wizards anymore. Fun enough, the only remaining occurrence of
that replace point is in Yast::Wizard.GenericTreeDialog, another old
function that doesn't seem to be used anymore (the Wizard module is a
code cemetery).

That leaves us only with the option discussed on TL;DR, which implements
a custom button labeled "Help" that opens a simple regular pop-up to
display the help text (eg. no searching box). For that, it uses the
commodity method Yast::Wizard.ShowHelp, which does simply that - opening
a regular pop-up (not based on QY2HelpDialog) to display some text. That
ShowHelp method is not connected to the default mechanism of the
standard "Help" buttons. It's only executed if called explicitly and
only displays the passed text. It's used seldomly to create custom
additional "Help" buttons (eg. in a pop-up that is not really part of
the Wizard).

I was kind of tempted to test the Services Manager approach in order to
add limited hyperlinks support for the Partitioner help... but I'm not
convinced it's worth it.

Still, the investigation was interesting and I'm writing my findings
here for my future self.

Cheers.
-- 
Ancor González Sosa
YaST Team at SUSE Software Solutions

Reply via email to