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