PluginApis.py

Sat, 27 Dec 2014 16:16:55 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Dec 2014 16:16:55 +0100
changeset 16
52e4319132bb
parent 12
c37c72600e60
child 17
adaddc543e28
permissions
-rw-r--r--

Created global tag <release-2.0.0>.

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
8
450c1914893d Updated copyright for 2014.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6
diff changeset
3 # Copyright (c) 2013 - 2014 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
9
f15912daba7e python2Compatible flag added.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 8
diff changeset
10 from __future__ import unicode_literals
3
551bd94613ac Python 2 compatibility for Eric 5.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 1
diff changeset
11
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12 import os
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
13 import glob
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14
12
c37c72600e60 Ported to PyQt5 and eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
15 from PyQt5.QtCore import QObject
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17 # Start-of-Header
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
18 name = "APIs Plugin"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
19 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
20 autoactivate = True
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21 deactivateable = True
12
c37c72600e60 Ported to PyQt5 and eric6.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9
diff changeset
22 version = "2.0.0"
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
23 className = "PluginApis"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
24 packageName = "APIs"
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
25 shortDescription = "API files for auto-completion and call tips."
6
89b4debad1df Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
26 longDescription = \
89b4debad1df Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
27 """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
28 """ and call tips that are often missing from distribution packages."""
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
29 needsRestart = False
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 pyqtApi = 2
9
f15912daba7e python2Compatible flag added.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 8
diff changeset
31 python2Compatible = True
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
32 # End-of-Header
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 error = ""
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35
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 def apiFiles(language):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
38 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
39 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
40
6
89b4debad1df Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4
diff changeset
41 @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
42 @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
43 """
3
551bd94613ac Python 2 compatibility for Eric 5.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 1
diff changeset
44 if language in ["Python3", "Python2", "Python"]:
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
45 apisDir = \
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46 os.path.join(os.path.dirname(__file__), "APIs", "Python")
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 apis = glob.glob(os.path.join(apisDir, '*.api'))
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
48 if language == "Python3":
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 apisDir = \
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50 os.path.join(os.path.dirname(__file__), "APIs", "Python3")
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 apis.extend(glob.glob(os.path.join(apisDir, '*.api')))
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52 else:
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
53 apisDir = \
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
54 os.path.join(os.path.dirname(__file__), "APIs", "Python2")
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
55 apis.extend(glob.glob(os.path.join(apisDir, '*.api')))
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
56 else:
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
57 apis = []
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58 return apis
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59
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 class PluginApis(QObject):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
62 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
63 Class implementing the Django project plugin.
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 def __init__(self, ui):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 Constructor
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 @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
70 """
3
551bd94613ac Python 2 compatibility for Eric 5.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 1
diff changeset
71 super(PluginApis, self).__init__(ui)
1
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
72 self.__ui = ui
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 activate(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 activate 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 @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
79 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
80 return None, True
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
81
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
82 def deactivate(self):
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
83 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
84 Public method to deactivate this plugin.
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
85 """
9fc07b8c55b8 First release of the plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
86 pass

eric ide

mercurial