Beispiel #1
0
 def showEvent(self, evt):
     """
     Protected method handleing the show event.
     
     @param evt show event to handle (QShowEvent)
     """
     E5TabWidget.showEvent(self, evt)
     if self.embeddedBrowser:
         self.fileBrowser.layoutDisplay()
Beispiel #2
0
 def showEvent(self, evt):
     """
     Protected method handleing the show event.
     
     @param evt show event to handle (QShowEvent)
     """
     E5TabWidget.showEvent(self, evt)
     if self.embeddedBrowser:
         self.fileBrowser.layoutDisplay()
Beispiel #3
0
 def __init__(self, project, parent=None, embeddedBrowser=True):
     """
     Constructor
     
     @param project reference to the project object
     @param parent parent widget (QWidget)
     @param embeddedBrowser flag indicating whether the file browser should
         be included. This flag is set to False by those layouts, that
         have the file browser in a separate window or embedded
         in the debeug browser instead
     """
     E5TabWidget.__init__(self, parent)
     self.project = project
     
     self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
     
     self.setUsesScrollButtons(True)
     
     self.vcsStatusIndicator = E5ClickableLed(self)
     self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner)
     self.vcsStatusIndicator.clicked.connect(
         self.__vcsStatusIndicatorClicked)
     self.vcsStatusColorNames = {
         "A": "VcsAdded",
         "M": "VcsModified",
         "O": "VcsRemoved",
         "R": "VcsReplaced",
         "U": "VcsUpdate",
         "Z": "VcsConflict",
     }
     self.vcsStatusText = {
         " ": self.tr("up to date"),
         "A": self.tr("files added"),
         "M": self.tr("local modifications"),
         "O": self.tr("files removed"),
         "R": self.tr("files replaced"),
         "U": self.tr("update required"),
         "Z": self.tr("conflict"),
     }
     self.__vcsStateChanged(" ")
     
     # step 1: create all the individual browsers
     from .ProjectSourcesBrowser import ProjectSourcesBrowser
     from .ProjectFormsBrowser import ProjectFormsBrowser
     from .ProjectTranslationsBrowser import ProjectTranslationsBrowser
     from .ProjectResourcesBrowser import ProjectResourcesBrowser
     from .ProjectInterfacesBrowser import ProjectInterfacesBrowser
     from .ProjectOthersBrowser import ProjectOthersBrowser
     # sources browser
     self.psBrowser = ProjectSourcesBrowser(self.project)
     # forms browser
     self.pfBrowser = ProjectFormsBrowser(self.project)
     # resources browser
     self.prBrowser = ProjectResourcesBrowser(self.project)
     # translations browser
     self.ptBrowser = ProjectTranslationsBrowser(self.project)
     # interfaces (IDL) browser
     self.piBrowser = ProjectInterfacesBrowser(self.project)
     # others browser
     self.poBrowser = ProjectOthersBrowser(self.project)
     
     # add the file browser, if it should be embedded here
     self.embeddedBrowser = embeddedBrowser
     if embeddedBrowser:
         self.fileBrowser = Browser()
     
     # step 2: connect all the browsers
     # connect the sources browser
     self.project.projectClosed.connect(self.psBrowser._projectClosed)
     self.project.projectOpened.connect(self.psBrowser._projectOpened)
     self.project.newProject.connect(self.psBrowser._newProject)
     self.project.reinitVCS.connect(self.psBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.psBrowser._initMenusAndVcs)
     
     # connect the forms browser
     self.project.projectClosed.connect(self.pfBrowser._projectClosed)
     self.project.projectOpened.connect(self.pfBrowser._projectOpened)
     self.project.newProject.connect(self.pfBrowser._newProject)
     self.project.reinitVCS.connect(self.pfBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.pfBrowser._initMenusAndVcs)
     
     # connect the resources browser
     self.project.projectClosed.connect(self.prBrowser._projectClosed)
     self.project.projectOpened.connect(self.prBrowser._projectOpened)
     self.project.newProject.connect(self.prBrowser._newProject)
     self.project.reinitVCS.connect(self.prBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.prBrowser._initMenusAndVcs)
     
     # connect the translations browser
     self.project.projectClosed.connect(self.ptBrowser._projectClosed)
     self.project.projectOpened.connect(self.ptBrowser._projectOpened)
     self.project.newProject.connect(self.ptBrowser._newProject)
     self.project.reinitVCS.connect(self.ptBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.ptBrowser._initMenusAndVcs)
     
     # connect the interfaces (IDL)  browser
     self.project.projectClosed.connect(self.piBrowser._projectClosed)
     self.project.projectOpened.connect(self.piBrowser._projectOpened)
     self.project.newProject.connect(self.piBrowser._newProject)
     self.project.reinitVCS.connect(self.piBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.piBrowser._initMenusAndVcs)
     
     # connect the others browser
     self.project.projectClosed.connect(self.poBrowser._projectClosed)
     self.project.projectOpened.connect(self.poBrowser._projectOpened)
     self.project.newProject.connect(self.poBrowser._newProject)
     self.project.reinitVCS.connect(self.poBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.poBrowser._initMenusAndVcs)
     
     # add signal connection to ourself
     self.project.projectOpened.connect(self.__projectOpened)
     self.project.projectClosed.connect(self.__projectClosed)
     self.project.newProject.connect(self.__newProject)
     self.project.projectPropertiesChanged.connect(
         self.__projectPropertiesChanged)
     self.currentChanged.connect(self.__currentChanged)
     self.project.getModel().vcsStateChanged.connect(self.__vcsStateChanged)
     
     self.__currentBrowsersFlags = 0
     self.__projectPropertiesChanged()
     if self.embeddedBrowser:
         self.setCurrentWidget(self.fileBrowser)
     else:
         self.setCurrentIndex(0)
Beispiel #4
0
    def __init__(self, project, parent=None):
        """
        Constructor
        
        @param project reference to the project object
        @param parent parent widget (QWidget)
        """
        E5TabWidget.__init__(self, parent)
        self.project = project

        self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))

        self.setUsesScrollButtons(True)

        self.vcsStatusIndicator = E5ClickableLed(self)
        self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner)
        self.vcsStatusIndicator.clicked.connect(
            self.__vcsStatusIndicatorClicked)
        self.vcsStatusColorNames = {
            "A": "VcsAdded",
            "M": "VcsModified",
            "O": "VcsRemoved",
            "R": "VcsReplaced",
            "U": "VcsUpdate",
            "Z": "VcsConflict",
        }
        self.vcsStatusText = {
            " ": self.tr("up to date"),
            "A": self.tr("files added"),
            "M": self.tr("local modifications"),
            "O": self.tr("files removed"),
            "R": self.tr("files replaced"),
            "U": self.tr("update required"),
            "Z": self.tr("conflict"),
        }
        self.__vcsStateChanged(" ")

        # step 1: create all the individual browsers
        from .ProjectSourcesBrowser import ProjectSourcesBrowser
        from .ProjectFormsBrowser import ProjectFormsBrowser
        from .ProjectTranslationsBrowser import ProjectTranslationsBrowser
        from .ProjectResourcesBrowser import ProjectResourcesBrowser
        from .ProjectInterfacesBrowser import ProjectInterfacesBrowser
        from .ProjectOthersBrowser import ProjectOthersBrowser
        from .ProjectProtocolsBrowser import ProjectProtocolsBrowser
        # sources browser
        self.psBrowser = ProjectSourcesBrowser(self.project)
        # forms browser
        self.pfBrowser = ProjectFormsBrowser(self.project)
        # resources browser
        self.prBrowser = ProjectResourcesBrowser(self.project)
        # translations browser
        self.ptBrowser = ProjectTranslationsBrowser(self.project)
        # interfaces (IDL) browser
        self.piBrowser = ProjectInterfacesBrowser(self.project)
        # protocols (protobuf) browser
        self.ppBrowser = ProjectProtocolsBrowser(self.project)
        # others browser
        self.poBrowser = ProjectOthersBrowser(self.project)

        # step 2: connect all the browsers
        # connect the sources browser
        self.project.projectClosed.connect(self.psBrowser._projectClosed)
        self.project.projectOpened.connect(self.psBrowser._projectOpened)
        self.project.newProject.connect(self.psBrowser._newProject)
        self.project.reinitVCS.connect(self.psBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.psBrowser._initMenusAndVcs)

        # connect the forms browser
        self.project.projectClosed.connect(self.pfBrowser._projectClosed)
        self.project.projectOpened.connect(self.pfBrowser._projectOpened)
        self.project.newProject.connect(self.pfBrowser._newProject)
        self.project.reinitVCS.connect(self.pfBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.pfBrowser._initMenusAndVcs)

        # connect the resources browser
        self.project.projectClosed.connect(self.prBrowser._projectClosed)
        self.project.projectOpened.connect(self.prBrowser._projectOpened)
        self.project.newProject.connect(self.prBrowser._newProject)
        self.project.reinitVCS.connect(self.prBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.prBrowser._initMenusAndVcs)

        # connect the translations browser
        self.project.projectClosed.connect(self.ptBrowser._projectClosed)
        self.project.projectOpened.connect(self.ptBrowser._projectOpened)
        self.project.newProject.connect(self.ptBrowser._newProject)
        self.project.reinitVCS.connect(self.ptBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.ptBrowser._initMenusAndVcs)

        # connect the interfaces (IDL)  browser
        self.project.projectClosed.connect(self.piBrowser._projectClosed)
        self.project.projectOpened.connect(self.piBrowser._projectOpened)
        self.project.newProject.connect(self.piBrowser._newProject)
        self.project.reinitVCS.connect(self.piBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.piBrowser._initMenusAndVcs)

        # connect the protocols (protobuf)  browser
        self.project.projectClosed.connect(self.ppBrowser._projectClosed)
        self.project.projectOpened.connect(self.ppBrowser._projectOpened)
        self.project.newProject.connect(self.ppBrowser._newProject)
        self.project.reinitVCS.connect(self.ppBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.ppBrowser._initMenusAndVcs)

        # connect the others browser
        self.project.projectClosed.connect(self.poBrowser._projectClosed)
        self.project.projectOpened.connect(self.poBrowser._projectOpened)
        self.project.newProject.connect(self.poBrowser._newProject)
        self.project.reinitVCS.connect(self.poBrowser._initMenusAndVcs)
        self.project.projectPropertiesChanged.connect(
            self.poBrowser._initMenusAndVcs)

        # add signal connection to ourselves
        self.project.projectOpened.connect(self.__projectOpened)
        self.project.projectClosed.connect(self.__projectClosed)
        self.project.newProject.connect(self.__newProject)
        self.project.projectPropertiesChanged.connect(
            self.__projectPropertiesChanged)
        self.currentChanged.connect(self.__currentChanged)
        self.project.getModel().vcsStateChanged.connect(self.__vcsStateChanged)

        self.__currentBrowsersFlags = 0
        self.__projectPropertiesChanged()
        self.setCurrentIndex(0)
Beispiel #5
0
    def __init__(self, debugServer, docked, vm, parent=None,
                 embeddedShell=True, embeddedBrowser=True):
        """
        Constructor
        
        @param debugServer reference to the debug server object
        @param docked flag indicating a dock window
        @param vm reference to the viewmanager object
        @param parent parent widget (QWidget)
        @param embeddedShell flag indicating whether the shell should be
            included. This flag is set to False by those layouts, that have
            the interpreter shell in a separate window.
        @param embeddedBrowser flag indicating whether the file browser should
            be included. This flag is set to False by those layouts, that
            have the file browser in a separate window or embedded
            in the project browser instead.
        """
        super(DebugViewer, self).__init__(parent)
        
        self.debugServer = debugServer
        self.debugUI = None
        
        self.setWindowIcon(UI.PixmapCache.getIcon("eric.png"))
        
        self.__mainLayout = QVBoxLayout()
        self.__mainLayout.setContentsMargins(0, 0, 0, 0)
        self.setLayout(self.__mainLayout)
        
        self.__tabWidget = E5TabWidget()
        self.__mainLayout.addWidget(self.__tabWidget)
        
        self.embeddedShell = embeddedShell
        if embeddedShell:
            from QScintilla.Shell import ShellAssembly
            # add the interpreter shell
            self.shellAssembly = ShellAssembly(debugServer, vm, False)
            self.shell = self.shellAssembly.shell()
            index = self.__tabWidget.addTab(
                self.shellAssembly,
                UI.PixmapCache.getIcon("shell.png"), '')
            self.__tabWidget.setTabToolTip(index, self.shell.windowTitle())
        
        self.embeddedBrowser = embeddedBrowser
        if embeddedBrowser:
            from UI.Browser import Browser
            # add the browser
            self.browser = Browser()
            index = self.__tabWidget.addTab(
                self.browser,
                UI.PixmapCache.getIcon("browser.png"), '')
            self.__tabWidget.setTabToolTip(index, self.browser.windowTitle())
        
        from .VariablesViewer import VariablesViewer
        # add the global variables viewer
        self.glvWidget = QWidget()
        self.glvWidgetVLayout = QVBoxLayout(self.glvWidget)
        self.glvWidgetVLayout.setContentsMargins(0, 0, 0, 0)
        self.glvWidgetVLayout.setSpacing(3)
        self.glvWidget.setLayout(self.glvWidgetVLayout)
        
        self.globalsViewer = VariablesViewer(self.glvWidget, True)
        self.glvWidgetVLayout.addWidget(self.globalsViewer)
        
        self.glvWidgetHLayout = QHBoxLayout()
        self.glvWidgetHLayout.setContentsMargins(3, 3, 3, 3)
        
        self.globalsFilterEdit = QLineEdit(self.glvWidget)
        self.globalsFilterEdit.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.glvWidgetHLayout.addWidget(self.globalsFilterEdit)
        self.globalsFilterEdit.setToolTip(
            self.tr("Enter regular expression patterns separated by ';'"
                    " to define variable filters. "))
        self.globalsFilterEdit.setWhatsThis(
            self.tr("Enter regular expression patterns separated by ';'"
                    " to define variable filters. All variables and"
                    " class attributes matched by one of the expressions"
                    " are not shown in the list above."))
        
        self.setGlobalsFilterButton = QPushButton(
            self.tr('Set'), self.glvWidget)
        self.glvWidgetHLayout.addWidget(self.setGlobalsFilterButton)
        self.glvWidgetVLayout.addLayout(self.glvWidgetHLayout)
        
        index = self.__tabWidget.addTab(
            self.glvWidget,
            UI.PixmapCache.getIcon("globalVariables.png"), '')
        self.__tabWidget.setTabToolTip(index, self.globalsViewer.windowTitle())
        
        self.setGlobalsFilterButton.clicked.connect(
            self.__setGlobalsFilter)
        self.globalsFilterEdit.returnPressed.connect(self.__setGlobalsFilter)
        
        # add the local variables viewer
        self.lvWidget = QWidget()
        self.lvWidgetVLayout = QVBoxLayout(self.lvWidget)
        self.lvWidgetVLayout.setContentsMargins(0, 0, 0, 0)
        self.lvWidgetVLayout.setSpacing(3)
        self.lvWidget.setLayout(self.lvWidgetVLayout)
        
        self.lvWidgetHLayout1 = QHBoxLayout()
        self.lvWidgetHLayout1.setContentsMargins(3, 3, 3, 3)
        
        self.stackComboBox = QComboBox(self.lvWidget)
        self.stackComboBox.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lvWidgetHLayout1.addWidget(self.stackComboBox)

        self.sourceButton = QPushButton(self.tr('Source'), self.lvWidget)
        self.lvWidgetHLayout1.addWidget(self.sourceButton)
        self.sourceButton.setEnabled(False)
        self.lvWidgetVLayout.addLayout(self.lvWidgetHLayout1)

        self.localsViewer = VariablesViewer(self.lvWidget, False)
        self.lvWidgetVLayout.addWidget(self.localsViewer)
        
        self.lvWidgetHLayout2 = QHBoxLayout()
        self.lvWidgetHLayout2.setContentsMargins(3, 3, 3, 3)
        
        self.localsFilterEdit = QLineEdit(self.lvWidget)
        self.localsFilterEdit.setSizePolicy(
            QSizePolicy.Expanding, QSizePolicy.Fixed)
        self.lvWidgetHLayout2.addWidget(self.localsFilterEdit)
        self.localsFilterEdit.setToolTip(
            self.tr(
                "Enter regular expression patterns separated by ';' to define "
                "variable filters. "))
        self.localsFilterEdit.setWhatsThis(
            self.tr(
                "Enter regular expression patterns separated by ';' to define "
                "variable filters. All variables and class attributes matched"
                " by one of the expressions are not shown in the list above."))
        
        self.setLocalsFilterButton = QPushButton(
            self.tr('Set'), self.lvWidget)
        self.lvWidgetHLayout2.addWidget(self.setLocalsFilterButton)
        self.lvWidgetVLayout.addLayout(self.lvWidgetHLayout2)
        
        index = self.__tabWidget.addTab(
            self.lvWidget,
            UI.PixmapCache.getIcon("localVariables.png"), '')
        self.__tabWidget.setTabToolTip(index, self.localsViewer.windowTitle())
        
        self.sourceButton.clicked.connect(self.__showSource)
        self.stackComboBox.currentIndexChanged[int].connect(
            self.__frameSelected)
        self.setLocalsFilterButton.clicked.connect(self.__setLocalsFilter)
        self.localsFilterEdit.returnPressed.connect(self.__setLocalsFilter)
        
        from .CallStackViewer import CallStackViewer
        # add the call stack viewer
        self.callStackViewer = CallStackViewer(self.debugServer)
        index = self.__tabWidget.addTab(
            self.callStackViewer,
            UI.PixmapCache.getIcon("step.png"), "")
        self.__tabWidget.setTabToolTip(
            index, self.callStackViewer.windowTitle())
        self.callStackViewer.sourceFile.connect(self.sourceFile)
        self.callStackViewer.frameSelected.connect(
            self.__callStackFrameSelected)
        
        from .CallTraceViewer import CallTraceViewer
        # add the call trace viewer
        self.callTraceViewer = CallTraceViewer(self.debugServer)
        index = self.__tabWidget.addTab(
            self.callTraceViewer,
            UI.PixmapCache.getIcon("callTrace.png"), "")
        self.__tabWidget.setTabToolTip(
            index, self.callTraceViewer.windowTitle())
        self.callTraceViewer.sourceFile.connect(self.sourceFile)
        
        from .BreakPointViewer import BreakPointViewer
        # add the breakpoint viewer
        self.breakpointViewer = BreakPointViewer()
        self.breakpointViewer.setModel(self.debugServer.getBreakPointModel())
        index = self.__tabWidget.addTab(
            self.breakpointViewer,
            UI.PixmapCache.getIcon("breakpoints.png"), '')
        self.__tabWidget.setTabToolTip(
            index, self.breakpointViewer.windowTitle())
        self.breakpointViewer.sourceFile.connect(self.sourceFile)
        
        from .WatchPointViewer import WatchPointViewer
        # add the watch expression viewer
        self.watchpointViewer = WatchPointViewer()
        self.watchpointViewer.setModel(self.debugServer.getWatchPointModel())
        index = self.__tabWidget.addTab(
            self.watchpointViewer,
            UI.PixmapCache.getIcon("watchpoints.png"), '')
        self.__tabWidget.setTabToolTip(
            index, self.watchpointViewer.windowTitle())
        
        from .ExceptionLogger import ExceptionLogger
        # add the exception logger
        self.exceptionLogger = ExceptionLogger()
        index = self.__tabWidget.addTab(
            self.exceptionLogger,
            UI.PixmapCache.getIcon("exceptions.png"), '')
        self.__tabWidget.setTabToolTip(
            index, self.exceptionLogger.windowTitle())
        
        if self.embeddedShell:
            self.__tabWidget.setCurrentWidget(self.shellAssembly)
        else:
            if self.embeddedBrowser:
                self.__tabWidget.setCurrentWidget(self.browser)
            else:
                self.__tabWidget.setCurrentWidget(self.glvWidget)
        
        # add the threads viewer
        self.__mainLayout.addWidget(QLabel(self.tr("Threads:")))
        self.__threadList = QTreeWidget()
        self.__threadList.setHeaderLabels(
            [self.tr("ID"), self.tr("Name"),
             self.tr("State"), ""])
        self.__threadList.setSortingEnabled(True)
        self.__mainLayout.addWidget(self.__threadList)
        
        self.__doThreadListUpdate = True
        
        self.__threadList.currentItemChanged.connect(self.__threadSelected)
        
        self.__mainLayout.setStretchFactor(self.__tabWidget, 5)
        self.__mainLayout.setStretchFactor(self.__threadList, 1)
        
        self.currPage = None
        self.currentStack = None
        self.framenr = 0
        
        self.debugServer.clientStack.connect(self.handleClientStack)
        
        self.__autoViewSource = Preferences.getDebugger("AutoViewSourceCode")
        self.sourceButton.setVisible(not self.__autoViewSource)
Beispiel #6
0
 def __init__(self, parent):
     """
     Constructor
     
     @param parent reference to the parent widget (QWidget)
     """
     E5TabWidget.__init__(self, parent, dnd=True)
     
     from .HelpTabBar import HelpTabBar
     self.__tabBar = HelpTabBar(self)
     self.setCustomTabBar(True, self.__tabBar)
     
     self.__mainWindow = parent
     
     self.setUsesScrollButtons(True)
     self.setDocumentMode(True)
     self.setElideMode(Qt.ElideNone)
     
     from .ClosedTabsManager import ClosedTabsManager
     self.__closedTabsManager = ClosedTabsManager(self)
     self.__closedTabsManager.closedTabAvailable.connect(
         self.__closedTabAvailable)
     
     from .UrlBar.StackedUrlBar import StackedUrlBar
     self.__stackedUrlBar = StackedUrlBar(self)
     self.__tabBar.tabMoved.connect(self.__stackedUrlBar.moveBar)
     
     self.__tabContextMenuIndex = -1
     self.currentChanged[int].connect(self.__currentChanged)
     self.setTabContextMenuPolicy(Qt.CustomContextMenu)
     self.customTabContextMenuRequested.connect(self.__showContextMenu)
     
     self.__rightCornerWidget = QWidget(self)
     self.__rightCornerWidgetLayout = QHBoxLayout(self.__rightCornerWidget)
     self.__rightCornerWidgetLayout.setContentsMargins(0, 0, 0, 0)
     self.__rightCornerWidgetLayout.setSpacing(0)
     
     self.__navigationMenu = QMenu(self)
     self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu)
     self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered)
     
     self.__navigationButton = QToolButton(self)
     self.__navigationButton.setIcon(
         UI.PixmapCache.getIcon("1downarrow.png"))
     self.__navigationButton.setToolTip(
         self.tr("Show a navigation menu"))
     self.__navigationButton.setPopupMode(QToolButton.InstantPopup)
     self.__navigationButton.setMenu(self.__navigationMenu)
     self.__navigationButton.setEnabled(False)
     self.__rightCornerWidgetLayout.addWidget(self.__navigationButton)
     
     self.__closedTabsMenu = QMenu(self)
     self.__closedTabsMenu.aboutToShow.connect(
         self.__aboutToShowClosedTabsMenu)
     
     self.__closedTabsButton = QToolButton(self)
     self.__closedTabsButton.setIcon(UI.PixmapCache.getIcon("trash.png"))
     self.__closedTabsButton.setToolTip(
         self.tr("Show a navigation menu for closed tabs"))
     self.__closedTabsButton.setPopupMode(QToolButton.InstantPopup)
     self.__closedTabsButton.setMenu(self.__closedTabsMenu)
     self.__closedTabsButton.setEnabled(False)
     self.__rightCornerWidgetLayout.addWidget(self.__closedTabsButton)
     
     self.__closeButton = QToolButton(self)
     self.__closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
     self.__closeButton.setToolTip(
         self.tr("Close the current help window"))
     self.__closeButton.setEnabled(False)
     self.__closeButton.clicked[bool].connect(self.closeBrowser)
     self.__rightCornerWidgetLayout.addWidget(self.__closeButton)
     if Preferences.getUI("SingleCloseButton") or \
        not hasattr(self, 'setTabsClosable'):
         self.__closeButton.show()
     else:
         self.setTabsClosable(True)
         self.tabCloseRequested.connect(self.closeBrowserAt)
         self.__closeButton.hide()
     
     self.setCornerWidget(self.__rightCornerWidget, Qt.TopRightCorner)
     
     self.__newTabButton = QToolButton(self)
     self.__newTabButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
     self.__newTabButton.setToolTip(
         self.tr("Open a new help window tab"))
     self.setCornerWidget(self.__newTabButton, Qt.TopLeftCorner)
     self.__newTabButton.clicked[bool].connect(self.newBrowser)
     
     self.__initTabContextMenu()
     
     self.__historyCompleter = None
Beispiel #7
0
 def __init__(self, project, parent=None, embeddedBrowser=True):
     """
     Constructor
     
     @param project reference to the project object
     @param parent parent widget (QWidget)
     @param embeddedBrowser flag indicating whether the file browser should
         be included. This flag is set to False by those layouts, that
         have the file browser in a separate window or embedded
         in the debeug browser instead
     """
     E5TabWidget.__init__(self, parent)
     self.project = project
     
     self.setWindowIcon(UI.PixmapCache.getIcon("pymakr.png"))
     
     self.setUsesScrollButtons(True)
     
     self.vcsStatusIndicator = E5ClickableLed(self)
     self.setCornerWidget(self.vcsStatusIndicator, Qt.TopLeftCorner)
     self.vcsStatusIndicator.clicked.connect(
         self.__vcsStatusIndicatorClicked)
     self.vcsStatusColorNames = {
         "A": "VcsAdded",
         "M": "VcsModified",
         "O": "VcsRemoved",
         "R": "VcsReplaced",
         "U": "VcsUpdate",
         "Z": "VcsConflict",
     }
     self.vcsStatusText = {
         " ": self.tr("up to date"),
         "A": self.tr("files added"),
         "M": self.tr("local modifications"),
         "O": self.tr("files removed"),
         "R": self.tr("files replaced"),
         "U": self.tr("update required"),
         "Z": self.tr("conflict"),
     }
     self.__vcsStateChanged(" ")
     
     # step 1: create all the individual browsers
     from .ProjectSourcesBrowser import ProjectSourcesBrowser
     from .ProjectFormsBrowser import ProjectFormsBrowser
     from .ProjectTranslationsBrowser import ProjectTranslationsBrowser
     from .ProjectResourcesBrowser import ProjectResourcesBrowser
     from .ProjectInterfacesBrowser import ProjectInterfacesBrowser
     from .ProjectOthersBrowser import ProjectOthersBrowser
     # sources browser
     self.psBrowser = ProjectSourcesBrowser(self.project)
     # forms browser
     self.pfBrowser = ProjectFormsBrowser(self.project)
     # resources browser
     self.prBrowser = ProjectResourcesBrowser(self.project)
     # translations browser
     self.ptBrowser = ProjectTranslationsBrowser(self.project)
     # interfaces (IDL) browser
     self.piBrowser = ProjectInterfacesBrowser(self.project)
     # others browser
     self.poBrowser = ProjectOthersBrowser(self.project)
     
     # add the file browser, if it should be embedded here
     self.embeddedBrowser = embeddedBrowser
     if embeddedBrowser:
         self.fileBrowser = Browser()
     
     # step 2: connect all the browsers
     # connect the sources browser
     self.project.projectClosed.connect(self.psBrowser._projectClosed)
     self.project.projectOpened.connect(self.psBrowser._projectOpened)
     self.project.newProject.connect(self.psBrowser._newProject)
     self.project.reinitVCS.connect(self.psBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.psBrowser._initMenusAndVcs)
     
     # connect the forms browser
     self.project.projectClosed.connect(self.pfBrowser._projectClosed)
     self.project.projectOpened.connect(self.pfBrowser._projectOpened)
     self.project.newProject.connect(self.pfBrowser._newProject)
     self.project.reinitVCS.connect(self.pfBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.pfBrowser._initMenusAndVcs)
     
     # connect the resources browser
     self.project.projectClosed.connect(self.prBrowser._projectClosed)
     self.project.projectOpened.connect(self.prBrowser._projectOpened)
     self.project.newProject.connect(self.prBrowser._newProject)
     self.project.reinitVCS.connect(self.prBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.prBrowser._initMenusAndVcs)
     
     # connect the translations browser
     self.project.projectClosed.connect(self.ptBrowser._projectClosed)
     self.project.projectOpened.connect(self.ptBrowser._projectOpened)
     self.project.newProject.connect(self.ptBrowser._newProject)
     self.project.reinitVCS.connect(self.ptBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.ptBrowser._initMenusAndVcs)
     
     # connect the interfaces (IDL)  browser
     self.project.projectClosed.connect(self.piBrowser._projectClosed)
     self.project.projectOpened.connect(self.piBrowser._projectOpened)
     self.project.newProject.connect(self.piBrowser._newProject)
     self.project.reinitVCS.connect(self.piBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.piBrowser._initMenusAndVcs)
     
     # connect the others browser
     self.project.projectClosed.connect(self.poBrowser._projectClosed)
     self.project.projectOpened.connect(self.poBrowser._projectOpened)
     self.project.newProject.connect(self.poBrowser._newProject)
     self.project.reinitVCS.connect(self.poBrowser._initMenusAndVcs)
     self.project.projectPropertiesChanged.connect(
         self.poBrowser._initMenusAndVcs)
     
     # add signal connection to ourself
     self.project.projectOpened.connect(self.__projectOpened)
     self.project.projectClosed.connect(self.__projectClosed)
     self.project.newProject.connect(self.__newProject)
     self.project.projectPropertiesChanged.connect(
         self.__projectPropertiesChanged)
     self.currentChanged.connect(self.__currentChanged)
     self.project.getModel().vcsStateChanged.connect(self.__vcsStateChanged)
     
     self.__currentBrowsersFlags = 0
     self.__projectPropertiesChanged()
     if self.embeddedBrowser:
         self.setCurrentWidget(self.fileBrowser)
     else:
         self.setCurrentIndex(0)
Beispiel #8
0
    def __init__(self, parent):
        """
        Constructor
        
        @param parent reference to the parent widget (QWidget)
        """
        E5TabWidget.__init__(self, parent, dnd=True)

        from .HelpTabBar import HelpTabBar
        self.__tabBar = HelpTabBar(self)
        self.setCustomTabBar(True, self.__tabBar)

        self.__mainWindow = parent

        self.setUsesScrollButtons(True)
        self.setDocumentMode(True)
        self.setElideMode(Qt.ElideNone)

        from .ClosedTabsManager import ClosedTabsManager
        self.__closedTabsManager = ClosedTabsManager(self)
        self.__closedTabsManager.closedTabAvailable.connect(
            self.__closedTabAvailable)

        from .UrlBar.StackedUrlBar import StackedUrlBar
        self.__stackedUrlBar = StackedUrlBar(self)
        self.__tabBar.tabMoved.connect(self.__stackedUrlBar.moveBar)

        self.__tabContextMenuIndex = -1
        self.currentChanged[int].connect(self.__currentChanged)
        self.setTabContextMenuPolicy(Qt.CustomContextMenu)
        self.customTabContextMenuRequested.connect(self.__showContextMenu)

        self.__rightCornerWidget = QWidget(self)
        self.__rightCornerWidgetLayout = QHBoxLayout(self.__rightCornerWidget)
        self.__rightCornerWidgetLayout.setContentsMargins(0, 0, 0, 0)
        self.__rightCornerWidgetLayout.setSpacing(0)

        self.__navigationMenu = QMenu(self)
        self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu)
        self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered)

        self.__navigationButton = QToolButton(self)
        self.__navigationButton.setIcon(
            UI.PixmapCache.getIcon("1downarrow.png"))
        self.__navigationButton.setToolTip(self.tr("Show a navigation menu"))
        self.__navigationButton.setPopupMode(QToolButton.InstantPopup)
        self.__navigationButton.setMenu(self.__navigationMenu)
        self.__navigationButton.setEnabled(False)
        self.__rightCornerWidgetLayout.addWidget(self.__navigationButton)

        self.__closedTabsMenu = QMenu(self)
        self.__closedTabsMenu.aboutToShow.connect(
            self.__aboutToShowClosedTabsMenu)

        self.__closedTabsButton = QToolButton(self)
        self.__closedTabsButton.setIcon(UI.PixmapCache.getIcon("trash.png"))
        self.__closedTabsButton.setToolTip(
            self.tr("Show a navigation menu for closed tabs"))
        self.__closedTabsButton.setPopupMode(QToolButton.InstantPopup)
        self.__closedTabsButton.setMenu(self.__closedTabsMenu)
        self.__closedTabsButton.setEnabled(False)
        self.__rightCornerWidgetLayout.addWidget(self.__closedTabsButton)

        self.__closeButton = QToolButton(self)
        self.__closeButton.setIcon(UI.PixmapCache.getIcon("close.png"))
        self.__closeButton.setToolTip(self.tr("Close the current help window"))
        self.__closeButton.setEnabled(False)
        self.__closeButton.clicked.connect(self.closeBrowser)
        self.__rightCornerWidgetLayout.addWidget(self.__closeButton)
        if Preferences.getUI("SingleCloseButton") or \
           not hasattr(self, 'setTabsClosable'):
            self.__closeButton.show()
        else:
            self.setTabsClosable(True)
            self.tabCloseRequested.connect(self.closeBrowserAt)
            self.__closeButton.hide()

        self.setCornerWidget(self.__rightCornerWidget, Qt.TopRightCorner)

        self.__newTabButton = QToolButton(self)
        self.__newTabButton.setIcon(UI.PixmapCache.getIcon("plus.png"))
        self.__newTabButton.setToolTip(self.tr("Open a new help window tab"))
        self.setCornerWidget(self.__newTabButton, Qt.TopLeftCorner)
        self.__newTabButton.clicked.connect(self.__newBrowser)

        self.__initTabContextMenu()

        self.__historyCompleter = None