Plugins/PluginPipInterface.py

branch
pypi
changeset 6782
390a45748883
parent 6744
f5249a9927c9
equal deleted inserted replaced
6781:9ede19ddfa98 6782:390a45748883
37 error = "" 37 error = ""
38 38
39 pipPluginObject = None 39 pipPluginObject = None
40 40
41 41
42 def exeDisplayDataList(): 42 ##def exeDisplayDataList():
43 """ 43 ## """
44 Module function to support the display of some executable info. 44 ## Module function to support the display of some executable info.
45 45 ##
46 @return list of dictionaries containing the data to query the presence of 46 ## @return list of dictionaries containing the data to query the presence of
47 the executable 47 ## the executable
48 """ 48 ## """
49 global pipPluginObject 49 ## global pipPluginObject
50 50 ##
51 dataList = [] 51 ## dataList = []
52 data = { 52 ## data = {
53 "programEntry": True, 53 ## "programEntry": True,
54 "header": QCoreApplication.translate( 54 ## "header": QCoreApplication.translate(
55 "PipInterfacePlugin", "Package Management - pip"), 55 ## "PipInterfacePlugin", "Package Management - pip"),
56 "exe": "dummyExe", 56 ## "exe": "dummyExe",
57 "versionCommand": "--version", 57 ## "versionCommand": "--version",
58 "versionStartsWith": "pip", 58 ## "versionStartsWith": "pip",
59 "versionPosition": 1, 59 ## "versionPosition": 1,
60 "version": "", 60 ## "version": "",
61 "versionCleanup": None, 61 ## "versionCleanup": None,
62 "exeModule": ["-m", "pip"], 62 ## "exeModule": ["-m", "pip"],
63 } 63 ## }
64 virtualenvManager = e5App().getObject("VirtualEnvManager") 64 ## virtualenvManager = e5App().getObject("VirtualEnvManager")
65 for venvName in virtualenvManager.getVirtualenvNames(): 65 ## for venvName in virtualenvManager.getVirtualenvNames():
66 interpreter = virtualenvManager.getVirtualenvInterpreter(venvName) 66 ## interpreter = virtualenvManager.getVirtualenvInterpreter(venvName)
67 data["exe"] = interpreter 67 ## data["exe"] = interpreter
68 dataList.append(data.copy()) 68 ## dataList.append(data.copy())
69 return dataList 69 ## return dataList
70 70 ##
71 71 ##
72 def createPipPage(configDlg): 72 ##def createPipPage(configDlg):
73 """ 73 ## """
74 Module function to create the pip configuration page. 74 ## Module function to create the pip configuration page.
75 75 ##
76 @param configDlg reference to the configuration dialog 76 ## @param configDlg reference to the configuration dialog
77 @return reference to the configuration page 77 ## @return reference to the configuration page
78 """ 78 ## """
79 global pipPluginObject 79 ## global pipPluginObject
80 from UiExtensionPlugins.PipInterface.ConfigurationPage.PipPage import \ 80 ## from UiExtensionPlugins.PipInterface.ConfigurationPage.PipPage import \
81 PipPage 81 ## PipPage
82 page = PipPage(pipPluginObject) 82 ## page = PipPage(pipPluginObject)
83 return page 83 ## return page
84 84 ##
85 85 ##
86 def getConfigData(): 86 ##def getConfigData():
87 """ 87 ## """
88 Module function returning data as required by the configuration dialog. 88 ## Module function returning data as required by the configuration dialog.
89 89 ##
90 @return dictionary containing the relevant data 90 ## @return dictionary containing the relevant data
91 """ 91 ## """
92 return { 92 ## return {
93 "pipPage": [ 93 ## "pipPage": [
94 QCoreApplication.translate( 94 ## QCoreApplication.translate(
95 "PipInterfacePlugin", "Python Package Management"), 95 ## "PipInterfacePlugin", "Python Package Management"),
96 "pypi.png", 96 ## "pypi.png",
97 createPipPage, None, None 97 ## createPipPage, None, None
98 ], 98 ## ],
99 } 99 ## }
100 100 ##
101 101 ##
102 def prepareUninstall(): 102 ##def prepareUninstall():
103 """ 103 ## """
104 Module function to prepare for an un-installation. 104 ## Module function to prepare for an un-installation.
105 """ 105 ## """
106 Preferences.Prefs.settings.remove(PipInterfacePlugin.PreferencesKey) 106 ## Preferences.Prefs.settings.remove(PipInterfacePlugin.PreferencesKey)
107 107
108 108
109 class PipInterfacePlugin(QObject): 109 class PipInterfacePlugin(QObject):
110 """ 110 """
111 Class implementing the pip interface plug-in. 111 Class implementing the pip interface plug-in.
174 menu = self.__ui.getMenu("extras") 174 menu = self.__ui.getMenu("extras")
175 menu.removeAction(self.__mainAct) 175 menu.removeAction(self.__mainAct)
176 self.__mainAct = None 176 self.__mainAct = None
177 177
178 self.__initialize() 178 self.__initialize()
179 179 ##
180 def getPreferences(self, key): 180 ## def getPreferences(self, key):
181 """ 181 ## """
182 Public method to retrieve the various pip related settings. 182 ## Public method to retrieve the various pip related settings.
183 183 ##
184 @param key the key of the value to get 184 ## @param key the key of the value to get
185 @type str 185 ## @type str
186 @return the requested setting 186 ## @return the requested setting
187 @rtype any 187 ## @rtype any
188 """ 188 ## """
189 return Preferences.Prefs.settings.value( 189 ## return Preferences.Prefs.settings.value(
190 self.PreferencesKey + "/" + key, self.__defaults[key]) 190 ## self.PreferencesKey + "/" + key, self.__defaults[key])
191 191 ##
192 def setPreferences(self, key, value): 192 ## def setPreferences(self, key, value):
193 """ 193 ## """
194 Public method to store the various pip related settings. 194 ## Public method to store the various pip related settings.
195 195 ##
196 @param key the key of the setting to be set 196 ## @param key the key of the setting to be set
197 @type str 197 ## @type str
198 @param value the value to be set 198 ## @param value the value to be set
199 @type any 199 ## @type any
200 """ 200 ## """
201 Preferences.Prefs.settings.setValue( 201 ## Preferences.Prefs.settings.setValue(
202 self.PreferencesKey + "/" + key, value) 202 ## self.PreferencesKey + "/" + key, value)
203 203 ##
204 if key == "CurrentEnvironment": 204 ## if key == "CurrentEnvironment":
205 self.currentEnvironmentChanged.emit(value) 205 ## self.currentEnvironmentChanged.emit(value)
206 206
207 def getMenu(self, name): 207 def getMenu(self, name):
208 """ 208 """
209 Public method to get a reference to the requested menu. 209 Public method to get a reference to the requested menu.
210 210

eric ide

mercurial