Actually, doing the checks in show_configuration doesn't work well. Its fine from the Customization menu item I created, but not when customization is done from the Preferences menu. I can add code in both places, but I think I'll just do all the checking in config_widget.
So one way is to do my checks in config_widget, and return a QLabel if there's an error. But the dialog box is large (saved from whatever size was last used) and doesn't look right with a small error messages. And it says OK or Cancel when in fact you just want the user to click OK since two options on an error message is confusing.
I actually use my own routines to show up error/warning/info dialogs depending on the issue so I don't need do_user_config to show a window, but I can work with it if there's a way to get it to resize and just show an OK button.
Some options, as mentioned above could be:
1. Run a pre-check method if defined. If false, don't show the window or do anything (assumes plugin handles user warnings, etc.)
2. In do_user_config, if config_widget is defined but returns None, don't show the window or do anything
3. If config_widget returns a simple QLabel, just show the label in a correctly sized window/dialog and a single OK button on the window - and exit after OK is clicked without validation or saving.
In the meantime I think I'll just live with the large text box since its only supposed to appear if you've done something wrong.
|