def on_import_gpx_file_button_clicked(self): """ Method to load GPS dialog """ layer_map = QgsMapLayerRegistry.instance().mapLayers() if not bool(layer_map): QMessageBox.warning( self, "STDM", "You must add a layer first from Spatial Unit " "Manager to import GPX to") elif bool(layer_map): self.gps_tool_dialog = GPSToolDialog(self.iface, self.curr_layer, self.curr_lyr_table, self.curr_lyr_sp_col) self.gps_tool_dialog.show()
def on_import_gpx_file_button_clicked(self): """ Method to load GPS dialog """ source_status = self.active_layer_source() layer_map = QgsMapLayerRegistry.instance().mapLayers() error_title = QApplication.translate( 'SpatialUnitManagerDockWidget', 'GPS Feature Import Loading Error' ) if len(layer_map) > 0: if source_status is None: QMessageBox.critical( self, error_title, QApplication.translate( 'SpatialUnitManagerDockWidget', 'You have not selected a layer.\n ' 'Please select a valid layer to import GPS features.' ) ) elif source_status is False: QMessageBox.critical( self, error_title, QApplication.translate( 'SpatialUnitManagerDockWidget', 'You have selected a non-STDM entity layer.\n ' 'Please select a valid layer to import GPS features.' ) ) elif source_status is True: self.gps_tool_dialog = GPSToolDialog( self.iface, self.active_entity, self.active_table, self.active_sp_col ) self.gps_tool_dialog.show() else: QMessageBox.critical( self, error_title, QApplication.translate( 'SpatialUnitManagerDockWidget', 'You must add an entity layer from Spatial Unit Manager\n' 'and select it to import GPS Features.' ) )