ProjectFlask/FlaskCommandDialog.py

changeset 32
80fc8deac8fe
parent 16
dd3f6bfb85f7
child 60
02243723ac17
equal deleted inserted replaced
31:e614add95516 32:80fc8deac8fe
60 @param args list of command line arguments for the command 60 @param args list of command line arguments for the command
61 @type list of str 61 @type list of str
62 @return flag indicating a successful start 62 @return flag indicating a successful start
63 @rtype bool 63 @rtype bool
64 """ 64 """
65 self.__normal = False
65 workdir, env = self.__project.prepareRuntimeEnvironment() 66 workdir, env = self.__project.prepareRuntimeEnvironment()
66 if env is not None: 67 if env is not None:
67 flaskCommand = self.__project.getFlaskCommand() 68 flaskCommand = self.__project.getFlaskCommand()
68 69
69 self.__process = QProcess() 70 self.__process = QProcess()
124 @param exitCode exit code of the process 125 @param exitCode exit code of the process
125 @type int 126 @type int
126 @param exitStatus exit status of the process 127 @param exitStatus exit status of the process
127 @type QProcess.ExitStatus 128 @type QProcess.ExitStatus
128 """ 129 """
129 normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0) 130 self.__normal = (exitStatus == QProcess.NormalExit) and (exitCode == 0)
130 self.__cancelProcess() 131 self.__cancelProcess()
131 132
132 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 133 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
133 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 134 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
134 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 135 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
135 self.buttonBox.button(QDialogButtonBox.Close).setFocus( 136 self.buttonBox.button(QDialogButtonBox.Close).setFocus(
136 Qt.OtherFocusReason) 137 Qt.OtherFocusReason)
137 138
138 if normal and self.__successMessage: 139 if self.__normal and self.__successMessage:
139 self.outputEdit.insertPlainText(self.__successMessage) 140 self.outputEdit.insertPlainText(self.__successMessage)
140 elif not normal and self.__errorMessage: 141 elif not self.__normal and self.__errorMessage:
141 self.outputEdit.insertPlainText(self.__errorMessage) 142 self.outputEdit.insertPlainText(self.__errorMessage)
142 143
143 @pyqtSlot() 144 @pyqtSlot()
144 def __cancelProcess(self): 145 def __cancelProcess(self):
145 """ 146 """
165 """ 166 """
166 if button is self.buttonBox.button(QDialogButtonBox.Close): 167 if button is self.buttonBox.button(QDialogButtonBox.Close):
167 self.close() 168 self.close()
168 elif button is self.buttonBox.button(QDialogButtonBox.Cancel): 169 elif button is self.buttonBox.button(QDialogButtonBox.Cancel):
169 self.__cancelProcess() 170 self.__cancelProcess()
171
172 def normalExit(self):
173 """
174 Public method to test, if the process ended without errors.
175
176 @return flag indicating a normal process exit
177 @rtype bool
178 """
179 return self.__normal

eric ide

mercurial