Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm looking for more guidance using the QGIS ComboBoxManager module ( After finally getting the imports correct, I'm trudging my way through learning how to use it. I'm creating a simple plugin that utilizes three separate combo boxes to choose layers. Accepting the initial dialog runs a series of calculations based on data associated. This thread got me off to a good start (Adding attribute list to combobox in a python plugin), but I'm new to this, and having some issues adapting the example.

Some code from my plugin's main .py:

class zConso(Ui_zConso, VectorLayerCombo):

def __init__(self, iface, QComboBox, initLayer="", options={}):
    # Save reference to the QGIS interface
    self.iface = iface
    VectorLayerCombo.__init__(self, QComboBox, initLayer, options)

    self.indivComboManager = VectorLayerCombo(self.indivCombo)
    self.grosComboManager = VectorLayerCombo(self.grosCombo)
    self.resComboManager = VectorLayerCombo(self.resCombo)

    # Create the GUI dialog (after translation) and keep reference
    self.dlg = zConsoDialog()

    # current layer ref (set in handleLayerChange)
    self.indivLayer = None
    self.grosLayer = None
    self.resLayer = None

def initGui(self):
    # connect the action to the run method
    QObject.connect(self.action, SIGNAL("triggered()"),

    # Add toolbar button and menu item
    self.iface.addPluginToMenu(u"&zConso", self.action)


def layerChanged(self):
    self.indivLayer = self.indivComboManager.getLayer()
    self.grosLayer = self.grosComboManager.getLayer()
    self.resLayer = self.resComboManager.getLayer()
    if self.layer is None:
            'Statistic AEP',
            'Choissisez des couche pour calculer des statistics de consommation AEP')

My plugin imports as broken:

__init__() takes at least 3 arguments (2 given)

I'm not sure I'm going about this the right way. Do let me know if you can make a suggestion.

share|improve this question
Why is zConsoDialog inheriting from VectorLayerCombo? That doesn't make any sense. – Nathan W Apr 5 '14 at 8:41
now i feel sure it doesn't. I went about it this way, as this class inherited from the compiled PyQt designer ui files. i've switched some things around now, but still far from my goal. – user25976 Apr 8 '14 at 19:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.