160 |
160 |
161 try: |
161 try: |
162 jsonString = json.dumps(shortcutsDict, indent=2) |
162 jsonString = json.dumps(shortcutsDict, indent=2) |
163 with open(filename, "w") as f: |
163 with open(filename, "w") as f: |
164 f.write(jsonString) |
164 f.write(jsonString) |
165 except (TypeError, EnvironmentError) as err: |
165 except (TypeError, OSError) as err: |
166 with E5OverridenCursor(): |
166 with E5OverridenCursor(): |
167 E5MessageBox.critical( |
167 E5MessageBox.critical( |
168 None, |
168 None, |
169 self.tr("Export Keyboard Shortcuts"), |
169 self.tr("Export Keyboard Shortcuts"), |
170 self.tr( |
170 self.tr( |
190 """ |
190 """ |
191 try: |
191 try: |
192 with open(filename, "r") as f: |
192 with open(filename, "r") as f: |
193 jsonString = f.read() |
193 jsonString = f.read() |
194 shortcutsDict = json.loads(jsonString) |
194 shortcutsDict = json.loads(jsonString) |
195 except (EnvironmentError, json.JSONDecodeError) as err: |
195 except (OSError, json.JSONDecodeError) as err: |
196 E5MessageBox.critical( |
196 E5MessageBox.critical( |
197 None, |
197 None, |
198 self.tr("Import Keyboard Shortcuts"), |
198 self.tr("Import Keyboard Shortcuts"), |
199 self.tr( |
199 self.tr( |
200 "<p>The keyboard shortcuts file <b>{0}</b> could not be" |
200 "<p>The keyboard shortcuts file <b>{0}</b> could not be" |