CondaInterface/CondaExecDialog.py

Wed, 13 Feb 2019 20:41:45 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Feb 2019 20:41:45 +0100
branch
conda
changeset 6741
33a82a20dd3a
parent 6717
afc972591ed2
permissions
-rw-r--r--

Fixed some code style issues.

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

eric ide

mercurial