36 """ |
36 """ |
37 super().__init__(parent) |
37 super().__init__(parent) |
38 |
38 |
39 self.__isGlobal = isGlobal |
39 self.__isGlobal = isGlobal |
40 |
40 |
41 def writeFile(self, filename: str) -> bool: |
41 def writeFile(self, filename: str, withServer: bool = True) -> bool: |
42 """ |
42 """ |
43 Public method to write the session data to a session JSON file. |
43 Public method to write the session data to a session JSON file. |
44 |
44 |
45 @param filename name of the session file |
45 @param filename name of the session file |
46 @type str |
46 @type str |
|
47 @param withServer flag indicating to save the current server connection |
|
48 (defaults to True) |
|
49 @type bool (optional) |
47 @return flag indicating a successful write |
50 @return flag indicating a successful write |
48 @rtype bool |
51 @rtype bool |
49 """ |
52 """ |
50 # get references to objects we need |
53 # get references to objects we need |
51 serverInterface = ericApp().getObject("EricServer") |
54 serverInterface = ericApp().getObject("EricServer") |
72 if Preferences.getProject("TimestampFile") or self.__isGlobal: |
75 if Preferences.getProject("TimestampFile") or self.__isGlobal: |
73 sessionDict["header"]["saved"] = time.strftime("%Y-%m-%d, %H:%M:%S") |
76 sessionDict["header"]["saved"] = time.strftime("%Y-%m-%d, %H:%M:%S") |
74 |
77 |
75 # step 1: eric-ide Server Connection |
78 # step 1: eric-ide Server Connection |
76 # ================================== |
79 # ================================== |
77 sessionDict["RemoteServer"] = ( |
80 if withServer: |
78 serverInterface.getHost() if serverInterface.isServerConnected() else "" |
81 sessionDict["RemoteServer"] = ( |
79 ) |
82 serverInterface.getHost() if serverInterface.isServerConnected() else "" |
|
83 ) |
80 |
84 |
81 # step 2: open multi project and project for global session |
85 # step 2: open multi project and project for global session |
82 # ========================================================= |
86 # ========================================================= |
83 sessionDict["MultiProject"] = "" |
87 sessionDict["MultiProject"] = "" |
84 sessionDict["Project"] = "" |
88 sessionDict["Project"] = "" |