def __init__(self, parent=None):
        """Constructor for the minimum needs dialog.

        :param parent: Parent widget of this dialog.
        :type parent: QWidget
        """
        QtWidgets.QDialog.__init__(self, parent)
        self.setupUi(self)
        self.setWindowTitle(self.tr(
            'InaSAFE %s Minimum Needs Calculator' % get_version()))
        icon = resources_path('img', 'icons', 'show-minimum-needs.svg')
        self.setWindowIcon(QtGui.QIcon(icon))

        self.result_layer = None
        self.button_box.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False)

        # get qgis map layer combobox object
        self.layer.setFilters(QgsMapLayerProxyModel.VectorLayer)

        # get field that represent displaced count(population)
        self.displaced.setFilters(QgsFieldProxyModel.Numeric)

        # get field that represent aggregation name
        self.aggregation_name.setFilters(QgsFieldProxyModel.String)

        # set field to the current selected layer
        self.displaced.setLayer(self.layer.currentLayer())
        self.aggregation_name.setLayer(self.layer.currentLayer())
        self.aggregation_id.setLayer(self.layer.currentLayer())

        # link map layer and field combobox
        self.layer.layerChanged.connect(self.displaced.setLayer)
        self.layer.layerChanged.connect(self.aggregation_name.setLayer)
        self.layer.layerChanged.connect(self.aggregation_id.setLayer)

        # enable/disable ok button
        self.update_button_status()
        self.displaced.fieldChanged.connect(self.update_button_status)

        # Set up things for context help
        self.help_button = self.button_box.button(
            QtWidgets.QDialogButtonBox.Help)
        # Allow toggling the help button
        self.help_button.setCheckable(True)
        self.help_button.toggled.connect(self.help_toggled)
        self.main_stacked_widget.setCurrentIndex(1)

        # Fix for issue 1699 - cancel button does nothing
        cancel_button = self.button_box.button(
            QtWidgets.QDialogButtonBox.Cancel)
        cancel_button.clicked.connect(self.reject)
        # Fix ends
        ok_button = self.button_box.button(QtWidgets.QDialogButtonBox.Ok)
        ok_button.clicked.connect(self.accept)
def __init__ ( self , parent = None ) : QtWidgets . QDialog . __init__ ( self , parent ) self . setupUi ( self ) self . setWindowTitle ( self . tr ( 'InaSAFE %s Minimum Needs Calculator' % get_version ( ) ) ) icon = resources_path ( 'img' , 'icons' , 'show-minimum-needs.svg' ) self . setWindowIcon ( QtGui . QIcon ( icon ) ) self . result_layer = None self . button_box . button ( QtWidgets . QDialogButtonBox . Ok ) . setEnabled ( False ) self . layer . setFilters ( QgsMapLayerProxyModel . VectorLayer ) self . displaced . setFilters ( QgsFieldProxyModel . Numeric ) self . aggregation_name . setFilters ( QgsFieldProxyModel . String ) self . displaced . setLayer ( self . layer . currentLayer ( ) ) self . aggregation_name . setLayer ( self . layer . currentLayer ( ) ) self . aggregation_id . setLayer ( self . layer . currentLayer ( ) ) self . layer . layerChanged . connect ( self . displaced . setLayer ) self . layer . layerChanged . connect ( self . aggregation_name . setLayer ) self . layer . layerChanged . connect ( self . aggregation_id . setLayer ) self . update_button_status ( ) self . displaced . fieldChanged . connect ( self . update_button_status ) self . help_button = self . button_box . button ( QtWidgets . QDialogButtonBox . Help ) self . help_button . setCheckable ( True ) self . help_button . toggled . connect ( self . help_toggled ) self . main_stacked_widget . setCurrentIndex ( 1 ) cancel_button = self . button_box . button ( QtWidgets . QDialogButtonBox . Cancel ) cancel_button . clicked . connect ( self . reject ) ok_button = self . button_box . button ( QtWidgets . QDialogButtonBox . Ok ) ok_button . clicked . connect ( self . accept )
Constructor for the minimum needs dialog.

        :param parent: Parent widget of this dialog.
        :type parent: QWidget