Plugins/UiExtensionPlugins/PipInterface/PipListDialog.py

changeset 6257
4523c5e6dd43
parent 6124
8467f7d4b567
child 6301
f488d2cc5841
equal deleted inserted replaced
6253:a148632e9610 6257:4523c5e6dd43
79 79
80 self.__pip = pip 80 self.__pip = pip
81 self.__mode = mode 81 self.__mode = mode
82 self.__defaultCommand = plugin.getPreferences("CurrentPipExecutable") 82 self.__defaultCommand = plugin.getPreferences("CurrentPipExecutable")
83 self.__ioEncoding = Preferences.getSystem("IOEncoding") 83 self.__ioEncoding = Preferences.getSystem("IOEncoding")
84 self.__indexUrl = plugin.getPreferences("PipSearchIndex")
84 self.__errors = "" 85 self.__errors = ""
85 self.__output = [] 86 self.__output = []
86 87
87 self.__nothingStrings = { 88 self.__nothingStrings = {
88 "list": self.tr("Nothing to show"), 89 "list": self.tr("Nothing to show"),
268 if self.localCheckBox.isChecked(): 269 if self.localCheckBox.isChecked():
269 args.append("--local") 270 args.append("--local")
270 if self.notRequiredCheckBox.isChecked(): 271 if self.notRequiredCheckBox.isChecked():
271 args.append("--not-required") 272 args.append("--not-required")
272 273
274 if self.__indexUrl:
275 args.append("--index-url")
276 args.append(self.__indexUrl + "/simple")
277
273 self.process.start(command, args) 278 self.process.start(command, args)
274 procStarted = self.process.waitForStarted(5000) 279 procStarted = self.process.waitForStarted(5000)
275 if not procStarted: 280 if not procStarted:
276 self.buttonBox.setFocus() 281 self.buttonBox.setFocus()
277 self.__stopProcess() 282 self.__stopProcess()
286 def __processOutput(self): 291 def __processOutput(self):
287 """ 292 """
288 Private method to process the captured output. 293 Private method to process the captured output.
289 """ 294 """
290 if self.__output: 295 if self.__output:
291 packageData = json.loads("\n".join(self.__output)) 296 try:
292 for package in packageData: 297 packageData = json.loads("\n".join(self.__output))
293 data = [ 298 for package in packageData:
294 package["name"], 299 data = [
295 package["version"], 300 package["name"],
296 ] 301 package["version"],
297 if self.__mode == "outdated": 302 ]
298 data.extend([ 303 if self.__mode == "outdated":
299 package["latest_version"], 304 data.extend([
300 package["latest_filetype"], 305 package["latest_version"],
301 ]) 306 package["latest_filetype"],
302 QTreeWidgetItem(self.packageList, data) 307 ])
308 QTreeWidgetItem(self.packageList, data)
309 except ValueError as err:
310 self.__errors += str(err) + "\n"
311 self.__errors += "received output:\n"
312 self.__errors += "\n".join(self.__output)
303 313
304 def __readStdout(self): 314 def __readStdout(self):
305 """ 315 """
306 Private slot to handle the readyReadStandardOutput signal. 316 Private slot to handle the readyReadStandardOutput signal.
307 317

eric ide

mercurial