src/eric7/Preferences/ShortcutsFile.py

branch
eric7
changeset 9278
36448ca469c2
parent 9221
bf71ee032bb4
child 9413
80c06d472826
equal deleted inserted replaced
9277:471c5a263d53 9278:36448ca469c2
142 self.__addActionsToDict( 142 self.__addActionsToDict(
143 helpViewer.getActionsCategory(), helpViewer.getActions(), actionsDict 143 helpViewer.getActionsCategory(), helpViewer.getActions(), actionsDict
144 ) 144 )
145 145
146 # step 2: assemble the data structure to be written 146 # step 2: assemble the data structure to be written
147 shortcutsDict = {} 147 shortcutsDict = {
148 # step 2.0: header 148 # step 2.0: header
149 shortcutsDict["header"] = { 149 "header": {
150 "comment": "eric keyboard shortcuts file", 150 "comment": "eric keyboard shortcuts file",
151 "saved": time.strftime("%Y-%m-%d, %H:%M:%S"), 151 "saved": time.strftime("%Y-%m-%d, %H:%M:%S"),
152 "author": Preferences.getUser("Email"), 152 "author": Preferences.getUser("Email"),
153 },
154 # step 2.1: keyboard shortcuts
155 "shortcuts": actionsDict,
153 } 156 }
154 # step 2.1: keyboard shortcuts
155 shortcutsDict["shortcuts"] = actionsDict
156 157
157 try: 158 try:
158 jsonString = json.dumps(shortcutsDict, indent=2) 159 jsonString = json.dumps(shortcutsDict, indent=2)
159 with open(filename, "w") as f: 160 with open(filename, "w") as f:
160 f.write(jsonString) 161 f.write(jsonString)

eric ide

mercurial