Modified the session file to not include the eric-ide server connection when creating a project session as these are stored on the remote side. eric7

Sat, 12 Oct 2024 16:41:06 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 12 Oct 2024 16:41:06 +0200
branch
eric7
changeset 10969
705b71b3fde6
parent 10968
b462c3d33ca0
child 10970
2ad8a7d0867c

Modified the session file to not include the eric-ide server connection when creating a project session as these are stored on the remote side.

src/eric7/APIs/Python3/eric7.api file | annotate | diff | comparison | revisions
src/eric7/Documentation/Help/source.qch file | annotate | diff | comparison | revisions
src/eric7/Documentation/Source/eric7.Sessions.SessionFile.html file | annotate | diff | comparison | revisions
src/eric7/Project/Project.py file | annotate | diff | comparison | revisions
src/eric7/Sessions/SessionFile.py file | annotate | diff | comparison | revisions
--- a/src/eric7/APIs/Python3/eric7.api	Sat Oct 12 13:00:39 2024 +0200
+++ b/src/eric7/APIs/Python3/eric7.api	Sat Oct 12 16:41:06 2024 +0200
@@ -10069,7 +10069,7 @@
 eric7.RemoteServerInterface.EricServerProfilesDialog.EricServerProfilesDialog.on_resetButton_clicked?4()
 eric7.RemoteServerInterface.EricServerProfilesDialog.EricServerProfilesDialog?1(profiles, parent=None)
 eric7.Sessions.SessionFile.SessionFile.readFile?4(filename: str)
-eric7.Sessions.SessionFile.SessionFile.writeFile?4(filename: str)
+eric7.Sessions.SessionFile.SessionFile.writeFile?4(filename: str, withServer: bool = True)
 eric7.Sessions.SessionFile.SessionFile?1(isGlobal: bool, parent: QObject = None)
 eric7.Snapshot.SnapWidget.SnapWidget.closeEvent?4(evt)
 eric7.Snapshot.SnapWidget.SnapWidget.on_copyButton_clicked?4()
Binary file src/eric7/Documentation/Help/source.qch has changed
--- a/src/eric7/Documentation/Source/eric7.Sessions.SessionFile.html	Sat Oct 12 13:00:39 2024 +0200
+++ b/src/eric7/Documentation/Source/eric7.Sessions.SessionFile.html	Sat Oct 12 16:41:06 2024 +0200
@@ -117,7 +117,7 @@
 </dl>
 <a NAME="SessionFile.writeFile" ID="SessionFile.writeFile"></a>
 <h4>SessionFile.writeFile</h4>
-<b>writeFile</b>(<i>filename: str</i>)
+<b>writeFile</b>(<i>filename: str, withServer: bool = True</i>)
 <p>
         Public method to write the session data to a session JSON file.
 </p>
@@ -128,6 +128,11 @@
 <dd>
 name of the session file
 </dd>
+<dt><i>withServer</i> (bool (optional))</dt>
+<dd>
+flag indicating to save the current server connection
+            (defaults to True)
+</dd>
 </dl>
 <dl>
 <dt>Return:</dt>
--- a/src/eric7/Project/Project.py	Sat Oct 12 13:00:39 2024 +0200
+++ b/src/eric7/Project/Project.py	Sat Oct 12 16:41:06 2024 +0200
@@ -1382,7 +1382,7 @@
             fn1, _ext = os.path.splitext(os.path.basename(self.pfile))
             fn = os.path.join(self.getProjectManagementDir(), f"{fn1}{indicator}.esj")
 
-        self.__sessionFile.writeFile(fn)
+        self.__sessionFile.writeFile(fn, withServer=False)
 
     def __deleteSession(self):
         """
--- a/src/eric7/Sessions/SessionFile.py	Sat Oct 12 13:00:39 2024 +0200
+++ b/src/eric7/Sessions/SessionFile.py	Sat Oct 12 16:41:06 2024 +0200
@@ -38,12 +38,15 @@
 
         self.__isGlobal = isGlobal
 
-    def writeFile(self, filename: str) -> bool:
+    def writeFile(self, filename: str, withServer: bool = True) -> bool:
         """
         Public method to write the session data to a session JSON file.
 
         @param filename name of the session file
         @type str
+        @param withServer flag indicating to save the current server connection
+            (defaults to True)
+        @type bool (optional)
         @return flag indicating a successful write
         @rtype bool
         """
@@ -74,9 +77,10 @@
 
         # step 1: eric-ide Server Connection
         # ==================================
-        sessionDict["RemoteServer"] = (
-            serverInterface.getHost() if serverInterface.isServerConnected() else ""
-        )
+        if withServer:
+            sessionDict["RemoteServer"] = (
+                serverInterface.getHost() if serverInterface.isServerConnected() else ""
+            )
 
         # step 2: open multi project and project for global session
         # =========================================================

eric ide

mercurial