eric6/Preferences/ShortcutsFile.py

changeset 8244
ed8cb108b27b
parent 8240
93b8a353c4bf
equal deleted inserted replaced
8243:cc717c2ae956 8244:ed8cb108b27b
24 24
25 class ShortcutsFile(QObject): 25 class ShortcutsFile(QObject):
26 """ 26 """
27 Class representing the shortcuts JSON file. 27 Class representing the shortcuts JSON file.
28 """ 28 """
29 def __init__(self, parent: QObject = None): 29 def __init__(self: "ShortcutsFile", parent: QObject = None) -> None:
30 """ 30 """
31 Constructor 31 Constructor
32 32
33 @param parent reference to the parent object (defaults to None) 33 @param parent reference to the parent object (defaults to None)
34 @type QObject (optional) 34 @type QObject (optional)
35 """ 35 """
36 super().__init__(parent) 36 super().__init__(parent)
37 37
38 def __addActionsToDict(self, category: str, actions: list, 38 def __addActionsToDict(self: "ShortcutsFile", category: str, actions: list,
39 actionsDict: dict): 39 actionsDict: dict) -> None:
40 """ 40 """
41 Private method to add a list of actions to the actions dictionary. 41 Private method to add a list of actions to the actions dictionary.
42 42
43 @param category category of the actions 43 @param category category of the actions
44 @type str 44 @type str
56 actionsDict[category][act.objectName()] = ( 56 actionsDict[category][act.objectName()] = (
57 act.shortcut().toString(), 57 act.shortcut().toString(),
58 act.alternateShortcut().toString() 58 act.alternateShortcut().toString()
59 ) 59 )
60 60
61 def writeFile(self, filename: str, helpViewer: HelpViewer = None) -> bool: 61 def writeFile(self: "ShortcutsFile", filename: str,
62 helpViewer: HelpViewer = None) -> bool:
62 """ 63 """
63 Public method to write the shortcuts data to a shortcuts JSON file. 64 Public method to write the shortcuts data to a shortcuts JSON file.
64 65
65 @param filename name of the shortcuts file 66 @param filename name of the shortcuts file
66 @type str 67 @type str
174 ) 175 )
175 return False 176 return False
176 177
177 return True 178 return True
178 179
179 def readFile(self, filename: str) -> bool: 180 def readFile(self: "ShortcutsFile", filename: str) -> bool:
180 """ 181 """
181 Public method to read the shortcuts data from a shortcuts JSON file. 182 Public method to read the shortcuts data from a shortcuts JSON file.
182 183
183 @param filename name of the shortcuts file 184 @param filename name of the shortcuts file
184 @type str 185 @type str

eric ide

mercurial