eric6/Plugins/VcsPlugins/vcsGit/GitBisectLogBrowserDialog.py

changeset 8143
2c730d5fd177
parent 7923
91e843545d9a
child 8218
7c09585bd960
equal deleted inserted replaced
8141:27f636beebad 8143:2c730d5fd177
42 super(GitBisectLogBrowserDialog, self).__init__(parent) 42 super(GitBisectLogBrowserDialog, self).__init__(parent)
43 self.setupUi(self) 43 self.setupUi(self)
44 44
45 self.__position = QPoint() 45 self.__position = QPoint()
46 46
47 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 47 self.buttonBox.button(
48 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 48 QDialogButtonBox.StandardButton.Close).setEnabled(False)
49 self.buttonBox.button(
50 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
49 51
50 self.logTree.headerItem().setText(self.logTree.columnCount(), "") 52 self.logTree.headerItem().setText(self.logTree.columnCount(), "")
51 53
52 self.refreshButton = self.buttonBox.addButton( 54 self.refreshButton = self.buttonBox.addButton(
53 self.tr("&Refresh"), QDialogButtonBox.ActionRole) 55 self.tr("&Refresh"), QDialogButtonBox.ButtonRole.ActionRole)
54 self.refreshButton.setToolTip( 56 self.refreshButton.setToolTip(
55 self.tr("Press to refresh the list of commits")) 57 self.tr("Press to refresh the list of commits"))
56 self.refreshButton.setEnabled(False) 58 self.refreshButton.setEnabled(False)
57 59
58 self.vcs = vcs 60 self.vcs = vcs
80 82
81 @param e close event (QCloseEvent) 83 @param e close event (QCloseEvent)
82 """ 84 """
83 if ( 85 if (
84 self.__process is not None and 86 self.__process is not None and
85 self.__process.state() != QProcess.NotRunning 87 self.__process.state() != QProcess.ProcessState.NotRunning
86 ): 88 ):
87 self.__process.terminate() 89 self.__process.terminate()
88 QTimer.singleShot(2000, self.__process.kill) 90 QTimer.singleShot(2000, self.__process.kill)
89 self.__process.waitForFinished(3000) 91 self.__process.waitForFinished(3000)
90 92
110 112
111 def __resizeColumnsLog(self): 113 def __resizeColumnsLog(self):
112 """ 114 """
113 Private method to resize the log tree columns. 115 Private method to resize the log tree columns.
114 """ 116 """
115 self.logTree.header().resizeSections(QHeaderView.ResizeToContents) 117 self.logTree.header().resizeSections(
118 QHeaderView.ResizeMode.ResizeToContents)
116 self.logTree.header().setStretchLastSection(True) 119 self.logTree.header().setStretchLastSection(True)
117 120
118 def __generateLogItem(self, commitId, operation, subject): 121 def __generateLogItem(self, commitId, operation, subject):
119 """ 122 """
120 Private method to generate a bisect log tree entry. 123 Private method to generate a bisect log tree entry.
134 137
135 def __getLogEntries(self): 138 def __getLogEntries(self):
136 """ 139 """
137 Private method to retrieve bisect log entries from the repository. 140 Private method to retrieve bisect log entries from the repository.
138 """ 141 """
139 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) 142 self.buttonBox.button(
140 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) 143 QDialogButtonBox.StandardButton.Close).setEnabled(False)
141 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) 144 self.buttonBox.button(
145 QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
146 self.buttonBox.button(
147 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
142 148
143 self.inputGroup.setEnabled(True) 149 self.inputGroup.setEnabled(True)
144 self.inputGroup.show() 150 self.inputGroup.show()
145 self.refreshButton.setEnabled(False) 151 self.refreshButton.setEnabled(False)
146 152
211 Private slot called when the process finished or the user pressed 217 Private slot called when the process finished or the user pressed
212 the button. 218 the button.
213 """ 219 """
214 if ( 220 if (
215 self.__process is not None and 221 self.__process is not None and
216 self.__process.state() != QProcess.NotRunning 222 self.__process.state() != QProcess.ProcessState.NotRunning
217 ): 223 ):
218 self.__process.terminate() 224 self.__process.terminate()
219 QTimer.singleShot(2000, self.__process.kill) 225 QTimer.singleShot(2000, self.__process.kill)
220 self.__process.waitForFinished(3000) 226 self.__process.waitForFinished(3000)
221 227
222 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) 228 self.buttonBox.button(
223 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) 229 QDialogButtonBox.StandardButton.Close).setEnabled(True)
224 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) 230 self.buttonBox.button(
231 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
232 self.buttonBox.button(
233 QDialogButtonBox.StandardButton.Close).setDefault(True)
225 234
226 self.inputGroup.setEnabled(False) 235 self.inputGroup.setEnabled(False)
227 self.inputGroup.hide() 236 self.inputGroup.hide()
228 self.refreshButton.setEnabled(True) 237 self.refreshButton.setEnabled(True)
229 238
246 self.logTree.setCurrentItem(self.logTree.topLevelItem(0)) 255 self.logTree.setCurrentItem(self.logTree.topLevelItem(0))
247 256
248 # restore current item 257 # restore current item
249 if self.__currentCommitId: 258 if self.__currentCommitId:
250 items = self.logTree.findItems( 259 items = self.logTree.findItems(
251 self.__currentCommitId, Qt.MatchExactly, self.CommitIdColumn) 260 self.__currentCommitId, Qt.MatchFlag.MatchExactly,
261 self.CommitIdColumn)
252 if items: 262 if items:
253 self.logTree.setCurrentItem(items[0]) 263 self.logTree.setCurrentItem(items[0])
254 self.__currentCommitId = "" 264 self.__currentCommitId = ""
255 265
256 def __readStdout(self): 266 def __readStdout(self):
257 """ 267 """
258 Private slot to handle the readyReadStandardOutput signal. 268 Private slot to handle the readyReadStandardOutput signal.
259 269
260 It reads the output of the process and inserts it into a buffer. 270 It reads the output of the process and inserts it into a buffer.
261 """ 271 """
262 self.__process.setReadChannel(QProcess.StandardOutput) 272 self.__process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
263 273
264 while self.__process.canReadLine(): 274 while self.__process.canReadLine():
265 line = str(self.__process.readLine(), 275 line = str(self.__process.readLine(),
266 Preferences.getSystem("IOEncoding"), 276 Preferences.getSystem("IOEncoding"),
267 'replace') 277 'replace')
294 """ 304 """
295 Private slot called by a button of the button box clicked. 305 Private slot called by a button of the button box clicked.
296 306
297 @param button button that was clicked (QAbstractButton) 307 @param button button that was clicked (QAbstractButton)
298 """ 308 """
299 if button == self.buttonBox.button(QDialogButtonBox.Close): 309 if button == self.buttonBox.button(
310 QDialogButtonBox.StandardButton.Close
311 ):
300 self.close() 312 self.close()
301 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): 313 elif button == self.buttonBox.button(
314 QDialogButtonBox.StandardButton.Cancel
315 ):
302 self.cancelled = True 316 self.cancelled = True
303 self.__finish() 317 self.__finish()
304 elif button == self.refreshButton: 318 elif button == self.refreshButton:
305 self.on_refreshButton_clicked() 319 self.on_refreshButton_clicked()
306 320
323 Private slot to handle the password checkbox toggled. 337 Private slot to handle the password checkbox toggled.
324 338
325 @param isOn flag indicating the status of the check box (boolean) 339 @param isOn flag indicating the status of the check box (boolean)
326 """ 340 """
327 if isOn: 341 if isOn:
328 self.input.setEchoMode(QLineEdit.Password) 342 self.input.setEchoMode(QLineEdit.EchoMode.Password)
329 else: 343 else:
330 self.input.setEchoMode(QLineEdit.Normal) 344 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
331 345
332 @pyqtSlot() 346 @pyqtSlot()
333 def on_sendButton_clicked(self): 347 def on_sendButton_clicked(self):
334 """ 348 """
335 Private slot to send the input to the git process. 349 Private slot to send the input to the git process.

eric ide

mercurial