eric6/Preferences/HighlightingStylesFile.py

changeset 8240
93b8a353c4bf
parent 8218
7c09585bd960
equal deleted inserted replaced
8239:59a9a658618c 8240:93b8a353c4bf
81 81
82 try: 82 try:
83 jsonString = json.dumps(stylesDict, indent=2) 83 jsonString = json.dumps(stylesDict, indent=2)
84 with open(filename, "w") as f: 84 with open(filename, "w") as f:
85 f.write(jsonString) 85 f.write(jsonString)
86 except (TypeError, EnvironmentError) as err: 86 except (TypeError, OSError) as err:
87 with E5OverridenCursor(): 87 with E5OverridenCursor():
88 E5MessageBox.critical( 88 E5MessageBox.critical(
89 None, 89 None,
90 self.tr("Export Highlighting Styles"), 90 self.tr("Export Highlighting Styles"),
91 self.tr( 91 self.tr(
109 """ 109 """
110 try: 110 try:
111 with open(filename, "r") as f: 111 with open(filename, "r") as f:
112 jsonString = f.read() 112 jsonString = f.read()
113 stylesDict = json.loads(jsonString) 113 stylesDict = json.loads(jsonString)
114 except (EnvironmentError, json.JSONDecodeError) as err: 114 except (OSError, json.JSONDecodeError) as err:
115 E5MessageBox.critical( 115 E5MessageBox.critical(
116 None, 116 None,
117 self.tr("Import Highlighting Styles"), 117 self.tr("Import Highlighting Styles"),
118 self.tr( 118 self.tr(
119 "<p>The highlighting styles file <b>{0}</b> could not be" 119 "<p>The highlighting styles file <b>{0}</b> could not be"

eric ide

mercurial