"Fossies" - the Fresh Open Source Software Archive

Member "eric6-20.9/eric/eric6/UI/UserInterface.py" (2 Sep 2020, 296553 Bytes) of package /linux/misc/eric6-20.9.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Python source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "UserInterface.py" see the Fossies "Dox" file reference documentation.

    1 # -*- coding: utf-8 -*-
    2 
    3 # Copyright (c) 2002 - 2020 Detlev Offenbach <detlev@die-offenbachs.de>
    4 #
    5 
    6 """
    7 Module implementing the main user interface.
    8 """
    9 
   10 
   11 import os
   12 import sys
   13 import logging
   14 
   15 from PyQt5.QtCore import (
   16     pyqtSlot, QTimer, QFile, QFileInfo, pyqtSignal, PYQT_VERSION_STR, QDate,
   17     QIODevice, qVersion, QProcess, QSize, QUrl, QObject, Qt, QUuid, QThread,
   18     QUrlQuery
   19 )
   20 from PyQt5.QtGui import QKeySequence, QDesktopServices
   21 from PyQt5.QtWidgets import (
   22     QSizePolicy, QWidget, QWhatsThis, QToolBar, QDialog, QSplitter,
   23     QApplication, QMenu, QVBoxLayout, QDockWidget, QAction, QLabel
   24 )
   25 from PyQt5.Qsci import QSCINTILLA_VERSION_STR
   26 from PyQt5.QtNetwork import (
   27     QNetworkProxyFactory, QNetworkAccessManager, QNetworkRequest, QNetworkReply
   28 )
   29 
   30 from .Info import Version, VersionOnly, BugAddress, Program, FeatureAddress
   31 from . import Config
   32 
   33 from E5Gui.E5SingleApplication import E5SingleApplicationServer
   34 from E5Gui.E5Action import E5Action, createActionGroup
   35 from E5Gui.E5ToolBarManager import E5ToolBarManager
   36 from E5Gui import E5MessageBox, E5FileDialog, E5ErrorMessage
   37 from E5Gui.E5Application import e5App
   38 from E5Gui.E5MainWindow import E5MainWindow
   39 from E5Gui.E5ZoomWidget import E5ZoomWidget
   40 from E5Gui.E5ProgressDialog import E5ProgressDialog
   41 from E5Gui.E5ClickableLabel import E5ClickableLabel
   42 
   43 import Preferences
   44 import Utilities
   45 
   46 import UI.PixmapCache
   47 
   48 from E5Network.E5NetworkIcon import E5NetworkIcon
   49 from E5Network.E5NetworkProxyFactory import (
   50     E5NetworkProxyFactory, proxyAuthenticationRequired
   51 )
   52 try:
   53     from E5Network.E5SslErrorHandler import E5SslErrorHandler
   54     SSL_AVAILABLE = True
   55 except ImportError:
   56     SSL_AVAILABLE = False
   57 
   58 from eric6config import getConfig
   59 
   60 
   61 class Redirector(QObject):
   62     """
   63     Helper class used to redirect stdout and stderr to the log window.
   64     
   65     @signal appendStderr(str) emitted to write data to stderr logger
   66     @signal appendStdout(str) emitted to write data to stdout logger
   67     """
   68     appendStderr = pyqtSignal(str)
   69     appendStdout = pyqtSignal(str)
   70     
   71     def __init__(self, stderr, parent=None):
   72         """
   73         Constructor
   74         
   75         @param stderr flag indicating stderr is being redirected
   76         @type bool
   77         @param parent reference to the parent object
   78         @type QObject
   79         """
   80         super(Redirector, self).__init__(parent)
   81         self.stderr = stderr
   82         self.buffer = ''
   83         
   84     def __nWrite(self, n):
   85         """
   86         Private method used to write data.
   87         
   88         @param n max number of bytes to write
   89         """
   90         if n:
   91             line = self.buffer[:n]
   92             if self.stderr:
   93                 self.appendStderr.emit(line)
   94             else:
   95                 self.appendStdout.emit(line)
   96             self.buffer = self.buffer[n:]
   97             
   98     def __bufferedWrite(self):
   99         """
  100         Private method returning number of characters to write.
  101         
  102         @return number of characters buffered or length of buffered line
  103             (integer)
  104         """
  105         return self.buffer.rfind('\n') + 1
  106         
  107     def flush(self):
  108         """
  109         Public method used to flush the buffered data.
  110         """
  111         self.__nWrite(len(self.buffer))
  112         
  113     def write(self, s):
  114         """
  115         Public method used to write data.
  116         
  117         @param s data to be written (it must support the str-method)
  118         """
  119         self.buffer += str(s)
  120         self.__nWrite(self.__bufferedWrite())
  121 
  122 
  123 class UserInterface(E5MainWindow):
  124     """
  125     Class implementing the main user interface.
  126     
  127     @signal appendStderr(str) emitted to write data to stderr logger
  128     @signal appendStdout(str) emitted to write data to stdout logger
  129     @signal preferencesChanged() emitted after the preferences were changed
  130     @signal reloadAPIs() emitted to reload the api information
  131     @signal showMenu(str, QMenu) emitted when a menu is about to be shown. The
  132         name of the menu and a reference to the menu are given.
  133     @signal masterPasswordChanged(str, str) emitted after the master
  134         password has been changed with the old and the new password
  135     @signal onlineStateChanged(online) emitted to indicate a change of the
  136         network state
  137     """
  138     appendStderr = pyqtSignal(str)
  139     appendStdout = pyqtSignal(str)
  140     preferencesChanged = pyqtSignal()
  141     reloadAPIs = pyqtSignal()
  142     showMenu = pyqtSignal(str, QMenu)
  143     masterPasswordChanged = pyqtSignal(str, str)
  144     onlineStateChanged = pyqtSignal(bool)
  145     
  146     maxFilePathLen = 100
  147     maxMenuFilePathLen = 75
  148     
  149     LeftSide = 1
  150     BottomSide = 2
  151     RightSide = 3
  152     
  153     ErrorLogFileName = "eric6_error.log"
  154     
  155     def __init__(self, app, locale, splash, plugin, disabledPlugins,
  156                  noOpenAtStartup, noCrashOpenAtStartup, disableCrashSession,
  157                  restartArguments, originalPathString):
  158         """
  159         Constructor
  160         
  161         @param app reference to the application object
  162         @type E5Application
  163         @param locale locale to be used by the UI
  164         @type str
  165         @param splash reference to the splashscreen
  166         @type UI.SplashScreen.SplashScreen
  167         @param plugin filename of a plug-in to be loaded (used for plugin
  168             development)
  169         @type str
  170         @param disabledPlugins list of plug-ins that have been disabled via
  171             the command line parameters '--disable-plugin='
  172         @type list of str
  173         @param noOpenAtStartup flag indicating that the open at startup option
  174             should not be executed
  175         @type bool
  176         @param noCrashOpenAtStartup flag indicating to ignore any crash session
  177             file found at statup
  178         @type bool
  179         @param disableCrashSession flag indicating to disable the crash session
  180             support
  181         @type bool
  182         @param restartArguments list of command line parameters to be used for
  183             a restart
  184         @type list of str
  185         @param originalPathString original PATH environment variable
  186         @type str
  187         """
  188         super(UserInterface, self).__init__()
  189         
  190         self.__restartArgs = restartArguments[:]
  191         
  192         self.setStyle(Preferences.getUI("Style"),
  193                       Preferences.getUI("StyleSheet"))
  194         
  195         self.maxEditorPathLen = Preferences.getUI("CaptionFilenameLength")
  196         self.locale = locale
  197         self.__noOpenAtStartup = noOpenAtStartup
  198         self.__noCrashOpenAtStartup = noCrashOpenAtStartup
  199         self.__disableCrashSession = disableCrashSession
  200         self.__disabledPlugins = disabledPlugins[:]
  201         
  202         self.__originalPathString = originalPathString
  203         
  204         self.__layoutType = Preferences.getUI("LayoutType")
  205         
  206         self.passiveMode = Preferences.getDebugger("PassiveDbgEnabled")
  207         
  208         g = Preferences.getGeometry("MainGeometry")
  209         if g.isEmpty():
  210             s = QSize(1280, 1024)
  211             self.resize(s)
  212         else:
  213             self.restoreGeometry(g)
  214         self.__startup = True
  215         
  216         if Preferences.getUI("UseSystemProxy"):
  217             QNetworkProxyFactory.setUseSystemConfiguration(True)
  218         else:
  219             self.__proxyFactory = E5NetworkProxyFactory()
  220             QNetworkProxyFactory.setApplicationProxyFactory(
  221                 self.__proxyFactory)
  222             QNetworkProxyFactory.setUseSystemConfiguration(False)
  223         
  224         self.capProject = ""
  225         self.capEditor = ""
  226         self.captionShowsFilename = Preferences.getUI("CaptionShowsFilename")
  227         
  228         QApplication.setWindowIcon(UI.PixmapCache.getIcon("eric"))
  229         self.setWindowIcon(UI.PixmapCache.getIcon("eric"))
  230         self.__setWindowCaption()
  231         
  232         # load the view profiles
  233         self.profiles = Preferences.getUI("ViewProfiles2")
  234         
  235         # Generate the conda interface
  236         from CondaInterface.Conda import Conda
  237         self.condaInterface = Conda(self)
  238         e5App().registerObject("Conda", self.condaInterface)
  239         
  240         # Generate the pip interface
  241         from PipInterface.Pip import Pip
  242         self.pipInterface = Pip(self)
  243         e5App().registerObject("Pip", self.pipInterface)
  244         
  245         # Generate the virtual environment manager
  246         from VirtualEnv.VirtualenvManager import VirtualenvManager
  247         self.virtualenvManager = VirtualenvManager(self)
  248         # register it early because it is needed very soon
  249         e5App().registerObject("VirtualEnvManager", self.virtualenvManager)
  250         
  251         # Generate the debug server object
  252         from Debugger.DebugServer import DebugServer
  253         debugServer = DebugServer(self.__originalPathString)
  254         
  255         # Create the background service object
  256         from Utilities.BackgroundService import BackgroundService
  257         self.backgroundService = BackgroundService()
  258         
  259         # Generate an empty project object and multi project object
  260         from Project.Project import Project
  261         self.project = Project(self)
  262         e5App().registerObject("Project", self.project)
  263         
  264         from MultiProject.MultiProject import MultiProject
  265         self.multiProject = MultiProject(self.project, self)
  266         
  267         splash.showMessage(self.tr("Initializing Plugin Manager..."))
  268         
  269         # Initialize the Plugin Manager (Plugins are initialized later
  270         from PluginManager.PluginManager import PluginManager
  271         self.pluginManager = PluginManager(self, self.__disabledPlugins,
  272                                            develPlugin=plugin)
  273         
  274         splash.showMessage(self.tr("Generating Main User Interface..."))
  275         
  276         self.codeDocumentationViewer = None
  277         self.cooperation = None
  278         self.irc = None
  279         self.symbolsViewer = None
  280         self.browser = None
  281         self.templateViewer = None
  282         self.numbersViewer = None
  283         self.pipWidget = None
  284         self.condaWidget = None
  285         self.microPythonWidget = None
  286         
  287         self.__webBrowserProcess = None
  288         self.__webBrowserClient = None
  289         self.__webBrowserSAName = QUuid.createUuid().toString()[1:-1]
  290         
  291         # Create the main window now so that we can connect QActions to it.
  292         logging.debug("Creating Layout...")
  293         self.__createLayout(debugServer)
  294         self.__currentRightWidget = None
  295         self.__currentBottomWidget = None
  296         
  297         # Generate the debugger part of the ui
  298         logging.debug("Creating Debugger UI...")
  299         from Debugger.DebugUI import DebugUI
  300         self.debuggerUI = DebugUI(self, self.viewmanager, debugServer,
  301                                   self.debugViewer, self.project)
  302         self.debugViewer.setDebugger(self.debuggerUI)
  303         self.shell.setDebuggerUI(self.debuggerUI)
  304         
  305         # Generate the redirection helpers
  306         self.stdout = Redirector(False, self)
  307         self.stderr = Redirector(True, self)
  308         
  309         # set a few dialog members for non-modal dialogs created on demand
  310         self.programsDialog = None
  311         self.shortcutsDialog = None
  312         self.unittestDialog = None
  313         self.findFileNameDialog = None
  314         self.diffDlg = None
  315         self.compareDlg = None
  316         self.findFilesDialog = None
  317         self.replaceFilesDialog = None
  318         self.__notification = None
  319         self.__readingSession = False
  320         self.__versionsDialog = None
  321         self.__configurationDialog = None
  322         
  323         # now setup the connections
  324         splash.showMessage(self.tr("Setting up connections..."))
  325         
  326         self.debugViewer.exceptionLogger.sourceFile.connect(
  327             self.viewmanager.openSourceFile)
  328         
  329         self.debugViewer.sourceFile.connect(self.viewmanager.showDebugSource)
  330         
  331         self.taskViewer.displayFile.connect(self.viewmanager.openSourceFile)
  332         
  333         self.projectBrowser.psBrowser.sourceFile[str].connect(
  334             self.viewmanager.openSourceFile)
  335         self.projectBrowser.psBrowser.sourceFile[str, int].connect(
  336             self.viewmanager.openSourceFile)
  337         self.projectBrowser.psBrowser.sourceFile[str, list].connect(
  338             self.viewmanager.openSourceFile)
  339         self.projectBrowser.psBrowser.sourceFile[str, int, str].connect(
  340             self.viewmanager.openSourceFile)
  341         self.projectBrowser.psBrowser.closeSourceWindow.connect(
  342             self.viewmanager.closeWindow)
  343         self.projectBrowser.psBrowser.unittestOpen.connect(
  344             self.__unittestScript)
  345         
  346         self.projectBrowser.pfBrowser.designerFile.connect(self.__designer)
  347         self.projectBrowser.pfBrowser.sourceFile.connect(
  348             self.viewmanager.openSourceFile)
  349         self.projectBrowser.pfBrowser.uipreview.connect(self.__UIPreviewer)
  350         self.projectBrowser.pfBrowser.trpreview.connect(self.__TRPreviewer)
  351         self.projectBrowser.pfBrowser.closeSourceWindow.connect(
  352             self.viewmanager.closeWindow)
  353         self.projectBrowser.pfBrowser.appendStderr.connect(self.appendToStderr)
  354         
  355         self.projectBrowser.prBrowser.sourceFile.connect(
  356             self.viewmanager.openSourceFile)
  357         self.projectBrowser.prBrowser.closeSourceWindow.connect(
  358             self.viewmanager.closeWindow)
  359         self.projectBrowser.prBrowser.appendStderr.connect(self.appendToStderr)
  360         
  361         self.projectBrowser.ptBrowser.linguistFile.connect(self.__linguist)
  362         self.projectBrowser.ptBrowser.sourceFile.connect(
  363             self.viewmanager.openSourceFile)
  364         self.projectBrowser.ptBrowser.trpreview[list].connect(
  365             self.__TRPreviewer)
  366         self.projectBrowser.ptBrowser.trpreview[list, bool].connect(
  367             self.__TRPreviewer)
  368         self.projectBrowser.ptBrowser.closeSourceWindow.connect(
  369             self.viewmanager.closeWindow)
  370         self.projectBrowser.ptBrowser.appendStdout.connect(self.appendToStdout)
  371         self.projectBrowser.ptBrowser.appendStderr.connect(self.appendToStderr)
  372         
  373         self.projectBrowser.piBrowser.sourceFile[str].connect(
  374             self.viewmanager.openSourceFile)
  375         self.projectBrowser.piBrowser.sourceFile[str, int].connect(
  376             self.viewmanager.openSourceFile)
  377         self.projectBrowser.piBrowser.closeSourceWindow.connect(
  378             self.viewmanager.closeWindow)
  379         self.projectBrowser.piBrowser.appendStdout.connect(self.appendToStdout)
  380         self.projectBrowser.piBrowser.appendStderr.connect(self.appendToStderr)
  381         
  382         self.projectBrowser.ppBrowser.sourceFile[str].connect(
  383             self.viewmanager.openSourceFile)
  384         self.projectBrowser.ppBrowser.sourceFile[str, int].connect(
  385             self.viewmanager.openSourceFile)
  386         self.projectBrowser.ppBrowser.closeSourceWindow.connect(
  387             self.viewmanager.closeWindow)
  388         self.projectBrowser.ppBrowser.appendStdout.connect(self.appendToStdout)
  389         self.projectBrowser.ppBrowser.appendStderr.connect(self.appendToStderr)
  390         
  391         self.projectBrowser.poBrowser.sourceFile.connect(
  392             self.viewmanager.openSourceFile)
  393         self.projectBrowser.poBrowser.closeSourceWindow.connect(
  394             self.viewmanager.closeWindow)
  395         self.projectBrowser.poBrowser.pixmapEditFile.connect(self.__editPixmap)
  396         self.projectBrowser.poBrowser.pixmapFile.connect(self.__showPixmap)
  397         self.projectBrowser.poBrowser.svgFile.connect(self.__showSvg)
  398         self.projectBrowser.poBrowser.binaryFile.connect(self.__openHexEditor)
  399         
  400         self.project.sourceFile.connect(self.viewmanager.openSourceFile)
  401         self.project.designerFile.connect(self.__designer)
  402         self.project.linguistFile.connect(self.__linguist)
  403         self.project.projectOpened.connect(self.viewmanager.projectOpened)
  404         self.project.projectClosed.connect(self.viewmanager.projectClosed)
  405         self.project.projectFileRenamed.connect(
  406             self.viewmanager.projectFileRenamed)
  407         self.project.lexerAssociationsChanged.connect(
  408             self.viewmanager.projectLexerAssociationsChanged)
  409         self.project.newProject.connect(self.__newProject)
  410         self.project.projectOpened.connect(self.__projectOpened)
  411         self.project.projectOpened.connect(self.__activateProjectBrowser)
  412         self.project.projectClosed.connect(self.__projectClosed)
  413         self.project.projectClosed.connect(
  414             self.backgroundService.preferencesOrProjectChanged)
  415         self.project.projectOpened.connect(self.__writeCrashSession)
  416         self.project.projectClosed.connect(self.__writeCrashSession)
  417         self.project.appendStdout.connect(self.appendToStdout)
  418         self.project.appendStderr.connect(self.appendToStderr)
  419         
  420         self.multiProject.multiProjectOpened.connect(
  421             self.__activateMultiProjectBrowser)
  422         self.multiProject.multiProjectOpened.connect(
  423             self.__writeCrashSession)
  424         self.multiProject.multiProjectClosed.connect(
  425             self.__writeCrashSession)
  426         
  427         self.debuggerUI.resetUI.connect(self.viewmanager.handleResetUI)
  428         self.debuggerUI.resetUI.connect(self.debugViewer.handleResetUI)
  429         self.debuggerUI.resetUI.connect(self.__debuggingDone)
  430         self.debuggerUI.debuggingStarted.connect(
  431             self.debugViewer.exceptionLogger.debuggingStarted)
  432         self.debuggerUI.debuggingStarted.connect(
  433             self.debugViewer.handleDebuggingStarted)
  434         self.debuggerUI.debuggingStarted.connect(self.__programChange)
  435         self.debuggerUI.debuggingStarted.connect(self.__debuggingStarted)
  436         self.debuggerUI.compileForms.connect(
  437             self.projectBrowser.pfBrowser.compileChangedForms)
  438         self.debuggerUI.compileResources.connect(
  439             self.projectBrowser.prBrowser.compileChangedResources)
  440         self.debuggerUI.executeMake.connect(self.project.executeMake)
  441         self.debuggerUI.appendStdout.connect(self.appendToStdout)
  442         
  443         debugServer.passiveDebugStarted.connect(
  444             self.debugViewer.exceptionLogger.debuggingStarted)
  445         debugServer.passiveDebugStarted.connect(
  446             self.debugViewer.handleDebuggingStarted)
  447         debugServer.clientException.connect(
  448             self.debugViewer.exceptionLogger.addException)
  449         debugServer.clientLine.connect(
  450             self.debugViewer.breakpointViewer.highlightBreakpoint)
  451         debugServer.clientProcessStdout.connect(self.appendToStdout)
  452         debugServer.clientProcessStderr.connect(self.appendToStderr)
  453         debugServer.appendStdout.connect(self.appendToStdout)
  454         
  455         self.stdout.appendStdout.connect(self.appendToStdout)
  456         self.stderr.appendStderr.connect(self.appendToStderr)
  457         
  458         self.preferencesChanged.connect(self.viewmanager.preferencesChanged)
  459         self.reloadAPIs.connect(self.viewmanager.getAPIsManager().reloadAPIs)
  460         self.preferencesChanged.connect(self.logViewer.preferencesChanged)
  461         self.appendStdout.connect(self.logViewer.appendToStdout)
  462         self.appendStderr.connect(self.logViewer.appendToStderr)
  463         self.preferencesChanged.connect(self.shell.handlePreferencesChanged)
  464         self.preferencesChanged.connect(self.project.handlePreferencesChanged)
  465         self.preferencesChanged.connect(
  466             self.projectBrowser.handlePreferencesChanged)
  467         self.preferencesChanged.connect(
  468             self.projectBrowser.psBrowser.handlePreferencesChanged)
  469         self.preferencesChanged.connect(
  470             self.projectBrowser.pfBrowser.handlePreferencesChanged)
  471         self.preferencesChanged.connect(
  472             self.projectBrowser.prBrowser.handlePreferencesChanged)
  473         self.preferencesChanged.connect(
  474             self.projectBrowser.ptBrowser.handlePreferencesChanged)
  475         self.preferencesChanged.connect(
  476             self.projectBrowser.piBrowser.handlePreferencesChanged)
  477         self.preferencesChanged.connect(
  478             self.projectBrowser.ppBrowser.handlePreferencesChanged)
  479         self.preferencesChanged.connect(
  480             self.projectBrowser.poBrowser.handlePreferencesChanged)
  481         self.preferencesChanged.connect(
  482             self.taskViewer.handlePreferencesChanged)
  483         self.preferencesChanged.connect(self.pluginManager.preferencesChanged)
  484         self.preferencesChanged.connect(debugServer.preferencesChanged)
  485         self.preferencesChanged.connect(self.debugViewer.preferencesChanged)
  486         self.preferencesChanged.connect(
  487             self.backgroundService.preferencesOrProjectChanged)
  488         self.preferencesChanged.connect(self.__previewer.preferencesChanged)
  489         
  490         if self.browser is not None:
  491             self.browser.sourceFile[str].connect(
  492                 self.viewmanager.openSourceFile)
  493             self.browser.sourceFile[str, int].connect(
  494                 self.viewmanager.openSourceFile)
  495             self.browser.sourceFile[str, list].connect(
  496                 self.viewmanager.openSourceFile)
  497             self.browser.sourceFile[str, int, str].connect(
  498                 self.viewmanager.openSourceFile)
  499             self.browser.designerFile.connect(self.__designer)
  500             self.browser.linguistFile.connect(self.__linguist)
  501             self.browser.projectFile.connect(self.project.openProject)
  502             self.browser.multiProjectFile.connect(
  503                 self.multiProject.openMultiProject)
  504             self.browser.pixmapEditFile.connect(self.__editPixmap)
  505             self.browser.pixmapFile.connect(self.__showPixmap)
  506             self.browser.svgFile.connect(self.__showSvg)
  507             self.browser.binaryFile.connect(self.__openHexEditor)
  508             self.browser.unittestOpen.connect(self.__unittestScript)
  509             self.browser.trpreview.connect(self.__TRPreviewer)
  510             
  511             self.debuggerUI.debuggingStarted.connect(
  512                 self.browser.handleProgramChange)
  513             
  514             debugServer.clientInterpreterChanged.connect(
  515                 self.browser.handleInterpreterChanged)
  516             
  517             self.preferencesChanged.connect(
  518                 self.browser.handlePreferencesChanged)
  519         
  520         if self.codeDocumentationViewer is not None:
  521             self.preferencesChanged.connect(
  522                 self.codeDocumentationViewer.preferencesChanged)
  523         
  524         self.viewmanager.editorSaved.connect(self.project.repopulateItem)
  525         self.viewmanager.lastEditorClosed.connect(self.__lastEditorClosed)
  526         self.viewmanager.editorOpened.connect(self.__editorOpened)
  527         self.viewmanager.changeCaption.connect(self.__setWindowCaption)
  528         self.viewmanager.checkActions.connect(self.__checkActions)
  529         self.viewmanager.editorChanged.connect(
  530             self.projectBrowser.handleEditorChanged)
  531         self.viewmanager.editorLineChanged.connect(
  532             self.projectBrowser.handleEditorLineChanged)
  533         self.viewmanager.editorOpened.connect(self.__writeCrashSession)
  534         self.viewmanager.editorClosed.connect(self.__writeCrashSession)
  535         self.viewmanager.editorRenamed.connect(self.__writeCrashSession)
  536         self.viewmanager.editorChanged.connect(self.__writeCrashSession)
  537         
  538         self.shell.zoomValueChanged.connect(
  539             lambda v: self.viewmanager.zoomValueChanged(v, self.shell))
  540         
  541         if self.cooperation is not None:
  542             self.viewmanager.checkActions.connect(
  543                 self.cooperation.checkEditorActions)
  544             self.preferencesChanged.connect(
  545                 self.cooperation.preferencesChanged)
  546             self.cooperation.shareEditor.connect(
  547                 self.viewmanager.shareEditor)
  548             self.cooperation.startEdit.connect(
  549                 self.viewmanager.startSharedEdit)
  550             self.cooperation.sendEdit.connect(
  551                 self.viewmanager.sendSharedEdit)
  552             self.cooperation.cancelEdit.connect(
  553                 self.viewmanager.cancelSharedEdit)
  554             self.cooperation.connected.connect(
  555                 self.viewmanager.shareConnected)
  556             self.cooperation.editorCommand.connect(
  557                 self.viewmanager.receive)
  558             self.viewmanager.setCooperationClient(
  559                 self.cooperation.getClient())
  560         
  561         if self.symbolsViewer is not None:
  562             self.symbolsViewer.insertSymbol.connect(
  563                 self.viewmanager.insertSymbol)
  564         
  565         if self.numbersViewer is not None:
  566             self.numbersViewer.insertNumber.connect(
  567                 self.viewmanager.insertNumber)
  568         
  569         if self.irc is not None:
  570             self.irc.autoConnected.connect(self.__ircAutoConnected)
  571         
  572         # create the toolbar manager object
  573         self.toolbarManager = E5ToolBarManager(self, self)
  574         self.toolbarManager.setMainWindow(self)
  575         
  576         # Initialize the tool groups and list of started tools
  577         splash.showMessage(self.tr("Initializing Tools..."))
  578         self.toolGroups, self.currentToolGroup = Preferences.readToolGroups()
  579         self.toolProcs = []
  580         self.__initExternalToolsActions()
  581         
  582         # redirect handling of http and https URLs to ourselves
  583         QDesktopServices.setUrlHandler("http", self.handleUrl)
  584         QDesktopServices.setUrlHandler("https", self.handleUrl)
  585         
  586         # register all relevant objects
  587         splash.showMessage(self.tr("Registering Objects..."))
  588         e5App().registerObject("UserInterface", self)
  589         e5App().registerObject("DebugUI", self.debuggerUI)
  590         e5App().registerObject("DebugServer", debugServer)
  591         e5App().registerObject("BackgroundService", self.backgroundService)
  592         e5App().registerObject("ViewManager", self.viewmanager)
  593         e5App().registerObject("ProjectBrowser", self.projectBrowser)
  594         e5App().registerObject("MultiProject", self.multiProject)
  595         e5App().registerObject("TaskViewer", self.taskViewer)
  596         if self.templateViewer is not None:
  597             e5App().registerObject("TemplateViewer", self.templateViewer)
  598         e5App().registerObject("Shell", self.shell)
  599         e5App().registerObject("PluginManager", self.pluginManager)
  600         e5App().registerObject("ToolbarManager", self.toolbarManager)
  601         if self.cooperation is not None:
  602             e5App().registerObject("Cooperation", self.cooperation)
  603         if self.irc is not None:
  604             e5App().registerObject("IRC", self.irc)
  605         if self.symbolsViewer is not None:
  606             e5App().registerObject("Symbols", self.symbolsViewer)
  607         if self.numbersViewer is not None:
  608             e5App().registerObject("Numbers", self.numbersViewer)
  609         if self.codeDocumentationViewer is not None:
  610             e5App().registerObject("DocuViewer", self.codeDocumentationViewer)
  611         if self.microPythonWidget is not None:
  612             e5App().registerObject("MicroPython", self.microPythonWidget)
  613         
  614         # list of web addresses serving the versions file
  615         self.__httpAlternatives = Preferences.getUI("VersionsUrls6")
  616         self.__inVersionCheck = False
  617         self.__versionCheckProgress = None
  618         
  619         # Initialize the actions, menus, toolbars and statusbar
  620         splash.showMessage(self.tr("Initializing Actions..."))
  621         self.__initActions()
  622         splash.showMessage(self.tr("Initializing Menus..."))
  623         self.__initMenus()
  624         splash.showMessage(self.tr("Initializing Toolbars..."))
  625         self.__initToolbars()
  626         splash.showMessage(self.tr("Initializing Statusbar..."))
  627         self.__initStatusbar()
  628         
  629         # connect the appFocusChanged signal after all actions are ready
  630         app.focusChanged.connect(self.viewmanager.appFocusChanged)
  631         
  632         # Initialize the instance variables.
  633         self.currentProg = None
  634         self.isProg = False
  635         self.utEditorOpen = False
  636         self.utProjectOpen = False
  637         
  638         self.inDragDrop = False
  639         self.setAcceptDrops(True)
  640         
  641         self.currentProfile = None
  642         
  643         self.shutdownCalled = False
  644         self.inCloseEvent = False
  645 
  646         # now redirect stdout and stderr
  647         sys.stdout = self.stdout
  648         sys.stderr = self.stderr
  649 
  650         # now fire up the single application server
  651         if Preferences.getUI("SingleApplicationMode"):
  652             splash.showMessage(
  653                 self.tr("Initializing Single Application Server..."))
  654             self.SAServer = E5SingleApplicationServer()
  655         else:
  656             self.SAServer = None
  657         
  658         # now finalize the plugin manager setup
  659         splash.showMessage(self.tr("Initializing Plugins..."))
  660         self.pluginManager.finalizeSetup()
  661         # now activate plugins having autoload set to True
  662         splash.showMessage(self.tr("Activating Plugins..."))
  663         self.pluginManager.activatePlugins()
  664         splash.showMessage(self.tr("Generating Plugins Toolbars..."))
  665         self.pluginManager.initPluginToolbars(self.toolbarManager)
  666         if Preferences.getPluginManager("StartupCleanup"):
  667             splash.showMessage(self.tr("Cleaning Plugins Download Area..."))
  668             from PluginManager.PluginRepositoryDialog import (
  669                 PluginRepositoryDownloadCleanup
  670             )
  671             PluginRepositoryDownloadCleanup(quiet=True)
  672         
  673         # now read the keyboard shortcuts for all the actions
  674         from Preferences import Shortcuts
  675         Shortcuts.readShortcuts()
  676         
  677         # restore toolbar manager state
  678         splash.showMessage(self.tr("Restoring Toolbarmanager..."))
  679         self.toolbarManager.restoreState(
  680             Preferences.getUI("ToolbarManagerState"))
  681         
  682         if self.codeDocumentationViewer is not None:
  683             # finalize the initialization of the code documentation viewer
  684             self.codeDocumentationViewer.finalizeSetup()
  685         
  686         # now activate the initial view profile
  687         splash.showMessage(self.tr("Setting View Profile..."))
  688         self.__setEditProfile()
  689         
  690         # special treatment for the VCS toolbars
  691         for tb in self.getToolbarsByCategory("vcs"):
  692             tb.setVisible(False)
  693             tb.setEnabled(False)
  694         tb = self.getToolbar("vcs")[1]
  695         tb.setEnabled(True)
  696         if Preferences.getVCS("ShowVcsToolbar"):
  697             tb.setVisible(True)
  698         
  699         # now read the saved tasks
  700         splash.showMessage(self.tr("Reading Tasks..."))
  701         self.__readTasks()
  702         
  703         if self.templateViewer is not None:
  704             # now read the saved templates
  705             splash.showMessage(self.tr("Reading Templates..."))
  706             self.templateViewer.readTemplates()
  707         
  708         # now start the debug client with the most recently used virtual
  709         # environment
  710         splash.showMessage(self.tr("Starting Debugger..."))
  711         if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"):
  712             debugServer.startClient(
  713                 False, venvName=Preferences.getShell("LastVirtualEnvironment")
  714             )
  715         else:
  716             debugServer.startClient(False)
  717         
  718         # attributes for the network objects
  719         self.__networkManager = QNetworkAccessManager(self)
  720         self.__networkManager.proxyAuthenticationRequired.connect(
  721             proxyAuthenticationRequired)
  722         if SSL_AVAILABLE:
  723             self.__sslErrorHandler = E5SslErrorHandler(self)
  724             self.__networkManager.sslErrors.connect(self.__sslErrors)
  725         self.__replies = []
  726         
  727         # set spellchecker defaults
  728         from QScintilla.SpellChecker import SpellChecker
  729         SpellChecker.setDefaultLanguage(
  730             Preferences.getEditor("SpellCheckingDefaultLanguage"))
  731         
  732         # attributes for the last shown configuration page and the
  733         # extended configuration entries
  734         self.__lastConfigurationPageName = ""
  735         self.__expandedConfigurationEntries = []
  736         
  737         # set the keyboard input interval
  738         interval = Preferences.getUI("KeyboardInputInterval")
  739         if interval > 0:
  740             QApplication.setKeyboardInputInterval(interval)
  741         
  742     def networkAccessManager(self):
  743         """
  744         Public method to get a reference to the network access manager object.
  745         
  746         @return reference to the network access manager object
  747         @rtype QNetworkAccessManager
  748         """
  749         return self.__networkManager
  750     
  751     def __createLayout(self, debugServer):
  752         """
  753         Private method to create the layout of the various windows.
  754         
  755         @param debugServer reference to the debug server object
  756         @exception ValueError raised to indicate an invalid layout type
  757         """
  758         # Create the view manager depending on the configuration setting
  759         logging.debug("Creating Viewmanager...")
  760         import ViewManager
  761         self.viewmanager = ViewManager.factory(
  762             self, self, debugServer, self.pluginManager)
  763         leftWidget = QWidget()
  764         layout = QVBoxLayout()
  765         layout.setContentsMargins(1, 1, 1, 1)
  766         layout.setSpacing(1)
  767         layout.addWidget(self.viewmanager.mainWidget())
  768         layout.addWidget(self.viewmanager.searchWidget())
  769         layout.addWidget(self.viewmanager.replaceWidget())
  770         self.viewmanager.mainWidget().setSizePolicy(
  771             QSizePolicy.Preferred, QSizePolicy.Expanding)
  772         leftWidget.setLayout(layout)
  773         self.viewmanager.searchWidget().hide()
  774         self.viewmanager.replaceWidget().hide()
  775         
  776         splitter = QSplitter(Qt.Horizontal)
  777         splitter.addWidget(leftWidget)
  778         self.setCentralWidget(splitter)
  779         
  780         # Create previewer
  781         logging.debug("Creating Previewer...")
  782         from .Previewer import Previewer
  783         self.__previewer = Previewer(self.viewmanager, splitter)
  784         splitter.addWidget(self.__previewer)
  785         
  786         # Create AST viewer
  787         logging.debug("Creating Python AST Viewer")
  788         from .PythonAstViewer import PythonAstViewer
  789         self.__astViewer = PythonAstViewer(self.viewmanager, splitter)
  790         splitter.addWidget(self.__astViewer)
  791         
  792         # Create layout with toolbox windows embedded in dock windows
  793         if self.__layoutType == "Toolboxes":
  794             logging.debug("Creating toolboxes...")
  795             self.__createToolboxesLayout(debugServer)
  796         
  797         # Create layout with sidebar windows embedded in dock windows
  798         elif self.__layoutType == "Sidebars":
  799             logging.debug("Creating sidebars...")
  800             self.__createSidebarsLayout(debugServer)
  801         
  802         else:
  803             raise ValueError("Wrong layout type given ({0})".format(
  804                 self.__layoutType))
  805         logging.debug("Created Layout")
  806 
  807     def __createToolboxesLayout(self, debugServer):
  808         """
  809         Private method to create the Toolboxes layout.
  810         
  811         @param debugServer reference to the debug server object
  812         """
  813         from E5Gui.E5ToolBox import E5VerticalToolBox, E5HorizontalToolBox
  814         
  815         logging.debug("Creating Toolboxes Layout...")
  816         
  817         # Create the left toolbox
  818         self.lToolboxDock = self.__createDockWindow("lToolboxDock")
  819         self.lToolbox = E5VerticalToolBox(self.lToolboxDock)
  820         self.__setupDockWindow(self.lToolboxDock, Qt.LeftDockWidgetArea,
  821                                self.lToolbox, self.tr("Left Toolbox"))
  822         
  823         # Create the horizontal toolbox
  824         self.hToolboxDock = self.__createDockWindow("hToolboxDock")
  825         self.hToolbox = E5HorizontalToolBox(self.hToolboxDock)
  826         self.__setupDockWindow(self.hToolboxDock, Qt.BottomDockWidgetArea,
  827                                self.hToolbox,
  828                                self.tr("Horizontal Toolbox"))
  829         
  830         # Create the right toolbox
  831         self.rToolboxDock = self.__createDockWindow("rToolboxDock")
  832         self.rToolbox = E5VerticalToolBox(self.rToolboxDock)
  833         self.__setupDockWindow(self.rToolboxDock, Qt.RightDockWidgetArea,
  834                                self.rToolbox, self.tr("Right Toolbox"))
  835         
  836         ####################################################
  837         ## Populate the left toolbox
  838         ####################################################
  839         
  840         # Create the project browser
  841         logging.debug("Creating Project Browser...")
  842         from Project.ProjectBrowser import ProjectBrowser
  843         self.projectBrowser = ProjectBrowser(self.project)
  844         self.lToolbox.addItem(self.projectBrowser,
  845                               UI.PixmapCache.getIcon("projectViewer"),
  846                               self.tr("Project-Viewer"))
  847 
  848         # Create the multi project browser
  849         logging.debug("Creating Multiproject Browser...")
  850         from MultiProject.MultiProjectBrowser import MultiProjectBrowser
  851         self.multiProjectBrowser = MultiProjectBrowser(self.multiProject,
  852                                                        self.project)
  853         self.lToolbox.addItem(self.multiProjectBrowser,
  854                               UI.PixmapCache.getIcon("multiProjectViewer"),
  855                               self.tr("Multiproject-Viewer"))
  856         
  857         if Preferences.getUI("ShowTemplateViewer"):
  858             # Create the template viewer part of the user interface
  859             logging.debug("Creating Template Viewer...")
  860             from Templates.TemplateViewer import TemplateViewer
  861             self.templateViewer = TemplateViewer(None,
  862                                                  self.viewmanager)
  863             self.lToolbox.addItem(self.templateViewer,
  864                                   UI.PixmapCache.getIcon("templateViewer"),
  865                                   self.tr("Template-Viewer"))
  866         
  867         ####################################################
  868         ## Populate the right toolbox
  869         ####################################################
  870         
  871         if Preferences.getUI("ShowCodeDocumentationViewer"):
  872             # Create the code documentation viewer
  873             logging.debug("Creating Code Documentation Viewer...")
  874             from .CodeDocumentationViewer import CodeDocumentationViewer
  875             self.codeDocumentationViewer = CodeDocumentationViewer(self)
  876             self.rToolbox.addItem(self.codeDocumentationViewer,
  877                                   UI.PixmapCache.getIcon("codeDocuViewer"),
  878                                   self.tr("Code Documentation Viewer"))
  879         
  880         # Create the debug viewer
  881         logging.debug("Creating Debug Viewer...")
  882         from Debugger.DebugViewer import DebugViewer
  883         self.debugViewer = DebugViewer(debugServer)
  884         self.rToolbox.addItem(self.debugViewer,
  885                               UI.PixmapCache.getIcon("debugViewer"),
  886                               self.tr("Debug-Viewer"))
  887         
  888         if Preferences.getUI("ShowPyPIPackageManager"):
  889             # Create the PyPI package manager
  890             logging.debug("Creating PyPI Package Manager...")
  891             from PipInterface.PipPackagesWidget import PipPackagesWidget
  892             self.pipWidget = PipPackagesWidget(self.pipInterface)
  893             self.rToolbox.addItem(self.pipWidget,
  894                                   UI.PixmapCache.getIcon("pypi"),
  895                                   self.tr("PyPI"))
  896         
  897         if Preferences.getUI("ShowCondaPackageManager"):
  898             # Create the conda package manager
  899             logging.debug("Creating Conda Package Manager...")
  900             from CondaInterface.CondaPackagesWidget import CondaPackagesWidget
  901             self.condaWidget = CondaPackagesWidget(self.condaInterface)
  902             self.rToolbox.addItem(self.condaWidget,
  903                                   UI.PixmapCache.getIcon("miniconda"),
  904                                   self.tr("Conda"))
  905         
  906         if Preferences.getUI("ShowCooperation"):
  907             # Create the chat part of the user interface
  908             logging.debug("Creating Chat Widget...")
  909             from Cooperation.ChatWidget import ChatWidget
  910             self.cooperation = ChatWidget(self)
  911             self.rToolbox.addItem(self.cooperation,
  912                                   UI.PixmapCache.getIcon("cooperation"),
  913                                   self.tr("Cooperation"))
  914         
  915         if Preferences.getUI("ShowIrc"):
  916             # Create the IRC part of the user interface
  917             logging.debug("Creating IRC Widget...")
  918             from Network.IRC.IrcWidget import IrcWidget
  919             self.irc = IrcWidget(self)
  920             self.rToolbox.addItem(self.irc,
  921                                   UI.PixmapCache.getIcon("irc"),
  922                                   self.tr("IRC"))
  923         
  924         if Preferences.getUI("ShowMicroPython"):
  925             # Create the MicroPython part of the user interface
  926             logging.debug("Creating MicroPython Widget...")
  927             from MicroPython.MicroPythonWidget import MicroPythonWidget
  928             self.microPythonWidget = MicroPythonWidget(self)
  929             self.rToolbox.addItem(self.microPythonWidget,
  930                                   UI.PixmapCache.getIcon("micropython"),
  931                                   self.tr("MicroPython"))
  932         
  933         ####################################################
  934         ## Populate the bottom toolbox
  935         ####################################################
  936         
  937         # Create the task viewer part of the user interface
  938         logging.debug("Creating Task Viewer...")
  939         from Tasks.TaskViewer import TaskViewer
  940         self.taskViewer = TaskViewer(None, self.project)
  941         self.hToolbox.addItem(self.taskViewer,
  942                               UI.PixmapCache.getIcon("task"),
  943                               self.tr("Task-Viewer"))
  944 
  945         # Create the log viewer part of the user interface
  946         logging.debug("Creating Log Viewer...")
  947         from .LogView import LogViewer
  948         self.logViewer = LogViewer(self)
  949         self.hToolbox.addItem(self.logViewer,
  950                               UI.PixmapCache.getIcon("logViewer"),
  951                               self.tr("Log-Viewer"))
  952 
  953         if Preferences.getUI("ShowFileBrowser"):
  954             # Create the file browser
  955             logging.debug("Creating File Browser...")
  956             from .Browser import Browser
  957             self.browser = Browser()
  958             self.lToolbox.addItem(self.browser,
  959                                   UI.PixmapCache.getIcon("browser"),
  960                                   self.tr("File-Browser"))
  961         
  962         if Preferences.getUI("ShowSymbolsViewer"):
  963             # Create the symbols viewer
  964             logging.debug("Creating Symbols Viewer...")
  965             from .SymbolsWidget import SymbolsWidget
  966             self.symbolsViewer = SymbolsWidget()
  967             self.lToolbox.addItem(self.symbolsViewer,
  968                                   UI.PixmapCache.getIcon("symbols"),
  969                                   self.tr("Symbols"))
  970         
  971         if Preferences.getUI("ShowNumbersViewer"):
  972             # Create the numbers viewer
  973             logging.debug("Creating Numbers Viewer...")
  974             from .NumbersWidget import NumbersWidget
  975             self.numbersViewer = NumbersWidget()
  976             self.hToolbox.addItem(self.numbersViewer,
  977                                   UI.PixmapCache.getIcon("numbers"),
  978                                   self.tr("Numbers"))
  979         
  980         ####################################################
  981         ## Populate the configurable widgets
  982         ####################################################
  983         
  984         # Create the shell
  985         logging.debug("Creating Shell...")
  986         self.__shellPosition = Preferences.getUI("ShellPosition")
  987         if self.__shellPosition == "left":
  988             self.__shellParent = self.lToolboxDock
  989         elif self.__shellPosition == "right":
  990             self.__shellParent = self.rToolboxDock
  991         else:
  992             self.__shellParent = self.hToolboxDock
  993         from QScintilla.Shell import ShellAssembly
  994         self.shellAssembly = ShellAssembly(
  995             debugServer, self.viewmanager, self.project, True)
  996         self.shell = self.shellAssembly.shell()
  997         self.__shellParent.widget().insertItem(
  998             0, self.shellAssembly, UI.PixmapCache.getIcon("shell"),
  999             self.tr("Shell"))
 1000         
 1001         ####################################################
 1002         ## Set the start index of each toolbox
 1003         ####################################################
 1004         
 1005         self.lToolbox.setCurrentIndex(0)
 1006         self.rToolbox.setCurrentIndex(0)
 1007         self.hToolbox.setCurrentIndex(0)
 1008         
 1009     def __createSidebarsLayout(self, debugServer):
 1010         """
 1011         Private method to create the Sidebars layout.
 1012         
 1013         @param debugServer reference to the debug server object
 1014         """
 1015         from E5Gui.E5SideBar import E5SideBar
 1016         
 1017         logging.debug("Creating Sidebars Layout...")
 1018         
 1019         delay = Preferences.getUI("SidebarDelay")
 1020         # Create the left sidebar
 1021         self.leftSidebar = E5SideBar(E5SideBar.West, delay)
 1022         
 1023         # Create the bottom sidebar
 1024         self.bottomSidebar = E5SideBar(E5SideBar.South, delay)
 1025         
 1026         # Create the right sidebar
 1027         self.rightSidebar = E5SideBar(E5SideBar.East, delay)
 1028         
 1029         ####################################################
 1030         ## Populate the left side bar
 1031         ####################################################
 1032         
 1033         # Create the project browser
 1034         logging.debug("Creating Project Browser...")
 1035         from Project.ProjectBrowser import ProjectBrowser
 1036         self.projectBrowser = ProjectBrowser(self.project)
 1037         self.leftSidebar.addTab(
 1038             self.projectBrowser,
 1039             UI.PixmapCache.getIcon("projectViewer"),
 1040             self.tr("Project-Viewer"))
 1041 
 1042         # Create the multi project browser
 1043         logging.debug("Creating Multiproject Browser...")
 1044         from MultiProject.MultiProjectBrowser import MultiProjectBrowser
 1045         self.multiProjectBrowser = MultiProjectBrowser(self.multiProject,
 1046                                                        self.project)
 1047         self.leftSidebar.addTab(
 1048             self.multiProjectBrowser,
 1049             UI.PixmapCache.getIcon("multiProjectViewer"),
 1050             self.tr("Multiproject-Viewer"))
 1051 
 1052         if Preferences.getUI("ShowTemplateViewer"):
 1053             # Create the template viewer part of the user interface
 1054             logging.debug("Creating Template Viewer...")
 1055             from Templates.TemplateViewer import TemplateViewer
 1056             self.templateViewer = TemplateViewer(None,
 1057                                                  self.viewmanager)
 1058             self.leftSidebar.addTab(
 1059                 self.templateViewer,
 1060                 UI.PixmapCache.getIcon("templateViewer"),
 1061                 self.tr("Template-Viewer"))
 1062 
 1063         ####################################################
 1064         ## Populate the right side bar
 1065         ####################################################
 1066         
 1067         if Preferences.getUI("ShowCodeDocumentationViewer"):
 1068             # Create the code documentation viewer
 1069             logging.debug("Creating Code Documentation Viewer...")
 1070             from .CodeDocumentationViewer import CodeDocumentationViewer
 1071             self.codeDocumentationViewer = CodeDocumentationViewer(self)
 1072             self.rightSidebar.addTab(
 1073                 self.codeDocumentationViewer,
 1074                 UI.PixmapCache.getIcon("codeDocuViewer"),
 1075                 self.tr("Code Documentation Viewer"))
 1076         
 1077         # Create the debug viewer
 1078         logging.debug("Creating Debug Viewer...")
 1079         from Debugger.DebugViewer import DebugViewer
 1080         self.debugViewer = DebugViewer(debugServer)
 1081         self.rightSidebar.addTab(
 1082             self.debugViewer, UI.PixmapCache.getIcon("debugViewer"),
 1083             self.tr("Debug-Viewer"))
 1084 
 1085         if Preferences.getUI("ShowPyPIPackageManager"):
 1086             # Create the PyPI package manager
 1087             logging.debug("Creating PyPI Package Manager...")
 1088             from PipInterface.PipPackagesWidget import PipPackagesWidget
 1089             self.pipWidget = PipPackagesWidget(self.pipInterface)
 1090             self.rightSidebar.addTab(
 1091                 self.pipWidget, UI.PixmapCache.getIcon("pypi"),
 1092                 self.tr("PyPI"))
 1093         
 1094         if Preferences.getUI("ShowCondaPackageManager"):
 1095             # Create the conda package manager
 1096             logging.debug("Creating Conda Package Manager...")
 1097             from CondaInterface.CondaPackagesWidget import CondaPackagesWidget
 1098             self.condaWidget = CondaPackagesWidget(self.condaInterface)
 1099             self.rightSidebar.addTab(
 1100                 self.condaWidget, UI.PixmapCache.getIcon("miniconda"),
 1101                 self.tr("Conda"))
 1102 
 1103         if Preferences.getUI("ShowCooperation"):
 1104             # Create the chat part of the user interface
 1105             logging.debug("Creating Chat Widget...")
 1106             from Cooperation.ChatWidget import ChatWidget
 1107             self.cooperation = ChatWidget(self)
 1108             self.rightSidebar.addTab(
 1109                 self.cooperation, UI.PixmapCache.getIcon("cooperation"),
 1110                 self.tr("Cooperation"))
 1111         
 1112         if Preferences.getUI("ShowIrc"):
 1113             # Create the IRC part of the user interface
 1114             logging.debug("Creating IRC Widget...")
 1115             from Network.IRC.IrcWidget import IrcWidget
 1116             self.irc = IrcWidget(self)
 1117             self.rightSidebar.addTab(
 1118                 self.irc, UI.PixmapCache.getIcon("irc"),
 1119                 self.tr("IRC"))
 1120         
 1121         if Preferences.getUI("ShowMicroPython"):
 1122             # Create the MicroPython part of the user interface
 1123             logging.debug("Creating MicroPython Widget...")
 1124             from MicroPython.MicroPythonWidget import MicroPythonWidget
 1125             self.microPythonWidget = MicroPythonWidget(self)
 1126             self.rightSidebar.addTab(
 1127                 self.microPythonWidget, UI.PixmapCache.getIcon("micropython"),
 1128                 self.tr("MicroPython"))
 1129         
 1130         ####################################################
 1131         ## Populate the bottom side bar
 1132         ####################################################
 1133         
 1134         # Create the task viewer part of the user interface
 1135         logging.debug("Creating Task Viewer...")
 1136         from Tasks.TaskViewer import TaskViewer
 1137         self.taskViewer = TaskViewer(None, self.project)
 1138         self.bottomSidebar.addTab(self.taskViewer,
 1139                                   UI.PixmapCache.getIcon("task"),
 1140                                   self.tr("Task-Viewer"))
 1141 
 1142         # Create the log viewer part of the user interface
 1143         logging.debug("Creating Log Viewer...")
 1144         from .LogView import LogViewer
 1145         self.logViewer = LogViewer(self)
 1146         self.bottomSidebar.addTab(self.logViewer,
 1147                                   UI.PixmapCache.getIcon("logViewer"),
 1148                                   self.tr("Log-Viewer"))
 1149 
 1150         if Preferences.getUI("ShowFileBrowser"):
 1151             # Create the file browser
 1152             logging.debug("Creating File Browser...")
 1153             from .Browser import Browser
 1154             self.browser = Browser()
 1155             self.leftSidebar.addTab(self.browser,
 1156                                     UI.PixmapCache.getIcon("browser"),
 1157                                     self.tr("File-Browser"))
 1158         
 1159         if Preferences.getUI("ShowSymbolsViewer"):
 1160             # Create the symbols viewer
 1161             logging.debug("Creating Symbols Viewer...")
 1162             from .SymbolsWidget import SymbolsWidget
 1163             self.symbolsViewer = SymbolsWidget()
 1164             self.leftSidebar.addTab(self.symbolsViewer,
 1165                                     UI.PixmapCache.getIcon("symbols"),
 1166                                     self.tr("Symbols"))
 1167         
 1168         if Preferences.getUI("ShowNumbersViewer"):
 1169             # Create the numbers viewer
 1170             logging.debug("Creating Numbers Viewer...")
 1171             from .NumbersWidget import NumbersWidget
 1172             self.numbersViewer = NumbersWidget()
 1173             self.bottomSidebar.addTab(self.numbersViewer,
 1174                                       UI.PixmapCache.getIcon("numbers"),
 1175                                       self.tr("Numbers"))
 1176         
 1177         ####################################################
 1178         ## Populate the configurable widgets
 1179         ####################################################
 1180         
 1181         # Create the shell
 1182         logging.debug("Creating Shell...")
 1183         self.__shellPosition = Preferences.getUI("ShellPosition")
 1184         if self.__shellPosition == "left":
 1185             self.__shellParent = self.leftSidebar
 1186         elif self.__shellPosition == "right":
 1187             self.__shellParent = self.rightSidebar
 1188         else:
 1189             self.__shellParent = self.bottomSidebar
 1190         from QScintilla.Shell import ShellAssembly
 1191         self.shellAssembly = ShellAssembly(
 1192             debugServer, self.viewmanager, self.project, True)
 1193         self.shell = self.shellAssembly.shell()
 1194         self.__shellParent.insertTab(0, self.shellAssembly,
 1195                                      UI.PixmapCache.getIcon("shell"),
 1196                                      self.tr("Shell"))
 1197         
 1198         ####################################################
 1199         ## Set the start index of each side bar
 1200         ####################################################
 1201         
 1202         self.leftSidebar.setCurrentIndex(0)
 1203         self.rightSidebar.setCurrentIndex(0)
 1204         self.bottomSidebar.setCurrentIndex(0)
 1205         
 1206         # create the central widget
 1207         logging.debug("Creating central widget...")
 1208         cw = self.centralWidget()   # save the current central widget
 1209         self.leftSplitter = QSplitter(Qt.Horizontal)
 1210         self.rightSplitter = QSplitter(Qt.Horizontal)
 1211         self.verticalSplitter = QSplitter(Qt.Vertical)
 1212         self.verticalSplitter.addWidget(cw)
 1213         self.verticalSplitter.addWidget(self.bottomSidebar)
 1214         self.rightSplitter.addWidget(self.verticalSplitter)
 1215         self.rightSplitter.addWidget(self.rightSidebar)
 1216         self.leftSplitter.addWidget(self.leftSidebar)
 1217         self.leftSplitter.addWidget(self.rightSplitter)
 1218         self.setCentralWidget(self.leftSplitter)
 1219         
 1220         self.leftSidebar.setSplitter(self.leftSplitter)
 1221         self.rightSidebar.setSplitter(self.rightSplitter)
 1222         self.bottomSidebar.setSplitter(self.verticalSplitter)
 1223         
 1224     def addSideWidget(self, side, widget, icon, label):
 1225         """
 1226         Public method to add a widget to the sides.
 1227         
 1228         @param side side to add the widget to
 1229         @type int (one of UserInterface.LeftSide, UserInterface.BottomSide,
 1230             UserInterface.RightSide)
 1231         @param widget reference to the widget to add
 1232         @type QWidget
 1233         @param icon icon to be used
 1234         @type QIcon
 1235         @param label label text to be shown
 1236         @type str
 1237         """
 1238         if side in [UserInterface.LeftSide, UserInterface.BottomSide,
 1239                     UserInterface.RightSide]:
 1240             if self.__layoutType == "Toolboxes":
 1241                 if side == UserInterface.LeftSide:
 1242                     self.lToolbox.addItem(widget, icon, label)
 1243                 elif side == UserInterface.BottomSide:
 1244                     self.hToolbox.addItem(widget, icon, label)
 1245                 elif side == UserInterface.RightSide:
 1246                     self.rToolbox.addItem(widget, icon, label)
 1247             elif self.__layoutType == "Sidebars":
 1248                 if side == UserInterface.LeftSide:
 1249                     self.leftSidebar.addTab(widget, icon, label)
 1250                 elif side == UserInterface.BottomSide:
 1251                     self.bottomSidebar.addTab(widget, icon, label)
 1252                 elif side == UserInterface.RightSide:
 1253                     self.rightSidebar.addTab(widget, icon, label)
 1254     
 1255     def removeSideWidget(self, widget):
 1256         """
 1257         Public method to remove a widget added using addSideWidget().
 1258         
 1259         @param widget reference to the widget to remove
 1260         @type QWidget
 1261         """
 1262         if self.__layoutType == "Toolboxes":
 1263             for container in [self.lToolbox, self.hToolbox, self.rToolbox]:
 1264                 index = container.indexOf(widget)
 1265                 if index != -1:
 1266                     container.removeItem(index)
 1267         elif self.__layoutType == "Sidebars":
 1268             for container in [self.leftSidebar, self.bottomSidebar,
 1269                               self.rightSidebar]:
 1270                 index = container.indexOf(widget)
 1271                 if index != -1:
 1272                     container.removeTab(index)
 1273     
 1274     def showSideWidget(self, widget):
 1275         """
 1276         Public method to show a specific widget placed in the side widgets.
 1277         
 1278         @param widget reference to the widget to be shown
 1279         @type QWidget
 1280         """
 1281         if self.__layoutType == "Toolboxes":
 1282             for dock in [self.lToolboxDock, self.hToolboxDock,
 1283                          self.rToolboxDock]:
 1284                 container = dock.widget()
 1285                 index = container.indexOf(widget)
 1286                 if index != -1:
 1287                     dock.show()
 1288                     container.setCurrentIndex(index)
 1289                     dock.raise_()
 1290         elif self.__layoutType == "Sidebars":
 1291             for container in [self.leftSidebar, self.bottomSidebar,
 1292                               self.rightSidebar]:
 1293                 index = container.indexOf(widget)
 1294                 if index != -1:
 1295                     container.show()
 1296                     container.setCurrentIndex(index)
 1297                     container.raise_()
 1298                     if container.isAutoHiding():
 1299                         container.setFocus()
 1300     
 1301     def showLogViewer(self):
 1302         """
 1303         Public method to show the Log-Viewer.
 1304         """
 1305         if Preferences.getUI("LogViewerAutoRaise"):
 1306             if self.__layoutType == "Toolboxes":
 1307                 self.hToolboxDock.show()
 1308                 self.hToolbox.setCurrentWidget(self.logViewer)
 1309                 self.hToolboxDock.raise_()
 1310             elif self.__layoutType == "Sidebars":
 1311                 self.bottomSidebar.show()
 1312                 self.bottomSidebar.setCurrentWidget(self.logViewer)
 1313                 self.bottomSidebar.raise_()
 1314                 if self.bottomSidebar.isAutoHiding():
 1315                     self.bottomSidebar.setFocus()
 1316         
 1317     def __openOnStartup(self, startupType=None):
 1318         """
 1319         Private method to open the last file, project or multiproject.
 1320         
 1321         @param startupType type of startup requested (string, one of
 1322             "Nothing", "File", "Project", "MultiProject" or "Session")
 1323         """
 1324         startupTypeMapping = {
 1325             "Nothing": 0,
 1326             "File": 1,
 1327             "Project": 2,
 1328             "MultiProject": 3,
 1329             "Session": 4,
 1330         }
 1331         
 1332         if startupType is None:
 1333             startup = Preferences.getUI("OpenOnStartup")
 1334         else:
 1335             try:
 1336                 startup = startupTypeMapping[startupType]
 1337             except KeyError:
 1338                 startup = Preferences.getUI("OpenOnStartup")
 1339         
 1340         if startup == 0:
 1341             # open nothing
 1342             pass
 1343         elif startup == 1:
 1344             # open last file
 1345             recent = self.viewmanager.getMostRecent()
 1346             if recent is not None:
 1347                 self.viewmanager.openFiles(recent)
 1348         elif startup == 2:
 1349             # open last project
 1350             recent = self.project.getMostRecent()
 1351             if recent is not None:
 1352                 self.project.openProject(recent)
 1353         elif startup == 3:
 1354             # open last multiproject
 1355             recent = self.multiProject.getMostRecent()
 1356             if recent is not None:
 1357                 self.multiProject.openMultiProject(recent)
 1358         elif startup == 4:
 1359             # open from session file
 1360             self.__readSession()
 1361         
 1362     def processArgs(self, args):
 1363         """
 1364         Public method to process the command line args passed to the UI.
 1365         
 1366         @param args list of files to open<br />
 1367             The args are processed one at a time. All arguments after a
 1368             '--' option are considered debug arguments to the program
 1369             for the debugger. All files named before the '--' option
 1370             are opened in a text editor, unless the argument ends in
 1371             .e4p, then it is opened as a project file. If it ends in
 1372             .e4m or .e5m, it is opened as a multiproject.
 1373         """
 1374         # check and optionally read a crash session and ignore any arguments
 1375         if self.__readCrashSession():
 1376             return
 1377         
 1378         # no args, return
 1379         if args is None:
 1380             if not self.__noOpenAtStartup:
 1381                 self.__openOnStartup()
 1382             return
 1383         
 1384         opens = 0
 1385         
 1386         # holds space delimited list of command args, if any
 1387         argsStr = None
 1388         # flag indicating '--' options was found
 1389         ddseen = False
 1390         
 1391         if Utilities.isWindowsPlatform():
 1392             argChars = ['-', '/']
 1393         else:
 1394             argChars = ['-']
 1395 
 1396         for arg in args:
 1397             # handle a request to start with last session
 1398             if arg == '--start-file':
 1399                 self.__openOnStartup("File")
 1400                 # ignore all further arguments
 1401                 return
 1402             elif arg == '--start-multi':
 1403                 self.__openOnStartup("MultiProject")
 1404                 # ignore all further arguments
 1405                 return
 1406             elif arg == '--start-project':
 1407                 self.__openOnStartup("Project")
 1408                 # ignore all further arguments
 1409                 return
 1410             elif arg == '--start-session':
 1411                 self.__openOnStartup("Session")
 1412                 # ignore all further arguments
 1413                 return
 1414             
 1415             if arg == '--' and not ddseen:
 1416                 ddseen = True
 1417                 continue
 1418             
 1419             if arg[0] in argChars or ddseen:
 1420                 if argsStr is None:
 1421                     argsStr = arg
 1422                 else:
 1423                     argsStr = "{0} {1}".format(argsStr, arg)
 1424                 continue
 1425             
 1426             try:
 1427                 ext = os.path.splitext(arg)[1]
 1428                 ext = os.path.normcase(ext)
 1429             except IndexError:
 1430                 ext = ""
 1431 
 1432             if ext in ['.e4p']:
 1433                 self.project.openProject(arg)
 1434                 opens += 1
 1435             elif ext in ['.e4m', '.e5m']:
 1436                 self.multiProject.openMultiProject(arg)
 1437                 opens += 1
 1438             else:
 1439                 self.viewmanager.openFiles(arg)
 1440                 opens += 1
 1441 
 1442         # store away any args we had
 1443         if argsStr is not None:
 1444             self.debuggerUI.setArgvHistory(argsStr)
 1445         
 1446         if opens == 0:
 1447             # no files, project or multiproject was given
 1448             if not self.__noOpenAtStartup:
 1449                 self.__openOnStartup()
 1450         
 1451     def __createDockWindow(self, name):
 1452         """
 1453         Private method to create a dock window with common properties.
 1454         
 1455         @param name object name of the new dock window (string)
 1456         @return the generated dock window (QDockWindow)
 1457         """
 1458         dock = QDockWidget()
 1459         dock.setObjectName(name)
 1460         dock.setFeatures(
 1461             QDockWidget.DockWidgetFeatures(QDockWidget.AllDockWidgetFeatures))
 1462         return dock
 1463 
 1464     def __setupDockWindow(self, dock, where, widget, caption):
 1465         """
 1466         Private method to configure the dock window created with
 1467         __createDockWindow().
 1468         
 1469         @param dock the dock window (QDockWindow)
 1470         @param where dock area to be docked to (Qt.DockWidgetArea)
 1471         @param widget widget to be shown in the dock window (QWidget)
 1472         @param caption caption of the dock window (string)
 1473         """
 1474         if caption is None:
 1475             caption = ""
 1476         self.addDockWidget(where, dock)
 1477         dock.setWidget(widget)
 1478         dock.setWindowTitle(caption)
 1479         dock.show()
 1480 
 1481     def __setWindowCaption(self, editor=None, project=None):
 1482         """
 1483         Private method to set the caption of the Main Window.
 1484         
 1485         @param editor filename to be displayed (string)
 1486         @param project project name to be displayed (string)
 1487         """
 1488         if editor is not None and self.captionShowsFilename:
 1489             self.capEditor = Utilities.compactPath(editor, self.maxFilePathLen)
 1490         if project is not None:
 1491             self.capProject = project
 1492         
 1493         if self.passiveMode:
 1494             if not self.capProject and not self.capEditor:
 1495                 self.setWindowTitle(
 1496                     self.tr("{0} - Passive Mode").format(Program))
 1497             elif self.capProject and not self.capEditor:
 1498                 self.setWindowTitle(
 1499                     self.tr("{0} - {1} - Passive Mode")
 1500                         .format(self.capProject, Program))
 1501             elif not self.capProject and self.capEditor:
 1502                 self.setWindowTitle(
 1503                     self.tr("{0} - {1} - Passive Mode")
 1504                         .format(self.capEditor, Program))
 1505             else:
 1506                 self.setWindowTitle(
 1507                     self.tr("{0} - {1} - {2} - Passive Mode")
 1508                     .format(self.capProject, self.capEditor, Program))
 1509         else:
 1510             if not self.capProject and not self.capEditor:
 1511                 self.setWindowTitle(Program)
 1512             elif self.capProject and not self.capEditor:
 1513                 self.setWindowTitle(
 1514                     "{0} - {1}".format(self.capProject, Program))
 1515             elif not self.capProject and self.capEditor:
 1516                 self.setWindowTitle(
 1517                     "{0} - {1}".format(self.capEditor, Program))
 1518             else:
 1519                 self.setWindowTitle("{0} - {1} - {2}".format(
 1520                     self.capProject, self.capEditor, Program))
 1521         
 1522     def __initActions(self):
 1523         """
 1524         Private method to define the user interface actions.
 1525         """
 1526         self.actions = []
 1527         self.wizardsActions = []
 1528         
 1529         self.exitAct = E5Action(
 1530             self.tr('Quit'),
 1531             UI.PixmapCache.getIcon("exit"),
 1532             self.tr('&Quit'),
 1533             QKeySequence(self.tr("Ctrl+Q", "File|Quit")),
 1534             0, self, 'quit')
 1535         self.exitAct.setStatusTip(self.tr('Quit the IDE'))
 1536         self.exitAct.setWhatsThis(self.tr(
 1537             """<b>Quit the IDE</b>"""
 1538             """<p>This quits the IDE. Any unsaved changes may be saved"""
 1539             """ first. Any Python program being debugged will be stopped"""
 1540             """ and the preferences will be written to disc.</p>"""
 1541         ))
 1542         self.exitAct.triggered.connect(self.__quit)
 1543         self.exitAct.setMenuRole(QAction.QuitRole)
 1544         self.actions.append(self.exitAct)
 1545 
 1546         self.restartAct = E5Action(
 1547             self.tr('Restart'),
 1548             UI.PixmapCache.getIcon("restart"),
 1549             self.tr('Restart'),
 1550             QKeySequence(self.tr("Ctrl+Shift+Q", "File|Quit")),
 1551             0, self, 'restart_eric')
 1552         self.restartAct.setStatusTip(self.tr('Restart the IDE'))
 1553         self.restartAct.setWhatsThis(self.tr(
 1554             """<b>Restart the IDE</b>"""
 1555             """<p>This restarts the IDE. Any unsaved changes may be saved"""
 1556             """ first. Any Python program being debugged will be stopped"""
 1557             """ and the preferences will be written to disc.</p>"""
 1558         ))
 1559         self.restartAct.triggered.connect(self.__restart)
 1560         self.actions.append(self.restartAct)
 1561 
 1562         self.saveSessionAct = E5Action(
 1563             self.tr('Save session'),
 1564             self.tr('Save session...'),
 1565             0, 0, self, 'save_session_to_file')
 1566         self.saveSessionAct.setStatusTip(self.tr('Save session'))
 1567         self.saveSessionAct.setWhatsThis(self.tr(
 1568             """<b>Save session...</b>"""
 1569             """<p>This saves the current session to disk. A dialog is"""
 1570             """ opened to select the file name.</p>"""
 1571         ))
 1572         self.saveSessionAct.triggered.connect(self.__saveSessionToFile)
 1573         self.actions.append(self.saveSessionAct)
 1574 
 1575         self.loadSessionAct = E5Action(
 1576             self.tr('Load session'),
 1577             self.tr('Load session...'),
 1578             0, 0, self, 'load_session_from_file')
 1579         self.loadSessionAct.setStatusTip(self.tr('Load session'))
 1580         self.loadSessionAct.setWhatsThis(self.tr(
 1581             """<b>Load session...</b>"""
 1582             """<p>This loads a session saved to disk previously. A dialog is"""
 1583             """ opened to select the file name.</p>"""
 1584         ))
 1585         self.loadSessionAct.triggered.connect(self.__loadSessionFromFile)
 1586         self.actions.append(self.loadSessionAct)
 1587 
 1588         self.newWindowAct = E5Action(
 1589             self.tr('New Window'),
 1590             UI.PixmapCache.getIcon("newWindow"),
 1591             self.tr('New &Window'),
 1592             QKeySequence(self.tr("Ctrl+Shift+N", "File|New Window")),
 1593             0, self, 'new_window')
 1594         self.newWindowAct.setStatusTip(self.tr(
 1595             'Open a new eric6 instance'))
 1596         self.newWindowAct.setWhatsThis(self.tr(
 1597             """<b>New Window</b>"""
 1598             """<p>This opens a new instance of the eric6 IDE.</p>"""
 1599         ))
 1600         self.newWindowAct.triggered.connect(self.__newWindow)
 1601         self.actions.append(self.newWindowAct)
 1602         self.newWindowAct.setEnabled(
 1603             not Preferences.getUI("SingleApplicationMode"))
 1604         
 1605         self.viewProfileActGrp = createActionGroup(self, "viewprofiles", True)
 1606         
 1607         self.setEditProfileAct = E5Action(
 1608             self.tr('Edit Profile'),
 1609             UI.PixmapCache.getIcon("viewProfileEdit"),
 1610             self.tr('Edit Profile'),
 1611             0, 0,
 1612             self.viewProfileActGrp, 'edit_profile', True)
 1613         self.setEditProfileAct.setStatusTip(self.tr(
 1614             'Activate the edit view profile'))
 1615         self.setEditProfileAct.setWhatsThis(self.tr(
 1616             """<b>Edit Profile</b>"""
 1617             """<p>Activate the "Edit View Profile". Windows being shown,"""
 1618             """ if this profile is active, may be configured with the"""
 1619             """ "View Profile Configuration" dialog.</p>"""
 1620         ))
 1621         self.setEditProfileAct.triggered.connect(self.__setEditProfile)
 1622         self.actions.append(self.setEditProfileAct)
 1623         
 1624         self.setDebugProfileAct = E5Action(
 1625             self.tr('Debug Profile'),
 1626             UI.PixmapCache.getIcon("viewProfileDebug"),
 1627             self.tr('Debug Profile'),
 1628             0, 0,
 1629             self.viewProfileActGrp, 'debug_profile', True)
 1630         self.setDebugProfileAct.setStatusTip(
 1631             self.tr('Activate the debug view profile'))
 1632         self.setDebugProfileAct.setWhatsThis(self.tr(
 1633             """<b>Debug Profile</b>"""
 1634             """<p>Activate the "Debug View Profile". Windows being shown,"""
 1635             """ if this profile is active, may be configured with the"""
 1636             """ "View Profile Configuration" dialog.</p>"""
 1637         ))
 1638         self.setDebugProfileAct.triggered.connect(self.setDebugProfile)
 1639         self.actions.append(self.setDebugProfileAct)
 1640         
 1641         self.pbActivateAct = E5Action(
 1642             self.tr('Project-Viewer'),
 1643             self.tr('&Project-Viewer'),
 1644             QKeySequence(self.tr("Alt+Shift+P")),
 1645             0, self,
 1646             'project_viewer_activate')
 1647         self.pbActivateAct.setStatusTip(self.tr(
 1648             "Switch the input focus to the Project-Viewer window."))
 1649         self.pbActivateAct.setWhatsThis(self.tr(
 1650             """<b>Activate Project-Viewer</b>"""
 1651             """<p>This switches the input focus to the Project-Viewer"""
 1652             """ window.</p>"""
 1653         ))
 1654         self.pbActivateAct.triggered.connect(self.__activateProjectBrowser)
 1655         self.actions.append(self.pbActivateAct)
 1656         self.addAction(self.pbActivateAct)
 1657 
 1658         self.mpbActivateAct = E5Action(
 1659             self.tr('Multiproject-Viewer'),
 1660             self.tr('&Multiproject-Viewer'),
 1661             QKeySequence(self.tr("Alt+Shift+M")),
 1662             0, self,
 1663             'multi_project_viewer_activate')
 1664         self.mpbActivateAct.setStatusTip(self.tr(
 1665             "Switch the input focus to the Multiproject-Viewer window."))
 1666         self.mpbActivateAct.setWhatsThis(self.tr(
 1667             """<b>Activate Multiproject-Viewer</b>"""
 1668             """<p>This switches the input focus to the Multiproject-Viewer"""
 1669             """ window.</p>"""
 1670         ))
 1671         self.mpbActivateAct.triggered.connect(
 1672             self.__activateMultiProjectBrowser)
 1673         self.actions.append(self.mpbActivateAct)
 1674         self.addAction(self.mpbActivateAct)
 1675 
 1676         self.debugViewerActivateAct = E5Action(
 1677             self.tr('Debug-Viewer'),
 1678             self.tr('&Debug-Viewer'),
 1679             QKeySequence(self.tr("Alt+Shift+D")),
 1680             0, self,
 1681             'debug_viewer_activate')
 1682         self.debugViewerActivateAct.setStatusTip(self.tr(
 1683             "Switch the input focus to the Debug-Viewer window."))
 1684         self.debugViewerActivateAct.setWhatsThis(self.tr(
 1685             """<b>Activate Debug-Viewer</b>"""
 1686             """<p>This switches the input focus to the Debug-Viewer"""
 1687             """ window.</p>"""
 1688         ))
 1689         self.debugViewerActivateAct.triggered.connect(
 1690             self.activateDebugViewer)
 1691         self.actions.append(self.debugViewerActivateAct)
 1692         self.addAction(self.debugViewerActivateAct)
 1693 
 1694         self.shellActivateAct = E5Action(
 1695             self.tr('Shell'),
 1696             self.tr('&Shell'),
 1697             QKeySequence(self.tr("Alt+Shift+S")),
 1698             0, self,
 1699             'interpreter_shell_activate')
 1700         self.shellActivateAct.setStatusTip(self.tr(
 1701             "Switch the input focus to the Shell window."))
 1702         self.shellActivateAct.setWhatsThis(self.tr(
 1703             """<b>Activate Shell</b>"""
 1704             """<p>This switches the input focus to the Shell window.</p>"""
 1705         ))
 1706         self.shellActivateAct.triggered.connect(self.__activateShell)
 1707         self.actions.append(self.shellActivateAct)
 1708         self.addAction(self.shellActivateAct)
 1709         
 1710         if self.browser is not None:
 1711             self.browserActivateAct = E5Action(
 1712                 self.tr('File-Browser'),
 1713                 self.tr('&File-Browser'),
 1714                 QKeySequence(self.tr("Alt+Shift+F")),
 1715                 0, self,
 1716                 'file_browser_activate')
 1717             self.browserActivateAct.setStatusTip(self.tr(
 1718                 "Switch the input focus to the File-Browser window."))
 1719             self.browserActivateAct.setWhatsThis(self.tr(
 1720                 """<b>Activate File-Browser</b>"""
 1721                 """<p>This switches the input focus to the File-Browser"""
 1722                 """ window.</p>"""
 1723             ))
 1724             self.browserActivateAct.triggered.connect(self.__activateBrowser)
 1725             self.actions.append(self.browserActivateAct)
 1726             self.addAction(self.browserActivateAct)
 1727 
 1728         self.logViewerActivateAct = E5Action(
 1729             self.tr('Log-Viewer'),
 1730             self.tr('Lo&g-Viewer'),
 1731             QKeySequence(self.tr("Alt+Shift+G")),
 1732             0, self,
 1733             'log_viewer_activate')
 1734         self.logViewerActivateAct.setStatusTip(self.tr(
 1735             "Switch the input focus to the Log-Viewer window."))
 1736         self.logViewerActivateAct.setWhatsThis(self.tr(
 1737             """<b>Activate Log-Viewer</b>"""
 1738             """<p>This switches the input focus to the Log-Viewer"""
 1739             """ window.</p>"""
 1740         ))
 1741         self.logViewerActivateAct.triggered.connect(
 1742             self.__activateLogViewer)
 1743         self.actions.append(self.logViewerActivateAct)
 1744         self.addAction(self.logViewerActivateAct)
 1745 
 1746         self.taskViewerActivateAct = E5Action(
 1747             self.tr('Task-Viewer'),
 1748             self.tr('&Task-Viewer'),
 1749             QKeySequence(self.tr("Alt+Shift+T")),
 1750             0, self,
 1751             'task_viewer_activate')
 1752         self.taskViewerActivateAct.setStatusTip(self.tr(
 1753             "Switch the input focus to the Task-Viewer window."))
 1754         self.taskViewerActivateAct.setWhatsThis(self.tr(
 1755             """<b>Activate Task-Viewer</b>"""
 1756             """<p>This switches the input focus to the Task-Viewer"""
 1757             """ window.</p>"""
 1758         ))
 1759         self.taskViewerActivateAct.triggered.connect(
 1760             self.__activateTaskViewer)
 1761         self.actions.append(self.taskViewerActivateAct)
 1762         self.addAction(self.taskViewerActivateAct)
 1763         
 1764         if self.templateViewer is not None:
 1765             self.templateViewerActivateAct = E5Action(
 1766                 self.tr('Template-Viewer'),
 1767                 self.tr('Templ&ate-Viewer'),
 1768                 QKeySequence(self.tr("Alt+Shift+A")),
 1769                 0, self,
 1770                 'template_viewer_activate')
 1771             self.templateViewerActivateAct.setStatusTip(self.tr(
 1772                 "Switch the input focus to the Template-Viewer window."))
 1773             self.templateViewerActivateAct.setWhatsThis(self.tr(
 1774                 """<b>Activate Template-Viewer</b>"""
 1775                 """<p>This switches the input focus to the Template-Viewer"""
 1776                 """ window.</p>"""
 1777             ))
 1778             self.templateViewerActivateAct.triggered.connect(
 1779                 self.__activateTemplateViewer)
 1780             self.actions.append(self.templateViewerActivateAct)
 1781             self.addAction(self.templateViewerActivateAct)
 1782 
 1783         self.ltAct = E5Action(
 1784             self.tr('Left Toolbox'),
 1785             self.tr('&Left Toolbox'), 0, 0, self, 'vertical_toolbox', True)
 1786         self.ltAct.setStatusTip(self.tr('Toggle the Left Toolbox window'))
 1787         self.ltAct.setWhatsThis(self.tr(
 1788             """<b>Toggle the Left Toolbox window</b>"""
 1789             """<p>If the Left Toolbox window is hidden then display it."""
 1790             """ If it is displayed then close it.</p>"""
 1791         ))
 1792         self.ltAct.triggered.connect(self.__toggleLeftToolbox)
 1793         self.actions.append(self.ltAct)
 1794         
 1795         self.rtAct = E5Action(
 1796             self.tr('Right Toolbox'),
 1797             self.tr('&Right Toolbox'),
 1798             0, 0, self, 'vertical_toolbox', True)
 1799         self.rtAct.setStatusTip(self.tr('Toggle the Right Toolbox window'))
 1800         self.rtAct.setWhatsThis(self.tr(
 1801             """<b>Toggle the Right Toolbox window</b>"""
 1802             """<p>If the Right Toolbox window is hidden then display it."""
 1803             """ If it is displayed then close it.</p>"""
 1804         ))
 1805         self.rtAct.triggered.connect(self.__toggleRightToolbox)
 1806         self.actions.append(self.rtAct)
 1807         
 1808         self.htAct = E5Action(
 1809             self.tr('Horizontal Toolbox'),
 1810             self.tr('&Horizontal Toolbox'), 0, 0, self,
 1811             'horizontal_toolbox', True)
 1812         self.htAct.setStatusTip(self.tr(
 1813             'Toggle the Horizontal Toolbox window'))
 1814         self.htAct.setWhatsThis(self.tr(
 1815             """<b>Toggle the Horizontal Toolbox window</b>"""
 1816             """<p>If the Horizontal Toolbox window is hidden then display"""
 1817             """ it. If it is displayed then close it.</p>"""
 1818         ))
 1819         self.htAct.triggered.connect(self.__toggleHorizontalToolbox)
 1820         self.actions.append(self.htAct)
 1821         
 1822         self.lsbAct = E5Action(
 1823             self.tr('Left Sidebar'),
 1824             self.tr('&Left Sidebar'),
 1825             0, 0, self, 'left_sidebar', True)
 1826         self.lsbAct.setStatusTip(self.tr('Toggle the left sidebar window'))
 1827         self.lsbAct.setWhatsThis(self.tr(
 1828             """<b>Toggle the left sidebar window</b>"""
 1829             """<p>If the left sidebar window is hidden then display it."""
 1830             """ If it is displayed then close it.</p>"""
 1831         ))
 1832         self.lsbAct.triggered.connect(self.__toggleLeftSidebar)
 1833         self.actions.append(self.lsbAct)
 1834         
 1835         self.rsbAct = E5Action(
 1836             self.tr('Right Sidebar'),
 1837             self.tr('&Right Sidebar'),
 1838             0, 0, self, 'right_sidebar', True)
 1839         self.rsbAct.setStatusTip(self.tr(
 1840             'Toggle the right sidebar window'))
 1841         self.rsbAct.setWhatsThis(self.tr(
 1842             """<b>Toggle the right sidebar window</b>"""
 1843             """<p>If the right sidebar window is hidden then display it."""
 1844             """ If it is displayed then close it.</p>"""
 1845         ))
 1846         self.rsbAct.triggered.connect(self.__toggleRightSidebar)
 1847         self.actions.append(self.rsbAct)
 1848         
 1849         self.bsbAct = E5Action(
 1850             self.tr('Bottom Sidebar'),
 1851             self.tr('&Bottom Sidebar'), 0, 0, self,
 1852             'bottom_sidebar', True)
 1853         self.bsbAct.setStatusTip(self.tr(
 1854             'Toggle the bottom sidebar window'))
 1855         self.bsbAct.setWhatsThis(self.tr(
 1856             """<b>Toggle the bottom sidebar window</b>"""
 1857             """<p>If the bottom sidebar window is hidden then display it."""
 1858             """ If it is displayed then close it.</p>"""
 1859         ))
 1860         self.bsbAct.triggered.connect(self.__toggleBottomSidebar)
 1861         self.actions.append(self.bsbAct)
 1862         
 1863         if self.cooperation is not None:
 1864             self.cooperationViewerActivateAct = E5Action(
 1865                 self.tr('Cooperation-Viewer'),
 1866                 self.tr('Co&operation-Viewer'),
 1867                 QKeySequence(self.tr("Alt+Shift+O")),
 1868                 0, self,
 1869                 'cooperation_viewer_activate')
 1870             self.cooperationViewerActivateAct.setStatusTip(self.tr(
 1871                 "Switch the input focus to the Cooperation-Viewer window."))
 1872             self.cooperationViewerActivateAct.setWhatsThis(self.tr(
 1873                 """<b>Activate Cooperation-Viewer</b>"""
 1874                 """<p>This switches the input focus to the"""
 1875                 """ Cooperation-Viewer window.</p>"""
 1876             ))
 1877             self.cooperationViewerActivateAct.triggered.connect(
 1878                 self.activateCooperationViewer)
 1879             self.actions.append(self.cooperationViewerActivateAct)
 1880             self.addAction(self.cooperationViewerActivateAct)
 1881         
 1882         if self.irc is not None:
 1883             self.ircActivateAct = E5Action(
 1884                 self.tr('IRC'),
 1885                 self.tr('&IRC'),
 1886                 QKeySequence(self.tr("Ctrl+Alt+Shift+I")),
 1887                 0, self,
 1888                 'irc_widget_activate')
 1889             self.ircActivateAct.setStatusTip(self.tr(
 1890                 "Switch the input focus to the IRC window."))
 1891             self.ircActivateAct.setWhatsThis(self.tr(
 1892                 """<b>Activate IRC</b>"""
 1893                 """<p>This switches the input focus to the IRC window.</p>"""
 1894             ))
 1895             self.ircActivateAct.triggered.connect(
 1896                 self.__activateIRC)
 1897             self.actions.append(self.ircActivateAct)
 1898             self.addAction(self.ircActivateAct)
 1899         
 1900         if self.symbolsViewer is not None:
 1901             self.symbolsViewerActivateAct = E5Action(
 1902                 self.tr('Symbols-Viewer'),
 1903                 self.tr('S&ymbols-Viewer'),
 1904                 QKeySequence(self.tr("Alt+Shift+Y")),
 1905                 0, self,
 1906                 'symbols_viewer_activate')
 1907             self.symbolsViewerActivateAct.setStatusTip(self.tr(
 1908                 "Switch the input focus to the Symbols-Viewer window."))
 1909             self.symbolsViewerActivateAct.setWhatsThis(self.tr(
 1910                 """<b>Activate Symbols-Viewer</b>"""
 1911                 """<p>This switches the input focus to the Symbols-Viewer"""
 1912                 """ window.</p>"""
 1913             ))
 1914             self.symbolsViewerActivateAct.triggered.connect(
 1915                 self.__activateSymbolsViewer)
 1916             self.actions.append(self.symbolsViewerActivateAct)
 1917             self.addAction(self.symbolsViewerActivateAct)
 1918         
 1919         if self.numbersViewer is not None:
 1920             self.numbersViewerActivateAct = E5Action(
 1921                 self.tr('Numbers-Viewer'),
 1922                 self.tr('Num&bers-Viewer'),
 1923                 QKeySequence(self.tr("Alt+Shift+B")),
 1924                 0, self,
 1925                 'numbers_viewer_activate')
 1926             self.numbersViewerActivateAct.setStatusTip(self.tr(
 1927                 "Switch the input focus to the Numbers-Viewer window."))
 1928             self.numbersViewerActivateAct.setWhatsThis(self.tr(
 1929                 """<b>Activate Numbers-Viewer</b>"""
 1930                 """<p>This switches the input focus to the Numbers-Viewer"""
 1931                 """ window.</p>"""
 1932             ))
 1933             self.numbersViewerActivateAct.triggered.connect(
 1934                 self.__activateNumbersViewer)
 1935             self.actions.append(self.numbersViewerActivateAct)
 1936             self.addAction(self.numbersViewerActivateAct)
 1937         
 1938         if self.codeDocumentationViewer is not None:
 1939             self.codeDocumentationViewerActivateAct = E5Action(
 1940                 self.tr('Code Documentation Viewer'),
 1941                 self.tr('Code Documentation Viewer'),
 1942                 QKeySequence(self.tr("Ctrl+Alt+Shift+D")),
 1943                 0, self,
 1944                 'code_documentation_viewer_activate')
 1945             self.codeDocumentationViewerActivateAct.setStatusTip(self.tr(
 1946                 "Switch the input focus to the Code Documentation Viewer"
 1947                 " window."))
 1948             self.codeDocumentationViewerActivateAct.setWhatsThis(self.tr(
 1949                 """<b>Code Documentation Viewer</b>"""
 1950                 """<p>This switches the input focus to the Code"""
 1951                 """ Documentation Viewer window.</p>"""
 1952             ))
 1953             self.codeDocumentationViewerActivateAct.triggered.connect(
 1954                 self.activateCodeDocumentationViewer)
 1955             self.actions.append(self.codeDocumentationViewerActivateAct)
 1956             self.addAction(self.codeDocumentationViewerActivateAct)
 1957         
 1958         if self.pipWidget is not None:
 1959             self.pipWidgetActivateAct = E5Action(
 1960                 self.tr('PyPI'),
 1961                 self.tr('PyPI'),
 1962                 QKeySequence(self.tr("Ctrl+Alt+Shift+P")),
 1963                 0, self,
 1964                 'pip_widget_activate')
 1965             self.pipWidgetActivateAct.setStatusTip(self.tr(
 1966                 "Switch the input focus to the PyPI window."))
 1967             self.pipWidgetActivateAct.setWhatsThis(self.tr(
 1968                 """<b>PyPI</b>"""
 1969                 """<p>This switches the input focus to the PyPI window.</p>"""
 1970             ))
 1971             self.pipWidgetActivateAct.triggered.connect(
 1972                 self.__activatePipWidget)
 1973             self.actions.append(self.pipWidgetActivateAct)
 1974             self.addAction(self.pipWidgetActivateAct)
 1975         
 1976         if self.condaWidget is not None:
 1977             self.condaWidgetActivateAct = E5Action(
 1978                 self.tr('Conda'),
 1979                 self.tr('Conda'),
 1980                 QKeySequence(self.tr("Ctrl+Alt+Shift+C")),
 1981                 0, self,
 1982                 'conda_widget_activate')
 1983             self.condaWidgetActivateAct.setStatusTip(self.tr(
 1984                 "Switch the input focus to the Conda window."))
 1985             self.condaWidgetActivateAct.setWhatsThis(self.tr(
 1986                 """<b>Conda</b>"""
 1987                 """<p>This switches the input focus to the Conda window.</p>"""
 1988             ))
 1989             self.condaWidgetActivateAct.triggered.connect(
 1990                 self.__activateCondaWidget)
 1991             self.actions.append(self.condaWidgetActivateAct)
 1992             self.addAction(self.condaWidgetActivateAct)
 1993         
 1994         if self.microPythonWidget is not None:
 1995             self.microPythonWidgetActivateAct = E5Action(
 1996                 self.tr('MicroPython'),
 1997                 self.tr('MicroPython'),
 1998                 QKeySequence(self.tr("Ctrl+Alt+Shift+M")),
 1999                 0, self,
 2000                 'micropython_widget_activate')
 2001             self.microPythonWidgetActivateAct.setStatusTip(self.tr(
 2002                 "Switch the input focus to the MicroPython window."))
 2003             self.microPythonWidgetActivateAct.setWhatsThis(self.tr(
 2004                 """<b>MicroPython</b>"""
 2005                 """<p>This switches the input focus to the MicroPython"""
 2006                 """ window.</p>"""
 2007             ))
 2008             self.microPythonWidgetActivateAct.triggered.connect(
 2009                 self.__activateMicroPython)
 2010             self.actions.append(self.microPythonWidgetActivateAct)
 2011             self.addAction(self.microPythonWidgetActivateAct)
 2012         
 2013         self.whatsThisAct = E5Action(
 2014             self.tr('What\'s This?'),
 2015             UI.PixmapCache.getIcon("whatsThis"),
 2016             self.tr('&What\'s This?'),
 2017             QKeySequence(self.tr("Shift+F1")),
 2018             0, self, 'whatsThis')
 2019         self.whatsThisAct.setStatusTip(self.tr('Context sensitive help'))
 2020         self.whatsThisAct.setWhatsThis(self.tr(
 2021             """<b>Display context sensitive help</b>"""
 2022             """<p>In What's This? mode, the mouse cursor shows an arrow with"""
 2023             """ a question mark, and you can click on the interface elements"""
 2024             """ to get a short description of what they do and how to use"""
 2025             """ them. In dialogs, this feature can be accessed using the"""
 2026             """ context help button in the titlebar.</p>"""
 2027         ))
 2028         self.whatsThisAct.triggered.connect(self.__whatsThis)
 2029         self.actions.append(self.whatsThisAct)
 2030 
 2031         self.helpviewerAct = E5Action(
 2032             self.tr('Helpviewer'),
 2033             UI.PixmapCache.getIcon("help"),
 2034             self.tr('&Helpviewer...'),
 2035             QKeySequence(self.tr("F1")),
 2036             0, self, 'helpviewer')
 2037         self.helpviewerAct.setStatusTip(self.tr(
 2038             'Open the helpviewer window'))
 2039         self.helpviewerAct.setWhatsThis(self.tr(
 2040             """<b>Helpviewer</b>"""
 2041             """<p>Display the eric6 web browser. This window will show"""
 2042             """ HTML help files and help from Qt help collections. It"""
 2043             """ has the capability to navigate to links, set bookmarks,"""
 2044             """ print the displayed help and some more features. You may"""
 2045             """ use it to browse the internet as well</p><p>If called"""
 2046             """ with a word selected, this word is search in the Qt help"""
 2047             """ collection.</p>"""
 2048         ))
 2049         self.helpviewerAct.triggered.connect(self.__helpViewer)
 2050         self.actions.append(self.helpviewerAct)
 2051         
 2052         self.__initQtDocActions()
 2053         self.__initPythonDocActions()
 2054         self.__initEricDocAction()
 2055         self.__initPySideDocActions()
 2056       
 2057         self.versionAct = E5Action(
 2058             self.tr('Show Versions'),
 2059             self.tr('Show &Versions'),
 2060             0, 0, self, 'show_versions')
 2061         self.versionAct.setStatusTip(self.tr(
 2062             'Display version information'))
 2063         self.versionAct.setWhatsThis(self.tr(
 2064             """<b>Show Versions</b>"""
 2065             """<p>Display version information.</p>"""
 2066         ))
 2067         self.versionAct.triggered.connect(self.__showVersions)
 2068         self.actions.append(self.versionAct)
 2069 
 2070         self.checkUpdateAct = E5Action(
 2071             self.tr('Check for Updates'),
 2072             self.tr('Check for &Updates...'), 0, 0, self, 'check_updates')
 2073         self.checkUpdateAct.setStatusTip(self.tr('Check for Updates'))
 2074         self.checkUpdateAct.setWhatsThis(self.tr(
 2075             """<b>Check for Updates...</b>"""
 2076             """<p>Checks the internet for updates of eric6.</p>"""
 2077         ))
 2078         self.checkUpdateAct.triggered.connect(self.performVersionCheck)
 2079         self.actions.append(self.checkUpdateAct)
 2080     
 2081         self.showVersionsAct = E5Action(
 2082             self.tr('Show downloadable versions'),
 2083             self.tr('Show &downloadable versions...'),
 2084             0, 0, self, 'show_downloadable_versions')
 2085         self.showVersionsAct.setStatusTip(
 2086             self.tr('Show the versions available for download'))
 2087         self.showVersionsAct.setWhatsThis(self.tr(
 2088             """<b>Show downloadable versions...</b>"""
 2089             """<p>Shows the eric6 versions available for download """
 2090             """from the internet.</p>"""
 2091         ))
 2092         self.showVersionsAct.triggered.connect(
 2093             self.showAvailableVersionsInfo)
 2094         self.actions.append(self.showVersionsAct)
 2095 
 2096         self.showErrorLogAct = E5Action(
 2097             self.tr('Show Error Log'),
 2098             self.tr('Show Error &Log...'),
 2099             0, 0, self, 'show_error_log')
 2100         self.showErrorLogAct.setStatusTip(self.tr('Show Error Log'))
 2101         self.showErrorLogAct.setWhatsThis(self.tr(
 2102             """<b>Show Error Log...</b>"""
 2103             """<p>Opens a dialog showing the most recent error log.</p>"""
 2104         ))
 2105         self.showErrorLogAct.triggered.connect(self.__showErrorLog)
 2106         self.actions.append(self.showErrorLogAct)
 2107         
 2108         self.reportBugAct = E5Action(
 2109             self.tr('Report Bug'),
 2110             self.tr('Report &Bug...'),
 2111             0, 0, self, 'report_bug')
 2112         self.reportBugAct.setStatusTip(self.tr('Report a bug'))
 2113         self.reportBugAct.setWhatsThis(self.tr(
 2114             """<b>Report Bug...</b>"""
 2115             """<p>Opens a dialog to report a bug.</p>"""
 2116         ))
 2117         self.reportBugAct.triggered.connect(self.__reportBug)
 2118         self.actions.append(self.reportBugAct)
 2119         
 2120         self.requestFeatureAct = E5Action(
 2121             self.tr('Request Feature'),
 2122             self.tr('Request &Feature...'),
 2123             0, 0, self, 'request_feature')
 2124         self.requestFeatureAct.setStatusTip(self.tr(
 2125             'Send a feature request'))
 2126         self.requestFeatureAct.setWhatsThis(self.tr(
 2127             """<b>Request Feature...</b>"""
 2128             """<p>Opens a dialog to send a feature request.</p>"""
 2129         ))
 2130         self.requestFeatureAct.triggered.connect(self.__requestFeature)
 2131         self.actions.append(self.requestFeatureAct)
 2132 
 2133         self.utActGrp = createActionGroup(self)
 2134         
 2135         self.utDialogAct = E5Action(
 2136             self.tr('Unittest'),
 2137             UI.PixmapCache.getIcon("unittest"),
 2138             self.tr('&Unittest...'),
 2139             0, 0, self.utActGrp, 'unittest')
 2140         self.utDialogAct.setStatusTip(self.tr('Start unittest dialog'))
 2141         self.utDialogAct.setWhatsThis(self.tr(
 2142             """<b>Unittest</b>"""
 2143             """<p>Perform unit tests. The dialog gives you the"""
 2144             """ ability to select and run a unittest suite.</p>"""
 2145         ))
 2146         self.utDialogAct.triggered.connect(self.__unittest)
 2147         self.actions.append(self.utDialogAct)
 2148 
 2149         self.utRestartAct = E5Action(
 2150             self.tr('Unittest Restart'),
 2151             UI.PixmapCache.getIcon("unittestRestart"),
 2152             self.tr('&Restart Unittest...'),
 2153             0, 0, self.utActGrp, 'unittest_restart')
 2154         self.utRestartAct.setStatusTip(self.tr('Restart last unittest'))
 2155         self.utRestartAct.setWhatsThis(self.tr(
 2156             """<b>Restart Unittest</b>"""
 2157             """<p>Restart the unittest performed last.</p>"""
 2158         ))
 2159         self.utRestartAct.triggered.connect(self.__unittestRestart)
 2160         self.utRestartAct.setEnabled(False)
 2161         self.actions.append(self.utRestartAct)
 2162         
 2163         self.utRerunFailedAct = E5Action(
 2164             self.tr('Unittest Rerun Failed'),
 2165             UI.PixmapCache.getIcon("unittestRerunFailed"),
 2166             self.tr('Rerun Failed Tests...'),
 2167             0, 0, self.utActGrp, 'unittest_rerun_failed')
 2168         self.utRerunFailedAct.setStatusTip(self.tr(
 2169             'Rerun failed tests of the last run'))
 2170         self.utRerunFailedAct.setWhatsThis(self.tr(
 2171             """<b>Rerun Failed Tests</b>"""
 2172             """<p>Rerun all tests that failed during the last unittest"""
 2173             """ run.</p>"""
 2174         ))
 2175         self.utRerunFailedAct.triggered.connect(self.__unittestRerunFailed)
 2176         self.utRerunFailedAct.setEnabled(False)
 2177         self.actions.append(self.utRerunFailedAct)
 2178         
 2179         self.utScriptAct = E5Action(
 2180             self.tr('Unittest Script'),
 2181             UI.PixmapCache.getIcon("unittestScript"),
 2182             self.tr('Unittest &Script...'),
 2183             0, 0, self.utActGrp, 'unittest_script')
 2184         self.utScriptAct.setStatusTip(self.tr(
 2185             'Run unittest with current script'))
 2186         self.utScriptAct.setWhatsThis(self.tr(
 2187             """<b>Unittest Script</b>"""
 2188             """<p>Run unittest with current script.</p>"""
 2189         ))
 2190         self.utScriptAct.triggered.connect(self.__unittestScript)
 2191         self.utScriptAct.setEnabled(False)
 2192         self.actions.append(self.utScriptAct)
 2193         
 2194         self.utProjectAct = E5Action(
 2195             self.tr('Unittest Project'),
 2196             UI.PixmapCache.getIcon("unittestProject"),
 2197             self.tr('Unittest &Project...'),
 2198             0, 0, self.utActGrp, 'unittest_project')
 2199         self.utProjectAct.setStatusTip(self.tr(
 2200             'Run unittest with current project'))
 2201         self.utProjectAct.setWhatsThis(self.tr(
 2202             """<b>Unittest Project</b>"""
 2203             """<p>Run unittest with current project.</p>"""
 2204         ))
 2205         self.utProjectAct.triggered.connect(self.__unittestProject)
 2206         self.utProjectAct.setEnabled(False)
 2207         self.actions.append(self.utProjectAct)
 2208         
 2209         # check for Qt5 designer and linguist
 2210         if Utilities.isWindowsPlatform():
 2211             designerExe = os.path.join(
 2212                 Utilities.getQtBinariesPath(),
 2213                 "{0}.exe".format(Utilities.generateQtToolName("designer")))
 2214         elif Utilities.isMacPlatform():
 2215             designerExe = Utilities.getQtMacBundle("designer")
 2216         else:
 2217             designerExe = os.path.join(
 2218                 Utilities.getQtBinariesPath(),
 2219                 Utilities.generateQtToolName("designer"))
 2220         if os.path.exists(designerExe):
 2221             self.designer4Act = E5Action(
 2222                 self.tr('Qt-Designer'),
 2223                 UI.PixmapCache.getIcon("designer4"),
 2224                 self.tr('Qt-&Designer...'),
 2225                 0, 0, self, 'qt_designer4')
 2226             self.designer4Act.setStatusTip(self.tr('Start Qt-Designer'))
 2227             self.designer4Act.setWhatsThis(self.tr(
 2228                 """<b>Qt-Designer</b>"""
 2229                 """<p>Start Qt-Designer.</p>"""
 2230             ))
 2231             self.designer4Act.triggered.connect(self.__designer)
 2232             self.actions.append(self.designer4Act)
 2233         else:
 2234             self.designer4Act = None
 2235         
 2236         if Utilities.isWindowsPlatform():
 2237             linguistExe = os.path.join(
 2238                 Utilities.getQtBinariesPath(),
 2239                 "{0}.exe".format(Utilities.generateQtToolName("linguist")))
 2240         elif Utilities.isMacPlatform():
 2241             linguistExe = Utilities.getQtMacBundle("linguist")
 2242         else:
 2243             linguistExe = os.path.join(
 2244                 Utilities.getQtBinariesPath(),
 2245                 Utilities.generateQtToolName("linguist"))
 2246         if os.path.exists(linguistExe):
 2247             self.linguist4Act = E5Action(
 2248                 self.tr('Qt-Linguist'),
 2249                 UI.PixmapCache.getIcon("linguist4"),
 2250                 self.tr('Qt-&Linguist...'),
 2251                 0, 0, self, 'qt_linguist4')
 2252             self.linguist4Act.setStatusTip(self.tr('Start Qt-Linguist'))
 2253             self.linguist4Act.setWhatsThis(self.tr(
 2254                 """<b>Qt-Linguist</b>"""
 2255                 """<p>Start Qt-Linguist.</p>"""
 2256             ))
 2257             self.linguist4Act.triggered.connect(self.__linguist)
 2258             self.actions.append(self.linguist4Act)
 2259         else:
 2260             self.linguist4Act = None
 2261     
 2262         self.uipreviewerAct = E5Action(
 2263             self.tr('UI Previewer'),
 2264             UI.PixmapCache.getIcon("uiPreviewer"),
 2265             self.tr('&UI Previewer...'),
 2266             0, 0, self, 'ui_previewer')
 2267         self.uipreviewerAct.setStatusTip(self.tr('Start the UI Previewer'))
 2268         self.uipreviewerAct.setWhatsThis(self.tr(
 2269             """<b>UI Previewer</b>"""
 2270             """<p>Start the UI Previewer.</p>"""
 2271         ))
 2272         self.uipreviewerAct.triggered.connect(self.__UIPreviewer)
 2273         self.actions.append(self.uipreviewerAct)
 2274         
 2275         self.trpreviewerAct = E5Action(
 2276             self.tr('Translations Previewer'),
 2277             UI.PixmapCache.getIcon("trPreviewer"),
 2278             self.tr('&Translations Previewer...'),
 2279             0, 0, self, 'tr_previewer')
 2280         self.trpreviewerAct.setStatusTip(self.tr(
 2281             'Start the Translations Previewer'))
 2282         self.trpreviewerAct.setWhatsThis(self.tr(
 2283             """<b>Translations Previewer</b>"""
 2284             """<p>Start the Translations Previewer.</p>"""
 2285         ))
 2286         self.trpreviewerAct.triggered.connect(self.__TRPreviewer)
 2287         self.actions.append(self.trpreviewerAct)
 2288         
 2289         self.diffAct = E5Action(
 2290             self.tr('Compare Files'),
 2291             UI.PixmapCache.getIcon("diffFiles"),
 2292             self.tr('&Compare Files...'),
 2293             0, 0, self, 'diff_files')
 2294         self.diffAct.setStatusTip(self.tr('Compare two files'))
 2295         self.diffAct.setWhatsThis(self.tr(
 2296             """<b>Compare Files</b>"""
 2297             """<p>Open a dialog to compare two files.</p>"""
 2298         ))
 2299         self.diffAct.triggered.connect(self.__compareFiles)
 2300         self.actions.append(self.diffAct)
 2301 
 2302         self.compareAct = E5Action(
 2303             self.tr('Compare Files side by side'),
 2304             UI.PixmapCache.getIcon("compareFiles"),
 2305             self.tr('Compare &Files side by side...'),
 2306             0, 0, self, 'compare_files')
 2307         self.compareAct.setStatusTip(self.tr('Compare two files'))
 2308         self.compareAct.setWhatsThis(self.tr(
 2309             """<b>Compare Files side by side</b>"""
 2310             """<p>Open a dialog to compare two files and show the result"""
 2311             """ side by side.</p>"""
 2312         ))
 2313         self.compareAct.triggered.connect(self.__compareFilesSbs)
 2314         self.actions.append(self.compareAct)
 2315 
 2316         self.sqlBrowserAct = E5Action(
 2317             self.tr('SQL Browser'),
 2318             UI.PixmapCache.getIcon("sqlBrowser"),
 2319             self.tr('SQL &Browser...'),
 2320             0, 0, self, 'sql_browser')
 2321         self.sqlBrowserAct.setStatusTip(self.tr('Browse a SQL database'))
 2322         self.sqlBrowserAct.setWhatsThis(self.tr(
 2323             """<b>SQL Browser</b>"""
 2324             """<p>Browse a SQL database.</p>"""
 2325         ))
 2326         self.sqlBrowserAct.triggered.connect(self.__sqlBrowser)
 2327         self.actions.append(self.sqlBrowserAct)
 2328 
 2329         self.miniEditorAct = E5Action(
 2330             self.tr('Mini Editor'),
 2331             UI.PixmapCache.getIcon("editor"),
 2332             self.tr('Mini &Editor...'),
 2333             0, 0, self, 'mini_editor')
 2334         self.miniEditorAct.setStatusTip(self.tr('Mini Editor'))
 2335         self.miniEditorAct.setWhatsThis(self.tr(
 2336             """<b>Mini Editor</b>"""
 2337             """<p>Open a dialog with a simplified editor.</p>"""
 2338         ))
 2339         self.miniEditorAct.triggered.connect(self.__openMiniEditor)
 2340         self.actions.append(self.miniEditorAct)
 2341 
 2342         self.hexEditorAct = E5Action(
 2343             self.tr('Hex Editor'),
 2344             UI.PixmapCache.getIcon("hexEditor"),
 2345             self.tr('&Hex Editor...'),
 2346             0, 0, self, 'hex_editor')
 2347         self.hexEditorAct.setStatusTip(self.tr(
 2348             'Start the eric6 Hex Editor'))
 2349         self.hexEditorAct.setWhatsThis(self.tr(
 2350             """<b>Hex Editor</b>"""
 2351             """<p>Starts the eric6 Hex Editor for viewing or editing"""
 2352             """ binary files.</p>"""
 2353         ))
 2354         self.hexEditorAct.triggered.connect(self.__openHexEditor)
 2355         self.actions.append(self.hexEditorAct)
 2356 
 2357         self.webBrowserAct = E5Action(
 2358             self.tr('eric6 Web Browser'),
 2359             UI.PixmapCache.getIcon("ericWeb"),
 2360             self.tr('eric6 &Web Browser...'),
 2361             0, 0, self, 'web_browser')
 2362         self.webBrowserAct.setStatusTip(self.tr(
 2363             'Start the eric6 Web Browser'))
 2364         self.webBrowserAct.setWhatsThis(self.tr(
 2365             """<b>eric6 Web Browser</b>"""
 2366             """<p>Browse the Internet with the eric6 Web Browser.</p>"""
 2367         ))
 2368         self.webBrowserAct.triggered.connect(self.__startWebBrowser)
 2369         self.actions.append(self.webBrowserAct)
 2370 ##        else:
 2371 ##            self.webBrowserAct = None
 2372 
 2373         self.iconEditorAct = E5Action(
 2374             self.tr('Icon Editor'),
 2375             UI.PixmapCache.getIcon("iconEditor"),
 2376             self.tr('&Icon Editor...'),
 2377             0, 0, self, 'icon_editor')
 2378         self.iconEditorAct.setStatusTip(self.tr(
 2379             'Start the eric6 Icon Editor'))
 2380         self.iconEditorAct.setWhatsThis(self.tr(
 2381             """<b>Icon Editor</b>"""
 2382             """<p>Starts the eric6 Icon Editor for editing simple icons.</p>"""
 2383         ))
 2384         self.iconEditorAct.triggered.connect(self.__editPixmap)
 2385         self.actions.append(self.iconEditorAct)
 2386 
 2387         self.snapshotAct = E5Action(
 2388             self.tr('Snapshot'),
 2389             UI.PixmapCache.getIcon("ericSnap"),
 2390             self.tr('&Snapshot...'),
 2391             0, 0, self, 'snapshot')
 2392         self.snapshotAct.setStatusTip(self.tr(
 2393             'Take snapshots of a screen region'))
 2394         self.snapshotAct.setWhatsThis(self.tr(
 2395             """<b>Snapshot</b>"""
 2396             """<p>This opens a dialog to take snapshots of a screen"""
 2397             """ region.</p>"""
 2398         ))
 2399         self.snapshotAct.triggered.connect(self.__snapshot)
 2400         self.actions.append(self.snapshotAct)
 2401 
 2402         self.prefAct = E5Action(
 2403             self.tr('Preferences'),
 2404             UI.PixmapCache.getIcon("configure"),
 2405             self.tr('&Preferences...'),
 2406             0, 0, self, 'preferences')
 2407         self.prefAct.setStatusTip(self.tr(
 2408             'Set the prefered configuration'))
 2409         self.prefAct.setWhatsThis(self.tr(
 2410             """<b>Preferences</b>"""
 2411             """<p>Set the configuration items of the application"""
 2412             """ with your prefered values.</p>"""
 2413         ))
 2414         self.prefAct.triggered.connect(self.showPreferences)
 2415         self.prefAct.setMenuRole(QAction.PreferencesRole)
 2416         self.actions.append(self.prefAct)
 2417 
 2418         self.prefExportAct = E5Action(
 2419             self.tr('Export Preferences'),
 2420             UI.PixmapCache.getIcon("configureExport"),
 2421             self.tr('E&xport Preferences...'),
 2422             0, 0, self, 'export_preferences')
 2423         self.prefExportAct.setStatusTip(self.tr(
 2424             'Export the current configuration'))
 2425         self.prefExportAct.setWhatsThis(self.tr(
 2426             """<b>Export Preferences</b>"""
 2427             """<p>Export the current configuration to a file.</p>"""
 2428         ))
 2429         self.prefExportAct.triggered.connect(self.__exportPreferences)
 2430         self.actions.append(self.prefExportAct)
 2431 
 2432         self.prefImportAct = E5Action(
 2433             self.tr('Import Preferences'),
 2434             UI.PixmapCache.getIcon("configureImport"),
 2435             self.tr('I&mport Preferences...'),
 2436             0, 0, self, 'import_preferences')
 2437         self.prefImportAct.setStatusTip(self.tr(
 2438             'Import a previously exported configuration'))
 2439         self.prefImportAct.setWhatsThis(self.tr(
 2440             """<b>Import Preferences</b>"""
 2441             """<p>Import a previously exported configuration.</p>"""
 2442         ))
 2443         self.prefImportAct.triggered.connect(self.__importPreferences)
 2444         self.actions.append(self.prefImportAct)
 2445 
 2446         self.reloadAPIsAct = E5Action(
 2447             self.tr('Reload APIs'),
 2448             self.tr('Reload &APIs'),
 2449             0, 0, self, 'reload_apis')
 2450         self.reloadAPIsAct.setStatusTip(self.tr(
 2451             'Reload the API information'))
 2452         self.reloadAPIsAct.setWhatsThis(self.tr(
 2453             """<b>Reload APIs</b>"""
 2454             """<p>Reload the API information.</p>"""
 2455         ))
 2456         self.reloadAPIsAct.triggered.connect(self.__reloadAPIs)
 2457         self.actions.append(self.reloadAPIsAct)
 2458 
 2459         self.showExternalToolsAct = E5Action(
 2460             self.tr('Show external tools'),
 2461             UI.PixmapCache.getIcon("showPrograms"),
 2462             self.tr('Show external &tools'),
 2463             0, 0, self, 'show_external_tools')
 2464         self.showExternalToolsAct.setStatusTip(self.tr(
 2465             'Show external tools'))
 2466         self.showExternalToolsAct.setWhatsThis(self.tr(
 2467             """<b>Show external tools</b>"""
 2468             """<p>Opens a dialog to show the path and versions of all"""
 2469             """ extenal tools used by eric6.</p>"""
 2470         ))
 2471         self.showExternalToolsAct.triggered.connect(
 2472             self.__showExternalTools)
 2473         self.actions.append(self.showExternalToolsAct)
 2474 
 2475         self.configViewProfilesAct = E5Action(
 2476             self.tr('View Profiles'),
 2477             UI.PixmapCache.getIcon("configureViewProfiles"),
 2478             self.tr('&View Profiles...'),
 2479             0, 0, self, 'view_profiles')
 2480         self.configViewProfilesAct.setStatusTip(self.tr(
 2481             'Configure view profiles'))
 2482         self.configViewProfilesAct.setWhatsThis(self.tr(
 2483             """<b>View Profiles</b>"""
 2484             """<p>Configure the view profiles. With this dialog you may"""
 2485             """ set the visibility of the various windows for the"""
 2486             """ predetermined view profiles.</p>"""
 2487         ))
 2488         self.configViewProfilesAct.triggered.connect(
 2489             self.__configViewProfiles)
 2490         self.actions.append(self.configViewProfilesAct)
 2491 
 2492         self.configToolBarsAct = E5Action(
 2493             self.tr('Toolbars'),
 2494             UI.PixmapCache.getIcon("toolbarsConfigure"),
 2495             self.tr('Tool&bars...'),
 2496             0, 0, self, 'configure_toolbars')
 2497         self.configToolBarsAct.setStatusTip(self.tr('Configure toolbars'))
 2498         self.configToolBarsAct.setWhatsThis(self.tr(
 2499             """<b>Toolbars</b>"""
 2500             """<p>Configure the toolbars. With this dialog you may"""
 2501             """ change the actions shown on the various toolbars and"""
 2502             """ define your own toolbars.</p>"""
 2503         ))
 2504         self.configToolBarsAct.triggered.connect(self.__configToolBars)
 2505         self.actions.append(self.configToolBarsAct)
 2506 
 2507         self.shortcutsAct = E5Action(
 2508             self.tr('Keyboard Shortcuts'),
 2509             UI.PixmapCache.getIcon("configureShortcuts"),
 2510             self.tr('Keyboard &Shortcuts...'),
 2511             0, 0, self, 'keyboard_shortcuts')
 2512         self.shortcutsAct.setStatusTip(self.tr(
 2513             'Set the keyboard shortcuts'))
 2514         self.shortcutsAct.setWhatsThis(self.tr(
 2515             """<b>Keyboard Shortcuts</b>"""
 2516             """<p>Set the keyboard shortcuts of the application"""
 2517             """ with your prefered values.</p>"""
 2518         ))
 2519         self.shortcutsAct.triggered.connect(self.__configShortcuts)
 2520         self.actions.append(self.shortcutsAct)
 2521 
 2522         self.exportShortcutsAct = E5Action(
 2523             self.tr('Export Keyboard Shortcuts'),
 2524             UI.PixmapCache.getIcon("exportShortcuts"),
 2525             self.tr('&Export Keyboard Shortcuts...'),
 2526             0, 0, self, 'export_keyboard_shortcuts')
 2527         self.exportShortcutsAct.setStatusTip(self.tr(
 2528             'Export the keyboard shortcuts'))
 2529         self.exportShortcutsAct.setWhatsThis(self.tr(
 2530             """<b>Export Keyboard Shortcuts</b>"""
 2531             """<p>Export the keyboard shortcuts of the application.</p>"""
 2532         ))
 2533         self.exportShortcutsAct.triggered.connect(self.__exportShortcuts)
 2534         self.actions.append(self.exportShortcutsAct)
 2535 
 2536         self.importShortcutsAct = E5Action(
 2537             self.tr('Import Keyboard Shortcuts'),
 2538             UI.PixmapCache.getIcon("importShortcuts"),
 2539             self.tr('&Import Keyboard Shortcuts...'),
 2540             0, 0, self, 'import_keyboard_shortcuts')
 2541         self.importShortcutsAct.setStatusTip(self.tr(
 2542             'Import the keyboard shortcuts'))
 2543         self.importShortcutsAct.setWhatsThis(self.tr(
 2544             """<b>Import Keyboard Shortcuts</b>"""
 2545             """<p>Import the keyboard shortcuts of the application.</p>"""
 2546         ))
 2547         self.importShortcutsAct.triggered.connect(self.__importShortcuts)
 2548         self.actions.append(self.importShortcutsAct)
 2549 
 2550         if SSL_AVAILABLE:
 2551             self.certificatesAct = E5Action(
 2552                 self.tr('Manage SSL Certificates'),
 2553                 UI.PixmapCache.getIcon("certificates"),
 2554                 self.tr('Manage SSL Certificates...'),
 2555                 0, 0, self, 'manage_ssl_certificates')
 2556             self.certificatesAct.setStatusTip(self.tr(
 2557                 'Manage the saved SSL certificates'))
 2558             self.certificatesAct.setWhatsThis(self.tr(
 2559                 """<b>Manage SSL Certificates...</b>"""
 2560                 """<p>Opens a dialog to manage the saved SSL certificates."""
 2561                 """</p>"""
 2562             ))
 2563             self.certificatesAct.triggered.connect(
 2564                 self.__showCertificatesDialog)
 2565             self.actions.append(self.certificatesAct)
 2566         
 2567         self.editMessageFilterAct = E5Action(
 2568             self.tr('Edit Message Filters'),
 2569             UI.PixmapCache.getIcon("warning"),
 2570             self.tr('Edit Message Filters...'),
 2571             0, 0, self, 'manage_message_filters')
 2572         self.editMessageFilterAct.setStatusTip(self.tr(
 2573             'Edit the message filters used to suppress unwanted messages'))
 2574         self.editMessageFilterAct.setWhatsThis(self.tr(
 2575             """<b>Edit Message Filters</b>"""
 2576             """<p>Opens a dialog to edit the message filters used to"""
 2577             """ suppress unwanted messages been shown in an error"""
 2578             """ window.</p>"""
 2579         ))
 2580         self.editMessageFilterAct.triggered.connect(
 2581             E5ErrorMessage.editMessageFilters)
 2582         self.actions.append(self.editMessageFilterAct)
 2583 
 2584         self.clearPrivateDataAct = E5Action(
 2585             self.tr('Clear private data'),
 2586             UI.PixmapCache.getIcon("clearPrivateData"),
 2587             self.tr('Clear private data'),
 2588             0, 0,
 2589             self, 'clear_private_data')
 2590         self.clearPrivateDataAct.setStatusTip(self.tr(
 2591             'Clear private data'))
 2592         self.clearPrivateDataAct.setWhatsThis(self.tr(
 2593             """<b>Clear private data</b>"""
 2594             """<p>Clears the private data like the various list of"""
 2595             """ recently opened files, projects or multi projects.</p>"""
 2596         ))
 2597         self.clearPrivateDataAct.triggered.connect(
 2598             self.__clearPrivateData)
 2599         self.actions.append(self.clearPrivateDataAct)
 2600         
 2601         self.viewmanagerActivateAct = E5Action(
 2602             self.tr('Activate current editor'),
 2603             self.tr('Activate current editor'),
 2604             QKeySequence(self.tr("Alt+Shift+E")),
 2605             0, self, 'viewmanager_activate')
 2606         self.viewmanagerActivateAct.triggered.connect(
 2607             self.__activateViewmanager)
 2608         self.actions.append(self.viewmanagerActivateAct)
 2609         self.addAction(self.viewmanagerActivateAct)
 2610 
 2611         self.nextTabAct = E5Action(
 2612             self.tr('Show next'),
 2613             self.tr('Show next'),
 2614             QKeySequence(self.tr('Ctrl+Alt+Tab')), 0,
 2615             self, 'view_next_tab')
 2616         self.nextTabAct.triggered.connect(self.__showNext)
 2617         self.actions.append(self.nextTabAct)
 2618         self.addAction(self.nextTabAct)
 2619         
 2620         self.prevTabAct = E5Action(
 2621             self.tr('Show previous'),
 2622             self.tr('Show previous'),
 2623             QKeySequence(self.tr('Shift+Ctrl+Alt+Tab')), 0,
 2624             self, 'view_previous_tab')
 2625         self.prevTabAct.triggered.connect(self.__showPrevious)
 2626         self.actions.append(self.prevTabAct)
 2627         self.addAction(self.prevTabAct)
 2628         
 2629         self.switchTabAct = E5Action(
 2630             self.tr('Switch between tabs'),
 2631             self.tr('Switch between tabs'),
 2632             QKeySequence(self.tr('Ctrl+1')), 0,
 2633             self, 'switch_tabs')
 2634         self.switchTabAct.triggered.connect(self.__switchTab)
 2635         self.actions.append(self.switchTabAct)
 2636         self.addAction(self.switchTabAct)
 2637         
 2638         self.pluginInfoAct = E5Action(
 2639             self.tr('Plugin Infos'),
 2640             UI.PixmapCache.getIcon("plugin"),
 2641             self.tr('&Plugin Infos...'), 0, 0, self, 'plugin_infos')
 2642         self.pluginInfoAct.setStatusTip(self.tr('Show Plugin Infos'))
 2643         self.pluginInfoAct.setWhatsThis(self.tr(
 2644             """<b>Plugin Infos...</b>"""
 2645             """<p>This opens a dialog, that show some information about"""
 2646             """ loaded plugins.</p>"""
 2647         ))
 2648         self.pluginInfoAct.triggered.connect(self.__showPluginInfo)
 2649         self.actions.append(self.pluginInfoAct)
 2650         
 2651         self.pluginInstallAct = E5Action(
 2652             self.tr('Install Plugins'),
 2653             UI.PixmapCache.getIcon("pluginInstall"),
 2654             self.tr('&Install Plugins...'),
 2655             0, 0, self, 'plugin_install')
 2656         self.pluginInstallAct.setStatusTip(self.tr('Install Plugins'))
 2657         self.pluginInstallAct.setWhatsThis(self.tr(
 2658             """<b>Install Plugins...</b>"""
 2659             """<p>This opens a dialog to install or update plugins.</p>"""
 2660         ))
 2661         self.pluginInstallAct.triggered.connect(self.__installPlugins)
 2662         self.actions.append(self.pluginInstallAct)
 2663         
 2664         self.pluginDeinstallAct = E5Action(
 2665             self.tr('Uninstall Plugin'),
 2666             UI.PixmapCache.getIcon("pluginUninstall"),
 2667             self.tr('&Uninstall Plugin...'),
 2668             0, 0, self, 'plugin_deinstall')
 2669         self.pluginDeinstallAct.setStatusTip(self.tr('Uninstall Plugin'))
 2670         self.pluginDeinstallAct.setWhatsThis(self.tr(
 2671             """<b>Uninstall Plugin...</b>"""
 2672             """<p>This opens a dialog to uninstall a plugin.</p>"""
 2673         ))
 2674         self.pluginDeinstallAct.triggered.connect(self.__deinstallPlugin)
 2675         self.actions.append(self.pluginDeinstallAct)
 2676 
 2677         self.pluginRepoAct = E5Action(
 2678             self.tr('Plugin Repository'),
 2679             UI.PixmapCache.getIcon("pluginRepository"),
 2680             self.tr('Plugin &Repository...'),
 2681             0, 0, self, 'plugin_repository')
 2682         self.pluginRepoAct.setStatusTip(self.tr(
 2683             'Show Plugins available for download'))
 2684         self.pluginRepoAct.setWhatsThis(self.tr(
 2685             """<b>Plugin Repository...</b>"""
 2686             """<p>This opens a dialog, that shows a list of plugins """
 2687             """available on the Internet.</p>"""
 2688         ))
 2689         self.pluginRepoAct.triggered.connect(self.showPluginsAvailable)
 2690         self.actions.append(self.pluginRepoAct)
 2691         
 2692         self.virtualenvManagerAct = E5Action(
 2693             self.tr('Virtualenv Manager'),
 2694             UI.PixmapCache.getIcon("virtualenv"),
 2695             self.tr('&Virtualenv Manager...'),
 2696             0, 0, self,
 2697             'virtualenv_manager')
 2698         self.virtualenvManagerAct.setStatusTip(self.tr(
 2699             'Virtualenv Manager'))
 2700         self.virtualenvManagerAct.setWhatsThis(self.tr(
 2701             """<b>Virtualenv Manager</b>"""
 2702             """<p>This opens a dialog to manage the defined Python virtual"""
 2703             """ environments.</p>"""
 2704         ))
 2705         self.virtualenvManagerAct.triggered.connect(
 2706             self.virtualenvManager.showVirtualenvManagerDialog)
 2707         self.actions.append(self.virtualenvManagerAct)
 2708         
 2709         self.virtualenvConfigAct = E5Action(
 2710             self.tr('Virtualenv Configurator'),
 2711             UI.PixmapCache.getIcon("virtualenvConfig"),
 2712             self.tr('Virtualenv &Configurator...'),
 2713             0, 0, self,
 2714             'virtualenv_configurator')
 2715         self.virtualenvConfigAct.setStatusTip(self.tr(
 2716             'Virtualenv Configurator'))
 2717         self.virtualenvConfigAct.setWhatsThis(self.tr(
 2718             """<b>Virtualenv Configurator</b>"""
 2719             """<p>This opens a dialog for entering all the parameters"""
 2720             """ needed to create a Python virtual environment using"""
 2721             """ virtualenv or pyvenv.</p>"""
 2722         ))
 2723         self.virtualenvConfigAct.triggered.connect(
 2724             self.virtualenvManager.createVirtualEnv)
 2725         self.actions.append(self.virtualenvConfigAct)
 2726         
 2727         # initialize viewmanager actions
 2728         self.viewmanager.initActions()
 2729         
 2730         # initialize debugger actions
 2731         self.debuggerUI.initActions()
 2732         
 2733         # initialize project actions
 2734         self.project.initActions()
 2735         
 2736         # initialize multi project actions
 2737         self.multiProject.initActions()
 2738     
 2739     def __initQtDocActions(self):
 2740         """
 2741         Private slot to initialize the action to show the Qt documentation.
 2742         """
 2743         self.qt5DocAct = E5Action(
 2744             self.tr('Qt5 Documentation'),
 2745             self.tr('Qt&5 Documentation'),
 2746             0, 0, self, 'qt5_documentation')
 2747         self.qt5DocAct.setStatusTip(self.tr('Open Qt5 Documentation'))
 2748         self.qt5DocAct.setWhatsThis(self.tr(
 2749             """<b>Qt5 Documentation</b>"""
 2750             """<p>Display the Qt5 Documentation. Dependent upon your"""
 2751             """ settings, this will either show the help in Eric's internal"""
 2752             """ help viewer/web browser, or execute a web browser or Qt"""
 2753             """ Assistant. </p>"""
 2754         ))
 2755         self.qt5DocAct.triggered.connect(self.__showQt5Doc)
 2756         self.actions.append(self.qt5DocAct)
 2757       
 2758         self.pyqt5DocAct = E5Action(
 2759             self.tr('PyQt5 Documentation'),
 2760             self.tr('PyQt&5 Documentation'),
 2761             0, 0, self, 'pyqt5_documentation')
 2762         self.pyqt5DocAct.setStatusTip(self.tr(
 2763             'Open PyQt5 Documentation'))
 2764         self.pyqt5DocAct.setWhatsThis(self.tr(
 2765             """<b>PyQt5 Documentation</b>"""
 2766             """<p>Display the PyQt5 Documentation. Dependent upon your"""
 2767             """ settings, this will either show the help in Eric's"""
 2768             """ internal help viewer/web browser, or execute a web"""
 2769             """ browser or Qt Assistant. </p>"""
 2770         ))
 2771         self.pyqt5DocAct.triggered.connect(self.__showPyQt5Doc)
 2772         self.actions.append(self.pyqt5DocAct)
 2773         
 2774     def __initPythonDocActions(self):
 2775         """
 2776         Private slot to initialize the actions to show the Python
 2777         documentation.
 2778         """
 2779         self.pythonDocAct = E5Action(
 2780             self.tr('Python 3 Documentation'),
 2781             self.tr('Python &3 Documentation'),
 2782             0, 0, self, 'python3_documentation')
 2783         self.pythonDocAct.setStatusTip(self.tr(
 2784             'Open Python 3 Documentation'))
 2785         self.pythonDocAct.setWhatsThis(self.tr(
 2786             """<b>Python 3 Documentation</b>"""
 2787             """<p>Display the Python 3 documentation. If no documentation"""
 2788             """ directory is configured, the location of the Python 3"""
 2789             """ documentation is assumed to be the doc directory underneath"""
 2790             """ the location of the Python 3 executable on Windows and"""
 2791             """ <i>/usr/share/doc/packages/python/html</i> on Unix. Set"""
 2792             """ PYTHON3DOCDIR in your environment to override this.</p>"""
 2793         ))
 2794         self.pythonDocAct.triggered.connect(self.__showPythonDoc)
 2795         self.actions.append(self.pythonDocAct)
 2796     
 2797     def __initEricDocAction(self):
 2798         """
 2799         Private slot to initialize the action to show the eric6 documentation.
 2800         """
 2801         self.ericDocAct = E5Action(
 2802             self.tr("Eric API Documentation"),
 2803             self.tr('&Eric API Documentation'),
 2804             0, 0, self, 'eric_documentation')
 2805         self.ericDocAct.setStatusTip(self.tr(
 2806             "Open Eric API Documentation"))
 2807         self.ericDocAct.setWhatsThis(self.tr(
 2808             """<b>Eric API Documentation</b>"""
 2809             """<p>Display the Eric API documentation. The location for the"""
 2810             """ documentation is the Documentation/Source subdirectory of"""
 2811             """ the eric6 installation directory.</p>"""
 2812         ))
 2813         self.ericDocAct.triggered.connect(self.__showEricDoc)
 2814         self.actions.append(self.ericDocAct)
 2815         
 2816     def __initPySideDocActions(self):
 2817         """
 2818         Private slot to initialize the actions to show the PySide
 2819         documentation.
 2820         """
 2821         if Utilities.checkPyside():
 2822             self.pyside2DocAct = E5Action(
 2823                 self.tr('PySide2 Documentation'),
 2824                 self.tr('PySide&2 Documentation'),
 2825                 0, 0, self, 'pyside2_documentation')
 2826             self.pyside2DocAct.setStatusTip(self.tr(
 2827                 'Open PySide2 Documentation'))
 2828             self.pyside2DocAct.setWhatsThis(self.tr(
 2829                 """<b>PySide2 Documentation</b>"""
 2830                 """<p>Display the PySide2 Documentation. Dependent upon your"""
 2831                 """ settings, this will either show the help in Eric's"""
 2832                 """ internal help viewer/web browser, or execute a web"""
 2833                 """ browser or Qt Assistant. </p>"""
 2834             ))
 2835             self.pyside2DocAct.triggered.connect(
 2836                 lambda: self.__showPySideDoc("2"))
 2837             self.actions.append(self.pyside2DocAct)
 2838         else:
 2839             self.pyside2DocAct = None
 2840     
 2841     def __initMenus(self):
 2842         """
 2843         Private slot to create the menus.
 2844         """
 2845         self.__menus = {}
 2846         mb = self.menuBar()
 2847         if (
 2848             Utilities.isLinuxPlatform() and
 2849             not Preferences.getUI("UseNativeMenuBar")
 2850         ):
 2851             mb.setNativeMenuBar(False)
 2852         
 2853         ##############################################################
 2854         ## File menu
 2855         ##############################################################
 2856         
 2857         self.__menus["file"] = self.viewmanager.initFileMenu()
 2858         mb.addMenu(self.__menus["file"])
 2859         self.__menus["file"].addSeparator()
 2860         self.__menus["file"].addAction(self.saveSessionAct)
 2861         self.__menus["file"].addAction(self.loadSessionAct)
 2862         self.__menus["file"].addSeparator()
 2863         self.__menus["file"].addAction(self.restartAct)
 2864         self.__menus["file"].addAction(self.exitAct)
 2865         act = self.__menus["file"].actions()[0]
 2866         sep = self.__menus["file"].insertSeparator(act)
 2867         self.__menus["file"].insertAction(sep, self.newWindowAct)
 2868         self.__menus["file"].aboutToShow.connect(self.__showFileMenu)
 2869         
 2870         ##############################################################
 2871         ## Edit menu
 2872         ##############################################################
 2873         
 2874         self.__menus["edit"] = self.viewmanager.initEditMenu()
 2875         mb.addMenu(self.__menus["edit"])
 2876         
 2877         ##############################################################
 2878         ## Search menu
 2879         ##############################################################
 2880         
 2881         self.__menus["search"] = self.viewmanager.initSearchMenu()
 2882         mb.addMenu(self.__menus["search"])
 2883         
 2884         ##############################################################
 2885         ## View menu
 2886         ##############################################################
 2887         
 2888         self.__menus["view"] = self.viewmanager.initViewMenu()
 2889         mb.addMenu(self.__menus["view"])
 2890 
 2891         ##############################################################
 2892         ## Bookmarks menu
 2893         ##############################################################
 2894         
 2895         self.__menus["bookmarks"] = self.viewmanager.initBookmarkMenu()
 2896         mb.addMenu(self.__menus["bookmarks"])
 2897         self.__menus["bookmarks"].setTearOffEnabled(True)
 2898         
 2899         ##############################################################
 2900         ## Multiproject menu
 2901         ##############################################################
 2902         
 2903         self.__menus["multiproject"] = self.multiProject.initMenu()
 2904         mb.addMenu(self.__menus["multiproject"])
 2905         
 2906         ##############################################################
 2907         ## Project menu
 2908         ##############################################################
 2909         
 2910         self.__menus["project"], self.__menus["project_tools"] = (
 2911             self.project.initMenus()
 2912         )
 2913         mb.addMenu(self.__menus["project"])
 2914         mb.addMenu(self.__menus["project_tools"])
 2915         
 2916         ##############################################################
 2917         ## Start and Debug menus
 2918         ##############################################################
 2919         
 2920         self.__menus["start"], self.__menus["debug"] = (
 2921             self.debuggerUI.initMenus()
 2922         )
 2923         mb.addMenu(self.__menus["start"])
 2924         mb.addMenu(self.__menus["debug"])
 2925         
 2926         ##############################################################
 2927         ## Extras menu
 2928         ##############################################################
 2929         
 2930         self.__menus["extras"] = QMenu(self.tr('E&xtras'), self)
 2931         self.__menus["extras"].setTearOffEnabled(True)
 2932         self.__menus["extras"].aboutToShow.connect(self.__showExtrasMenu)
 2933         mb.addMenu(self.__menus["extras"])
 2934         self.viewmanager.addToExtrasMenu(self.__menus["extras"])
 2935         
 2936         ##############################################################
 2937         ## Extras/Wizards menu
 2938         ##############################################################
 2939         
 2940         self.__menus["wizards"] = QMenu(self.tr('Wi&zards'), self)
 2941         self.__menus["wizards"].setTearOffEnabled(True)
 2942         self.__menus["wizards"].aboutToShow.connect(self.__showWizardsMenu)
 2943         self.wizardsMenuAct = self.__menus["extras"].addMenu(
 2944             self.__menus["wizards"])
 2945         self.wizardsMenuAct.setEnabled(False)
 2946         
 2947         ##############################################################
 2948         ## Extras/Macros menu
 2949         ##############################################################
 2950         
 2951         self.__menus["macros"] = self.viewmanager.initMacroMenu()
 2952         self.__menus["extras"].addMenu(self.__menus["macros"])
 2953         self.__menus["extras"].addSeparator()
 2954         
 2955         ##############################################################
 2956         ## Extras/VirtualEnv Manager menu entries
 2957         ##############################################################
 2958         
 2959         self.__menus["extras"].addAction(self.virtualenvManagerAct)
 2960         self.__menus["extras"].addAction(self.virtualenvConfigAct)
 2961         self.__menus["extras"].addSeparator()
 2962         
 2963         ##############################################################
 2964         ## Extras/Plugins menu
 2965         ##############################################################
 2966         
 2967         pluginsMenu = QMenu(self.tr('P&lugins'), self)
 2968         pluginsMenu.setIcon(UI.PixmapCache.getIcon("plugin"))
 2969         pluginsMenu.setTearOffEnabled(True)
 2970         pluginsMenu.addAction(self.pluginInfoAct)
 2971         pluginsMenu.addAction(self.pluginInstallAct)
 2972         pluginsMenu.addAction(self.pluginDeinstallAct)
 2973         pluginsMenu.addSeparator()
 2974         pluginsMenu.addAction(self.pluginRepoAct)
 2975         pluginsMenu.addSeparator()
 2976         pluginsMenu.addAction(
 2977             self.tr("Configure..."), self.__pluginsConfigure)
 2978         
 2979         self.__menus["extras"].addMenu(pluginsMenu)
 2980         self.__menus["extras"].addSeparator()
 2981     
 2982         ##############################################################
 2983         ## Extras/Unittest menu
 2984         ##############################################################
 2985         
 2986         self.__menus["unittest"] = QMenu(self.tr('&Unittest'), self)
 2987         self.__menus["unittest"].setTearOffEnabled(True)
 2988         self.__menus["unittest"].addAction(self.utDialogAct)
 2989         self.__menus["unittest"].addSeparator()
 2990         self.__menus["unittest"].addAction(self.utRestartAct)
 2991         self.__menus["unittest"].addAction(self.utRerunFailedAct)
 2992         self.__menus["unittest"].addSeparator()
 2993         self.__menus["unittest"].addAction(self.utScriptAct)
 2994         self.__menus["unittest"].addAction(self.utProjectAct)
 2995         
 2996         self.__menus["extras"].addMenu(self.__menus["unittest"])
 2997         self.__menus["extras"].addSeparator()
 2998         
 2999         ##############################################################
 3000         ## Extras/Builtin,Plugin,User tools menus
 3001         ##############################################################
 3002         
 3003         self.toolGroupsMenu = QMenu(self.tr("Select Tool Group"), self)
 3004         self.toolGroupsMenu.aboutToShow.connect(self.__showToolGroupsMenu)
 3005         self.toolGroupsMenu.triggered.connect(self.__toolGroupSelected)
 3006         self.toolGroupsMenuTriggered = False
 3007         self.__initToolsMenus(self.__menus["extras"])
 3008         self.__menus["extras"].addSeparator()
 3009         
 3010         ##############################################################
 3011         ## Settings menu
 3012         ##############################################################
 3013         
 3014         self.__menus["settings"] = QMenu(self.tr('Se&ttings'), self)
 3015         mb.addMenu(self.__menus["settings"])
 3016         self.__menus["settings"].setTearOffEnabled(True)
 3017         
 3018         self.__menus["settings"].addAction(self.prefAct)
 3019         self.__menus["settings"].addAction(self.prefExportAct)
 3020         self.__menus["settings"].addAction(self.prefImportAct)
 3021         self.__menus["settings"].addSeparator()
 3022         self.__menus["settings"].addAction(self.reloadAPIsAct)
 3023         self.__menus["settings"].addSeparator()
 3024         self.__menus["settings"].addAction(self.configViewProfilesAct)
 3025         self.__menus["settings"].addAction(self.configToolBarsAct)
 3026         self.__menus["settings"].addSeparator()
 3027         self.__menus["settings"].addAction(self.shortcutsAct)
 3028         self.__menus["settings"].addAction(self.exportShortcutsAct)
 3029         self.__menus["settings"].addAction(self.importShortcutsAct)
 3030         self.__menus["settings"].addSeparator()
 3031         self.__menus["settings"].addAction(self.showExternalToolsAct)
 3032         if SSL_AVAILABLE:
 3033             self.__menus["settings"].addSeparator()
 3034             self.__menus["settings"].addAction(self.certificatesAct)
 3035         self.__menus["settings"].addSeparator()
 3036         self.__menus["settings"].addAction(self.editMessageFilterAct)
 3037         self.__menus["settings"].addSeparator()
 3038         self.__menus["settings"].addAction(self.clearPrivateDataAct)
 3039         
 3040         ##############################################################
 3041         ## Window menu
 3042         ##############################################################
 3043         
 3044         self.__menus["window"] = QMenu(self.tr('&Window'), self)
 3045         mb.addMenu(self.__menus["window"])
 3046         self.__menus["window"].setTearOffEnabled(True)
 3047         self.__menus["window"].aboutToShow.connect(self.__showWindowMenu)
 3048         
 3049         ##############################################################
 3050         ## Window/Windows menu
 3051         ##############################################################
 3052         
 3053         self.__menus["subwindow"] = QMenu(self.tr("&Windows"),
 3054                                           self.__menus["window"])
 3055         self.__menus["subwindow"].setTearOffEnabled(True)
 3056         # central park
 3057         self.__menus["subwindow"].addSection(self.tr("Central Park"))
 3058         self.__menus["subwindow"].addAction(self.viewmanagerActivateAct)
 3059         # left side
 3060         self.__menus["subwindow"].addSection(self.tr("Left Side"))
 3061         if self.__shellPosition == "left":
 3062             self.__menus["subwindow"].addAction(self.shellActivateAct)
 3063         self.__menus["subwindow"].addAction(self.pbActivateAct)
 3064         self.__menus["subwindow"].addAction(self.mpbActivateAct)
 3065         if self.templateViewer is not None:
 3066             self.__menus["subwindow"].addAction(self.templateViewerActivateAct)
 3067         if self.browser is not None:
 3068             self.__menus["subwindow"].addAction(self.browserActivateAct)
 3069         if self.symbolsViewer is not None:
 3070             self.__menus["subwindow"].addAction(self.symbolsViewerActivateAct)
 3071         # bottom side
 3072         self.__menus["subwindow"].addSection(self.tr("Bottom Side"))
 3073         if self.__shellPosition == "bottom":
 3074             self.__menus["subwindow"].addAction(self.shellActivateAct)
 3075         self.__menus["subwindow"].addAction(self.taskViewerActivateAct)
 3076         self.__menus["subwindow"].addAction(self.logViewerActivateAct)
 3077         if self.numbersViewer is not None:
 3078             self.__menus["subwindow"].addAction(self.numbersViewerActivateAct)
 3079         self.__menus["subwindow"].addSection(self.tr("Right Side"))
 3080         # right side
 3081         if self.__shellPosition == "right":
 3082             self.__menus["subwindow"].addAction(self.shellActivateAct)
 3083         if self.codeDocumentationViewer is not None:
 3084             self.__menus["subwindow"].addAction(
 3085                 self.codeDocumentationViewerActivateAct)
 3086         self.__menus["subwindow"].addAction(self.debugViewerActivateAct)
 3087         if self.pipWidget is not None:
 3088             self.__menus["subwindow"].addAction(self.pipWidgetActivateAct)
 3089         if self.condaWidget is not None:
 3090             self.__menus["subwindow"].addAction(self.condaWidgetActivateAct)
 3091         if self.cooperation is not None:
 3092             self.__menus["subwindow"].addAction(
 3093                 self.cooperationViewerActivateAct)
 3094         if self.irc is not None:
 3095             self.__menus["subwindow"].addAction(self.ircActivateAct)
 3096         if self.microPythonWidget is not None:
 3097             self.__menus["subwindow"].addAction(
 3098                 self.microPythonWidgetActivateAct)
 3099         self.__menus["subwindow"].addSection(self.tr("Plug-ins"))
 3100         
 3101         ##############################################################
 3102         ## Window/Toolbars menu
 3103         ##############################################################
 3104         
 3105         self.__menus["toolbars"] = QMenu(
 3106             self.tr("&Toolbars"), self.__menus["window"])
 3107         self.__menus["toolbars"].setTearOffEnabled(True)
 3108         self.__menus["toolbars"].aboutToShow.connect(self.__showToolbarsMenu)
 3109         self.__menus["toolbars"].triggered.connect(self.__TBMenuTriggered)
 3110         
 3111         self.__showWindowMenu()  # to initialize these actions
 3112 
 3113         mb.addSeparator()
 3114 
 3115         ##############################################################
 3116         ## Help menu
 3117         ##############################################################
 3118         
 3119         self.__menus["help"] = QMenu(self.tr('&Help'), self)
 3120         mb.addMenu(self.__menus["help"])
 3121         self.__menus["help"].setTearOffEnabled(True)
 3122         if self.helpviewerAct:
 3123             self.__menus["help"].addAction(self.helpviewerAct)
 3124             self.__menus["help"].addSeparator()
 3125         self.__menus["help"].addAction(self.ericDocAct)
 3126         self.__menus["help"].addAction(self.pythonDocAct)
 3127         self.__menus["help"].addAction(self.qt5DocAct)
 3128         if self.pyqt5DocAct is not None:
 3129             self.__menus["help"].addAction(self.pyqt5DocAct)
 3130         if self.pyside2DocAct is not None:
 3131             self.__menus["help"].addAction(self.pyside2DocAct)
 3132         self.__menus["help"].addSeparator()
 3133         self.__menus["help"].addAction(self.versionAct)
 3134         self.__menus["help"].addSeparator()
 3135         self.__menus["help"].addAction(self.checkUpdateAct)
 3136         self.__menus["help"].addAction(self.showVersionsAct)
 3137         self.__menus["help"].addSeparator()
 3138         self.__menus["help"].addAction(self.showErrorLogAct)
 3139         self.__menus["help"].addAction(self.reportBugAct)
 3140         self.__menus["help"].addAction(self.requestFeatureAct)
 3141         self.__menus["help"].addSeparator()
 3142         self.__menus["help"].addAction(self.whatsThisAct)
 3143         self.__menus["help"].aboutToShow.connect(self.__showHelpMenu)
 3144     
 3145     def getToolBarIconSize(self):
 3146         """
 3147         Public method to get the toolbar icon size.
 3148         
 3149         @return toolbar icon size (QSize)
 3150         """
 3151         return Config.ToolBarIconSize
 3152     
 3153     def __initToolbars(self):
 3154         """
 3155         Private slot to create the toolbars.
 3156         """
 3157         filetb = self.viewmanager.initFileToolbar(self.toolbarManager)
 3158         edittb = self.viewmanager.initEditToolbar(self.toolbarManager)
 3159         searchtb, quicksearchtb = self.viewmanager.initSearchToolbars(
 3160             self.toolbarManager)
 3161         viewtb = self.viewmanager.initViewToolbar(self.toolbarManager)
 3162         starttb, debugtb = self.debuggerUI.initToolbars(self.toolbarManager)
 3163         multiprojecttb = self.multiProject.initToolbar(self.toolbarManager)
 3164         projecttb, vcstb = self.project.initToolbars(self.toolbarManager)
 3165         toolstb = QToolBar(self.tr("Tools"), self)
 3166         unittesttb = QToolBar(self.tr("Unittest"), self)
 3167         bookmarktb = self.viewmanager.initBookmarkToolbar(self.toolbarManager)
 3168         spellingtb = self.viewmanager.initSpellingToolbar(self.toolbarManager)
 3169         settingstb = QToolBar(self.tr("Settings"), self)
 3170         helptb = QToolBar(self.tr("Help"), self)
 3171         profilestb = QToolBar(self.tr("Profiles"), self)
 3172         pluginstb = QToolBar(self.tr("Plugins"), self)
 3173         
 3174         toolstb.setIconSize(Config.ToolBarIconSize)
 3175         unittesttb.setIconSize(Config.ToolBarIconSize)
 3176         settingstb.setIconSize(Config.ToolBarIconSize)
 3177         helptb.setIconSize(Config.ToolBarIconSize)
 3178         profilestb.setIconSize(Config.ToolBarIconSize)
 3179         pluginstb.setIconSize(Config.ToolBarIconSize)
 3180         
 3181         toolstb.setObjectName("ToolsToolbar")
 3182         unittesttb.setObjectName("UnittestToolbar")
 3183         settingstb.setObjectName("SettingsToolbar")
 3184         helptb.setObjectName("HelpToolbar")
 3185         profilestb.setObjectName("ProfilesToolbar")
 3186         pluginstb.setObjectName("PluginsToolbar")
 3187         
 3188         toolstb.setToolTip(self.tr("Tools"))
 3189         unittesttb.setToolTip(self.tr("Unittest"))
 3190         settingstb.setToolTip(self.tr("Settings"))
 3191         helptb.setToolTip(self.tr("Help"))
 3192         profilestb.setToolTip(self.tr("Profiles"))
 3193         pluginstb.setToolTip(self.tr("Plugins"))
 3194         
 3195         filetb.addSeparator()
 3196         filetb.addAction(self.restartAct)
 3197         filetb.addAction(self.exitAct)
 3198         act = filetb.actions()[0]
 3199         sep = filetb.insertSeparator(act)
 3200         filetb.insertAction(sep, self.newWindowAct)
 3201         self.toolbarManager.addToolBar(filetb, filetb.windowTitle())
 3202         
 3203         # setup the unittest toolbar
 3204         unittesttb.addAction(self.utDialogAct)
 3205         unittesttb.addSeparator()
 3206         unittesttb.addAction(self.utRestartAct)
 3207         unittesttb.addAction(self.utRerunFailedAct)
 3208         unittesttb.addSeparator()
 3209         unittesttb.addAction(self.utScriptAct)
 3210         unittesttb.addAction(self.utProjectAct)
 3211         self.toolbarManager.addToolBar(unittesttb, unittesttb.windowTitle())
 3212         
 3213         # setup the tools toolbar
 3214         if self.designer4Act is not None:
 3215             toolstb.addAction(self.designer4Act)
 3216         if self.linguist4Act is not None:
 3217             toolstb.addAction(self.linguist4Act)
 3218         toolstb.addAction(self.uipreviewerAct)
 3219         toolstb.addAction(self.trpreviewerAct)
 3220         toolstb.addSeparator()
 3221         toolstb.addAction(self.diffAct)
 3222         toolstb.addAction(self.compareAct)
 3223         toolstb.addSeparator()
 3224         toolstb.addAction(self.sqlBrowserAct)
 3225         toolstb.addSeparator()
 3226         toolstb.addAction(self.miniEditorAct)
 3227         toolstb.addAction(self.hexEditorAct)
 3228         toolstb.addAction(self.iconEditorAct)
 3229         toolstb.addAction(self.snapshotAct)
 3230         toolstb.addSeparator()
 3231         toolstb.addAction(self.virtualenvManagerAct)
 3232         toolstb.addAction(self.virtualenvConfigAct)
 3233         if self.webBrowserAct:
 3234             toolstb.addSeparator()
 3235             toolstb.addAction(self.webBrowserAct)
 3236         self.toolbarManager.addToolBar(toolstb, toolstb.windowTitle())
 3237         
 3238         # setup the settings toolbar
 3239         settingstb.addAction(self.prefAct)
 3240         settingstb.addAction(self.configViewProfilesAct)
 3241         settingstb.addAction(self.configToolBarsAct)
 3242         settingstb.addAction(self.shortcutsAct)
 3243         settingstb.addAction(self.showExternalToolsAct)
 3244         self.toolbarManager.addToolBar(settingstb, settingstb.windowTitle())
 3245         self.toolbarManager.addActions([
 3246             self.exportShortcutsAct,
 3247             self.importShortcutsAct,
 3248             self.prefExportAct,
 3249             self.prefImportAct,
 3250             self.showExternalToolsAct,
 3251             self.editMessageFilterAct,
 3252             self.clearPrivateDataAct,
 3253         ], settingstb.windowTitle())
 3254         if SSL_AVAILABLE:
 3255             self.toolbarManager.addAction(
 3256                 self.certificatesAct, settingstb.windowTitle())
 3257         
 3258         # setup the help toolbar
 3259         helptb.addAction(self.whatsThisAct)
 3260         self.toolbarManager.addToolBar(helptb, helptb.windowTitle())
 3261         if self.helpviewerAct:
 3262             self.toolbarManager.addAction(self.helpviewerAct,
 3263                                           helptb.windowTitle())
 3264         
 3265         # setup the view profiles toolbar
 3266         profilestb.addActions(self.viewProfileActGrp.actions())
 3267         self.toolbarManager.addToolBar(profilestb, profilestb.windowTitle())
 3268         
 3269         # setup the plugins toolbar
 3270         pluginstb.addAction(self.pluginInfoAct)
 3271         pluginstb.addAction(self.pluginInstallAct)
 3272         pluginstb.addAction(self.pluginDeinstallAct)
 3273         pluginstb.addSeparator()
 3274         pluginstb.addAction(self.pluginRepoAct)
 3275         self.toolbarManager.addToolBar(pluginstb, pluginstb.windowTitle())
 3276         
 3277         # add the various toolbars
 3278         self.addToolBar(filetb)
 3279         self.addToolBar(edittb)
 3280         self.addToolBar(searchtb)
 3281         self.addToolBar(quicksearchtb)
 3282         self.addToolBar(viewtb)
 3283         self.addToolBar(starttb)
 3284         self.addToolBar(debugtb)
 3285         self.addToolBar(multiprojecttb)
 3286         self.addToolBar(projecttb)
 3287         self.addToolBar(vcstb)
 3288         self.addToolBar(Qt.RightToolBarArea, settingstb)
 3289         self.addToolBar(Qt.RightToolBarArea, toolstb)
 3290         self.addToolBar(helptb)
 3291         self.addToolBar(bookmarktb)
 3292         self.addToolBar(spellingtb)
 3293         self.addToolBar(unittesttb)
 3294         self.addToolBar(profilestb)
 3295         self.addToolBar(pluginstb)
 3296         
 3297         # hide toolbars not wanted in the initial layout
 3298         searchtb.hide()
 3299         quicksearchtb.hide()
 3300         viewtb.hide()
 3301         debugtb.hide()
 3302         multiprojecttb.hide()
 3303         helptb.hide()
 3304         spellingtb.hide()
 3305         unittesttb.hide()
 3306         pluginstb.hide()
 3307 
 3308         # just add new toolbars to the end of the list
 3309         self.__toolbars = {}
 3310         self.__toolbars["file"] = [filetb.windowTitle(), filetb, ""]
 3311         self.__toolbars["edit"] = [edittb.windowTitle(), edittb, ""]
 3312         self.__toolbars["search"] = [searchtb.windowTitle(), searchtb, ""]
 3313         self.__toolbars["view"] = [viewtb.windowTitle(), viewtb, ""]
 3314         self.__toolbars["start"] = [starttb.windowTitle(), starttb, ""]
 3315         self.__toolbars["debug"] = [debugtb.windowTitle(), debugtb, ""]
 3316         self.__toolbars["project"] = [projecttb.windowTitle(), projecttb, ""]
 3317         self.__toolbars["tools"] = [toolstb.windowTitle(), toolstb, ""]
 3318         self.__toolbars["help"] = [helptb.windowTitle(), helptb, ""]
 3319         self.__toolbars["settings"] = [settingstb.windowTitle(), settingstb,
 3320                                        ""]
 3321         self.__toolbars["bookmarks"] = [bookmarktb.windowTitle(), bookmarktb,
 3322                                         ""]
 3323         self.__toolbars["unittest"] = [unittesttb.windowTitle(), unittesttb,
 3324                                        ""]
 3325         self.__toolbars["view_profiles"] = [profilestb.windowTitle(),
 3326                                             profilestb, ""]
 3327         self.__toolbars["plugins"] = [pluginstb.windowTitle(), pluginstb, ""]
 3328         self.__toolbars["quicksearch"] = [quicksearchtb.windowTitle(),
 3329                                           quicksearchtb, ""]
 3330         self.__toolbars["multiproject"] = [multiprojecttb.windowTitle(),
 3331                                            multiprojecttb, ""]
 3332         self.__toolbars["spelling"] = [spellingtb.windowTitle(), spellingtb,
 3333                                        ""]
 3334         self.__toolbars["vcs"] = [vcstb.windowTitle(), vcstb, "vcs"]
 3335         
 3336     def __initDebugToolbarsLayout(self):
 3337         """
 3338         Private slot to initialize the toolbars layout for the debug profile.
 3339         """
 3340         # Step 1: set the edit profile to be sure
 3341         self.__setEditProfile()
 3342         
 3343         # Step 2: switch to debug profile and do the layout
 3344         initSize = self.size()
 3345         self.setDebugProfile()
 3346         self.__toolbars["project"][1].hide()
 3347         self.__toolbars["debug"][1].show()
 3348         self.resize(initSize)
 3349         
 3350         # Step 3: switch back to edit profile
 3351         self.__setEditProfile()
 3352         
 3353     def __initStatusbar(self):
 3354         """
 3355         Private slot to set up the status bar.
 3356         """
 3357         self.__statusBar = self.statusBar()
 3358         self.__statusBar.setSizeGripEnabled(True)
 3359 
 3360         self.sbLanguage = E5ClickableLabel(self.__statusBar)
 3361         self.__statusBar.addPermanentWidget(self.sbLanguage)
 3362         self.sbLanguage.setWhatsThis(self.tr(
 3363             """<p>This part of the status bar displays the"""
 3364             """ current editors language.</p>"""
 3365         ))
 3366 
 3367         self.sbEncoding = E5ClickableLabel(self.__statusBar)
 3368         self.__statusBar.addPermanentWidget(self.sbEncoding)
 3369         self.sbEncoding.setWhatsThis(self.tr(
 3370             """<p>This part of the status bar displays the"""
 3371             """ current editors encoding.</p>"""
 3372         ))
 3373 
 3374         self.sbEol = E5ClickableLabel(self.__statusBar)
 3375         self.__statusBar.addPermanentWidget(self.sbEol)
 3376         self.sbEol.setWhatsThis(self.tr(
 3377             """<p>This part of the status bar displays the"""
 3378             """ current editors eol setting.</p>"""
 3379         ))
 3380 
 3381         self.sbWritable = QLabel(self.__statusBar)
 3382         self.__statusBar.addPermanentWidget(self.sbWritable)
 3383         self.sbWritable.setWhatsThis(self.tr(
 3384             """<p>This part of the status bar displays an indication of the"""
 3385             """ current editors files writability.</p>"""
 3386         ))
 3387 
 3388         self.sbLine = QLabel(self.__statusBar)
 3389         self.__statusBar.addPermanentWidget(self.sbLine)
 3390         self.sbLine.setWhatsThis(self.tr(
 3391             """<p>This part of the status bar displays the line number of"""
 3392             """ the current editor.</p>"""
 3393         ))
 3394 
 3395         self.sbPos = QLabel(self.__statusBar)
 3396         self.__statusBar.addPermanentWidget(self.sbPos)
 3397         self.sbPos.setWhatsThis(self.tr(
 3398             """<p>This part of the status bar displays the cursor position"""
 3399             """ of the current editor.</p>"""
 3400         ))
 3401         
 3402         self.sbZoom = E5ZoomWidget(
 3403             UI.PixmapCache.getPixmap("zoomOut"),
 3404             UI.PixmapCache.getPixmap("zoomIn"),
 3405             UI.PixmapCache.getPixmap("zoomReset"),
 3406             self.__statusBar)
 3407         self.__statusBar.addPermanentWidget(self.sbZoom)
 3408         self.sbZoom.setWhatsThis(self.tr(
 3409             """<p>This part of the status bar allows zooming the current"""
 3410             """ editor or shell.</p>"""
 3411         ))
 3412         
 3413         self.viewmanager.setSbInfo(
 3414             self.sbLine, self.sbPos, self.sbWritable, self.sbEncoding,
 3415             self.sbLanguage, self.sbEol, self.sbZoom)
 3416 
 3417         from VCS.StatusMonitorLed import StatusMonitorLedWidget
 3418         self.sbVcsMonitorLed = StatusMonitorLedWidget(
 3419             self.project, self.__statusBar)
 3420         self.__statusBar.addPermanentWidget(self.sbVcsMonitorLed)
 3421         
 3422         self.networkIcon = E5NetworkIcon(self.__statusBar)
 3423         self.__statusBar.addPermanentWidget(self.networkIcon)
 3424         self.networkIcon.onlineStateChanged.connect(self.onlineStateChanged)
 3425         self.networkIcon.onlineStateChanged.connect(self.__onlineStateChanged)
 3426     
 3427     def __initExternalToolsActions(self):
 3428         """
 3429         Private slot to create actions for the configured external tools.
 3430         """
 3431         self.toolGroupActions = {}
 3432         for toolGroup in self.toolGroups:
 3433             category = self.tr("External Tools/{0}").format(toolGroup[0])
 3434             for tool in toolGroup[1]:
 3435                 if tool['menutext'] != '--':
 3436                     act = QAction(UI.PixmapCache.getIcon(tool['icon']),
 3437                                   tool['menutext'], self)
 3438                     act.setObjectName("{0}@@{1}".format(toolGroup[0],
 3439                                       tool['menutext']))
 3440                     act.triggered.connect(
 3441                         lambda: self.__toolActionTriggered(act))
 3442                     self.toolGroupActions[act.objectName()] = act
 3443                     
 3444                     self.toolbarManager.addAction(act, category)
 3445     
 3446     def __updateExternalToolsActions(self):
 3447         """
 3448         Private method to update the external tools actions for the current
 3449         tool group.
 3450         """
 3451         toolGroup = self.toolGroups[self.currentToolGroup]
 3452         groupkey = "{0}@@".format(toolGroup[0])
 3453         groupActionKeys = []
 3454         # step 1: get actions for this group
 3455         for key in self.toolGroupActions:
 3456             if key.startswith(groupkey):
 3457                 groupActionKeys.append(key)
 3458         
 3459         # step 2: build keys for all actions i.a.w. current configuration
 3460         ckeys = []
 3461         for tool in toolGroup[1]:
 3462             if tool['menutext'] != '--':
 3463                 ckeys.append("{0}@@{1}".format(toolGroup[0], tool['menutext']))
 3464         
 3465         # step 3: remove all actions not configured any more
 3466         for key in groupActionKeys:
 3467             if key not in ckeys:
 3468                 self.toolbarManager.removeAction(self.toolGroupActions[key])
 3469                 self.toolGroupActions[key].triggered.disconnect()
 3470                 del self.toolGroupActions[key]
 3471         
 3472         # step 4: add all newly configured tools
 3473         category = self.tr("External Tools/{0}").format(toolGroup[0])
 3474         for tool in toolGroup[1]:
 3475             if tool['menutext'] != '--':
 3476                 key = "{0}@@{1}".format(toolGroup[0], tool['menutext'])
 3477                 if key not in groupActionKeys:
 3478                     act = QAction(UI.PixmapCache.getIcon(tool['icon']),
 3479                                   tool['menutext'], self)
 3480                     act.setObjectName(key)
 3481                     act.triggered.connect(
 3482                         lambda: self.__toolActionTriggered(act))
 3483                     self.toolGroupActions[key] = act
 3484                     
 3485                     self.toolbarManager.addAction(act, category)
 3486     
 3487     def __showFileMenu(self):
 3488         """
 3489         Private slot to display the File menu.
 3490         """
 3491         self.showMenu.emit("File", self.__menus["file"])
 3492     
 3493     def __showExtrasMenu(self):
 3494         """
 3495         Private slot to display the Extras menu.
 3496         """
 3497         self.showMenu.emit("Extras", self.__menus["extras"])
 3498     
 3499     def __showWizardsMenu(self):
 3500         """
 3501         Private slot to display the Wizards menu.
 3502         """
 3503         self.showMenu.emit("Wizards", self.__menus["wizards"])
 3504     
 3505     def __showHelpMenu(self):
 3506         """
 3507         Private slot to display the Help menu.
 3508         """
 3509         self.checkUpdateAct.setEnabled(not self.__inVersionCheck)
 3510         self.showVersionsAct.setEnabled(not self.__inVersionCheck)
 3511         self.showErrorLogAct.setEnabled(self.__hasErrorLog())
 3512         
 3513         self.showMenu.emit("Help", self.__menus["help"])
 3514     
 3515     def __showSettingsMenu(self):
 3516         """
 3517         Private slot to show the Settings menu.
 3518         """
 3519         self.editMessageFilterAct.setEnabled(
 3520             E5ErrorMessage.messageHandlerInstalled())
 3521         
 3522         self.showMenu.emit("Settings", self.__menus["settings"])
 3523     
 3524     def __showNext(self):
 3525         """
 3526         Private slot used to show the next tab or file.
 3527         """
 3528         fwidget = QApplication.focusWidget()
 3529         while fwidget and not hasattr(fwidget, 'nextTab'):
 3530             fwidget = fwidget.parent()
 3531         if fwidget:
 3532             fwidget.nextTab()
 3533 
 3534     def __showPrevious(self):
 3535         """
 3536         Private slot used to show the previous tab or file.
 3537         """
 3538         fwidget = QApplication.focusWidget()
 3539         while fwidget and not hasattr(fwidget, 'prevTab'):
 3540             fwidget = fwidget.parent()
 3541         if fwidget:
 3542             fwidget.prevTab()
 3543     
 3544     def __switchTab(self):
 3545         """
 3546         Private slot used to switch between the current and the previous
 3547         current tab.
 3548         """
 3549         fwidget = QApplication.focusWidget()
 3550         while fwidget and not hasattr(fwidget, 'switchTab'):
 3551             fwidget = fwidget.parent()
 3552         if fwidget:
 3553             fwidget.switchTab()
 3554     
 3555     def __whatsThis(self):
 3556         """
 3557         Private slot called in to enter Whats This mode.
 3558         """
 3559         QWhatsThis.enterWhatsThisMode()
 3560         
 3561     def __showVersions(self):
 3562         """
 3563         Private slot to handle the Versions dialog.
 3564         """
 3565         try:
 3566             try:
 3567                 from PyQt5 import sip
 3568             except ImportError:
 3569                 import sip
 3570             sip_version_str = sip.SIP_VERSION_STR
 3571         except (ImportError, AttributeError):
 3572             sip_version_str = "sip version not available"
 3573         
 3574         if sys.maxsize > 2**32:
 3575             sizeStr = "64-Bit"
 3576         else:
 3577             sizeStr = "32-Bit"
 3578         
 3579         versionText = self.tr(
 3580             """<h2>Version Numbers</h2>"""
 3581             """<table>""")
 3582         versionText += (
 3583             """<tr><td><b>Python</b></td><td>{0}, {1}</td></tr>"""
 3584         ).format(sys.version.split()[0], sizeStr)
 3585         versionText += (
 3586             """<tr><td><b>Qt</b></td><td>{0}</td></tr>"""
 3587         ).format(qVersion())
 3588         versionText += (
 3589             """<tr><td><b>PyQt</b></td><td>{0}</td></tr>"""
 3590         ).format(PYQT_VERSION_STR)
 3591         try:
 3592             from PyQt5 import QtChart
 3593             versionText += (
 3594                 """<tr><td><b>PyQtChart</b></td><td>{0}</td></tr>"""
 3595             ).format(QtChart.PYQT_CHART_VERSION_STR)
 3596         except (ImportError, AttributeError):
 3597             pass
 3598         try:
 3599             from PyQt5 import QtWebEngine
 3600             versionText += (
 3601                 """<tr><td><b>PyQtWebEngine</b></td><td>{0}</td></tr>"""
 3602             ).format(QtWebEngine.PYQT_WEBENGINE_VERSION_STR)
 3603         except (ImportError, AttributeError):
 3604             pass
 3605         versionText += (
 3606             """<tr><td><b>QScintilla</b></td><td>{0}</td></tr>"""
 3607         ).format(QSCINTILLA_VERSION_STR)
 3608         versionText += (
 3609             """<tr><td><b>sip</b></td><td>{0}</td></tr>"""
 3610         ).format(sip_version_str)
 3611         try:
 3612             from WebBrowser.Tools import WebBrowserTools
 3613             chromeVersion = WebBrowserTools.getWebEngineVersions()[0]
 3614             versionText += (
 3615                 """<tr><td><b>WebEngine</b></td><td>{0}</td></tr>"""
 3616             ).format(chromeVersion)
 3617         except ImportError:
 3618             pass
 3619         versionText += ("""<tr><td><b>{0}</b></td><td>{1}</td></tr>"""
 3620                         ).format(Program, Version)
 3621         versionText += self.tr("""</table>""")
 3622         
 3623         E5MessageBox.about(self, Program, versionText)
 3624         
 3625     def __reportBug(self):
 3626         """
 3627         Private slot to handle the Report Bug dialog.
 3628         """
 3629         self.showEmailDialog("bug")
 3630         
 3631     def __requestFeature(self):
 3632         """
 3633         Private slot to handle the Feature Request dialog.
 3634         """
 3635         self.showEmailDialog("feature")
 3636         
 3637     def showEmailDialog(self, mode, attachFile=None, deleteAttachFile=False):
 3638         """
 3639         Public slot to show the email dialog in a given mode.
 3640         
 3641         @param mode mode of the email dialog (string, "bug" or "feature")
 3642         @param attachFile name of a file to attach to the email (string)
 3643         @param deleteAttachFile flag indicating to delete the attached file
 3644             after it has been sent (boolean)
 3645         """
 3646         if Preferences.getUser("UseSystemEmailClient"):
 3647             self.__showSystemEmailClient(mode, attachFile, deleteAttachFile)
 3648         else:
 3649             if not Preferences.getUser("UseGoogleMailOAuth2") and (
 3650                 Preferences.getUser("Email") == "" or
 3651                     Preferences.getUser("MailServer") == ""):
 3652                 E5MessageBox.critical(
 3653                     self,
 3654                     self.tr("Report Bug"),
 3655                     self.tr(
 3656                         """Email address or mail server address is empty."""
 3657                         """ Please configure your Email settings in the"""
 3658                         """ Preferences Dialog."""))
 3659                 self.showPreferences("emailPage")
 3660                 return
 3661                 
 3662             from .EmailDialog import EmailDialog
 3663             self.dlg = EmailDialog(mode=mode)
 3664             if attachFile is not None:
 3665                 self.dlg.attachFile(attachFile, deleteAttachFile)
 3666             self.dlg.show()
 3667         
 3668     def __showSystemEmailClient(self, mode, attachFile=None,
 3669                                 deleteAttachFile=False):
 3670         """
 3671         Private slot to show the system email dialog.
 3672         
 3673         @param mode mode of the email dialog (string, "bug" or "feature")
 3674         @param attachFile name of a file to put into the body of the
 3675             email (string)
 3676         @param deleteAttachFile flag indicating to delete the file after
 3677             it has been read (boolean)
 3678         """
 3679         if mode == "feature":
 3680             address = FeatureAddress
 3681         else:
 3682             address = BugAddress
 3683         subject = "[eric6] "
 3684         if attachFile is not None:
 3685             f = open(attachFile, "r", encoding="utf-8")
 3686             body = f.read()
 3687             f.close()
 3688             if deleteAttachFile:
 3689                 os.remove(attachFile)
 3690         else:
 3691             body = "\r\n----\r\n{0}----\r\n{1}----\r\n{2}".format(
 3692                 Utilities.generateVersionInfo("\r\n"),
 3693                 Utilities.generatePluginsVersionInfo("\r\n"),
 3694                 Utilities.generateDistroInfo("\r\n"))
 3695         
 3696         url = QUrl("mailto:{0}".format(address))
 3697         urlQuery = QUrlQuery(url)
 3698         urlQuery.addQueryItem("subject", subject)
 3699         urlQuery.addQueryItem("body", body)
 3700         url.setQuery(urlQuery)
 3701         QDesktopServices.openUrl(url)
 3702         
 3703     def checkForErrorLog(self):
 3704         """
 3705         Public method to check for the presence of an error log and ask the
 3706         user, what to do with it.
 3707         """
 3708         if Preferences.getUI("CheckErrorLog"):
 3709             logFile = os.path.join(Utilities.getConfigDir(),
 3710                                    self.ErrorLogFileName)
 3711             if os.path.exists(logFile):
 3712                 from .ErrorLogDialog import ErrorLogDialog
 3713                 dlg = ErrorLogDialog(logFile, False, self)
 3714                 dlg.exec_()
 3715         
 3716     def __hasErrorLog(self):
 3717         """
 3718         Private method to check, if an error log file exists.
 3719         
 3720         @return flag indicating the existence of an error log file (boolean)
 3721         """
 3722         logFile = os.path.join(Utilities.getConfigDir(),
 3723                                self.ErrorLogFileName)
 3724         return os.path.exists(logFile)
 3725         
 3726     def __showErrorLog(self):
 3727         """
 3728         Private slot to show the most recent error log message.
 3729         """
 3730         logFile = os.path.join(Utilities.getConfigDir(),
 3731                                self.ErrorLogFileName)
 3732         if os.path.exists(logFile):
 3733             from .ErrorLogDialog import ErrorLogDialog
 3734             dlg = ErrorLogDialog(logFile, True, self)
 3735             dlg.show()
 3736         
 3737     def __compareFiles(self):
 3738         """
 3739         Private slot to handle the Compare Files dialog.
 3740         """
 3741         aw = self.viewmanager.activeWindow()
 3742         fn = aw and aw.getFileName() or None
 3743         if self.diffDlg is None:
 3744             from .DiffDialog import DiffDialog
 3745             self.diffDlg = DiffDialog()
 3746         self.diffDlg.show(fn)
 3747         
 3748     def __compareFilesSbs(self):
 3749         """
 3750         Private slot to handle the Compare Files dialog.
 3751         """
 3752         aw = self.viewmanager.activeWindow()
 3753         fn = aw and aw.getFileName() or None
 3754         if self.compareDlg is None:
 3755             from .CompareDialog import CompareDialog
 3756             self.compareDlg = CompareDialog()
 3757         self.compareDlg.show(fn)
 3758         
 3759     def __openMiniEditor(self):
 3760         """
 3761         Private slot to show a mini editor window.
 3762         """
 3763         from QScintilla.MiniEditor import MiniEditor
 3764         editor = MiniEditor(parent=self)
 3765         editor.show()
 3766         
 3767     def addE5Actions(self, actions, actionType):
 3768         """
 3769         Public method to add actions to the list of actions.
 3770         
 3771         @param actions list of actions to be added (list of E5Action)
 3772         @param actionType string denoting the action set to add to.
 3773             It must be one of "ui" or "wizards".
 3774         """
 3775         if actionType == 'ui':
 3776             self.actions.extend(actions)
 3777         elif actionType == 'wizards':
 3778             self.wizardsActions.extend(actions)
 3779         
 3780     def removeE5Actions(self, actions, actionType='ui'):
 3781         """
 3782         Public method to remove actions from the list of actions.
 3783         
 3784         @param actions list of actions (list of E5Action)
 3785         @param actionType string denoting the action set to remove from.
 3786             It must be one of "ui" or "wizards".
 3787         """
 3788         for act in actions:
 3789             try:
 3790                 if actionType == 'ui':
 3791                     self.actions.remove(act)
 3792                 elif actionType == 'wizards':
 3793                     self.wizardsActions.remove(act)
 3794             except ValueError:
 3795                 pass
 3796         
 3797     def getActions(self, actionType):
 3798         """
 3799         Public method to get a list of all actions.
 3800         
 3801         @param actionType string denoting the action set to get.
 3802             It must be one of "ui" or "wizards".
 3803         @return list of all actions (list of E5Action)
 3804         """
 3805         if actionType == 'ui':
 3806             return self.actions[:]
 3807         elif actionType == 'wizards':
 3808             return self.wizardsActions[:]
 3809         else:
 3810             return []
 3811         
 3812     def getMenuAction(self, menuName, actionName):
 3813         """
 3814         Public method to get a reference to an action of a menu.
 3815         
 3816         @param menuName name of the menu to search in (string)
 3817         @param actionName object name of the action to search for
 3818             (string)
 3819         @return reference to the menu action (QAction)
 3820         """
 3821         try:
 3822             menu = self.__menus[menuName]
 3823         except KeyError:
 3824             return None
 3825         
 3826         for act in menu.actions():
 3827             if act.objectName() == actionName:
 3828                 return act
 3829         
 3830         return None
 3831         
 3832     def getMenuBarAction(self, menuName):
 3833         """
 3834         Public method to get a reference to an action of the main menu.
 3835         
 3836         @param menuName name of the menu to search in (string)
 3837         @return reference to the menu bar action (QAction)
 3838         """
 3839         try:
 3840             menu = self.__menus[menuName]
 3841         except KeyError:
 3842             return None
 3843         
 3844         return menu.menuAction()
 3845         
 3846     def getMenu(self, name):
 3847         """
 3848         Public method to get a reference to a specific menu.
 3849         
 3850         @param name name of the menu (string)
 3851         @return reference to the menu (QMenu)
 3852         """
 3853         try:
 3854             return self.__menus[name]
 3855         except KeyError:
 3856             return None
 3857         
 3858     def registerToolbar(self, name, text, toolbar, category=""):
 3859         """
 3860         Public method to register a toolbar.
 3861         
 3862         This method must be called in order to make a toolbar manageable by the
 3863         UserInterface object.
 3864         
 3865         @param name name of the toolbar. This is used as the key into
 3866             the dictionary of toolbar references.
 3867         @type str
 3868         @param text user visible text for the toolbar entry
 3869         @type str
 3870         @param toolbar reference to the toolbar to be registered
 3871         @type QToolBar
 3872         @param category toolbar category
 3873         @type str
 3874         @exception KeyError raised, if a toolbar with the given name was
 3875             already registered
 3876         """
 3877         if name in self.__toolbars:
 3878             raise KeyError("Toolbar '{0}' already registered.".format(name))
 3879         
 3880         self.__toolbars[name] = [text, toolbar, category]
 3881         
 3882     def reregisterToolbar(self, name, text, category=""):
 3883         """
 3884         Public method to change the visible text for the named toolbar.
 3885         
 3886         @param name name of the toolbar to be changed
 3887         @type str
 3888         @param text new user visible text for the toolbar entry
 3889         @type str
 3890         @param category new toolbar category for the toolbar entry
 3891         @type str
 3892         """
 3893         if name in self.__toolbars:
 3894             self.__toolbars[name][0] = text
 3895             self.__toolbars[name][2] = category
 3896         
 3897     def unregisterToolbar(self, name):
 3898         """
 3899         Public method to unregister a toolbar.
 3900         
 3901         @param name name of the toolbar (string).
 3902         """
 3903         if name in self.__toolbars:
 3904             del self.__toolbars[name]
 3905         
 3906     def getToolbar(self, name):
 3907         """
 3908         Public method to get a reference to a specific toolbar.
 3909         
 3910         @param name name of the toolbar (string)
 3911         @return reference to the toolbar entry (tuple of string and QToolBar)
 3912         """
 3913         try:
 3914             return self.__toolbars[name]
 3915         except KeyError:
 3916             return None
 3917     
 3918     def getToolbarsByCategory(self, category):
 3919         """
 3920         Public method to get a list of toolbars belonging to a given toolbar
 3921         category.
 3922         
 3923         @param category toolbar category
 3924         @type str
 3925         @return list of toolbars
 3926         @rtype list of QToolBar
 3927         """
 3928         toolbars = []
 3929         for tbName in self.__toolbars:
 3930             try:
 3931                 if self.__toolbars[tbName][2] == category:
 3932                     toolbars.append(self.__toolbars[tbName][1])
 3933             except IndexError:
 3934                 # backward compatibility; category is not yet supported
 3935                 pass
 3936         
 3937         return toolbars
 3938     
 3939     def getLocale(self):
 3940         """
 3941         Public method to get the locale of the IDE.
 3942         
 3943         @return locale of the IDE (string or None)
 3944         """
 3945         return self.locale
 3946         
 3947     def __quit(self):
 3948         """
 3949         Private method to quit the application.
 3950         """
 3951         if self.__shutdown():
 3952             e5App().closeAllWindows()
 3953     
 3954     @pyqtSlot()
 3955     def __restart(self, ask=False):
 3956         """
 3957         Private method to restart the application.
 3958         
 3959         @param ask flag indicating to ask the user for permission
 3960         @type bool
 3961         """
 3962         if ask:
 3963             res = E5MessageBox.yesNo(
 3964                 self,
 3965                 self.tr("Restart application"),
 3966                 self.tr(
 3967                     """The application needs to be restarted. Do it now?"""),
 3968                 yesDefault=True)
 3969         else:
 3970             res = True
 3971         
 3972         if res and self.__shutdown():
 3973             e5App().closeAllWindows()
 3974             program = sys.executable
 3975             eric6 = os.path.join(getConfig("ericDir"), "eric6.py")
 3976             args = [eric6]
 3977             args.append("--start-session")
 3978             args.extend(self.__restartArgs)
 3979             QProcess.startDetached(program, args)
 3980         
 3981     def __newWindow(self):
 3982         """
 3983         Private slot to start a new instance of eric6.
 3984         """
 3985         if not Preferences.getUI("SingleApplicationMode"):
 3986             # start eric6 without any arguments
 3987             program = sys.executable
 3988             eric6 = os.path.join(getConfig("ericDir"), "eric6.py")
 3989             args = [eric6]
 3990             QProcess.startDetached(program, args)
 3991         
 3992     def __initToolsMenus(self, menu):
 3993         """
 3994         Private slot to initialize the various tool menus.
 3995         
 3996         @param menu reference to the parent menu
 3997         @type QMenu
 3998         """
 3999         btMenu = QMenu(self.tr("&Builtin Tools"), self)
 4000         if self.designer4Act is not None:
 4001             btMenu.addAction(self.designer4Act)
 4002         if self.linguist4Act is not None:
 4003             btMenu.addAction(self.linguist4Act)
 4004         btMenu.addAction(self.uipreviewerAct)
 4005         btMenu.addAction(self.trpreviewerAct)
 4006         btMenu.addAction(self.diffAct)
 4007         btMenu.addAction(self.compareAct)
 4008         btMenu.addAction(self.sqlBrowserAct)
 4009         btMenu.addAction(self.miniEditorAct)
 4010         btMenu.addAction(self.hexEditorAct)
 4011         btMenu.addAction(self.iconEditorAct)
 4012         btMenu.addAction(self.snapshotAct)
 4013         if self.webBrowserAct:
 4014             btMenu.addAction(self.webBrowserAct)
 4015         
 4016         ptMenu = QMenu(self.tr("&Plugin Tools"), self)
 4017         ptMenu.aboutToShow.connect(self.__showPluginToolsMenu)
 4018         
 4019         utMenu = QMenu(self.tr("&User Tools"), self)
 4020         utMenu.triggered.connect(self.__toolExecute)
 4021         utMenu.aboutToShow.connect(self.__showUserToolsMenu)
 4022         
 4023         menu.addMenu(btMenu)
 4024         menu.addMenu(ptMenu)
 4025         menu.addMenu(utMenu)
 4026         
 4027         self.__menus["builtin_tools"] = btMenu
 4028         self.__menus["plugin_tools"] = ptMenu
 4029         self.__menus["user_tools"] = utMenu
 4030         
 4031     def __showPluginToolsMenu(self):
 4032         """
 4033         Private slot to show the Plugin Tools menu.
 4034         """
 4035         self.showMenu.emit("PluginTools", self.__menus["plugin_tools"])
 4036         
 4037     def __showUserToolsMenu(self):
 4038         """
 4039         Private slot to display the User Tools menu.
 4040         """
 4041         self.__menus["user_tools"].clear()
 4042         
 4043         self.__menus["user_tools"].addMenu(self.toolGroupsMenu)
 4044         act = self.__menus["user_tools"].addAction(
 4045             self.tr("Configure Tool Groups ..."),
 4046             self.__toolGroupsConfiguration)
 4047         act.setData(-1)
 4048         act = self.__menus["user_tools"].addAction(
 4049             self.tr("Configure current Tool Group ..."),
 4050             self.__toolsConfiguration)
 4051         act.setData(-2)
 4052         act.setEnabled(self.currentToolGroup >= 0)
 4053         self.__menus["user_tools"].addSeparator()
 4054         
 4055         # add the configurable entries
 4056         idx = 0
 4057         try:
 4058             for tool in self.toolGroups[self.currentToolGroup][1]:
 4059                 if tool['menutext'] == '--':
 4060                     self.__menus["user_tools"].addSeparator()
 4061                 else:
 4062                     act = self.__menus["user_tools"].addAction(
 4063                         UI.PixmapCache.getIcon(tool['icon']),
 4064                         tool['menutext'])
 4065                     act.setData(idx)
 4066                 idx += 1
 4067         except IndexError:
 4068             # the current tool group might have been deleted
 4069             act = self.__menus["user_tools"].addAction(
 4070                 self.tr("No User Tools Configured"))
 4071             act.setData(-3)
 4072         
 4073     def __showToolGroupsMenu(self):
 4074         """
 4075         Private slot to display the Tool Groups menu.
 4076         """
 4077         self.toolGroupsMenu.clear()
 4078         
 4079         # add the configurable tool groups
 4080         if self.toolGroups:
 4081             idx = 0
 4082             for toolGroup in self.toolGroups:
 4083                 act = self.toolGroupsMenu.addAction(toolGroup[0])
 4084                 act.setData(idx)
 4085                 if self.currentToolGroup == idx:
 4086                     font = act.font()
 4087                     font.setBold(True)
 4088                     act.setFont(font)
 4089                 idx += 1
 4090         else:
 4091             act = self.toolGroupsMenu.addAction(
 4092                 self.tr("No User Tools Configured"))
 4093             act.setData(-3)
 4094         
 4095     def __toolGroupSelected(self, act):
 4096         """
 4097         Private slot to set the current tool group.
 4098         
 4099         @param act reference to the action that was triggered (QAction)
 4100         """
 4101         self.toolGroupsMenuTriggered = True
 4102         idx = act.data()
 4103         if idx is not None:
 4104             self.currentToolGroup = idx
 4105         
 4106     def __showWindowMenu(self):
 4107         """
 4108         Private slot to display the Window menu.
 4109         """
 4110         self.__menus["window"].clear()
 4111         
 4112         self.__menus["window"].addActions(self.viewProfileActGrp.actions())
 4113         self.__menus["window"].addSeparator()
 4114         
 4115         if self.__layoutType == "Toolboxes":
 4116             self.__menus["window"].addAction(self.ltAct)
 4117             self.ltAct.setChecked(not self.lToolboxDock.isHidden())
 4118             self.__menus["window"].addAction(self.rtAct)
 4119             self.rtAct.setChecked(not self.lToolboxDock.isHidden())
 4120             self.__menus["window"].addAction(self.htAct)
 4121             self.htAct.setChecked(not self.hToolboxDock.isHidden())
 4122         elif self.__layoutType == "Sidebars":
 4123             self.__menus["window"].addAction(self.lsbAct)
 4124             self.lsbAct.setChecked(not self.leftSidebar.isHidden())
 4125             self.__menus["window"].addAction(self.rsbAct)
 4126             self.rsbAct.setChecked(not self.rightSidebar.isHidden())
 4127             self.__menus["window"].addAction(self.bsbAct)
 4128             self.bsbAct.setChecked(not self.bottomSidebar.isHidden())
 4129         
 4130         # Insert menu entry for sub-windows
 4131         self.__menus["window"].addSeparator()
 4132         self.__menus["window"].addMenu(self.__menus["subwindow"])
 4133         
 4134         # Insert menu entry for toolbar settings
 4135         self.__menus["window"].addSeparator()
 4136         self.__menus["window"].addMenu(self.__menus["toolbars"])
 4137         
 4138         # Now do any Source Viewer related stuff.
 4139         self.viewmanager.showWindowMenu(self.__menus["window"])
 4140         
 4141         self.showMenu.emit("Window", self.__menus["window"])
 4142         
 4143     def __showSubWindowMenu(self):
 4144         """
 4145         Private slot to display the Window menu of the Window menu.
 4146         """
 4147         self.showMenu.emit("Subwindows", self.__menus["subwindow"])
 4148         
 4149     def __populateToolbarsMenu(self, menu):
 4150         """
 4151         Private method to populate a toolbars menu.
 4152         
 4153         @param menu reference to the menu to be populated (QMenu)
 4154         """
 4155         menu.clear()
 4156         
 4157         for name, (text, tb, category) in sorted(
 4158             self.__toolbars.items(), key=lambda t: t[1][0]
 4159         ):
 4160             act = menu.addAction(text)
 4161             act.setCheckable(True)
 4162             act.setChecked(not tb.isHidden())
 4163             act.setData(name)
 4164         menu.addSeparator()
 4165         act = menu.addAction(self.tr("&Show all"))
 4166         act.setData("__SHOW__")
 4167         act = menu.addAction(self.tr("&Hide all"))
 4168         act.setData("__HIDE__")
 4169         
 4170     def createPopupMenu(self):
 4171         """
 4172         Public method to create the toolbars menu for Qt.
 4173         
 4174         @return toolbars menu (QMenu)
 4175         """
 4176         menu = QMenu(self)
 4177         menu.triggered.connect(self.__TBPopupMenuTriggered)
 4178         
 4179         self.__populateToolbarsMenu(menu)
 4180         
 4181         return menu
 4182         
 4183     def __showToolbarsMenu(self):
 4184         """
 4185         Private slot to display the Toolbars menu.
 4186         """
 4187         self.__populateToolbarsMenu(self.__menus["toolbars"])
 4188 
 4189     def __TBMenuTriggered(self, act):
 4190         """
 4191         Private method to handle the toggle of a toolbar via the Window->
 4192         Toolbars submenu.
 4193         
 4194         @param act reference to the action that was triggered (QAction)
 4195         """
 4196         name = act.data()
 4197         if name:
 4198             if name == "__SHOW__":
 4199                 for _text, tb, category in self.__toolbars.values():
 4200                     tb.show()
 4201                 if self.__menus["toolbars"].isTearOffMenuVisible():
 4202                     self.__menus["toolbars"].hideTearOffMenu()
 4203             elif name == "__HIDE__":
 4204                 for _text, tb, category in self.__toolbars.values():
 4205                     tb.hide()
 4206                 if self.__menus["toolbars"].isTearOffMenuVisible():
 4207                     self.__menus["toolbars"].hideTearOffMenu()
 4208             else:
 4209                 tb = self.__toolbars[name][1]
 4210                 if act.isChecked():
 4211                     tb.show()
 4212                     tb.setEnabled(True)
 4213                 else:
 4214                     tb.hide()
 4215 
 4216     def __TBPopupMenuTriggered(self, act):
 4217         """
 4218         Private method to handle the toggle of a toolbar via the QMainWindow
 4219         Toolbars popup menu.
 4220         
 4221         @param act reference to the action that was triggered (QAction)
 4222         """
 4223         name = act.data()
 4224         if name:
 4225             if name == "__SHOW__":
 4226                 for _text, tb, category in self.__toolbars.values():
 4227                     tb.show()
 4228             elif name == "__HIDE__":
 4229                 for _text, tb, category in self.__toolbars.values():
 4230                     tb.hide()
 4231             else:
 4232                 tb = self.__toolbars[name][1]
 4233                 if act.isChecked():
 4234                     tb.show()
 4235                     tb.setEnabled(True)
 4236                 else:
 4237                     tb.hide()
 4238             if self.__menus["toolbars"].isTearOffMenuVisible():
 4239                 self.__menus["toolbars"].hideTearOffMenu()
 4240         
 4241     def __saveCurrentViewProfile(self, save):
 4242         """
 4243         Private slot to save the window geometries of the active profile.
 4244         
 4245         @param save flag indicating that the current profile should
 4246             be saved (boolean)
 4247         """
 4248         if self.currentProfile and save:
 4249             # step 1: save the window geometries of the active profile
 4250             if self.__layoutType in ["Toolboxes", "Sidebars"]:
 4251                 state = self.saveState()
 4252                 self.profiles[self.currentProfile][0] = state
 4253                 if self.__layoutType == "Sidebars":
 4254                     state = self.leftSplitter.saveState()
 4255                     self.profiles[self.currentProfile][2][0] = state
 4256                     state = self.verticalSplitter.saveState()
 4257                     self.profiles[self.currentProfile][2][1] = state
 4258                     state = self.leftSidebar.saveState()
 4259                     self.profiles[self.currentProfile][2][2] = state
 4260                     state = self.bottomSidebar.saveState()
 4261                     self.profiles[self.currentProfile][2][3] = state
 4262                     state = self.rightSplitter.saveState()
 4263                     self.profiles[self.currentProfile][2][4] = state
 4264                     state = self.rightSidebar.saveState()
 4265                     self.profiles[self.currentProfile][2][5] = state
 4266             # step 2: save the visibility of the windows of the active profile
 4267             if self.__layoutType == "Toolboxes":
 4268                 self.profiles[self.currentProfile][1][0] = (
 4269                     self.lToolboxDock.isVisible()
 4270                 )
 4271                 self.profiles[self.currentProfile][1][1] = (
 4272                     self.hToolboxDock.isVisible()
 4273                 )
 4274                 self.profiles[self.currentProfile][1][2] = (
 4275                     self.rToolboxDock.isVisible()
 4276                 )
 4277             elif self.__layoutType == "Sidebars":
 4278                 self.profiles[self.currentProfile][1][0] = (
 4279                     self.leftSidebar.isVisible()
 4280                 )
 4281                 self.profiles[self.currentProfile][1][1] = (
 4282                     self.bottomSidebar.isVisible()
 4283                 )
 4284                 self.profiles[self.currentProfile][1][2] = (
 4285                     self.rightSidebar.isVisible()
 4286                 )
 4287             Preferences.setUI("ViewProfiles2", self.profiles)
 4288     
 4289     def __activateViewProfile(self, name, save=True):
 4290         """
 4291         Private slot to activate a view profile.
 4292         
 4293         @param name name of the profile to be activated (string)
 4294         @param save flag indicating that the current profile should
 4295             be saved (boolean)
 4296         """
 4297         if self.currentProfile != name or not save:
 4298             # step 1: save the active profile
 4299             self.__saveCurrentViewProfile(save)
 4300             
 4301             # step 2: set the window geometries of the new profile
 4302             if self.__layoutType in ["Toolboxes", "Sidebars"]:
 4303                 state = self.profiles[name][0]
 4304                 if not state.isEmpty():
 4305                     self.restoreState(state)
 4306                 if self.__layoutType == "Sidebars":
 4307                     state = self.profiles[name][2][0]
 4308                     if not state.isEmpty():
 4309                         self.leftSplitter.restoreState(state)
 4310                     state = self.profiles[name][2][1]
 4311                     if not state.isEmpty():
 4312                         self.verticalSplitter.restoreState(state)
 4313                     state = self.profiles[name][2][2]
 4314                     if not state.isEmpty():
 4315                         self.leftSidebar.restoreState(state)
 4316                     state = self.profiles[name][2][3]
 4317                     if not state.isEmpty():
 4318                         self.bottomSidebar.restoreState(state)
 4319                     state = self.profiles[name][2][4]
 4320                     if not state.isEmpty():
 4321                         self.rightSplitter.restoreState(state)
 4322                     state = self.profiles[name][2][5]
 4323                     if not state.isEmpty():
 4324                         self.rightSidebar.restoreState(state)
 4325                 
 4326                 if self.__layoutType == "Toolboxes":
 4327                     # set the corner usages
 4328                     self.setCorner(Qt.TopLeftCorner,
 4329                                    Qt.LeftDockWidgetArea)
 4330                     self.setCorner(Qt.BottomLeftCorner,
 4331                                    Qt.LeftDockWidgetArea)
 4332                     self.setCorner(Qt.TopRightCorner,
 4333                                    Qt.RightDockWidgetArea)
 4334                     self.setCorner(Qt.BottomRightCorner,
 4335                                    Qt.RightDockWidgetArea)
 4336             
 4337             # step 3: activate the windows of the new profile
 4338             if self.__layoutType == "Toolboxes":
 4339                 self.lToolboxDock.setVisible(self.profiles[name][1][0])
 4340                 self.hToolboxDock.setVisible(self.profiles[name][1][1])
 4341                 self.rToolboxDock.setVisible(self.profiles[name][1][2])
 4342             elif self.__layoutType == "Sidebars":
 4343                 self.leftSidebar.setVisible(self.profiles[name][1][0])
 4344                 self.bottomSidebar.setVisible(self.profiles[name][1][1])
 4345                 self.rightSidebar.setVisible(self.profiles[name][1][2])
 4346             
 4347             # step 4: remember the new profile
 4348             self.currentProfile = name
 4349             
 4350             # step 5: make sure that cursor of the shell is visible
 4351             self.shell.ensureCursorVisible()
 4352             
 4353             # step 6: make sure, that the toolbars and window menu are
 4354             #         shown correctly
 4355             if self.__menus["toolbars"].isTearOffMenuVisible():
 4356                 self.__showToolbarsMenu()
 4357             if self.__menus["window"].isTearOffMenuVisible():
 4358                 self.__showWindowMenu()
 4359         
 4360     def __debuggingStarted(self):
 4361         """
 4362         Private slot to handle the start of a debugging session.
 4363         """
 4364         self.setDebugProfile()
 4365         if self.__layoutType == "Toolboxes":
 4366             self.__currentRightWidget = self.rToolbox.currentWidget()
 4367             self.rToolbox.setCurrentWidget(self.debugViewer)
 4368             self.__currentBottomWidget = self.hToolbox.currentWidget()
 4369             self.hToolbox.setCurrentWidget(self.shellAssembly)
 4370         elif self.__layoutType == "Sidebars":
 4371             self.__currentRightWidget = self.rightSidebar.currentWidget()
 4372             self.rightSidebar.setCurrentWidget(self.debugViewer)
 4373             self.__currentBottomWidget = self.bottomSidebar.currentWidget()
 4374             self.bottomSidebar.setCurrentWidget(self.shellAssembly)
 4375         
 4376     def __debuggingDone(self):
 4377         """
 4378         Private slot to handle the end of a debugging session.
 4379         """
 4380         self.__setEditProfile()
 4381         if self.__layoutType == "Toolboxes":
 4382             if self.__currentRightWidget:
 4383                 self.rToolbox.setCurrentWidget(self.__currentRightWidget)
 4384             if self.__currentBottomWidget:
 4385                 self.hToolbox.setCurrentWidget(self.__currentBottomWidget)
 4386         elif self.__layoutType == "Sidebars":
 4387             if self.__currentRightWidget:
 4388                 self.rightSidebar.setCurrentWidget(self.__currentRightWidget)
 4389             if self.__currentBottomWidget:
 4390                 self.bottomSidebar.setCurrentWidget(self.__currentBottomWidget)
 4391         self.__currentRightWidget = None
 4392         self.__currentBottomWidget = None
 4393         self.__activateViewmanager()
 4394         
 4395     @pyqtSlot()
 4396     def __setEditProfile(self, save=True):
 4397         """
 4398         Private slot to activate the edit view profile.
 4399         
 4400         @param save flag indicating that the current profile should
 4401             be saved (boolean)
 4402         """
 4403         self.__activateViewProfile("edit", save)
 4404         self.setEditProfileAct.setChecked(True)
 4405         
 4406     @pyqtSlot()
 4407     def setDebugProfile(self, save=True):
 4408         """
 4409         Public slot to activate the debug view profile.
 4410         
 4411         @param save flag indicating that the current profile should
 4412             be saved (boolean)
 4413         """
 4414         self.viewmanager.searchWidget().hide()
 4415         self.viewmanager.replaceWidget().hide()
 4416         self.__activateViewProfile("debug", save)
 4417         self.setDebugProfileAct.setChecked(True)
 4418         
 4419     def getViewProfile(self):
 4420         """
 4421         Public method to get the current view profile.
 4422         
 4423         @return the name of the current view profile (string)
 4424         """
 4425         return self.currentProfile
 4426     
 4427     def getLayoutType(self):
 4428         """
 4429         Public method to get the current layout type.
 4430         
 4431         @return current layout type
 4432         @rtype str
 4433         """
 4434         return self.__layoutType
 4435     
 4436     def __activateProjectBrowser(self):
 4437         """
 4438         Private slot to handle the activation of the project browser.
 4439         """
 4440         if self.__layoutType == "Toolboxes":
 4441             self.lToolboxDock.show()
 4442             self.lToolbox.setCurrentWidget(self.projectBrowser)
 4443         elif self.__layoutType == "Sidebars":
 4444             self.leftSidebar.show()
 4445             self.leftSidebar.setCurrentWidget(self.projectBrowser)
 4446         self.projectBrowser.currentWidget().setFocus(
 4447             Qt.ActiveWindowFocusReason)
 4448         
 4449     def __activateMultiProjectBrowser(self):
 4450         """
 4451         Private slot to handle the activation of the project browser.
 4452         """
 4453         if self.__layoutType == "Toolboxes":
 4454             self.lToolboxDock.show()
 4455             self.lToolbox.setCurrentWidget(self.multiProjectBrowser)
 4456         elif self.__layoutType == "Sidebars":
 4457             self.leftSidebar.show()
 4458             self.leftSidebar.setCurrentWidget(self.multiProjectBrowser)
 4459         self.multiProjectBrowser.setFocus(Qt.ActiveWindowFocusReason)
 4460         
 4461     def activateDebugViewer(self):
 4462         """
 4463         Public slot to handle the activation of the debug viewer.
 4464         """
 4465         if self.__layoutType == "Toolboxes":
 4466             self.rToolboxDock.show()
 4467             self.rToolbox.setCurrentWidget(self.debugViewer)
 4468         elif self.__layoutType == "Sidebars":
 4469             self.rightSidebar.show()
 4470             self.rightSidebar.setCurrentWidget(self.debugViewer)
 4471         self.debugViewer.currentWidget().setFocus(Qt.ActiveWindowFocusReason)
 4472         
 4473     def __activateShell(self):
 4474         """
 4475         Private slot to handle the activation of the Shell window.
 4476         """
 4477         if self.__layoutType == "Toolboxes":
 4478             self.__shellParent.show()
 4479             self.__shellParent.widget().setCurrentWidget(self.shellAssembly)
 4480         elif self.__layoutType == "Sidebars":
 4481             self.__shellParent.show()
 4482             self.__shellParent.setCurrentWidget(self.shellAssembly)
 4483         self.shell.setFocus(Qt.ActiveWindowFocusReason)
 4484         
 4485     def __activateLogViewer(self):
 4486         """
 4487         Private slot to handle the activation of the Log Viewer.
 4488         """
 4489         if self.__layoutType == "Toolboxes":
 4490             self.hToolboxDock.show()
 4491             self.hToolbox.setCurrentWidget(self.logViewer)
 4492         elif self.__layoutType == "Sidebars":
 4493             self.bottomSidebar.show()
 4494             self.bottomSidebar.setCurrentWidget(self.logViewer)
 4495         self.logViewer.setFocus(Qt.ActiveWindowFocusReason)
 4496         
 4497     def __activateTaskViewer(self):
 4498         """
 4499         Private slot to handle the activation of the Task Viewer.
 4500         """
 4501         if self.__layoutType == "Toolboxes":
 4502             self.hToolboxDock.show()
 4503             self.hToolbox.setCurrentWidget(self.taskViewer)
 4504         elif self.__layoutType == "Sidebars":
 4505             self.bottomSidebar.show()
 4506             self.bottomSidebar.setCurrentWidget(self.taskViewer)
 4507         self.taskViewer.setFocus(Qt.ActiveWindowFocusReason)
 4508         
 4509     def __activateTemplateViewer(self):
 4510         """
 4511         Private slot to handle the activation of the Template Viewer.
 4512         """
 4513         if self.templateViewer is not None:
 4514             if self.__layoutType == "Toolboxes":
 4515                 self.lToolboxDock.show()
 4516                 self.lToolbox.setCurrentWidget(self.templateViewer)
 4517             elif self.__layoutType == "Sidebars":
 4518                 self.leftSidebar.show()
 4519                 self.leftSidebar.setCurrentWidget(self.templateViewer)
 4520             self.templateViewer.setFocus(Qt.ActiveWindowFocusReason)
 4521         
 4522     def __activateBrowser(self):
 4523         """
 4524         Private slot to handle the activation of the file browser.
 4525         """
 4526         if self.browser is not None:
 4527             if self.__layoutType == "Toolboxes":
 4528                 self.lToolboxDock.show()
 4529                 self.lToolbox.setCurrentWidget(self.browser)
 4530             elif self.__layoutType == "Sidebars":
 4531                 self.leftSidebar.show()
 4532                 self.leftSidebar.setCurrentWidget(self.browser)
 4533             self.browser.setFocus(Qt.ActiveWindowFocusReason)
 4534         
 4535     def __toggleLeftToolbox(self):
 4536         """
 4537         Private slot to handle the toggle of the Left Toolbox window.
 4538         """
 4539         hasFocus = self.lToolbox.currentWidget().hasFocus()
 4540         shown = self.__toggleWindow(self.lToolboxDock)
 4541         if shown:
 4542             self.lToolbox.currentWidget().setFocus(Qt.ActiveWindowFocusReason)
 4543         else:
 4544             if hasFocus:
 4545                 self.__activateViewmanager()
 4546         
 4547     def __toggleRightToolbox(self):
 4548         """
 4549         Private slot to handle the toggle of the Right Toolbox window.
 4550         """
 4551         hasFocus = self.rToolbox.currentWidget().hasFocus()
 4552         shown = self.__toggleWindow(self.rToolboxDock)
 4553         if shown:
 4554             self.rToolbox.currentWidget().setFocus(Qt.ActiveWindowFocusReason)
 4555         else:
 4556             if hasFocus:
 4557                 self.__activateViewmanager()
 4558         
 4559     def __toggleHorizontalToolbox(self):
 4560         """
 4561         Private slot to handle the toggle of the Horizontal Toolbox window.
 4562         """
 4563         hasFocus = self.hToolbox.currentWidget().hasFocus()
 4564         shown = self.__toggleWindow(self.hToolboxDock)
 4565         if shown:
 4566             self.hToolbox.currentWidget().setFocus(Qt.ActiveWindowFocusReason)
 4567         else:
 4568             if hasFocus:
 4569                 self.__activateViewmanager()
 4570         
 4571     def __toggleLeftSidebar(self):
 4572         """
 4573         Private slot to handle the toggle of the left sidebar window.
 4574         """
 4575         hasFocus = self.leftSidebar.currentWidget().hasFocus()
 4576         shown = self.__toggleWindow(self.leftSidebar)
 4577         if shown:
 4578             self.leftSidebar.currentWidget().setFocus(
 4579                 Qt.ActiveWindowFocusReason)
 4580         else:
 4581             if hasFocus:
 4582                 self.__activateViewmanager()
 4583         
 4584     def __toggleRightSidebar(self):
 4585         """
 4586         Private slot to handle the toggle of the right sidebar window.
 4587         """
 4588         hasFocus = self.rightSidebar.currentWidget().hasFocus()
 4589         shown = self.__toggleWindow(self.rightSidebar)
 4590         if shown:
 4591             self.rightSidebar.currentWidget().setFocus(
 4592                 Qt.ActiveWindowFocusReason)
 4593         else:
 4594             if hasFocus:
 4595                 self.__activateViewmanager()
 4596         
 4597     def __toggleBottomSidebar(self):
 4598         """
 4599         Private slot to handle the toggle of the bottom sidebar window.
 4600         """
 4601         hasFocus = self.bottomSidebar.currentWidget().hasFocus()
 4602         shown = self.__toggleWindow(self.bottomSidebar)
 4603         if shown:
 4604             self.bottomSidebar.currentWidget().setFocus(
 4605                 Qt.ActiveWindowFocusReason)
 4606         else:
 4607             if hasFocus:
 4608                 self.__activateViewmanager()
 4609         
 4610     def activateCooperationViewer(self):
 4611         """
 4612         Public slot to handle the activation of the cooperation window.
 4613         """
 4614         if self.cooperation is not None:
 4615             if self.__layoutType == "Toolboxes":
 4616                 self.rToolboxDock.show()
 4617                 self.rToolbox.setCurrentWidget(self.cooperation)
 4618             elif self.__layoutType == "Sidebars":
 4619                 self.rightSidebar.show()
 4620                 self.rightSidebar.setCurrentWidget(self.cooperation)
 4621             self.cooperation.setFocus(Qt.ActiveWindowFocusReason)
 4622         
 4623     def __activateIRC(self):
 4624         """
 4625         Private slot to handle the activation of the IRC window.
 4626         """
 4627         if self.irc is not None:
 4628             if self.__layoutType == "Toolboxes":
 4629                 self.rToolboxDock.show()
 4630                 self.rToolbox.setCurrentWidget(self.irc)
 4631             elif self.__layoutType == "Sidebars":
 4632                 self.rightSidebar.show()
 4633                 self.rightSidebar.setCurrentWidget(self.irc)
 4634             self.irc.setFocus(Qt.ActiveWindowFocusReason)
 4635         
 4636     def __activateSymbolsViewer(self):
 4637         """
 4638         Private slot to handle the activation of the Symbols Viewer.
 4639         """
 4640         if self.symbolsViewer is not None:
 4641             if self.__layoutType == "Toolboxes":
 4642                 self.lToolboxDock.show()
 4643                 self.lToolbox.setCurrentWidget(self.symbolsViewer)
 4644             elif self.__layoutType == "Sidebars":
 4645                 self.leftSidebar.show()
 4646                 self.leftSidebar.setCurrentWidget(self.symbolsViewer)
 4647             self.symbolsViewer.setFocus(Qt.ActiveWindowFocusReason)
 4648         
 4649     def __activateNumbersViewer(self):
 4650         """
 4651         Private slot to handle the activation of the Numbers Viewer.
 4652         """
 4653         if self.numbersViewer is not None:
 4654             if self.__layoutType == "Toolboxes":
 4655                 self.hToolboxDock.show()
 4656                 self.hToolbox.setCurrentWidget(self.numbersViewer)
 4657             elif self.__layoutType == "Sidebars":
 4658                 self.bottomSidebar.show()
 4659                 self.bottomSidebar.setCurrentWidget(self.numbersViewer)
 4660             self.numbersViewer.setFocus(Qt.ActiveWindowFocusReason)
 4661         
 4662     def __activateViewmanager(self):
 4663         """
 4664         Private slot to handle the activation of the current editor.
 4665         """
 4666         aw = self.viewmanager.activeWindow()
 4667         if aw is not None:
 4668             aw.setFocus(Qt.ActiveWindowFocusReason)
 4669     
 4670     def activateCodeDocumentationViewer(self, switchFocus=True):
 4671         """
 4672         Public slot to handle the activation of the Code Documentation Viewer.
 4673         
 4674         @param switchFocus flag indicating to transfer the input focus
 4675         @type bool
 4676         """
 4677         if self.codeDocumentationViewer is not None:
 4678             if self.__layoutType == "Toolboxes":
 4679                 self.rToolboxDock.show()
 4680                 self.rToolbox.setCurrentWidget(self.codeDocumentationViewer)
 4681             elif self.__layoutType == "Sidebars":
 4682                 self.rightSidebar.show()
 4683                 self.rightSidebar.setCurrentWidget(
 4684                     self.codeDocumentationViewer)
 4685             if