|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2013 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the APIs plugin. |
|
8 """ |
|
9 |
|
10 import os |
|
11 import glob |
|
12 |
|
13 from PyQt4.QtCore import QObject |
|
14 |
|
15 # Start-of-Header |
|
16 name = "APIs Plugin" |
|
17 author = "Detlev Offenbach <detlev@die-offenbachs.de>" |
|
18 autoactivate = True |
|
19 deactivateable = True |
|
20 version = "1.0.0" |
|
21 className = "PluginApis" |
|
22 packageName = "APIs" |
|
23 shortDescription = "API files for auto-completion and call tips." |
|
24 longDescription = """This plug-in provides API files for auto-completion and""" \ |
|
25 """ call tips that are often missing from distribution packages.""" |
|
26 needsRestart = False |
|
27 pyqtApi = 2 |
|
28 # End-of-Header |
|
29 |
|
30 error = "" |
|
31 |
|
32 |
|
33 def apiFiles(language): |
|
34 """ |
|
35 Module function to return the API files made available by this plugin. |
|
36 |
|
37 @return list of API filenames (list of string) |
|
38 """ |
|
39 if language in ["Python3", "Python2"]: |
|
40 apisDir = \ |
|
41 os.path.join(os.path.dirname(__file__), "APIs", "Python") |
|
42 apis = glob.glob(os.path.join(apisDir, '*.api')) |
|
43 if language == "Python3": |
|
44 apisDir = \ |
|
45 os.path.join(os.path.dirname(__file__), "APIs", "Python3") |
|
46 apis.extend(glob.glob(os.path.join(apisDir, '*.api'))) |
|
47 else: |
|
48 apisDir = \ |
|
49 os.path.join(os.path.dirname(__file__), "APIs", "Python2") |
|
50 apis.extend(glob.glob(os.path.join(apisDir, '*.api'))) |
|
51 else: |
|
52 apis = [] |
|
53 return apis |
|
54 |
|
55 |
|
56 class PluginApis(QObject): |
|
57 """ |
|
58 Class implementing the Django project plugin. |
|
59 """ |
|
60 def __init__(self, ui): |
|
61 """ |
|
62 Constructor |
|
63 |
|
64 @param ui reference to the user interface object (UI.UserInterface) |
|
65 """ |
|
66 super().__init__(ui) |
|
67 self.__ui = ui |
|
68 |
|
69 def activate(self): |
|
70 """ |
|
71 Public method to activate this plugin. |
|
72 |
|
73 @return tuple of None and activation status (boolean) |
|
74 """ |
|
75 return None, True |
|
76 |
|
77 def deactivate(self): |
|
78 """ |
|
79 Public method to deactivate this plugin. |
|
80 """ |
|
81 pass |