Example #1
0
    def deactivate(self):
        """Deactivates the plugin.

        The plugin may override the method to do specific
        plugin deactivation handling.
        Note: if overriden do not forget to call the
              base class deactivate()
        """
        self.hpy = None

        self.__memtopButton.disconnect()
        self.__debuggerButton.disconnect()
        self.__repeatButton.disconnect()
        self.__resetButton.disconnect()

        mainToolbar = self.ide.mainWindow.getToolbar()
        mainToolbar.removeAction(self.__separator)
        mainToolbar.removeAction(self.__debuggerButton)
        mainToolbar.removeAction(self.__memtopButton)
        mainToolbar.removeAction(self.__repeatButton)
        mainToolbar.removeAction(self.__resetButton)

        self.__separator.deleteLater()
        self.__memtopButton.deleteLater()
        self.__debuggerButton.deleteLater()
        self.__repeatButton.deleteLater()
        self.__resetButton.deleteLater()

        WizardInterface.deactivate(self)
Example #2
0
    def activate(self, ideSettings, ideGlobalData):
        """Activates the plugin.

        The plugin may override the method to do specific
        plugin activation handling.

        ideSettings - reference to the IDE Settings singleton
                      see codimension/src/utils/settings.py
        ideGlobalData - reference to the IDE global settings
                        see codimension/src/utils/globals.py

        Note: if overriden do not forget to call the
              base class activate()
        """
        WizardInterface.activate(self, ideSettings, ideGlobalData)

        self.__resultViewer = PylintResultViewer(self.ide, PLUGIN_HOME_DIR)
        self.ide.sideBars['bottom'].addTab(
            self.__resultViewer, QIcon(PLUGIN_HOME_DIR + 'pylint.png'),
            'Pylint', 'pylint', 2)
        self.ide.sideBars['bottom'].tabButton('pylint',
                                              QTabBar.RightSide).resize(0, 0)

        # The clear call must be here, not in the results viewer __init__()
        # This is because the viewer has not been inserted into the side bar at
        # the time of __init__() so the tooltip setting does not work
        self.__resultViewer.clear()

        self.__pylintDriver = PylintDriver(self.ide)
        self.__pylintDriver.sigFinished.connect(self.__pylintFinished)

        if self.__globalShortcut is None:
            self.__globalShortcut = QShortcut(QKeySequence('Ctrl+L'),
                                              self.ide.mainWindow, self.__run)
        else:
            self.__globalShortcut.setKey('Ctrl+L')

        # Add buttons
        for _, _, tabWidget in self.ide.editorsManager.getTextEditors():
            self.__addButton(tabWidget)

        # File type changed & new tab
        self.ide.editorsManager.sigTextEditorTabAdded.connect(
            self.__textEditorTabAdded)
        self.ide.editorsManager.sigFileTypeChanged.connect(
            self.__fileTypeChanged)

        # Add main menu
        self.__mainMenu = QMenu('Pylint', self.ide.mainWindow)
        self.__mainMenu.setIcon(QIcon(PLUGIN_HOME_DIR + 'pylint.png'))
        self.__mainRunAction = self.__mainMenu.addAction(
            QIcon(PLUGIN_HOME_DIR + 'pylint.png'), 'Run pylint\t(Ctrl+L)',
            self.__run)
        self.__mainGenerateAction = self.__mainMenu.addAction(
            QIcon(PLUGIN_HOME_DIR + 'generate.png'),
            'Generate/open pylintrc file', self.__generate)
        toolsMenu = self.ide.mainWindow.menuBar().findChild(QMenu, 'tools')
        self.__mainMenuSeparator = toolsMenu.addSeparator()
        toolsMenu.addMenu(self.__mainMenu)
        self.__mainMenu.aboutToShow.connect(self.__mainMenuAboutToShow)
Example #3
0
    def activate(self, ideSettings, ideGlobalData):
        """Activates the plugin.

        The plugin may override the method to do specific
        plugin activation handling.

        ideSettings - reference to the IDE Settings singleton
                      see codimension/src/utils/settings.py
        ideGlobalData - reference to the IDE global settings
                        see codimension/src/utils/globals.py

        Note: if overriden do not forget to call the
              base class activate()
        """
        WizardInterface.activate(self, ideSettings, ideGlobalData)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))
        try:

            self.__where = self.__getConfiguredWhere()
            mainToolbar = self.ide.mainWindow.getToolbar()
            beforeWidget = mainToolbar.findChild(QAction, 'debugSpacer')
            self.__separator = mainToolbar.insertSeparator(beforeWidget)

            self.__memtopButton = QAction(
                QIcon(PLUGIN_HOME_DIR + 'memtop.png'), 'memtop report',
                mainToolbar)
            self.__memtopButton.triggered.connect(self.__onMemtop)
            mainToolbar.insertAction(beforeWidget, self.__memtopButton)

            self.__debuggerButton = QAction(
                QIcon(PLUGIN_HOME_DIR + 'debugger.png'), 'stop with debugger',
                mainToolbar)
            self.__debuggerButton.triggered.connect(self.__onDebugger)
            mainToolbar.insertAction(beforeWidget, self.__debuggerButton)

            self.__repeatButton = QAction(
                QIcon(PLUGIN_HOME_DIR + 'repeat.png'), 'Repeated actions',
                mainToolbar)
            self.__repeatButton.triggered.connect(self.__onRepeatedAction)
            mainToolbar.insertAction(beforeWidget, self.__repeatButton)

            self.__resetButton = QAction(QIcon(PLUGIN_HOME_DIR + 'reset.png'),
                                         'Reset the heap reference point',
                                         mainToolbar)
            self.__resetButton.triggered.connect(self.__onResetHeap)
            mainToolbar.insertAction(beforeWidget, self.__resetButton)

            self.hpy = hpy()
            self.hpy.setref()
        except:
            QApplication.restoreOverrideCursor()
            raise
        QApplication.restoreOverrideCursor()
Example #4
0
    def deactivate(self):
        """ The plugin may override the method to do specific
            plugin deactivation handling.
            Note: if overriden do not forget to call the
                  base class deactivate() """

        self.ide.project.projectChanged.disconnect(self.__collectGarbage)
        self.disconnect(self.ide.editorsManager, SIGNAL('tabClosed'),
                        self.__collectGarbage)

        WizardInterface.deactivate(self)
        return
Example #5
0
    def __init__(self):
        WizardInterface.__init__(self)
        self.__pylintDriver = None
        self.__resultViewer = None
        self.__bufferRunAction = None
        self.__bufferGenerateAction = None
        self.__globalShortcut = None

        self.__mainMenu = None
        self.__mainMenuSeparator = None
        self.__mainRunAction = None
        self.__mainGenerateAction = None
Example #6
0
    def deactivate( self ):
        """ The plugin may override the method to do specific
            plugin deactivation handling.
            Note: if overriden do not forget to call the
                  base class deactivate() """

        self.ide.project.projectChanged.disconnect( self.__collectGarbage )
        self.disconnect( self.ide.editorsManager, SIGNAL( 'tabClosed' ),
                         self.__collectGarbage )

        WizardInterface.deactivate( self )
        return
Example #7
0
    def activate(self, ideSettings, ideGlobalData):
        """ The plugin may override the method to do specific
            plugin activation handling.

            ideSettings - reference to the IDE Settings singleton
                          see codimension/src/utils/settings.py
            ideGlobalData - reference to the IDE global settings
                            see codimension/src/utils/globals.py

            Note: if overriden do not forget to call the
                  base class activate() """
        WizardInterface.activate(self, ideSettings, ideGlobalData)

        self.__where = self.__getConfiguredWhere()

        self.connect(self.ide.editorsManager, SIGNAL('tabClosed'),
                     self.__collectGarbage)
        self.ide.project.projectChanged.connect(self.__collectGarbage)
        return
Example #8
0
    def activate( self, ideSettings, ideGlobalData ):
        """ The plugin may override the method to do specific
            plugin activation handling.

            ideSettings - reference to the IDE Settings singleton
                          see codimension/src/utils/settings.py
            ideGlobalData - reference to the IDE global settings
                            see codimension/src/utils/globals.py

            Note: if overriden do not forget to call the
                  base class activate() """
        WizardInterface.activate( self, ideSettings, ideGlobalData )

        self.__where = self.__getConfiguredWhere()

        self.connect( self.ide.editorsManager, SIGNAL( 'tabClosed' ),
                      self.__collectGarbage )
        self.ide.project.projectChanged.connect( self.__collectGarbage )
        return
Example #9
0
    def deactivate(self):
        """Deactivates the plugin.

        The plugin may override the method to do specific
        plugin deactivation handling.
        Note: if overriden do not forget to call the
              base class deactivate()
        """
        self.__globalShortcut.setKey(0)

        self.__resultViewer = None
        self.ide.sideBars['bottom'].removeTab('pylint')
        self.__pylintDriver = None

        # Remove buttons
        for _, _, tabWidget in self.ide.editorsManager.getTextEditors():
            pylintAction = tabWidget.toolbar.findChild(QAction, 'pylint')
            tabWidget.toolbar.removeAction(pylintAction)

            # deleteLater() is essential. Otherwise the button is not removed
            # really from the list of children
            pylintAction.deleteLater()

            tabWidget.getEditor().modificationChanged.disconnect(
                self.__modificationChanged)

        self.ide.editorsManager.sigTextEditorTabAdded.disconnect(
            self.__textEditorTabAdded)
        self.ide.editorsManager.sigFileTypeChanged.disconnect(
            self.__fileTypeChanged)

        # Remove main menu items
        self.__mainRunAction.deleteLater()
        self.__mainRunAction = None
        self.__mainGenerateAction.deleteLater()
        self.__mainGenerateAction = None
        self.__mainMenu.deleteLater()
        self.__mainMenu = None
        self.__mainMenuSeparator.deleteLater()
        self.__mainMenuSeparator = None

        WizardInterface.deactivate(self)
Example #10
0
 def __init__(self):
     WizardInterface.__init__(self)
     self.__where = GCPluginConfigDialog.SILENT
     return
Example #11
0
 def __init__(self):
     WizardInterface.__init__(self)
     self.__where = IntrospectionPluginConfigDialog.CONSOLE
     self.heap = None
Example #12
0
 def __init__( self ):
     WizardInterface.__init__( self )
     self.__where = GCPluginConfigDialog.SILENT
     return