class GeneticSimplifierDialog(QtGui.QDialog, Ui_GeneticSimplifier):
    def __init__(self):
        QtGui.QDialog.__init__(self)
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
        self.ui = Ui_GeneticSimplifier()
        self.ui.setupUi(self)

        # Get the available mate types
        self.ui.mateCombo.addItems(Types.MateTypes)

        # Connecting SIGNAL/SLOTS for the Output button
        QtCore.QObject.connect(
            self.ui.inputLayerCombo, QtCore.SIGNAL("currentIndexChanged (int)"), self.updateFeatureCount
        )

        self.layers = []
        self.currentLayer = None

    def updateFeatureCount(self, index):
        self.currentLayer = self.layers[index]
        count = self.currentLayer.featureCount()
        self.ui.featureCountEdit.setText(str(count))

    def saveOutputFile(self):
        fileName = QtGui.QFileDialog.getSaveFileName(self, "Save output file", "", "ShapeFile (*.shp)")
        # fileName = QtGui.QFileDialog.getSaveFileName(self, 'Save output file', '', "Vector Files (*.shp *.geojson *.gml *.kml *.bna *.gdb)")
        if fileName:
            self.ui.outputEdit.setText(fileName)

    def insertLineLayers(self, layers):
        self.layers = layers
        self.ui.inputLayerCombo.clear()
        for layer in layers:
            self.ui.inputLayerCombo.addItem(layer.name(), layer.id())
    def __init__(self):
        QtGui.QDialog.__init__(self)
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect
        self.ui = Ui_GeneticSimplifier()
        self.ui.setupUi(self)

        # Get the available mate types
        self.ui.mateCombo.addItems(Types.MateTypes)

        # Connecting SIGNAL/SLOTS for the Output button
        QtCore.QObject.connect(
            self.ui.inputLayerCombo, QtCore.SIGNAL("currentIndexChanged (int)"), self.updateFeatureCount
        )

        self.layers = []
        self.currentLayer = None