eric7/Sessions/SessionFile.py

branch
eric7
changeset 8529
569623270e29
parent 8358
144a6b854f70
child 8881
54e42bc2437a
equal deleted inserted replaced
8528:2175f268ad9b 8529:569623270e29
5 5
6 """ 6 """
7 Module implementing a class representing the session JSON file. 7 Module implementing a class representing the session JSON file.
8 """ 8 """
9 9
10 import contextlib
10 import json 11 import json
11 import time 12 import time
12 13
13 from PyQt6.QtCore import Qt, QObject 14 from PyQt6.QtCore import Qt, QObject
14 15
143 wpModel = dbs.getWatchPointModel() 144 wpModel = dbs.getWatchPointModel()
144 sessionDict["Watchpoints"] = wpModel.getAllWatchpoints() 145 sessionDict["Watchpoints"] = wpModel.getAllWatchpoints()
145 146
146 # step 5: debug info 147 # step 5: debug info
147 if self.__isGlobal: 148 if self.__isGlobal:
149 if len(dbg.scriptsHistory):
150 dbgScriptName = dbg.scriptsHistory[0]
151 else:
152 dbgScriptName = ""
148 if len(dbg.argvHistory): 153 if len(dbg.argvHistory):
149 dbgCmdline = dbg.argvHistory[0] 154 dbgCmdline = dbg.argvHistory[0]
150 else: 155 else:
151 dbgCmdline = "" 156 dbgCmdline = ""
152 if len(dbg.wdHistory): 157 if len(dbg.wdHistory):
163 ) 168 )
164 else: 169 else:
165 dbgMultiprocessNoDebug = "" 170 dbgMultiprocessNoDebug = ""
166 sessionDict["DebugInfo"] = { 171 sessionDict["DebugInfo"] = {
167 "VirtualEnv": dbg.lastUsedVenvName, 172 "VirtualEnv": dbg.lastUsedVenvName,
173 "ScriptName": dbgScriptName,
168 "CommandLine": dbgCmdline, 174 "CommandLine": dbgCmdline,
169 "WorkingDirectory": dbgWd, 175 "WorkingDirectory": dbgWd,
170 "Environment": dbgEnv, 176 "Environment": dbgEnv,
171 "ReportExceptions": dbg.exceptions, 177 "ReportExceptions": dbg.exceptions,
172 "Exceptions": dbg.excList, 178 "Exceptions": dbg.excList,
179 "GlobalConfigOverride": dbg.overrideGlobalConfig, 185 "GlobalConfigOverride": dbg.overrideGlobalConfig,
180 } 186 }
181 else: 187 else:
182 sessionDict["DebugInfo"] = { 188 sessionDict["DebugInfo"] = {
183 "VirtualEnv": project.dbgVirtualEnv, 189 "VirtualEnv": project.dbgVirtualEnv,
190 "ScriptName": "",
184 "CommandLine": project.dbgCmdline, 191 "CommandLine": project.dbgCmdline,
185 "WorkingDirectory": project.dbgWd, 192 "WorkingDirectory": project.dbgWd,
186 "Environment": project.dbgEnv, 193 "Environment": project.dbgEnv,
187 "ReportExceptions": project.dbgReportExceptions, 194 "ReportExceptions": project.dbgReportExceptions,
188 "Exceptions": project.dbgExcList, 195 "Exceptions": project.dbgExcList,
329 "enable": False, 336 "enable": False,
330 "redirect": True, 337 "redirect": True,
331 } 338 }
332 339
333 dbg.lastUsedVenvName = debugInfoDict["VirtualEnv"] 340 dbg.lastUsedVenvName = debugInfoDict["VirtualEnv"]
341 with contextlib.suppress(KeyError):
342 dbg.setScriptsHistory(debugInfoDict["ScriptName"])
334 dbg.setArgvHistory(debugInfoDict["CommandLine"]) 343 dbg.setArgvHistory(debugInfoDict["CommandLine"])
335 dbg.setWdHistory(debugInfoDict["WorkingDirectory"]) 344 dbg.setWdHistory(debugInfoDict["WorkingDirectory"])
336 dbg.setEnvHistory(debugInfoDict["Environment"]) 345 dbg.setEnvHistory(debugInfoDict["Environment"])
337 dbg.setExceptionReporting(debugInfoDict["ReportExceptions"]) 346 dbg.setExceptionReporting(debugInfoDict["ReportExceptions"])
338 dbg.setExcList(debugInfoDict["Exceptions"]) 347 dbg.setExcList(debugInfoDict["Exceptions"])

eric ide

mercurial