eric7/MultiProject/MultiProjectFile.py

branch
eric7
changeset 8356
68ec9c3d4de5
parent 8318
962bce857696
child 8358
144a6b854f70
equal deleted inserted replaced
8355:8a7677a63c8d 8356:68ec9c3d4de5
12 import time 12 import time
13 import typing 13 import typing
14 14
15 from PyQt6.QtCore import QObject 15 from PyQt6.QtCore import QObject
16 16
17 from E5Gui import E5MessageBox 17 from E5Gui import EricMessageBox
18 from E5Gui.E5OverrideCursor import E5OverridenCursor 18 from E5Gui.EricOverrideCursor import EricOverridenCursor
19 19
20 import Preferences 20 import Preferences
21 21
22 MultiProject = typing.TypeVar("MultiProject") 22 MultiProject = typing.TypeVar("MultiProject")
23 23
66 try: 66 try:
67 jsonString = json.dumps(multiProjectDict, indent=2) 67 jsonString = json.dumps(multiProjectDict, indent=2)
68 with open(filename, "w") as f: 68 with open(filename, "w") as f:
69 f.write(jsonString) 69 f.write(jsonString)
70 except (TypeError, OSError) as err: 70 except (TypeError, OSError) as err:
71 with E5OverridenCursor(): 71 with EricOverridenCursor():
72 E5MessageBox.critical( 72 EricMessageBox.critical(
73 None, 73 None,
74 self.tr("Save Multi Project File"), 74 self.tr("Save Multi Project File"),
75 self.tr( 75 self.tr(
76 "<p>The multi project file <b>{0}</b> could not be " 76 "<p>The multi project file <b>{0}</b> could not be "
77 "written.</p><p>Reason: {1}</p>" 77 "written.</p><p>Reason: {1}</p>"
94 try: 94 try:
95 with open(filename, "r") as f: 95 with open(filename, "r") as f:
96 jsonString = f.read() 96 jsonString = f.read()
97 multiProjectDict = json.loads(jsonString) 97 multiProjectDict = json.loads(jsonString)
98 except (OSError, json.JSONDecodeError) as err: 98 except (OSError, json.JSONDecodeError) as err:
99 E5MessageBox.critical( 99 EricMessageBox.critical(
100 None, 100 None,
101 self.tr("Read Multi Project File"), 101 self.tr("Read Multi Project File"),
102 self.tr( 102 self.tr(
103 "<p>The multi project file <b>{0}</b> could not be " 103 "<p>The multi project file <b>{0}</b> could not be "
104 "read.</p><p>Reason: {1}</p>" 104 "read.</p><p>Reason: {1}</p>"

eric ide

mercurial