PluginApis.py

Wed, 28 Sep 2022 17:44:54 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 28 Sep 2022 17:44:54 +0200
branch
eric7
changeset 58
319eebb00f26
parent 57
67e7ac09e569
permissions
-rw-r--r--

Created global tag <release-10.3.2>.

1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2
39
4d56882f8a1b Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 38
diff changeset
3 # Copyright (c) 2013 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
4 #
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
5
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
6 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
7 Module implementing the APIs plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
8 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
9
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
10 import os
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
11 import glob
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12
38
ca48d6a66d7e Ported the plug-in to PyQt6 for eric7.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 35
diff changeset
13 from PyQt6.QtCore import QObject
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 # Start-of-Header
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16 name = "APIs Plugin"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
18 autoactivate = True
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
19 deactivateable = True
57
67e7ac09e569 Added platform specific MicroPython API file
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 55
diff changeset
20 version = "10.3.2"
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21 className = "PluginApis"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22 packageName = "APIs"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
23 shortDescription = "API files for auto-completion and call tips."
28
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
24 longDescription = (
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
25 """This plug-in provides API files for auto-completion"""
4
a27bb7a06650 Shortened lines to adhere to the 79 character limit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3
diff changeset
26 """ and call tips that are often missing from distribution packages."""
28
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
27 )
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
28 needsRestart = False
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
29 pyqtApi = 2
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 # End-of-Header
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
31
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
32 error = ""
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
33
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
34
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35 def apiFiles(language):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
36 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
37 Module function to return the API files made available by this plugin.
52
c8ea815f673d Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
38
6
89b4debad1df Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
39 @param language language to get APIs for (string)
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
40 @return list of API filenames (list of string)
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
41 """
53
f69d7f9ab8e4 - reorganized API directory structure by programming language
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 52
diff changeset
42 if language:
f69d7f9ab8e4 - reorganized API directory structure by programming language
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 52
diff changeset
43 apisDir = os.path.join(os.path.dirname(__file__), "APIs", language)
f69d7f9ab8e4 - reorganized API directory structure by programming language
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 52
diff changeset
44 return glob.glob(os.path.join(apisDir, "*.api"))
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
45 else:
28
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
46 return []
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
48
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 class PluginApis(QObject):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 Class implementing the Django project plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52 """
52
c8ea815f673d Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
53
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
54 def __init__(self, ui):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
55 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
56 Constructor
52
c8ea815f673d Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
57
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58 @param ui reference to the user interface object (UI.UserInterface)
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59 """
33
aae0ec9126cc - implemented some code simplifications
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
60 super().__init__(ui)
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
61 self.__ui = ui
52
c8ea815f673d Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
62
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
63 def activate(self):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
64 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
65 Public method to activate this plugin.
52
c8ea815f673d Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
66
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 @return tuple of None and activation status (boolean)
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
68 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
69 return None, True
52
c8ea815f673d Reformatted source code with 'Black'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 50
diff changeset
70
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
71 def deactivate(self):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
72 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73 Public method to deactivate this plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
74 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
75 pass

eric ide

mercurial