本文整理汇总了Python中panel.Panel.toggleViewAction方法的典型用法代码示例。如果您正苦于以下问题:Python Panel.toggleViewAction方法的具体用法?Python Panel.toggleViewAction怎么用?Python Panel.toggleViewAction使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类panel.Panel
的用法示例。
在下文中一共展示了Panel.toggleViewAction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from panel import Panel [as 别名]
# 或者: from panel.Panel import toggleViewAction [as 别名]
class ProcessingManager:
""" Processing plugin
"""
def __init__(self, iface):
self._iface = iface
self.panel = None
self.settings = None
self.aboutDialog = None
self.workflowBuilder = None
def initGui(self):
from PyQt4.QtCore import QObject, SIGNAL
from PyQt4.QtGui import QMenu
self.menu = QMenu()
self.menu.setTitle(self.menu.tr("&Processing", "Processing"))
# We only generate the panel & populate the menu when needed,
# to increase our chances that the framework has been loaded.
QObject.connect(self.menu, SIGNAL("aboutToShow()"),
self.populateMenu)
menuBar = self._iface.mainWindow().menuBar()
menuBar.insertMenu(menuBar.actions()[-1], self.menu)
def populateMenu(self):
from panel import Panel
from PyQt4.QtCore import QObject, SIGNAL
from PyQt4.QtGui import QAction
if not self.panel:
self.panel = Panel(self._iface)
self.panel.setVisible(False)
self.panelAction = self.panel.toggleViewAction()
self.menu.addAction(self.panelAction)
self.settingsAction = QAction(
self.menu.tr("&Settings", "Processing"),
self._iface.mainWindow())
self.menu.addAction(self.settingsAction)
QObject.connect(self.settingsAction,
SIGNAL("triggered()"), self.showSettings)
self.workflowBuilderAction= QAction(
self.menu.tr("&Workflow builder", "Processing"),
self._iface.mainWindow())
self.menu.addAction(self.workflowBuilderAction)
QObject.connect(self.workflowBuilderAction,
SIGNAL("triggered()"), self.showWorkflowBuilder)
self.aboutAction = QAction(
self.menu.tr("&About", "Processing"),
self._iface.mainWindow())
self.menu.addAction(self.aboutAction)
QObject.connect(self.aboutAction,
SIGNAL("triggered()"), self.showAboutDialog)
def unload(self):
if self.panel:
self.panel.setVisible(False)
def showSettings(self):
from settings import Settings
if not self.settings:
self.settings = Settings(self._iface.mainWindow())
self.settings.setVisible(True)
def showAboutDialog(self):
from aboutdialog import AboutDialog
if not self.aboutDialog:
self.aboutDialog = AboutDialog(self._iface.mainWindow())
self.aboutDialog.setVisible(True)
def showWorkflowBuilder(self):
from workflowBuilder import WorkflowBuilder
if not self.workflowBuilder:
self.workflowBuilder = WorkflowBuilder(self._iface)
self.workflowBuilder.setVisible(True)