Ejemplo n.º 1
0
    def show_shakemap_importer(self):
        """Show the converter dialog."""
        # import here only so that it is AFTER i18n set up
        from safe_qgis.tools.shakemap_importer import ShakemapImporter

        myDialog = ShakemapImporter(self.iface.mainWindow())
        myDialog.exec_()  # modal
Ejemplo n.º 2
0
    def show_shakemap_importer(self):
        """Show the converter dialog."""
        # import here only so that it is AFTER i18n set up
        from safe_qgis.tools.shakemap_importer import ShakemapImporter

        myDialog = ShakemapImporter(self.iface.mainWindow())
        myDialog.exec_()  # modal
Ejemplo n.º 3
0
 def test_behaviour(self):
     """Test behaviour of elements in the dialog
     """
     myDialog = ShakemapImporter(PARENT)
     myDialog.use_output_default.setEnabled(True)
     my_grid_path = os.path.join(TESTDATA, 'grid.xml')
     myDialog.input_path.setText(my_grid_path)
     input_path = myDialog.input_path.text()
     output_path = myDialog.output_path.text()
     assert myDialog.isEnabled(), 'Output location should be disabled'
     expected_output_path = input_path[:-3] + 'tif'
     assert output_path == expected_output_path, \
         'Expected %s got %s' % (expected_output_path, output_path)
 def test_behaviour(self):
     """Test behaviour of elements in the dialog
     """
     myDialog = ShakemapImporter(PARENT)
     myDialog.use_output_default.setEnabled(True)
     my_grid_path = os.path.join(TESTDATA, 'grid.xml')
     myDialog.input_path.setText(my_grid_path)
     input_path = myDialog.input_path.text()
     output_path = myDialog.output_path.text()
     assert myDialog.isEnabled(), 'Output location should be disabled'
     expected_output_path = input_path[:-3] + 'tif'
     assert output_path == expected_output_path, \
         'Expected %s got %s' % (expected_output_path, output_path)
Ejemplo n.º 5
0
    def test_behaviour(self):
        """Test behaviour of elements in the dialog
        """
        shakemap_importer_dialog = ShakemapImporter(PARENT)
        shakemap_importer_dialog.use_output_default.setEnabled(True)
        my_grid_path = os.path.join(TESTDATA, 'grid.xml')
        shakemap_importer_dialog.input_path.setText(my_grid_path)
        input_path = shakemap_importer_dialog.input_path.text()
        output_path = shakemap_importer_dialog.output_path.text()

        msg = 'Output location should be disabled'
        self.assertTrue(shakemap_importer_dialog.isEnabled(), msg)

        expected_output_path = input_path[:-3] + 'tif'
        msg = 'Expected %s got %s' % (expected_output_path, output_path)
        self.assertEqual(output_path, expected_output_path, msg)
Ejemplo n.º 6
0
    def test_behaviour(self):
        """Test behaviour of elements in the dialog
        """
        shakemap_importer_dialog = ShakemapImporter(PARENT)
        shakemap_importer_dialog.use_output_default.setEnabled(True)
        my_grid_path = os.path.join(TESTDATA, 'grid.xml')
        shakemap_importer_dialog.input_path.setText(my_grid_path)
        input_path = shakemap_importer_dialog.input_path.text()
        output_path = shakemap_importer_dialog.output_path.text()

        msg = 'Output location should be disabled'
        self.assertTrue(shakemap_importer_dialog.isEnabled(), msg)

        expected_output_path = input_path[:-3] + 'tif'
        msg = 'Expected %s got %s' % (expected_output_path, output_path)
        self.assertEqual(output_path, expected_output_path, msg)
Ejemplo n.º 7
0
 def Xtest_Converting(self):
     """Test converting a file
     """
     myDialog = ShakemapImporter(PARENT)
     myDialog.test_mode = True
     myDialog.cBDefaultOutputLocation.setEnabled(False)
     my_grid_path = os.path.join(TESTDATA, 'grid.xml')
     my_output_raster = unique_filename(prefix='result_grid',
                                        suffix='.tif',
                                        dir=temp_dir('test'))
     myDialog.cBLoadLayer.setEnabled(True)
     myDialog.leInputPath.setText(my_grid_path)
     myDialog.leOutputPath.setText(my_output_raster)
     myButton = myDialog.buttonBox.button(QDialogButtonBox.Ok)
     myButton.click()
     assert os.path.exists(my_output_raster), 'Raster is not created'
Ejemplo n.º 8
0
 def Xtest_Converting(self):
     """Test converting a file
     """
     myDialog = ShakemapImporter(PARENT)
     myDialog.test_mode = True
     myDialog.cBDefaultOutputLocation.setEnabled(False)
     my_grid_path = os.path.join(TESTDATA, 'grid.xml')
     my_output_raster = unique_filename(prefix='result_grid',
                                        suffix='.tif',
                                        dir=temp_dir('test'))
     myDialog.cBLoadLayer.setEnabled(True)
     myDialog.leInputPath.setText(my_grid_path)
     myDialog.leOutputPath.setText(my_output_raster)
     myButton = myDialog.buttonBox.button(QDialogButtonBox.Ok)
     # noinspection PyArgumentList
     QTest.mouseClick(myButton, Qt.LeftButton)
     assert os.path.exists(my_output_raster), 'Raster is not created'
Ejemplo n.º 9
0
    def showConverter(self):
        """Show the converter dialog.

        This slot is called when the user clicks the impact functions
        toolbar icon or menu item associated with this plugin

        .. see also:: :func:`Plugin.initGui`.

        Args:
           None.
        Returns:
           None.
        Raises:
           no exceptions explicitly raised.
        """
        # import here only so that it is AFTER i18n set up
        from safe_qgis.tools.shakemap_importer import ShakemapImporter

        myDialog = ShakemapImporter(self.iface.mainWindow())
        myDialog.show()
Ejemplo n.º 10
0
 def test_converting(self):
     """Test converting a file.
     """
     dialog = ShakemapImporter(PARENT)
     dialog.use_output_default.setEnabled(False)
     grid_path = os.path.join(TESTDATA, 'grid.xml')
     output_raster = unique_filename(prefix='result_grid',
                                     suffix='.tif',
                                     dir=temp_dir('test'))
     dialog.load_result.setEnabled(True)
     dialog.input_path.setText(grid_path)
     dialog.output_path.setText(output_raster)
     button = dialog.button_box.button(QDialogButtonBox.Ok)
     button.click()
     assert os.path.exists(output_raster), 'Raster is not created'
Ejemplo n.º 11
0
 def test_init_dialog(self):
     """Test for showing table in the first."""
     shakemap_converter_dialog = ShakemapImporter(PARENT)
     msg = 'Dialog is failed to create'
     self.assertIsNotNone(shakemap_converter_dialog, msg)
Ejemplo n.º 12
0
 def test_initDialog(self):
     """Test for showing table in the first."""
     myDialog = ShakemapImporter(PARENT)
     assert myDialog is not None, 'Dialog is failed to created'