Exemplo n.º 1
0
    def show_batch_runner(self):
        """Show the batch runner dialog."""
        from safe_qgis.batch.batch_dialog import BatchDialog

        myDialog = BatchDialog(parent=self.iface.mainWindow(),
                               iface=self.iface,
                               dock=self.dockWidget)
        myDialog.exec_()  # modal
Exemplo n.º 2
0
    def showScriptDialog(self):
        """Show Script Dialog"""
        from safe_qgis.batch.batch_dialog import BatchDialog

        myDialog = BatchDialog(
            self.iface.mainWindow(), self.iface, self.dockWidget)
        myDialog.setModal(True)
        myDialog.show()
Exemplo n.º 3
0
    def show_batch_runner(self):
        """Show the batch runner dialog."""
        from safe_qgis.batch.batch_dialog import BatchDialog

        myDialog = BatchDialog(
            self.iface.mainWindow(), self.iface, self.dockWidget)
        myDialog.setModal(True)
        myDialog.show()
Exemplo n.º 4
0
    def show_batch_runner(self):
        """Show the batch runner dialog."""
        from safe_qgis.batch.batch_dialog import BatchDialog

        myDialog = BatchDialog(
            parent=self.iface.mainWindow(),
            iface=self.iface,
            dock=self.dockWidget)
        myDialog.exec_()  # modal
Exemplo n.º 5
0
 def test_run_single_scenario(self):
     """Test run single scenario."""
     dialog = BatchDialog(PARENT, IFACE, DOCK)
     dialog.show_results_popup = False
     dialog.scenario_directory_radio.setChecked(False)
     dialog.source_directory.setText(SCENARIO_DIR)
     dialog.source_directory.textChanged.emit(SCENARIO_DIR)
     out_path = temp_dir()
     dialog.output_directory.setText(out_path)
     dialog.table.selectRow(1)
     button = dialog.run_selected_button
     button.click()
     status = dialog.table.item(1, 1).text()
     self.assertTrue(status == 'Report Ok')
Exemplo n.º 6
0
 def test_runSingleScenario(self):
     """Test run single scenario."""
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.show_results_popup = False
     myDialog.scenario_directory_radio.setChecked(False)
     myDialog.source_directory.setText(SCENARIO_DIR)
     myDialog.source_directory.textChanged.emit(SCENARIO_DIR)
     myOutputDir = temp_dir()
     myDialog.output_directory.setText(myOutputDir)
     myDialog.table.selectRow(1)
     myButton = myDialog.run_selected_button
     myButton.click()
     myStatus = myDialog.table.item(1, 1).text()
     assert myStatus == 'Report Ok'
Exemplo n.º 7
0
 def test_runSingleScenario(self):
     """Test run single scenario."""
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.show_results_popup = False
     myDialog.scenario_directory_radio.setChecked(False)
     myDialog.source_directory.setText(SCENARIO_DIR)
     myDialog.source_directory.textChanged.emit(SCENARIO_DIR)
     myOutputDir = temp_dir()
     myDialog.output_directory.setText(myOutputDir)
     myDialog.table.selectRow(1)
     myButton = myDialog.run_selected_button
     myButton.click()
     myStatus = myDialog.table.item(1, 1).text()
     assert myStatus == 'Report Ok'
Exemplo n.º 8
0
 def test_loadBatchDialog(self):
     """Definitely, this is a test. Test for BatchDialog behaviour
     """
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.show_results_popup = False
     myDialog.scenario_directory_radio.setChecked(True)
     myDialog.source_directory.setText(SCENARIO_DIR)
     myDialog.source_directory.textChanged.emit(SCENARIO_DIR)
     print "Testing using : %s" % SCENARIO_DIR
     numberRow = myDialog.table.rowCount()
     assert numberRow == 2, 'Num scenario is wrong. I got %s' % numberRow
     myOutputDir = myDialog.output_directory.text()
     assert myOutputDir == SCENARIO_DIR, 'Output directory is ' + \
                                         myOutputDir
     myDialog.scenario_directory_radio.setChecked(False)
     myDialog.output_directory.setText('not a dir')
     myOutputDir = myDialog.output_directory.text()
     myDialog.scenario_directory_radio.setText(SCENARIO_DIR + 'a')
     myDialog.scenario_directory_radio.setText(SCENARIO_DIR)
     assert myOutputDir != SCENARIO_DIR, 'Output directory is ' + \
                                         myOutputDir
Exemplo n.º 9
0
 def test_loadBatchDialog(self):
     """Definitely, this is a test. Test for BatchDialog behaviour
     """
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.show_results_popup = False
     myDialog.scenario_directory_radio.setChecked(True)
     myDialog.source_directory.setText(SCENARIO_DIR)
     myDialog.source_directory.textChanged.emit(SCENARIO_DIR)
     print "Testing using : %s" % SCENARIO_DIR
     numberRow = myDialog.table.rowCount()
     assert numberRow == 2, 'Num scenario is wrong. I got %s' % numberRow
     myOutputDir = myDialog.output_directory.text()
     assert myOutputDir == SCENARIO_DIR, 'Output directory is ' + \
                                         myOutputDir
     myDialog.scenario_directory_radio.setChecked(False)
     myDialog.output_directory.setText('not a dir')
     myOutputDir = myDialog.output_directory.text()
     myDialog.scenario_directory_radio.setText(SCENARIO_DIR + 'a')
     myDialog.scenario_directory_radio.setText(SCENARIO_DIR)
     assert myOutputDir != SCENARIO_DIR, 'Output directory is ' + \
                                         myOutputDir
Exemplo n.º 10
0
 def test_load_batch_dialog(self):
     """Test for BatchDialog behaviour.
     """
     dialog = BatchDialog(PARENT, IFACE, DOCK)
     dialog.show_results_popup = False
     dialog.scenario_directory_radio.setChecked(True)
     dialog.source_directory.setText(SCENARIO_DIR)
     dialog.source_directory.textChanged.emit(SCENARIO_DIR)
     print "Testing using : %s" % SCENARIO_DIR
     number_row = dialog.table.rowCount()
     self.assertTrue(
         number_row == 2, 'Num scenario is wrong. I got %s' % number_row)
     out_path = dialog.output_directory.text()
     self.assertTrue(
         out_path == SCENARIO_DIR, 'Output directory is %s' % out_path)
     dialog.scenario_directory_radio.setChecked(False)
     dialog.output_directory.setText('not a dir')
     out_path = dialog.output_directory.text()
     dialog.scenario_directory_radio.setText(SCENARIO_DIR + 'a')
     dialog.scenario_directory_radio.setText(SCENARIO_DIR)
     self.assertTrue(
         out_path != SCENARIO_DIR, 'Output directory is %s' % out_path)
Exemplo n.º 11
0
    def show_batch_runner(self):
        """Show the batch runner dialog."""
        from safe_qgis.batch.batch_dialog import BatchDialog

        myDialog = BatchDialog(self.iface.mainWindow(), self.iface,
                               self.dockWidget)
        myDialog.setModal(True)
        myDialog.show()
Exemplo n.º 12
0
 def test_runAllScenario(self):
     """Test run single scenario.
     """
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.cbDefaultOutputDir.setChecked(False)
     myDialog.leSourceDir.setText(SCENARIO_DIR)
     myOutputDir = temp_dir()
     myDialog.leOutputDir.setText(myOutputDir)
     myButton = myDialog.run_all_button
     # noinspection PyArgumentList
     QTest.mouseClick(myButton, QtCore.Qt.LeftButton)
     myStatus0 = myDialog.tblScript.item(0, 1).text()
     myStatus1 = myDialog.tblScript.item(1, 1).text()
     assert myStatus0 == 'Analysis Fail', myStatus0
     assert myStatus1 == 'Report Ok', myStatus1
Exemplo n.º 13
0
 def test_runSingleScenario(self):
     """Test run single scenario
     """
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.cbDefaultOutputDir.setChecked(False)
     myDialog.leSourceDir.setText(SCENARIO_DIR)
     myOutputDir = temp_dir()
     myDialog.leOutputDir.setText(myOutputDir)
     myDialog.sboCount.setValue(1)
     myDialog.tblScript.selectRow(1)
     myButton = myDialog.run_selected_button
     # noinspection PyArgumentList
     QTest.mouseClick(myButton, QtCore.Qt.LeftButton)
     myStatus = myDialog.tblScript.item(1, 1).text()
     assert myStatus == 'Report Ok'
Exemplo n.º 14
0
 def test_loadBatchDialog(self):
     """Definitely, this is a test. Test for BatchDialog behaviour
     """
     myDialog = BatchDialog(PARENT, IFACE, DOCK)
     myDialog.cbDefaultOutputDir.setChecked(True)
     myDialog.leSourceDir.setText(SCENARIO_DIR)
     numberRow = myDialog.tblScript.rowCount()
     assert numberRow == 2, 'Num scenario is wrong. I got %s' % numberRow
     myOutputDir = myDialog.leOutputDir.text()
     assert myOutputDir == SCENARIO_DIR, 'Output directory is ' + \
                                         myOutputDir
     myDialog.cbDefaultOutputDir.setChecked(False)
     myDialog.leOutputDir.setText('not a dir')
     myOutputDir = myDialog.leOutputDir.text()
     myDialog.leSourceDir.setText(SCENARIO_DIR + 'a')
     myDialog.leSourceDir.setText(SCENARIO_DIR)
     assert myOutputDir != SCENARIO_DIR, 'Output directory is ' + \
                                         myOutputDir