I am aware that for custom plugins that the customization_help() function can be used to allow plugins to have a single string value supplied by the user.

However is it at all possible to launch a custom Qt .ui dialog included as part of the plugin zip file? Or are you limited to just the singly .py file containing your plugin code?

I have until now always used "tweaks" for my GUI plugins that require complex configuration. I can appreciate that it would of course be much nicer and consistent with other plugins if such configuration was self-contained and maintained within the plugins dialog instead. However a single "string" isn't a sufficiently powerful function for some of them.

Even if you can't compile the .ui file, you should be able to programmatically build dialog boxes. It isn't hard, even for moderately complex dialogs. For example, the check_library dialog box is built programmatically.

Even if you can't compile the .ui file, you should be able to programatically build dialog boxes. It isn't hard, even for moderately complex dialogs. For example, the check_library dialog box is built programatically.

Thanks for the suggestion chaley, I will take a look at that. As I have said before on other threads Python/Qt is new to me but I don't mind dabbling to learn at the moment...

One thing you can do is build some UI files, then get python to compile them. Look at the resulting code. You will line after line of widget creation, setup, and adding to the layout. This, plus looking at some of the programmatic dialogs, should help you get started.

Another thing you can do -- use UI files, let python compile them, then capture the resulting _ui.py and put it into your plugin's zip file. No client-side ui compilation would be necessary.

Another thing you can do -- use UI files, let python compile them, then capture the resulting _ui.py and put it into your plugin's zip file. No client-side ui compilation would be necessary.

Now that sounds pretty good and a nice way to learn the code to generate.

When looking at how I would then actually invoke the dialog (in plugins.py) when the user clicks within the Preferences dialog I found a whole bunch of stuff to do with a "config_widget" function. Presumably this is to support the existing "complex" dialogs like the metadata reader plugins. So looks like there is some kind of infrastructure there that I would need to hook into anyway to allow my custom dialog content to be displayed. I'll do some investigating. Thanks again.

I'm rewriting my "Search the internet" plugin to use a custom preferences dialog, so far progressing ok. However can you tell me if there is a way I am missing to persist/restore the size of the plugin configuration dialog itself? I have a grid that could be resized rather wide to show more stuff on screen, but don't want to force it super wide by default.

I figured out all the necessary code to saveGeometry() etc into the JSON file. However of course inside the config_widget() function I have no handle to the config_dialog instance that the widget will be added to. So as far as I can tell, using restoreGeometry() on a widget that does not yet have a parent is effectively useless.

It seems that at best I can set a minimumSize.

Am I missing something? Or will it require a change to Calibre so that instead Calibre takes care of persisting/restoring the size of configuration windows per plugin? (Which would be a better solution anyway so every plugin developer does not have to repeat this code)?