eric7/Project/DebuggerPropertiesFile.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 Project = typing.TypeVar("Project") 22 Project = typing.TypeVar("Project")
23 23
67 try: 67 try:
68 jsonString = json.dumps(debuggerPropertiesDict, indent=2) 68 jsonString = json.dumps(debuggerPropertiesDict, indent=2)
69 with open(filename, "w") as f: 69 with open(filename, "w") as f:
70 f.write(jsonString) 70 f.write(jsonString)
71 except (TypeError, OSError) as err: 71 except (TypeError, OSError) as err:
72 with E5OverridenCursor(): 72 with EricOverridenCursor():
73 E5MessageBox.critical( 73 EricMessageBox.critical(
74 None, 74 None,
75 self.tr("Save Debugger Properties"), 75 self.tr("Save Debugger Properties"),
76 self.tr( 76 self.tr(
77 "<p>The project debugger properties file" 77 "<p>The project debugger properties file"
78 " <b>{0}</b> could not be written.</p>" 78 " <b>{0}</b> could not be written.</p>"
96 try: 96 try:
97 with open(filename, "r") as f: 97 with open(filename, "r") as f:
98 jsonString = f.read() 98 jsonString = f.read()
99 debuggerPropertiesDict = json.loads(jsonString) 99 debuggerPropertiesDict = json.loads(jsonString)
100 except (OSError, json.JSONDecodeError) as err: 100 except (OSError, json.JSONDecodeError) as err:
101 E5MessageBox.critical( 101 EricMessageBox.critical(
102 None, 102 None,
103 self.tr("Read Debugger Properties"), 103 self.tr("Read Debugger Properties"),
104 self.tr( 104 self.tr(
105 "<p>The project debugger properties file <b>{0}</b>" 105 "<p>The project debugger properties file <b>{0}</b>"
106 " could not be read.</p><p>Reason: {1}</p>" 106 " could not be read.</p><p>Reason: {1}</p>"

eric ide

mercurial