eric6/CondaInterface/CondaExecDialog.py

Wed, 30 Dec 2020 11:00:44 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 30 Dec 2020 11:00:44 +0100
branch
maintenance
changeset 7924
8a96736d465e
parent 7780
41420f82c0ac
child 8143
2c730d5fd177
permissions
-rw-r--r--

Updated copyright for 2021.

6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7924
8a96736d465e Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2019 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to show the output of a conda execution.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 import json
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt5.QtCore import pyqtSlot, QProcess, QTimer
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QAbstractButton
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 from E5Gui import E5MessageBox
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from .Ui_CondaExecDialog import Ui_CondaExecDialog
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19 import Preferences
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
20 import Globals
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 class CondaExecDialog(QDialog, Ui_CondaExecDialog):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
6678
5f1de9e59227 Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6677
diff changeset
25 Class implementing a dialog to show the output of a conda execution.
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
27 def __init__(self, command, parent=None):
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 Constructor
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
31 @param command conda command executed
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
32 @type str
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param parent reference to the parent widget
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @type QWidget
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 super(CondaExecDialog, self).__init__(parent)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
39 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
40 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
6685
fbaee9890715 CondaExecDialog: did some cleanup and streamlining.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6683
diff changeset
41
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
42 self.__condaCommand = command
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.__process = None
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__condaExe = Preferences.getConda("CondaExecutable")
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 if not self.__condaExe:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__condaExe = "conda"
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 @pyqtSlot(QAbstractButton)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 def on_buttonBox_clicked(self, button):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 Private slot called by a button of the button box clicked.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 @param button button that was clicked
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 @type QAbstractButton
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 if button == self.buttonBox.button(QDialogButtonBox.Close):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.accept()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
6679
c5f7b2e9a06d CondaExecDialog: fixed abug calling the finish method.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6678
diff changeset
60 self.__finish(1, 0)
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 def start(self, arguments):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 Public slot to start the conda command.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 @param arguments commandline arguments for conda program
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 @type list of str
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 self.errorGroup.hide()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 self.progressLabel.hide()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 self.progressBar.hide()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.contents.clear()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74 self.errors.clear()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 self.progressLabel.clear()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 self.progressBar.setValue(0)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.__bufferedStdout = None
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 self.__json = "--json" in arguments
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 self.__firstProgress = True
6683
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
81 self.__lastFetchFile = ""
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
83 self.__statusOk = False
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
84 self.__result = None
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
85
6706
d792e054cde2 Conda, CondaPackagesWidget: continued implementing list functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6697
diff changeset
86 self.__logOutput(self.__condaExe + " " + " ".join(arguments) + "\n\n")
d792e054cde2 Conda, CondaPackagesWidget: continued implementing list functionality.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6697
diff changeset
87
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.__process = QProcess()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 self.__process.readyReadStandardOutput.connect(self.__readStdout)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 self.__process.readyReadStandardError.connect(self.__readStderr)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.__process.finished.connect(self.__finish)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.__process.start(self.__condaExe, arguments)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 procStarted = self.__process.waitForStarted(5000)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 if not procStarted:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 E5MessageBox.critical(
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self,
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.tr("Conda Execution"),
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 self.tr("""The conda executable could not be started. Is it"""
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """ configured correctly?"""))
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 self.__finish(1, 0)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 else:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 self.__logOutput(self.tr("Operation started.\n"))
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 def __finish(self, exitCode, exitStatus, giveUp=False):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 Private slot called when the process finished.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 It is called when the process finished or
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 the user pressed the button.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
112 @param exitCode exit code of the process
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
113 @type int
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
114 @param exitStatus exit status of the process
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
115 @type QProcess.ExitStatus
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
116 @param giveUp flag indicating to not start another attempt
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
117 @type bool
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 """
7250
d8bdc55aee1a Started to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
119 if (self.__process is not None and
d8bdc55aee1a Started to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
120 self.__process.state() != QProcess.NotRunning):
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.__process.terminate()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 QTimer.singleShot(2000, self.__process.kill)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.__process.waitForFinished(3000)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128
6683
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
129 self.progressLabel.hide()
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
130 self.progressBar.hide()
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
131
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
132 self.__statusOk = exitCode == 0
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
133
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 self.__logOutput(self.tr("Operation finished.\n"))
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
135 if not self.__json and self.__bufferedStdout:
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
136 self.__logOutput(self.__bufferedStdout)
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
137
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
138 if self.__json and self.__bufferedStdout:
6741
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
139 index = self.__bufferedStdout.find("{")
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
140 rindex = self.__bufferedStdout.rfind("}")
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
141 self.__bufferedStdout = self.__bufferedStdout[index:rindex + 1]
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
142 try:
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
143 self.__result = json.loads(self.__bufferedStdout)
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
144 except Exception as error:
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
145 self.__result = {}
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
146 self.__logError(str(error))
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
147 return
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
148
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
149 if "error" in self.__result:
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
150 self.__logError(self.__result["error"])
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
151 self.__statusOk = False
7250
d8bdc55aee1a Started to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
152 elif ("success" in self.__result and
d8bdc55aee1a Started to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
153 not self.__result["success"]):
6741
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
154 self.__logError(
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
155 self.tr("Conda command '{0}' did not return success.")
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
156 .format(self.__condaCommand))
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
157 if "message" in self.__result:
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
158 self.__logError("\n")
6685
fbaee9890715 CondaExecDialog: did some cleanup and streamlining.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6683
diff changeset
159 self.__logError(
6714
7718e9b548fa CondaExecDialog: added some more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6706
diff changeset
160 self.tr("\nConda Message: {0}").format(
7718e9b548fa CondaExecDialog: added some more output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6706
diff changeset
161 self.__result["message"]))
6741
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
162 self.__statusOk = False
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
163 elif "message" in self.__result:
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
164 self.__logOutput(
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
165 self.tr("\nConda Message: {0}").format(
33a82a20dd3a Fixed some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6717
diff changeset
166 self.__result["message"]))
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
168 def getResult(self):
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 """
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
170 Public method to the result of the command execution.
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
171
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
172 @return tuple containing a flag indicating success and the result data.
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
173 @rtype tuple of (bool, dict)
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
174 """
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
175 return self.__statusOk, self.__result
6683
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
176
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
177 def __setProgressValues(self, jsonDict, progressType):
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
178 """
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
179 Private method to set the value of the progress bar.
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
180
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
181 @param jsonDict dictionary containing the progress info
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
182 @type dict
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
183 @param progressType action type to check for
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
184 @type str
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
185 @return flag indicating success
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
186 @rtype bool
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
187 """
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
188 if progressType in jsonDict and "progress" in jsonDict:
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
189 if jsonDict["maxval"] == 1:
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
190 self.progressBar.setMaximum(100)
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
191 # percent values
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
192 self.progressBar.setValue(
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
193 int(jsonDict["progress"] * 100))
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
194 parts = jsonDict["fetch"].split("|")
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
195 filename = parts[0].strip()
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
196 filesize = parts[1].strip()
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
197 else:
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
198 self.progressBar.setMaximum(jsonDict["maxval"])
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
199 self.progressBar.setValue(jsonDict["progress"])
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
200 filename = jsonDict["fetch"].strip()
6697
2f5c951bdf14 Conda interface: added capability to remove conda environments the conda way.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6685
diff changeset
201 filesize = Globals.dataString(int(jsonDict["maxval"]))
6683
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
202
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
203 self.progressLabel.setText(
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
204 self.tr("{0} (Size: {1})").format(filename, filesize))
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
205
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
206 if progressType == "fetch":
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
207 if filename != self.__lastFetchFile:
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
208 self.__logOutput(
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
209 self.tr("Fetching {0} ...").format(filename))
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
210 self.__lastFetchFile = filename
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
211 elif jsonDict["finished"]:
6717
afc972591ed2 CondaExecDialog: small enhancement to the output.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6714
diff changeset
212 self.__logOutput(self.tr(" Done.\n"))
6683
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
213
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
214 if self.__firstProgress:
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
215 self.progressLabel.show()
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
216 self.progressBar.show()
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
217 self.__firstProgress = False
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
218
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
219 return True
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
220
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
221 return False
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 def __readStdout(self):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 Private slot to handle the readyReadStandardOutput signal.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 It reads the output of the process, formats it and inserts it into
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 the contents pane.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 all_stdout = str(self.__process.readAllStandardOutput(),
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 Preferences.getSystem("IOEncoding"),
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 'replace')
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 all_stdout = all_stdout.replace("\x00", "")
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 if self.__json:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 for stdout in all_stdout.splitlines():
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 try:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 jsonDict = json.loads(stdout.replace("\x00", "").strip())
6683
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
238 if self.__setProgressValues(jsonDict, "fetch"):
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
239 # nothing to do anymore
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
240 pass
aca9d39fbfbd CondaExecDialog: finished the progress bar function
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6679
diff changeset
241 elif "progress" not in jsonDict:
6677
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 if self.__bufferedStdout is None:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 self.__bufferedStdout = stdout
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 else:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 self.__bufferedStdout += stdout
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 except (TypeError, ValueError):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 if self.__bufferedStdout is None:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 self.__bufferedStdout = stdout
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249 else:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 self.__bufferedStdout += stdout
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
251 else:
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 self.__logOutput(all_stdout)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 def __readStderr(self):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 Private slot to handle the readyReadStandardError signal.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 It reads the error output of the process and inserts it into the
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 error pane.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
260 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 self.__process.setReadChannel(QProcess.StandardError)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 while self.__process.canReadLine():
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 stderr = str(self.__process.readLine(),
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 Preferences.getSystem("IOEncoding"),
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266 'replace')
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 self.__logError(stderr)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 def __logOutput(self, stdout):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 Private method to log some output.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 @param stdout output string to log
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 @type str
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 self.contents.insertPlainText(stdout)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 self.contents.ensureCursorVisible()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 def __logError(self, stderr):
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 Private method to log an error.
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 @param stderr error string to log
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 @type str
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 """
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 self.errorGroup.show()
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 self.errors.insertPlainText(stderr)
6299d69a218a Continued implementing environment creation with conda.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 self.errors.ensureCursorVisible()

eric ide

mercurial