示例#1
0
    def show_shakemap_importer(self):
        """Show the converter dialog."""
        # import here only so that it is AFTER i18n set up
        from safe.gui.tools.shake_grid.shakemap_converter_dialog import (
            ShakemapConverterDialog)

        dialog = ShakemapConverterDialog(self.iface.mainWindow())
        dialog.exec_()  # modal
示例#2
0
文件: plugin.py 项目: sopac/inasafe
    def show_shakemap_importer(self):
        """Show the converter dialog."""
        # import here only so that it is AFTER i18n set up
        from safe.gui.tools.shake_grid.shakemap_converter_dialog import (
            ShakemapConverterDialog)

        dialog = ShakemapConverterDialog(self.iface.mainWindow())
        dialog.exec_()  # modal
示例#3
0
    def test_behaviour(self):
        """Test behaviour of elements in the dialog."""
        shakemap_importer_dialog = ShakemapConverterDialog(PARENT, IFACE)
        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)
    def test_behaviour(self):
        """Test behaviour of elements in the dialog."""
        shakemap_importer_dialog = ShakemapConverterDialog(PARENT, IFACE)
        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)
示例#5
0
    def test_converting(self):
        """Test converting grif file to tiff."""
        dialog = ShakemapConverterDialog(PARENT, IFACE)
        dialog.use_output_default.setEnabled(False)
        grid_path = standard_data_path(
            'hazard',
            'shake_data',
            '20131105060809',
            'output',
            'grid.xml')
        output_raster = unique_filename(
            prefix='result_grid',
            suffix='.tif',
            dir=temp_dir('test'))
        dialog.load_result.setEnabled(True)
        dialog.load_result.setChecked(False)
        dialog.input_path.setText(grid_path)
        dialog.nearest_mode.setChecked(True)
        dialog.output_path.setText(output_raster)
        button = dialog.button_box.button(QDialogButtonBox.Ok)
        button.click()

        msg = 'Raster is not created'
        output_path = '%s-nearest.tif' % output_raster[:-4]
        self.assertTrue(os.path.exists(output_path), msg)
示例#6
0
 def test_init_dialog(self):
     """Test for showing table in the first."""
     shakemap_converter_dialog = ShakemapConverterDialog(PARENT, IFACE)
     msg = 'Dialog is failed to create'
     self.assertIsNotNone(shakemap_converter_dialog, msg)