当前位置: 首页>>代码示例>>Python>>正文


Python QMenu.tr方法代码示例

本文整理汇总了Python中PyQt4.QtGui.QMenu.tr方法的典型用法代码示例。如果您正苦于以下问题:Python QMenu.tr方法的具体用法?Python QMenu.tr怎么用?Python QMenu.tr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtGui.QMenu的用法示例。


在下文中一共展示了QMenu.tr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from PyQt4.QtGui import QMenu [as 别名]
# 或者: from PyQt4.QtGui.QMenu import tr [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)
开发者ID:CzendaZdenda,项目名称:qgis,代码行数:80,代码来源:__init__.py


注:本文中的PyQt4.QtGui.QMenu.tr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。