[PyQt] pyqt: best practice for writting an app with plugins

brian downing brian.downing at yakkadesign.com
Fri Apr 16 01:10:49 BST 2010

I writing a app that I want to have the ability to use plugins and I'm 
curious what the best way to write it is.

I'll describe what I'm trying to accomplish.  In the top widget I have a 
QPushButton("convert") and QPushButton("converter options").  I want the 
"converter options" button to pull up a dialog that allows the different 
plugins to be selected and the selected plugin options to be set.  For 
the top widget, when the user clicks "convert" I want to it run the 
selected converter plugin.  For the plugins, I'll need to be able to 
hook signals and slots to the other widgets.

I'm not sure what the best way to store the plugins is.  My initial 
thought was to do something like:
class topWidget(QWidget)
  def init:  

     connect(QPushButton("converter options"), "clicked", self.showMgrDlg)
     connect(QPushButton("convert"), "clicked", self.convert)   
  def showMgrDlg:
  def  self.convert:

class pluginMangerDialog(QDialog)
  def init(self,listOfPlugins):
      for plugin in listOfPlugins:
         store plugin

   def convert
     run convert for plug in selected

Is there a better way to do this? 


More information about the PyQt mailing list