PluginApis.py

Wed, 26 May 2021 19:33:42 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 26 May 2021 19:33:42 +0200
branch
eric7
changeset 37
7a23ee287a6f
parent 35
908f5f14b718
child 38
ca48d6a66d7e
permissions
-rw-r--r--

Created new branch <eric7>.

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
30
30eb69e6049c Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 28
diff changeset
3 # Copyright (c) 2013 - 2021 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
12
c37c72600e60 Ported to PyQt5 and eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
13 from PyQt5.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
35
908f5f14b718 Added API file for PyQt6 (Qt 6.1.x)
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 33
diff changeset
20 version = "3.1.0"
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.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
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 """
28
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
42 if language in ["Python3", "Python"]:
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
43 apisDir = os.path.join(os.path.dirname(__file__), "APIs", "Python")
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
44 apis = glob.glob(os.path.join(apisDir, '*.api'))
28
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
45
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
46 apisDir = os.path.join(os.path.dirname(__file__), "APIs", "Python3")
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
47 apis.extend(glob.glob(os.path.join(apisDir, '*.api')))
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
48 return apis
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 else:
28
d772634a378a - removed support for Python2 nad PyQt4
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 27
diff changeset
50 return []
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
53 class PluginApis(QObject):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
54 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
55 Class implementing the Django project plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
56 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
57 def __init__(self, ui):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59 Constructor
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
60
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
61 @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
62 """
33
aae0ec9126cc - implemented some code simplifications
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 31
diff changeset
63 super().__init__(ui)
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
64 self.__ui = ui
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
65
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 def activate(self):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
68 Public method to activate this plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
69
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
70 @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
71 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
72 return None, True
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
74 def deactivate(self):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
75 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
76 Public method to deactivate this plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
77 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
78 pass

eric ide

mercurial