The eric7 plug-in system
The eric7 plug-in system
Version 22.1
Copyright © 2007-2022 Detlev Offenbach <detlev@die-offenbachs.de>
Page 1 of 58
The eric7 plug-in system
Table of contents
1 Introduction.......................................................................................................................6
2 Description of the plug-in system......................................................................................6
3 The plug-in system from a user perspective.....................................................................6
3.1 The Plug-ins menu and toolbar.................................................................................6
3.2 The Plug-in Infos dialog.............................................................................................7
3.3 Installing Plug-ins.....................................................................................................10
3.4 Uninstalling Plug-ins................................................................................................14
3.5 The Plug-ins repository............................................................................................15
4 eric7 for plug-in developers.............................................................................................17
5 Anatomy of a plug-in.......................................................................................................19
5.1 Plug-in structure.......................................................................................................19
5.2 Plug-in header.........................................................................................................19
5.3 Plug-in module functions.........................................................................................21
5.3.1 moduleSetup()..................................................................................................21
5.3.2 prepareUninstall().............................................................................................22
5.3.3 getConfigData()................................................................................................22
5.3.4 previewPix()......................................................................................................23
5.3.5 exeDisplayData()..............................................................................................24
5.3.6 exeDisplayDataList()........................................................................................26
5.3.7 apiFiles(language)............................................................................................28
5.3.8 clearPrivateData()............................................................................................28
5.4 Plug-in object methods............................................................................................28
5.4.1 __init__(self, ui)................................................................................................29
5.4.2 activate(self).....................................................................................................30
5.4.3 deactivate(self).................................................................................................32
5.4.4 __loadTranslator(self)......................................................................................33
5.4.5 initToolbar(self, ui, toolbarManager)................................................................34
5.4.6 prepareUnload(self)..........................................................................................34
6 eric7 hooks......................................................................................................................35
6.1 Hooks of the project browser objects......................................................................35
6.1.1 Hooks of the ProjectFormsBrowser object.......................................................35
6.1.2 Hooks of the ProjectResourcesBrowser object................................................36
6.1.3 Hooks of the ProjectTranslationsBrowser object.............................................36
6.2 Hooks of the Editor object.......................................................................................37
6.3 Hooks of the CodeDocumentationViewer object.....................................................38
7 eric7 functions available for plug-in development...........................................................39
7.1 The eric7 object registry..........................................................................................39
7.2 The action registries................................................................................................41
7.3 The getMenu() methods..........................................................................................41
7.4 Methods of the PluginManager object.....................................................................43
7.5 Methods of the UserInterface object........................................................................44
7.6 Methods of the E5ToolBarManager object..............................................................45
7.7 Methods of the Project object..................................................................................45
7.8 Methods of the ProjectBrowser object.....................................................................47
7.9 Methods of QScintilla.Lexer.....................................................................................47
7.10 Signals...................................................................................................................48
8 Special plug-in types.......................................................................................................52
8.1 VCS plug-ins............................................................................................................52
Page 2 of 58
The eric7 plug-in system
8.2 ViewManager plug-ins.............................................................................................53
9 The BackgroudService....................................................................................................53
9.1 How to access the background service...................................................................53
9.2 The SyntaxCheckService........................................................................................55
Page 3 of 58
The eric7 plug-in system
List of figures
Figure 1: eric7 Extras menu...................................................................................................6
Figure 2: The Plug-ins menu..................................................................................................7
Figure 3: The Plug-ins toolbar................................................................................................7
Figure 4: Plug-ins Info dialog.................................................................................................8
Figure 5: Plug-ins Info dialog context menu..........................................................................9
Figure 6: Plug-in Details dialog..............................................................................................9
Figure 7: Plug-ins Installation dialog, step 1........................................................................11
Figure 8: Plug-ins Installation dialog, step 2........................................................................12
Figure 9: Plug-ins Installation dialog, step 3........................................................................13
Figure 10: Plug-ins Installation dialog, step 4......................................................................14
Figure 11: Plug-ins Installation dialog, step 5......................................................................14
Figure 12: Plug-in Uninstallation dialog, step 1...................................................................15
Figure 13: Plug-in Uninstallation dialog, step 2...................................................................15
Figure 14: Plug-in Repository dialog....................................................................................16
Figure 15: Plug-in specific project properties.......................................................................17
Figure 16: Packagers submenu...........................................................................................18
Page 4 of 58
The eric7 plug-in system
List of listings
Listing 1: Example of a PKGLIST file...................................................................................18
Listing 2: Plug-in header......................................................................................................19
Listing 3: Additional header for on-demand plug-ins...........................................................21
Listing 4: Example for the moduleSetup() function..............................................................22
Listing 5: Example for the prepareUninstall() function.........................................................22
Listing 6: Example for the getConfigData() function............................................................23
Listing 7: Example for the previewPix() function..................................................................23
Listing 8: Example for the exeDisplayData() function returning a dictionary of type 1........25
Listing 9: Example for the exeDisplayData() function returning a dictionary of type 2........26
Listing 10: Example for the exeDisplayDataList() function returning a list of dictionaries of
type 1....................................................................................................................................27
Listing 11: Example for the apiFiles(language) function......................................................28
Listing 12: Example for the clearPrivateData() function......................................................28
Listing 13: Example for the __init__(self, ui) method...........................................................29
Listing 14: Example for the activate(self) method................................................................31
Listing 15: Example for the deactivate(self) method............................................................33
Listing 16: Example for the __loadTranslator(self) method.................................................34
Listing 17: Example for the initToolbar(self, ui, toolbarManager) method...........................34
Listing 18: Example for the prepareUnload(self) method....................................................35
Listing 19: Example for the usage of the object registry......................................................40
Listing 20: Example of the getVcsSystemIndicator() function.............................................53
Listing 21: Example of a serviceConnect.............................................................................54
Listing 22: Example of enqueueing a request......................................................................55
Listing 23: Example of disconnecting from a service...........................................................55
Listing 24: Example of registering a language.....................................................................56
Page 5 of 58