本文整理汇总了Python中processing.gui.ProcessingToolbox.ProcessingToolbox.set_in_place_edit_mode方法的典型用法代码示例。如果您正苦于以下问题:Python ProcessingToolbox.set_in_place_edit_mode方法的具体用法?Python ProcessingToolbox.set_in_place_edit_mode怎么用?Python ProcessingToolbox.set_in_place_edit_mode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.gui.ProcessingToolbox.ProcessingToolbox
的用法示例。
在下文中一共展示了ProcessingToolbox.set_in_place_edit_mode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from processing.gui.ProcessingToolbox import ProcessingToolbox [as 别名]
# 或者: from processing.gui.ProcessingToolbox.ProcessingToolbox import set_in_place_edit_mode [as 别名]
#.........这里部分代码省略.........
QgsApplication.getThemeIcon("/mActionOptions.svg"),
self.tr('Options'), self.iface.mainWindow())
self.optionsAction.setObjectName('optionsAction')
self.optionsAction.triggered.connect(self.openProcessingOptions)
self.toolbox.processingToolbar.addAction(self.optionsAction)
menuBar = self.iface.mainWindow().menuBar()
menuBar.insertMenu(
self.iface.firstRightStandardMenu().menuAction(), self.menu)
self.menu.addSeparator()
initializeMenus()
createMenus()
# In-place editing button state sync
self.iface.currentLayerChanged.connect(self.sync_in_place_button_state)
self.iface.mapCanvas().selectionChanged.connect(self.sync_in_place_button_state)
self.iface.actionToggleEditing().triggered.connect(partial(self.sync_in_place_button_state, None))
self.sync_in_place_button_state()
def sync_in_place_button_state(self, layer=None):
"""Synchronise the button state with layer state"""
if layer is None:
layer = self.iface.activeLayer()
old_enabled_state = self.editInPlaceAction.isEnabled()
new_enabled_state = layer is not None and layer.type() == QgsMapLayerType.VectorLayer
self.editInPlaceAction.setEnabled(new_enabled_state)
if new_enabled_state != old_enabled_state:
self.toolbox.set_in_place_edit_mode(new_enabled_state and self.editInPlaceAction.isChecked())
def openProcessingOptions(self):
self.iface.showOptionsDialog(self.iface.mainWindow(), currentPage='processingOptions')
def unload(self):
self.toolbox.setVisible(False)
self.iface.removeDockWidget(self.toolbox)
self.iface.attributesToolBar().removeAction(self.toolboxAction)
self.resultsDock.setVisible(False)
self.iface.removeDockWidget(self.resultsDock)
self.toolbox.deleteLater()
self.menu.deleteLater()
# delete temporary output files
folder = QgsProcessingUtils.tempFolder()
if QDir(folder).exists():
shutil.rmtree(folder, True)
# also delete temporary help files
folder = tempHelpFolder()
if QDir(folder).exists():
shutil.rmtree(folder, True)
self.iface.unregisterMainWindowAction(self.toolboxAction)
self.iface.unregisterMainWindowAction(self.modelerAction)
self.iface.unregisterMainWindowAction(self.historyAction)
self.iface.unregisterMainWindowAction(self.resultsAction)
self.iface.unregisterOptionsWidgetFactory(self.options_factory)
self.iface.deregisterLocatorFilter(self.locator_filter)