View Single Post
Old 12-22-2010, 12:20 PM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,850
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You can load a .ui file from a plugin zip file and auto compile it, using PyQT4.uic.compileUI (for an example of doing this look at calibre.gui2.build_forms)

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)
  ...
Look at the MetadataSource class for an example (though I would recommen using JSONConfig rather than XMLConfig ina modern plugin.
kovidgoyal is offline   Reply With Quote