Exemplo n.º 1
0
 def finished_analyzing_layers(self, usable_layers):
     self.analyzer_thread.wait()
     if any(usable_layers):
         self.layers = usable_layers
         current_layers = self.iface.legendInterface().selectedLayers()
         valid = [la for la in current_layers if la in usable_layers.keys()]
         if not any(valid):
             valid.append(self.layers.keys()[0])
         selected = utilities.exist_selected_features(self.layers.keys())
         self.change_ui_availability(True, selected)
         if utilities.exist_selected_features(self.layers.keys()):
             self.use_selected_features_chb.setEnabled(True)
             self.use_selected_features_chb.setChecked(True)
         else:
             self.use_selected_features_chb.setEnabled(False)
         self.model = ProcessLayerTableModel(self.layers, valid,
                                             self.processor, self)
         self.tableView.setModel(self.model)
         delegate = ProcessLayerDelegate(self, self)
         self.tableView.setItemDelegate(delegate)
         self.add_row_btn.released.connect(self.add_row)
         self.remove_row_btn.released.connect(self.remove_row)
         self.run_btn.released.connect(self.run_queries)
         self.output_dir_btn.released.connect(self.get_output_dir)
         self.lock_layers_chb.toggled.connect(self.toggle_lock_layers)
         self.processor.progress_changed.connect(self.update_progress)
         self.processor.update_info.connect(self.update_info)
         self.model.is_runnable_check.connect(self.toggle_run_button)
         if len(current_layers) < 2:
             self.remove_row_btn.setEnabled(False)
         self.toggle_run_button()
         output_dir = self.load_settings('output_dir',
                                         default_to=os.path.expanduser('~'))
         if str(output_dir) == '':
             output_dir = os.path.expanduser('~')
         self.output_dir_le.setText(output_dir)
         self.create_distances_files_chb.setChecked(False)
         self.reset_progress_bar()
         self.progressBar.setValue(self.processor.global_progress)
         self.update_info('')
     else:
         self.reset_progress_bar()
         self.change_ui_availability(False)
         self.progress_la.setText('No suitable layers found. Please '
                                  'consult the plugin\'s Help page.')
         palette = QPalette()
         palette.setColor(QPalette.Foreground, Qt.red)
         self.progress_la.setPalette(palette)
Exemplo n.º 2
0
 def finished_analyzing_layers(self, usable_layers):
     self.analyzer_thread.wait()
     if any(usable_layers):
         self.layers = usable_layers
         current_layers = self.iface.legendInterface().selectedLayers()
         valid = [la for la in current_layers if la in usable_layers.keys()]
         if not any(valid):
             valid.append(self.layers.keys()[0])
         selected = utilities.exist_selected_features(self.layers.keys())
         self.change_ui_availability(True, selected)
         if utilities.exist_selected_features(self.layers.keys()):
             self.use_selected_features_chb.setEnabled(True)
             self.use_selected_features_chb.setChecked(True)
         else:
             self.use_selected_features_chb.setEnabled(False)
         self.model = ProcessLayerTableModel(self.layers, valid,
                                             self.processor, self)
         self.tableView.setModel(self.model)
         delegate = ProcessLayerDelegate(self, self)
         self.tableView.setItemDelegate(delegate)
         self.add_row_btn.released.connect(self.add_row)
         self.remove_row_btn.released.connect(self.remove_row)
         self.run_btn.released.connect(self.run_queries)
         self.output_dir_btn.released.connect(self.get_output_dir)
         self.lock_layers_chb.toggled.connect(self.toggle_lock_layers)
         self.processor.progress_changed.connect(self.update_progress)
         self.processor.update_info.connect(self.update_info)
         self.model.is_runnable_check.connect(self.toggle_run_button)
         if len(current_layers) < 2:
             self.remove_row_btn.setEnabled(False)
         self.toggle_run_button()
         output_dir = self.load_settings('output_dir',
                                         default_to=os.path.expanduser('~'))
         if str(output_dir) == '':
             output_dir = os.path.expanduser('~')
         self.output_dir_le.setText(output_dir)
         self.create_distances_files_chb.setChecked(False)
         self.reset_progress_bar()
         self.progressBar.setValue(self.processor.global_progress)
         self.update_info('')
     else:
         self.reset_progress_bar()
         self.change_ui_availability(False)
         self.progress_la.setText('No suitable layers found. Please '
                                  'consult the plugin\'s Help page.')
         palette = QPalette()
         palette.setColor(QPalette.Foreground, Qt.red)
         self.progress_la.setPalette(palette)
Exemplo n.º 3
0
 def finished_processing_layers(self, layers, new_files=[]):
     self.processing_thread.wait()
     exist_selected = utilities.exist_selected_features(layers)
     self.change_ui_availability(True, exist_selected)
     registry = QgsMapLayerRegistry.instance()
     if self.create_distances_files_chb.isChecked():
         for new_layer_path in new_files:
             if new_layer_path.endswith('.shp'):
                 layer_name = os.path.basename(new_layer_path)
                 new_layer = QgsVectorLayer(new_layer_path, layer_name,
                                            'ogr')
                 registry.addMapLayer(new_layer)
Exemplo n.º 4
0
 def finished_processing_layers(self, layers, new_files=[]):
     self.processing_thread.wait()
     exist_selected = utilities.exist_selected_features(layers)
     self.change_ui_availability(True, exist_selected)
     registry = QgsMapLayerRegistry.instance()
     if self.create_distances_files_chb.isChecked():
         for new_layer_path in new_files:
             if new_layer_path.endswith('.shp'):
                 layer_name = os.path.basename(new_layer_path)
                 new_layer = QgsVectorLayer(new_layer_path, layer_name,
                                            'ogr')
                 registry.addMapLayer(new_layer)