Could someone provide some detailed instructions (for very new beginners!!) on how to integrate combomanager in another plugin?

What I have tried (maybe wrong way of doing it!!...):
First I downloaded Qgis Combo Manager from http://3nids.github.io/qgiscombomanager/ and extracted the zip folder.

Then I copied composercombo.py, expressionfieldcombo.py, fieldcombo.py, layercombo.py and optiondictionary.py in my class directory. Then I included in the import section of my module' s python file the following:

from qgis.core import *
from layercombo import VectorLayerCombo, LayerCombo
from fieldcombo import FieldCombo
from expressionfieldcombo import ExpressionFieldCombo

Finally, under run(self)

line186    def run(self)
line187    self.dlg.comboBox = VectorLayerCombo(self.dlg.comboBox)
line188    self.dlg.comboBox_2 = FieldCombo(self.dlg.comboBox_2, self.dlg.comboBox)

So when I run my plugin for the first time it works. Then, if I run it again just after the first time I get this error message:

Traceback (most recent call last):
  File "C:/Users/Eleftheria/.qgis2/python/plugins\MyClass\my_module.py",line 188, in run
self.dlg.comboBox = VectorLayerCombo(self.dlg.comboBox)<br/>
  File "C:/Users/Eleftheria/.qgis2/python/plugins\MyClass\layercombo.py",line 187, in __init__
 LayerCombo.__init__(self, widget, initLayer, options, QgsMapLayer.VectorLayer)
  File "C:/Users/Eleftheria/.qgis2/python/plugins\MyClass\layercombo.py",line 62, in __init__
AttributeError: 'VectorLayerCombo' object has no attribute 'currentIndexChanged'
Python Έκδοση:
2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]
Έκδοση Qgis:
2.10.1-Pisa Pisa, d20c5b7

In line 62 there is this:

line62    if qVersion() > '4.3.3':
line63        QCoreApplication.installTranslator(self.translator)
  • 1
    You can use QgsMapLayerComboBox (combined with filters of QgsMapLayerProxyModel) and QgsFieldComboBox native objects of qgis.gui. They work very well in my plugins. – xunilk Oct 24 '15 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.