src/eric7/UI/UserInterface.py

branch
eric7-maintenance
changeset 10814
ba20efe10336
parent 10733
d96c69a235fc
parent 10813
77d4d1878228
child 10815
b8631a4fb2f0
--- a/src/eric7/UI/UserInterface.py	Sun Jun 02 09:51:47 2024 +0200
+++ b/src/eric7/UI/UserInterface.py	Wed Jul 03 09:20:41 2024 +0200
@@ -59,7 +59,7 @@
     QWidget,
 )
 
-from eric7 import Globals, Preferences, Testing, Utilities
+from eric7 import EricUtilities, Globals, Preferences, Testing, Utilities
 from eric7.__version__ import Version, VersionOnly
 from eric7.CondaInterface.Conda import Conda
 from eric7.Debugger.DebugServer import DebugServer
@@ -87,6 +87,7 @@
 from eric7.Preferences import Shortcuts
 from eric7.Project.Project import Project
 from eric7.QScintilla.SpellChecker import SpellChecker
+from eric7.RemoteServerInterface.EricServerInterface import EricServerInterface
 from eric7.Sessions.SessionFile import SessionFile
 from eric7.SystemUtilities import (
     DesktopUtilities,
@@ -178,6 +179,27 @@
         self.buffer += str(s)
         self.__nWrite(self.__bufferedWrite())
 
+    def isatty(self):
+        """
+        Public method to indicate a tty.
+
+        Note: This always reports 'False'.
+
+        @return flag indicating a tty
+        @rtype bool
+        """
+        return False
+
+    @property
+    def encoding(self):
+        """
+        Public method to report the used encoding.
+
+        @return used encoding
+        @rtype str
+        """
+        return Preferences.getSystem("IOEncoding")
+
 
 class UserInterfaceSide(enum.Enum):
     """
@@ -216,6 +238,9 @@
     maxFilePathLen = 100
     maxMenuFilePathLen = 75
 
+    # TODO: change this to 'True' for official releases
+    ReleaseMode = False
+
     ErrorLogFileName = "eric7_error.log"
 
     def __init__(
@@ -313,48 +338,72 @@
         self.profiles = Preferences.getUI("ViewProfiles")
 
         splash.showMessage(self.tr("Initializing Basic Services..."))
+        logging.getLogger(__name__).debug("Initializing Basic Services...")
+
+        # Generate the redirection helpers
+        self.stdout = Redirector(False, self)
+        self.stdout.appendStdout.connect(self.appendToStdout)
+        self.stderr = Redirector(True, self)
+        self.stderr.appendStderr.connect(self.appendToStderr)
+        # Redirect sys.stdout and/or sys.stderr if those are None
+        if sys.stdout is None or UserInterface.ReleaseMode:
+            sys.stdout = self.stdout
+        if sys.stderr is None or UserInterface.ReleaseMode:
+            sys.stderr = self.stderr
+
+        # create the remote server interface
+        logging.getLogger(__name__).debug("Creating 'eric-ide' Server Interface...")
+        self.__ericServerInterface = EricServerInterface(self)
+        # register it early because it is needed very soon
+        ericApp().registerObject("EricServer", self.__ericServerInterface)
 
         # Generate the conda interface
-        logging.debug("Creating Conda Interface...")
+        logging.getLogger(__name__).debug("Creating Conda Interface...")
         self.condaInterface = Conda(self)
+        # register it early because it is needed very soon
         ericApp().registerObject("Conda", self.condaInterface)
 
         # Generate the pip interface
-        logging.debug("Creating Pip Interface...")
+        logging.getLogger(__name__).debug("Creating Pip Interface...")
         self.pipInterface = Pip(self)
+        # register it early because it is needed very soon
         ericApp().registerObject("Pip", self.pipInterface)
 
         # Generate the virtual environment manager
-        logging.debug("Creating Virtual Environments Manager...")
+        logging.getLogger(__name__).debug("Creating Virtual Environments Manager...")
         self.virtualenvManager = VirtualenvManager(self)
         # register it early because it is needed very soon
         ericApp().registerObject("VirtualEnvManager", self.virtualenvManager)
 
-        # Generate an empty project object and multi project object
-        logging.debug("Creating Project Manager...")
-        self.project = Project(self)
+        # Generate an empty project object
+        logging.getLogger(__name__).debug("Creating Project Manager...")
+        self.project = Project(self, remoteServer=self.__ericServerInterface)
         ericApp().registerObject("Project", self.project)
 
-        logging.debug("Creating Multi-Project Manager...")
+        # Generate the multi project object
+        logging.getLogger(__name__).debug("Creating Multi-Project Manager...")
         self.multiProject = MultiProject(self.project, self)
 
         # Generate the debug server object
-        logging.debug("Creating Debug Server...")
+        logging.getLogger(__name__).debug("Creating Debug Server...")
         self.__debugServer = DebugServer(
             self.__originalPathString, project=self.project, parent=self
         )
 
         # Create the background service object
+        logging.getLogger(__name__).debug("Creating Background Service...")
         self.backgroundService = BackgroundService(self)
 
         splash.showMessage(self.tr("Initializing Plugin Manager..."))
-
-        # Initialize the Plugin Manager (Plugins are initialized later
+        logging.getLogger(__name__).debug("Initializing Plugin Manager...")
+
+        # Initialize the Plugin Manager (Plugins are initialized later)
         self.pluginManager = PluginManager(
             self, self.__disabledPlugins, develPlugin=plugin
         )
 
         splash.showMessage(self.tr("Generating Main User Interface..."))
+        logging.getLogger(__name__).debug("Generating Main User Interface...")
 
         self.__webBrowserProcess = None
         self.__webBrowserClient = None
@@ -376,27 +425,23 @@
                 Preferences.getEditor("SpellCheckingDefaultLanguage"), pwl, pel
             )
 
-        logging.debug("Creating Application Objects...")
+        logging.getLogger(__name__).debug("Creating Application Objects...")
         self.__createObjects()
 
         # Create the main window now so that we can connect QActions to it.
-        logging.debug("Creating Layout...")
+        logging.getLogger(__name__).debug("Creating Layout...")
         self.__createLayout()
         self.__currentRightWidget = None
         self.__currentBottomWidget = None
 
         # Generate the debugger part of the ui
-        logging.debug("Creating Debugger UI...")
+        logging.getLogger(__name__).debug("Creating Debugger UI...")
         self.debuggerUI = DebugUI(
             self, self.viewmanager, self.__debugServer, self.debugViewer, self.project
         )
         self.debugViewer.setDebugger(self.debuggerUI)
         self.shell.setDebuggerUI(self.debuggerUI)
 
-        # Generate the redirection helpers
-        self.stdout = Redirector(False, self)
-        self.stderr = Redirector(True, self)
-
         # set a few dialog members for non-modal dialogs created on demand
         self.programsDialog = None
         self.shortcutsDialog = None
@@ -413,6 +458,9 @@
 
         # now setup the connections
         splash.showMessage(self.tr("Setting up signal/slot-connections..."))
+        logging.getLogger(__name__).debug(
+            self.tr("Setting up signal/slot-connections...")
+        )
 
         self.debugViewer.exceptionLogger.sourceFile.connect(
             self.viewmanager.openSourceFile
@@ -495,9 +543,6 @@
         self.__debugServer.clientProcessStderr.connect(self.appendToStderr)
         self.__debugServer.appendStdout.connect(self.appendToStdout)
 
-        self.stdout.appendStdout.connect(self.appendToStdout)
-        self.stderr.appendStderr.connect(self.appendToStderr)
-
         self.preferencesChanged.connect(self.viewmanager.preferencesChanged)
         self.reloadAPIs.connect(self.viewmanager.getAPIsManager().reloadAPIs)
         self.preferencesChanged.connect(self.logViewer.preferencesChanged)
@@ -599,6 +644,21 @@
                 self.viewmanager.closeDeviceEditors
             )
 
+        self.__ericServerInterface.connectionStateChanged.connect(
+            self.project.remoteConnectionChanged
+        )
+        self.__ericServerInterface.connectionStateChanged.connect(
+            self.viewmanager.remoteConnectionChanged
+        )
+        self.__ericServerInterface.connectionStateChanged.connect(
+            self.shell.remoteConnectionChanged
+        )
+
+        self.__ericServerInterface.aboutToDisconnect.connect(self.project.closeProject)
+        self.__ericServerInterface.aboutToDisconnect.connect(
+            self.viewmanager.closeRemoteEditors
+        )
+
         # create the toolbar manager object
         self.toolbarManager = EricToolBarManager(self, self)
         self.toolbarManager.setMainWindow(self)
@@ -606,6 +666,7 @@
 
         # Initialize the tool groups and list of started tools
         splash.showMessage(self.tr("Initializing Tools..."))
+        logging.getLogger(__name__).debug("Initializing Tools...")
         self.toolGroups, self.currentToolGroup = Preferences.readToolGroups()
         self.toolProcs = []
         self.__initExternalToolsActions()
@@ -617,6 +678,7 @@
 
         # register all relevant objects
         splash.showMessage(self.tr("Registering Objects..."))
+        logging.getLogger(__name__).debug("Registering Objects...")
         ericApp().registerObject("UserInterface", self)
         ericApp().registerObject("DebugUI", self.debuggerUI)
         ericApp().registerObject("DebugServer", self.__debugServer)
@@ -651,12 +713,16 @@
 
         # Initialize the actions, menus, toolbars and statusbar
         splash.showMessage(self.tr("Initializing Actions..."))
+        logging.getLogger(__name__).debug("Initializing Actions...")
         self.__initActions()
         splash.showMessage(self.tr("Initializing Menus..."))
+        logging.getLogger(__name__).debug("Initializing Menus...")
         self.__initMenus()
         splash.showMessage(self.tr("Initializing Toolbars..."))
+        logging.getLogger(__name__).debug("Initializing Toolbars...")
         self.__initToolbars()
         splash.showMessage(self.tr("Initializing Statusbar..."))
+        logging.getLogger(__name__).debug("Initializing Statusbar...")
         self.__initStatusbar()
 
         # connect the appFocusChanged signal after all actions are ready
@@ -676,28 +742,30 @@
         self.shutdownCalled = False
         self.inCloseEvent = False
 
-        # now redirect stdout and stderr
-        # TODO: release - reenable redirection
-        ##sys.stdout = self.stdout          # __IGNORE_WARNING_M891__
-        ##sys.stderr = self.stderr          # __IGNORE_WARNING_M891__
-
         # now fire up the single application server
         if Preferences.getUI("SingleApplicationMode"):
             splash.showMessage(self.tr("Initializing Single Application Server..."))
+            logging.getLogger(__name__).debug(
+                self.tr("Initializing Single Application Server...")
+            )
             self.SAServer = EricSingleApplicationServer()
         else:
             self.SAServer = None
 
         # now finalize the plugin manager setup
         splash.showMessage(self.tr("Initializing Plugins..."))
+        logging.getLogger(__name__).debug("Initializing Plugins...")
         self.pluginManager.finalizeSetup()
         # now activate plugins having autoload set to True
         splash.showMessage(self.tr("Activating Plugins..."))
+        logging.getLogger(__name__).debug("Activating Plugins...")
         self.pluginManager.activatePlugins()
         splash.showMessage(self.tr("Generating Plugins Toolbars..."))
+        logging.getLogger(__name__).debug("Generating Plugins Toolbars...")
         self.pluginManager.initPluginToolbars(self.toolbarManager)
         if Preferences.getPluginManager("StartupCleanup"):
             splash.showMessage(self.tr("Cleaning Plugins Download Area..."))
+            logging.getLogger(__name__).debug("Cleaning Plugins Download Area...")
             PluginRepositoryDownloadCleanup(quiet=True)
 
         if self.__findFileWidget:
@@ -708,6 +776,7 @@
 
         # restore toolbar manager state
         splash.showMessage(self.tr("Restoring Toolbarmanager..."))
+        logging.getLogger(__name__).debug("Restoring Toolbarmanager...")
         self.toolbarManager.restoreState(Preferences.getUI("ToolbarManagerState"))
 
         if self.codeDocumentationViewer is not None:
@@ -716,6 +785,7 @@
 
         # now activate the initial view profile
         splash.showMessage(self.tr("Setting View Profile..."))
+        logging.getLogger(__name__).debug("Setting View Profile...")
         self.__setEditProfile()
 
         # special treatment for the VCS toolbars
@@ -729,16 +799,19 @@
 
         # now read the saved tasks
         splash.showMessage(self.tr("Reading Tasks..."))
+        logging.getLogger(__name__).debug("Reading Tasks...")
         self.__readTasks()
 
         if self.templateViewer is not None:
             # now read the saved templates
             splash.showMessage(self.tr("Reading Templates..."))
+            logging.getLogger(__name__).debug("Reading Templates...")
             self.templateViewer.readTemplates()
 
         # now start the debug client with the most recently used virtual
         # environment
         splash.showMessage(self.tr("Starting Debugger..."))
+        logging.getLogger(__name__).debug("Starting Debugger...")
         if Preferences.getShell("StartWithMostRecentlyUsedEnvironment"):
             venvName = Preferences.getShell("LastVirtualEnvironment")
             if venvName == "embedded environment":
@@ -802,45 +875,45 @@
         from .PythonDisViewer import PythonDisViewer
 
         # Create the view manager depending on the configuration setting
-        logging.debug("Creating Viewmanager...")
+        logging.getLogger(__name__).debug("Creating Viewmanager...")
         self.viewmanager = ViewManager.factory(
-            self, self.__debugServer, self.pluginManager
+            self, self.__debugServer, self.__ericServerInterface, self.pluginManager
         )
 
         # Create previewer
-        logging.debug("Creating Previewer...")
+        logging.getLogger(__name__).debug("Creating Previewer...")
         self.__previewer = Previewer(self.viewmanager)
 
         # Create AST viewer
-        logging.debug("Creating Python AST Viewer")
+        logging.getLogger(__name__).debug("Creating Python AST Viewer")
         self.__astViewer = PythonAstViewer(self.viewmanager)
 
         # Create DIS viewer
-        logging.debug("Creating Python Disassembly Viewer")
+        logging.getLogger(__name__).debug("Creating Python Disassembly Viewer")
         self.__disViewer = PythonDisViewer(self.viewmanager)
 
         # Create the project browser
-        logging.debug("Creating Project Browser...")
+        logging.getLogger(__name__).debug("Creating Project Browser...")
         self.projectBrowser = ProjectBrowser(self.project)
 
         # Create the multi project browser
-        logging.debug("Creating Multiproject Browser...")
+        logging.getLogger(__name__).debug("Creating Multi Project Browser...")
         self.multiProjectBrowser = MultiProjectBrowser(self.multiProject, self.project)
 
         # Create the task viewer part of the user interface
-        logging.debug("Creating Task Viewer...")
+        logging.getLogger(__name__).debug("Creating Task Viewer...")
         self.taskViewer = TaskViewer(None, self.project)
 
         # Create the log viewer part of the user interface
-        logging.debug("Creating Log Viewer...")
+        logging.getLogger(__name__).debug("Creating Log Viewer...")
         self.logViewer = LogViewer(self)
 
         # Create the debug viewer
-        logging.debug("Creating Debug Viewer...")
+        logging.getLogger(__name__).debug("Creating Debug Viewer...")
         self.debugViewer = DebugViewer(self.__debugServer)
 
         # Create the shell
-        logging.debug("Creating Shell...")
+        logging.getLogger(__name__).debug("Creating Shell...")
         self.shellAssembly = ShellAssembly(
             self.__debugServer, self.viewmanager, self.project, True
         )
@@ -848,115 +921,116 @@
 
         if Preferences.getUI("ShowTemplateViewer"):
             # Create the template viewer part of the user interface
-            logging.debug("Creating Template Viewer...")
+            logging.getLogger(__name__).debug("Creating Template Viewer...")
             from eric7.Templates.TemplateViewer import TemplateViewer  # noqa: I101
 
             self.templateViewer = TemplateViewer(None, self.viewmanager)
         else:
-            logging.debug("Template Viewer disabled")
+            logging.getLogger(__name__).debug("Template Viewer disabled")
             self.templateViewer = None
 
         if Preferences.getUI("ShowFileBrowser"):
             # Create the file browser
-            logging.debug("Creating File Browser...")
+            logging.getLogger(__name__).debug("Creating File Browser...")
             from .Browser import Browser  # noqa: I101
 
-            self.browser = Browser()
+            self.browser = Browser(self.__ericServerInterface)
         else:
-            logging.debug("File Browser disabled")
+            logging.getLogger(__name__).debug("File Browser disabled")
             self.browser = None
 
         if Preferences.getUI("ShowSymbolsViewer"):
             # Create the symbols viewer
-            logging.debug("Creating Symbols Viewer...")
+            logging.getLogger(__name__).debug("Creating Symbols Viewer...")
             from .SymbolsWidget import SymbolsWidget  # noqa: I101
 
             self.symbolsViewer = SymbolsWidget()
         else:
-            logging.debug("Symbols Viewer disabled")
+            logging.getLogger(__name__).debug("Symbols Viewer disabled")
             self.symbolsViewer = None
 
         if Preferences.getUI("ShowCodeDocumentationViewer"):
             # Create the code documentation viewer
-            logging.debug("Creating Code Documentation Viewer...")
+            logging.getLogger(__name__).debug("Creating Code Documentation Viewer...")
             from .CodeDocumentationViewer import CodeDocumentationViewer  # noqa: I101
 
             self.codeDocumentationViewer = CodeDocumentationViewer(self)
         else:
-            logging.debug("Code Documentation Viewer disabled")
+            logging.getLogger(__name__).debug("Code Documentation Viewer disabled")
             self.codeDocumentationViewer = None
 
         if Preferences.getUI("ShowPyPIPackageManager"):
             # Create the PyPI package manager
-            logging.debug("Creating PyPI Package Manager...")
+            logging.getLogger(__name__).debug("Creating PyPI Package Manager...")
             from eric7.PipInterface.PipPackagesWidget import (  # noqa: I101
                 PipPackagesWidget,
             )
 
             self.pipWidget = PipPackagesWidget(self.pipInterface)
         else:
-            logging.debug("PyPI Package Manager disabled")
+            logging.getLogger(__name__).debug("PyPI Package Manager disabled")
             self.pipWidget = None
 
         if Preferences.getUI("ShowCondaPackageManager"):
             # Create the conda package manager
-            logging.debug("Creating Conda Package Manager...")
+            logging.getLogger(__name__).debug("Creating Conda Package Manager...")
             from eric7.CondaInterface.CondaPackagesWidget import (  # noqa: I101
                 CondaPackagesWidget,
             )
 
             self.condaWidget = CondaPackagesWidget(self.condaInterface)
         else:
-            logging.debug("Conda Package Manager disabled")
+            logging.getLogger(__name__).debug("Conda Package Manager disabled")
             self.condaWidget = None
 
         if Preferences.getUI("ShowCooperation"):
             # Create the chat part of the user interface
-            logging.debug("Creating Chat Widget...")
+            logging.getLogger(__name__).debug("Creating Chat Widget...")
             from eric7.Cooperation.ChatWidget import ChatWidget  # noqa: I101
 
             self.cooperation = ChatWidget(self)
         else:
-            logging.debug("Chat Widget disabled")
+            logging.getLogger(__name__).debug("Chat Widget disabled")
             self.cooperation = None
 
         if Preferences.getUI("ShowIrc"):
             # Create the IRC part of the user interface
-            logging.debug("Creating IRC Widget...")
+            logging.getLogger(__name__).debug("Creating IRC Widget...")
             from eric7.Network.IRC.IrcWidget import IrcWidget  # noqa: I101
 
             self.irc = IrcWidget(self)
         else:
-            logging.debug("IRC Widget disabled")
+            logging.getLogger(__name__).debug("IRC Widget disabled")
             self.irc = None
 
         if Preferences.getUI("ShowMicroPython"):
             # Create the MicroPython part of the user interface
-            logging.debug("Creating MicroPython Widget...")
+            logging.getLogger(__name__).debug("Creating MicroPython Widget...")
             from eric7.MicroPython.MicroPythonWidget import (  # noqa: I101
                 MicroPythonWidget,
             )
 
             self.microPythonWidget = MicroPythonWidget(self)
         else:
-            logging.debug("MicroPython Widget disabled")
+            logging.getLogger(__name__).debug("MicroPython Widget disabled")
             self.microPythonWidget = None
 
         if Preferences.getUI("ShowNumbersViewer"):
             # Create the numbers viewer
-            logging.debug("Creating Numbers Viewer...")
+            logging.getLogger(__name__).debug("Creating Numbers Viewer...")
             from .NumbersWidget import NumbersWidget  # noqa: I101
 
             self.numbersViewer = NumbersWidget()
         else:
-            logging.debug("Numbers Viewer disabled")
+            logging.getLogger(__name__).debug("Numbers Viewer disabled")
             self.numbersViewer = None
 
         # Create the Jedi Assistant
-        logging.debug("Creating Jedi Assistant...")
+        logging.getLogger(__name__).debug("Creating Jedi Assistant...")
         self.jediAssistant = AssistantJedi(self, self.viewmanager, self.project)
 
         # Create the plug-ins repository viewer
+        logging.getLogger(__name__).debug("Creating Plugin Repository Viewer...")
         self.pluginRepositoryViewer = PluginRepositoryWidget(
             self.pluginManager, integrated=True, parent=self
         )
@@ -965,6 +1039,7 @@
         )
 
         # Create the virtual environments management widget
+        logging.getLogger(__name__).debug("Creating Virtual Environments Viewer...")
         self.__virtualenvManagerWidget = VirtualenvManagerWidget(
             self.virtualenvManager, self
         )
@@ -975,6 +1050,7 @@
             # Create the find in files widget
             from .FindFileWidget import FindFileWidget  # noqa: I101
 
+            logging.getLogger(__name__).debug("Creating Find/Replace Pane...")
             self.__findFileWidget = FindFileWidget(self.project, self)
             self.__findFileWidget.sourceFile.connect(self.viewmanager.openSourceFile)
             self.__findFileWidget.designerFile.connect(self.__designer)
@@ -984,6 +1060,7 @@
             self.__findFileWidget.svgFile.connect(self.__showSvg)
             self.__findFileWidget.umlFile.connect(self.__showUml)
         else:
+            logging.getLogger(__name__).debug("Find/Replace Pane disabled...")
             self.__findFileWidget = None
 
         self.__findLocationDialog = None
@@ -991,6 +1068,7 @@
             # Create the find location (file) widget
             from .FindLocationWidget import FindLocationWidget  # noqa: I101
 
+            logging.getLogger(__name__).debug("Creating Find File Pane...")
             self.__findLocationWidget = FindLocationWidget(self.project, self)
             self.__findLocationWidget.sourceFile.connect(
                 self.viewmanager.openSourceFile
@@ -1002,9 +1080,11 @@
             self.__findLocationWidget.svgFile.connect(self.__showSvg)
             self.__findLocationWidget.umlFile.connect(self.__showUml)
         else:
+            logging.getLogger(__name__).debug("Find File Pane disabled...")
             self.__findLocationWidget = None
 
         # Create the VCS Status widget
+        logging.getLogger(__name__).debug("Creating VCS Status Viewer...")
         self.__vcsStatusWidget = StatusWidget(self.project, self.viewmanager, self)
 
         if (
@@ -1012,12 +1092,12 @@
             or Preferences.getHelp("HelpViewerType") == 0
         ):
             # Create the embedded help viewer
-            logging.debug("Creating Internal Help Viewer...")
+            logging.getLogger(__name__).debug("Creating Internal Help Viewer...")
             from eric7.HelpViewer.HelpViewerWidget import HelpViewerWidget  # noqa: I101
 
             self.__helpViewerWidget = HelpViewerWidget(self)
         else:
-            logging.debug("Internal Help Viewer disabled...")
+            logging.getLogger(__name__).debug("Internal Help Viewer disabled...")
             self.__helpViewerWidget = None
 
     def __createLayout(self):
@@ -1059,17 +1139,17 @@
 
         # Create layout with toolbox windows embedded in dock windows
         if self.__layoutType == "Toolboxes":
-            logging.debug("Creating toolboxes...")
+            logging.getLogger(__name__).debug("Creating toolboxes...")
             self.__createToolboxesLayout()
 
         # Create layout with sidebar windows embedded in dock windows
         elif self.__layoutType == "Sidebars":
-            logging.debug("Creating sidebars...")
+            logging.getLogger(__name__).debug("Creating sidebars...")
             self.__createSidebarsLayout()
 
         else:
             raise ValueError("Wrong layout type given ({0})".format(self.__layoutType))
-        logging.debug("Created Layout")
+        logging.getLogger(__name__).debug("Created Layout")
 
     def __createToolboxesLayout(self):
         """
@@ -1080,7 +1160,7 @@
             EricVerticalToolBox,
         )
 
-        logging.debug("Creating Toolboxes Layout...")
+        logging.getLogger(__name__).debug("Creating Toolboxes Layout...")
 
         # Create the left toolbox
         self.lToolboxDock = self.__createDockWindow("lToolboxDock")
@@ -1208,7 +1288,9 @@
 
         if self.pipWidget:
             self.rToolbox.addItem(
-                self.pipWidget, EricPixmapCache.getIcon("pypi"), self.tr("PyPI")
+                self.pipWidget,
+                EricPixmapCache.getIcon("pypi"),
+                self.tr("PyPI Package Management"),
             )
 
         if self.condaWidget:
@@ -1272,7 +1354,7 @@
         """
         from eric7.EricWidgets.EricSideBar import EricSideBar, EricSideBarSide
 
-        logging.debug("Creating Sidebars Layout...")
+        logging.getLogger(__name__).debug("Creating Sidebars Layout...")
 
         # Create the left sidebar
         self.leftSidebar = EricSideBar(
@@ -1404,7 +1486,9 @@
 
         if self.pipWidget:
             sidebar.addTab(
-                self.pipWidget, EricPixmapCache.getIcon("sbPyPI96"), self.tr("PyPI")
+                self.pipWidget,
+                EricPixmapCache.getIcon("sbPyPI96"),
+                self.tr("PyPI Package Management"),
             )
 
         if self.condaWidget:
@@ -1471,7 +1555,7 @@
         self.bottomSidebar.setCurrentIndex(0)
 
         # create the central widget
-        logging.debug("Creating central widget...")
+        logging.getLogger(__name__).debug("Creating central widget...")
         cw = self.centralWidget()  # save the current central widget
         self.horizontalSplitter = QSplitter(Qt.Orientation.Horizontal)
         self.horizontalSplitter.setChildrenCollapsible(False)
@@ -2460,15 +2544,15 @@
 
         if self.pipWidget is not None:
             self.pipWidgetActivateAct = EricAction(
-                self.tr("PyPI"),
-                self.tr("PyPI"),
+                self.tr("PyPI Package Management"),
+                self.tr("PyPI Package Management"),
                 QKeySequence(self.tr("Ctrl+Alt+Shift+P")),
                 0,
                 self,
                 "pip_widget_activate",
             )
             self.pipWidgetActivateAct.setStatusTip(
-                self.tr("Switch the input focus to the PyPI window.")
+                self.tr("Switch the input focus to the PyPI Package Management window.")
             )
             self.pipWidgetActivateAct.setWhatsThis(
                 self.tr(
@@ -3604,6 +3688,9 @@
         # initialize multi project actions
         self.multiProject.initActions()
 
+        # initialize eric-ide server actions
+        self.__ericServerInterface.initActions()
+
     def __initQtDocActions(self):
         """
         Private slot to initialize the action to show the Qt documentation.
@@ -3813,6 +3900,12 @@
             mb.setNativeMenuBar(False)
 
         ##############################################################
+        ## Remote Server menu
+        ##############################################################
+
+        self.__menus["server"] = self.__ericServerInterface.initMenu()
+
+        ##############################################################
         ## File menu
         ##############################################################
 
@@ -3827,6 +3920,9 @@
         act = self.__menus["file"].actions()[0]
         sep = self.__menus["file"].insertSeparator(act)
         self.__menus["file"].insertAction(sep, self.newWindowAct)
+        self.__menus["file"].insertSeparator(sep)
+        self.__menus["file"].insertMenu(sep, self.__menus["server"])
+        self.__menus["file"].insertSeparator(sep)
         self.__menus["file"].aboutToShow.connect(self.__showFileMenu)
 
         ##############################################################
@@ -4125,6 +4221,7 @@
         helptb = QToolBar(self.tr("Help"), self)
         profilestb = QToolBar(self.tr("Profiles"), self)
         pluginstb = QToolBar(self.tr("Plugins"), self)
+        servertb = self.__ericServerInterface.initToolbar(self.toolbarManager)
 
         toolstb.setObjectName("ToolsToolbar")
         testingtb.setObjectName("UnittestToolbar")
@@ -4228,6 +4325,7 @@
 
         # add the various toolbars
         self.addToolBar(filetb)
+        self.addToolBar(servertb)
         self.addToolBar(edittb)
         self.addToolBar(searchtb)
         self.addToolBar(viewtb)
@@ -4278,6 +4376,7 @@
         ]
         self.__toolbars["spelling"] = [spellingtb.windowTitle(), spellingtb, ""]
         self.__toolbars["vcs"] = [vcstb.windowTitle(), vcstb, "vcs"]
+        self.__toolbars["server"] = [servertb.windowTitle(), servertb, ""]
 
     def __initDebugToolbarsLayout(self):
         """
@@ -8366,12 +8465,12 @@
                             # daily, weekly, monthly
                             return
 
-            versionTuple = Globals.versionToTuple(VersionOnly)
+            versionTuple = EricUtilities.versionToTuple(VersionOnly)
             availableVersions = self.pipInterface.getPackageVersions("eric-ide")
             newerVersionsTuple = [
-                Globals.versionToTuple(v)
+                EricUtilities.versionToTuple(v)
                 for v in availableVersions
-                if Globals.versionToTuple(v) > versionTuple
+                if EricUtilities.versionToTuple(v) > versionTuple
             ]
             updateAvailable = bool(newerVersionsTuple)
             if updateAvailable:
@@ -8480,9 +8579,9 @@
                 vers = VersionOnly.split("snapshot-")[1]
                 return vers > snapshot
 
-        versionTuple = Globals.versionToTuple(VersionOnly)
+        versionTuple = EricUtilities.versionToTuple(VersionOnly)
         if isinstance(required, str):
-            required = Globals.versionToTuple(required)
+            required = EricUtilities.versionToTuple(required)
         try:
             res = versionTuple > required
         except TypeError:
@@ -8656,3 +8755,18 @@
         elif self.__layoutType == "Sidebars":
             self.__activateLeftRightSidebarWidget(self.__virtualenvManagerWidget)
         self.__virtualenvManagerWidget.setFocus(Qt.FocusReason.ActiveWindowFocusReason)
+
+    ############################################################
+    ## Interface to the eric-ide server interface
+    ############################################################
+
+    def isEricServerConnected(self):
+        """
+        Public method to check, if a connection to an eric-ide server has been
+        established.
+
+        @return flag indicating the interface connection state
+        @rtype bool
+        """
+        # simply delegated to the eric-ide server interface object
+        return self.__ericServerInterface.isServerConnected()

eric ide

mercurial