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_importer_dialog import ShakemapImporterDialog dialog = ShakemapImporterDialog(self.iface.mainWindow()) dialog.exec_() # modal
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_importer_dialog import ( ShakemapImporterDialog) dialog = ShakemapImporterDialog(self.iface.mainWindow()) dialog.exec_() # modal
def test_behaviour(self): """Test behaviour of elements in the dialog """ shakemap_importer_dialog = ShakemapImporterDialog(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)
def test_converting(self): """Test converting grif file to tiff.""" dialog = ShakemapImporterDialog(PARENT) dialog.use_output_default.setEnabled(False) grid_path = test_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.input_path.setText(grid_path) dialog.output_path.setText(output_raster) button = dialog.button_box.button(QDialogButtonBox.Ok) button.click() msg = 'Raster is not created' self.assertTrue(os.path.exists(output_raster), msg)
def test_init_dialog(self): """Test for showing table in the first.""" shakemap_converter_dialog = ShakemapImporterDialog(PARENT) msg = 'Dialog is failed to create' self.assertIsNotNone(shakemap_converter_dialog, msg)