def on_button_box_accepted(self):
        stopScale = int(self.stopScaleCombo.currentText().replace('k', ''))
        scale = int(self.scaleCombo.currentText().replace('k', ''))

        if stopScale > scale:
            QMessageBox.warning(
                self, self.tr('Warning!'),
                self.tr('The stop scale denominator should not be bigger than \
                                                                    the scale denominator!'
                        ))
            return
        if self.createShapeBox.isChecked() and not self.saveEdit.text():
            QMessageBox.warning(self, self.tr('Warning!'),
                                self.tr('A output file must be specified!'))
            return
        if not self.crsLineEdit.text():
            QMessageBox.warning(self, self.tr('Warning!'),
                                self.tr('A CRS must be specified!'))
            return
        if not self.validateMI():
            QMessageBox.warning(self, self.tr('Warning!'),
                                self.tr('Invalid Map Index!'))
            return

        # Initiating processing
        gridThread = UtmGrid()

        if self.createShapeBox.isChecked():
            self.layer = None
        else:
            self.layer = gridThread.createGridLayer(self.tr('Grid Zones'),
                                                    'Multipolygon',
                                                    self.crs.authid())

        gridThread.setParameters(self.indexLineEdit.text(), stopScale,
                                 self.miLineEdit.text(), self.crs,
                                 self.saveEdit.text(), self.layer)
        # Connecting end signal
        gridThread.aux.processFinished.connect(self.finishProcess)
        gridThread.aux.rangeCalculated.connect(self.setRange)
        gridThread.aux.errorOccurred.connect(self.showError)
        gridThread.aux.stepProcessed.connect(self.updateProgress)
        # Setting the progress bar
        self.progressMessageBar = define._messagBar.createMessage(
            self.tr('Generating grid, please wait...'))
        self.progressBar = QtGui.QProgressBar()
        self.progressBar.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        self.progressMessageBar.layout().addWidget(self.progressBar)
        define._messagBar.pushWidget(self.progressMessageBar,
                                     define._messagBar.INFO)
        self.progressBar.setRange(0, 0)
        self.progressMessageBar.destroyed.connect(gridThread.aux.cancel)
        # Starting process
        # self.threadpool.start(gridThread)
        gridThread.run()
    def __init__(self, iface, parent=None):
        """Constructor."""
        super(GridZoneGeneratorDialog, self).__init__(parent)
        # 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.setupUi(self)
        self.iface = iface

        self.crsLineEdit.setReadOnly(True)

        self.utmgrid = UtmGrid()

        self.setValidCharacters()

        self.setMask()

        self.threadpool = QThreadPool()