# eric7.Preferences.ShortcutsFile

Module implementing a class representing the shortcuts JSON file.

### Global Attributes

HelpViewer

### Classes

ShortcutsFile | Class representing the shortcuts JSON file.

### Functions

None

## ShortcutsFile

Class representing the shortcuts JSON file.

### Derived from

QObject

### Class Attributes

None

### Class Methods

None

### Methods

ShortcutsFile | Constructor
__addActionsToDict | Private method to add a list of actions to the actions dictionary.
readFile | Public method to read the shortcuts data from a shortcuts JSON file.
writeFile | Public method to write the shortcuts data to a shortcuts JSON file.

### Static Methods

None

#### ShortcutsFile (Constructor)

ShortcutsFile(parent: QObject = None)

Constructor

parent (QObject (optional))
  reference to the parent object (defaults to None)

#### ShortcutsFile.__addActionsToDict

__addActionsToDict(category: str, actions: list, actionsDict: dict)

Private method to add a list of actions to the actions dictionary.

category (str)
  category of the actions
actions (list of QAction)
  list of actions
actionsDict (dict)
  reference to the actions dictionary to be modified

#### ShortcutsFile.readFile

readFile(filename: str)

Public method to read the shortcuts data from a shortcuts JSON file.

filename (str)
  name of the shortcuts file

Return:
  Dictionary of dictionaries of shortcuts. The keys of the dictionary are the shortcuts categories, the values are dictionaries. These dictionaries have the shortcut name as their key and a tuple of accelerators as their value.

Return Type:
  dict

#### ShortcutsFile.writeFile

writeFile(filename: str, helpViewer: HelpViewer = None)

Public method to write the shortcuts data to a shortcuts JSON file.

filename (str)
  name of the shortcuts file
helpViewer (WebBrowserWindow)
  reference to the help window object

Return:
  flag indicating a successful write

Return Type:
  bool

Up