def run(self): """Specific stuff at tool activating.""" if not iface.mapCanvas().currentLayer(): no_vector_lyr_msg() return # Retrieve shapefile selected by the user selectedFileName = execFileDialog() if selectedFileName: self.launch_import(selectedFileName)
def _check_state(self): if self.uvc_form and self.uvc_form.ui.isVisible(): return False cur_carhab_lyr = CarhabLayerRegistry.instance().getCurrentCarhabLayer() if not cur_carhab_lyr: no_carhab_lyr_msg() return False if self._get_selected_feature() == 0: no_vector_lyr_msg() return False if self._get_selected_feature() == 1: one_only_selected_feat_msg() return False return True