View Single Post
Old 01-03-2011, 06:42 PM   #8
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,224
Karma: 1334002
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
Quote:
Originally Posted by kovidgoyal View Post
And you can have your plugin tell the calibre preferences dialog to use your custom widget by defining two methods on your plugin

Code:
def config_widget(self):
  ...
  return QWidget

def save_setting(self, takes the widget returned previously and stores the settings)
  ...
Kovid,

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)?

Last edited by kiwidude; 01-03-2011 at 06:44 PM.
kiwidude is offline   Reply With Quote