Esempio n. 1
0
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)
Esempio n. 2
0
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)
Esempio n. 3
0
 def showWorkflowBuilder(self):
     from workflowBuilder import WorkflowBuilder
     if not self.workflowBuilder:
         self.workflowBuilder = WorkflowBuilder(self._iface)
     self.workflowBuilder.setVisible(True)
Esempio n. 4
0
 def showWorkflowBuilder(self):
     from workflowBuilder import WorkflowBuilder
     if not self.workflowBuilder:
         self.workflowBuilder = WorkflowBuilder(self._iface)
     self.workflowBuilder.setVisible(True)