The YaST Wizard and the help pop-up
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/b00e038670d2381ac38bb726b... 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
On 2/22/21 4:14 PM, Ancor Gonzalez Sosa wrote:
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/b00e038670d2381ac38bb726b...
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).
Yes, we also faced that problem when implementing such help in the Services Manager. Maybe this is a good time to open the door to a new CWM widget to manage the help?
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.
Thanks for sharing it! -- José Iván López González YaST Team at SUSE LINUX GmbH IRC: jilopez
On 2/23/21 10:08 AM, José Iván López González wrote:
On 2/22/21 4:14 PM, Ancor Gonzalez Sosa wrote:
[...]
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).
Yes, we also faced that problem when implementing such help in the Services Manager. Maybe this is a good time to open the door to a new CWM widget to manage the help?
Not CWM, please. In fact, the Yast2::Popup module would already serve as a good starting point. Its approach is quite valid and there is quite some logic that could be shared with an hypothetical Yast2::HelpPopup. Just if we want to go that road, which is not still clear to me.
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.
Thanks for sharing it!
It was unfair to keep all the fun for myself. Cheers. -- Ancor González Sosa YaST Team at SUSE Software Solutions
On Tue, 23 Feb 2021 11:21:35 +0100 Ancor Gonzalez Sosa <ancor@suse.de> wrote:
On 2/23/21 10:08 AM, José Iván López González wrote:
On 2/22/21 4:14 PM, Ancor Gonzalez Sosa wrote:
[...]
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).
Yes, we also faced that problem when implementing such help in the Services Manager. Maybe this is a good time to open the door to a new CWM widget to manage the help?
Not CWM, please.
In fact, the Yast2::Popup module would already serve as a good starting point. Its approach is quite valid and there is quite some logic that could be shared with an hypothetical Yast2::HelpPopup.
We can do it in fact other way round and use that new HelpPopup in CWM to show help. Josef
Just if we want to go that road, which is not still clear to me.
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.
Thanks for sharing it!
It was unfair to keep all the fun for myself.
Cheers.
On 2021-02-22 17:14, Ancor Gonzalez Sosa wrote:
...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).
It should be reasonably easy to add that. Kind regards -- Stefan Hundhammer <shundhammer@suse.de> YaST Developer SUSE Linux GmbH GF: Felix Imendörffer, Jane Smithard, Graham Norton; HRB 21284 (AG Nürnberg)
participants (4)
-
Ancor Gonzalez Sosa
-
josef Reidinger
-
José Iván López González
-
Stefan Hundhammer