eric6/Sessions/SessionFile.py

changeset 8164
c8b88e73b56f
parent 8163
29fb6d420a25
child 8218
7c09585bd960
equal deleted inserted replaced
8163:29fb6d420a25 8164:c8b88e73b56f
271 vm = e5App().getObject("ViewManager") 271 vm = e5App().getObject("ViewManager")
272 dbg = e5App().getObject("DebugUI") 272 dbg = e5App().getObject("DebugUI")
273 dbs = e5App().getObject("DebugServer") 273 dbs = e5App().getObject("DebugServer")
274 274
275 # step 1: multi project and project 275 # step 1: multi project and project
276 # =================================
276 if sessionDict["MultiProject"]: 277 if sessionDict["MultiProject"]:
277 multiProject.openMultiProject(sessionDict["MultiProject"], False) 278 multiProject.openMultiProject(sessionDict["MultiProject"], False)
278 if sessionDict["Project"]: 279 if sessionDict["Project"]:
279 project.openProject(sessionDict["Project"], False) 280 project.openProject(sessionDict["Project"], False)
280 281
281 # step 2: (project) filenames and the active editor 282 # step 2: (project) filenames and the active editor
283 # =================================================
282 vm.setSplitOrientation(sessionDict["ViewManagerSplits"]["Orientation"]) 284 vm.setSplitOrientation(sessionDict["ViewManagerSplits"]["Orientation"])
283 vm.setSplitCount(sessionDict["ViewManagerSplits"]["Count"]) 285 vm.setSplitCount(sessionDict["ViewManagerSplits"]["Count"])
284 286
285 editorsDict = {} 287 editorsDict = {}
286 for editorDict in sessionDict["Editors"]: 288 for editorDict in sessionDict["Editors"]:
304 ed.recolor() 306 ed.recolor()
305 ed.setContractedFolds(editorDict["Folds"]) 307 ed.setContractedFolds(editorDict["Folds"])
306 ed.setCursorPosition(*editorDict["Cursor"]) 308 ed.setCursorPosition(*editorDict["Cursor"])
307 309
308 # step 3: breakpoints 310 # step 3: breakpoints
311 # ===================
309 bpModel = dbs.getBreakPointModel() 312 bpModel = dbs.getBreakPointModel()
310 bpModel.addBreakPoints(sessionDict["Breakpoints"]) 313 bpModel.addBreakPoints(sessionDict["Breakpoints"])
311 314
312 # step 4: watch expressions 315 # step 4: watch expressions
316 # =========================
313 wpModel = dbs.getWatchPointModel() 317 wpModel = dbs.getWatchPointModel()
314 wpModel.addWatchPoints(sessionDict["Watchpoints"]) 318 wpModel.addWatchPoints(sessionDict["Watchpoints"])
315 319
316 # step 5: debug info 320 # step 5: debug info
321 # ==================
317 debugInfoDict = sessionDict["DebugInfo"] 322 debugInfoDict = sessionDict["DebugInfo"]
323
324 # adjust for newer session types
325 if "GlobalConfigOverride" not in debugInfoDict:
326 debugInfoDict["GlobalConfigOverride"] = {
327 "enable": False,
328 "redirect": True,
329 }
330
318 dbg.lastUsedVenvName = debugInfoDict["VirtualEnv"] 331 dbg.lastUsedVenvName = debugInfoDict["VirtualEnv"]
319 dbg.setArgvHistory(debugInfoDict["CommandLine"]) 332 dbg.setArgvHistory(debugInfoDict["CommandLine"])
320 dbg.setWdHistory(debugInfoDict["WorkingDirectory"]) 333 dbg.setWdHistory(debugInfoDict["WorkingDirectory"])
321 dbg.setEnvHistory(debugInfoDict["Environment"]) 334 dbg.setEnvHistory(debugInfoDict["Environment"])
322 dbg.setExceptionReporting(debugInfoDict["ReportExceptions"]) 335 dbg.setExceptionReporting(debugInfoDict["ReportExceptions"])
345 debugInfoDict["MultiprocessNoDebug"], 358 debugInfoDict["MultiprocessNoDebug"],
346 debugInfoDict["GlobalConfigOverride"], 359 debugInfoDict["GlobalConfigOverride"],
347 ) 360 )
348 361
349 # step 6: bookmarks 362 # step 6: bookmarks
363 # =================
350 for bookmark in sessionDict["Bookmarks"]: 364 for bookmark in sessionDict["Bookmarks"]:
351 editor = vm.getOpenEditor(bookmark["Filename"]) 365 editor = vm.getOpenEditor(bookmark["Filename"])
352 if editor is not None: 366 if editor is not None:
353 for lineno in bookmark["Lines"]: 367 for lineno in bookmark["Lines"]:
354 editor.toggleBookmark(lineno) 368 editor.toggleBookmark(lineno)
355 369
356 # step 7: state of the various project browsers 370 # step 7: state of the various project browsers
371 # =============================================
357 for browserState in sessionDict["ProjectBrowserStates"]: 372 for browserState in sessionDict["ProjectBrowserStates"]:
358 browser = projectBrowser.getProjectBrowser(browserState["Name"]) 373 browser = projectBrowser.getProjectBrowser(browserState["Name"])
359 if browser is not None: 374 if browser is not None:
360 browser.expandItemsByName(browserState["ExpandedItems"]) 375 browser.expandItemsByName(browserState["ExpandedItems"])
361 376
362 # step 8: active window 377 # step 8: active window
378 # =====================
363 if sessionDict["ActiveWindow"]: 379 if sessionDict["ActiveWindow"]:
364 vm.openFiles(sessionDict["ActiveWindow"]["Filename"]) 380 vm.openFiles(sessionDict["ActiveWindow"]["Filename"])
365 ed = vm.getOpenEditor(sessionDict["ActiveWindow"]["Filename"]) 381 ed = vm.getOpenEditor(sessionDict["ActiveWindow"]["Filename"])
366 if ed is not None: 382 if ed is not None:
367 ed.setCursorPosition(*sessionDict["ActiveWindow"]["Cursor"]) 383 ed.setCursorPosition(*sessionDict["ActiveWindow"]["Cursor"])

eric ide

mercurial