33 @param vcs reference to the vcs object |
33 @param vcs reference to the vcs object |
34 @param parent parent widget (QWidget) |
34 @param parent parent widget (QWidget) |
35 """ |
35 """ |
36 super(SvnBlameDialog, self).__init__(parent) |
36 super(SvnBlameDialog, self).__init__(parent) |
37 self.setupUi(self) |
37 self.setupUi(self) |
38 self.setWindowFlags(Qt.Window) |
38 self.setWindowFlags(Qt.WindowType.Window) |
39 |
39 |
40 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
40 self.buttonBox.button( |
41 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
41 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
42 self.buttonBox.button( |
|
43 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
42 |
44 |
43 self.vcs = vcs |
45 self.vcs = vcs |
44 |
46 |
45 self.blameList.headerItem().setText(self.blameList.columnCount(), "") |
47 self.blameList.headerItem().setText(self.blameList.columnCount(), "") |
46 font = Preferences.getEditorOtherFonts("MonospacedFont") |
48 font = Preferences.getEditorOtherFonts("MonospacedFont") |
59 |
61 |
60 @param e close event (QCloseEvent) |
62 @param e close event (QCloseEvent) |
61 """ |
63 """ |
62 if ( |
64 if ( |
63 self.process is not None and |
65 self.process is not None and |
64 self.process.state() != QProcess.NotRunning |
66 self.process.state() != QProcess.ProcessState.NotRunning |
65 ): |
67 ): |
66 self.process.terminate() |
68 self.process.terminate() |
67 QTimer.singleShot(2000, self.process.kill) |
69 QTimer.singleShot(2000, self.process.kill) |
68 self.process.waitForFinished(3000) |
70 self.process.waitForFinished(3000) |
69 |
71 |
113 Private slot called when the process finished or the user pressed the |
115 Private slot called when the process finished or the user pressed the |
114 button. |
116 button. |
115 """ |
117 """ |
116 if ( |
118 if ( |
117 self.process is not None and |
119 self.process is not None and |
118 self.process.state() != QProcess.NotRunning |
120 self.process.state() != QProcess.ProcessState.NotRunning |
119 ): |
121 ): |
120 self.process.terminate() |
122 self.process.terminate() |
121 QTimer.singleShot(2000, self.process.kill) |
123 QTimer.singleShot(2000, self.process.kill) |
122 self.process.waitForFinished(3000) |
124 self.process.waitForFinished(3000) |
123 |
125 |
124 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
126 self.buttonBox.button( |
125 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
127 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
126 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
128 self.buttonBox.button( |
127 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
129 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
128 Qt.OtherFocusReason) |
130 self.buttonBox.button( |
|
131 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
132 self.buttonBox.button( |
|
133 QDialogButtonBox.StandardButton.Close).setFocus( |
|
134 Qt.FocusReason.OtherFocusReason) |
129 |
135 |
130 self.inputGroup.setEnabled(False) |
136 self.inputGroup.setEnabled(False) |
131 self.inputGroup.hide() |
137 self.inputGroup.hide() |
132 |
138 |
133 self.__resizeColumns() |
139 self.__resizeColumns() |
136 """ |
142 """ |
137 Private slot called by a button of the button box clicked. |
143 Private slot called by a button of the button box clicked. |
138 |
144 |
139 @param button button that was clicked (QAbstractButton) |
145 @param button button that was clicked (QAbstractButton) |
140 """ |
146 """ |
141 if button == self.buttonBox.button(QDialogButtonBox.Close): |
147 if button == self.buttonBox.button( |
|
148 QDialogButtonBox.StandardButton.Close |
|
149 ): |
142 self.close() |
150 self.close() |
143 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
151 elif button == self.buttonBox.button( |
|
152 QDialogButtonBox.StandardButton.Cancel |
|
153 ): |
144 self.__finish() |
154 self.__finish() |
145 |
155 |
146 def __procFinished(self, exitCode, exitStatus): |
156 def __procFinished(self, exitCode, exitStatus): |
147 """ |
157 """ |
148 Private slot connected to the finished signal. |
158 Private slot connected to the finished signal. |
154 |
164 |
155 def __resizeColumns(self): |
165 def __resizeColumns(self): |
156 """ |
166 """ |
157 Private method to resize the list columns. |
167 Private method to resize the list columns. |
158 """ |
168 """ |
159 self.blameList.header().resizeSections(QHeaderView.ResizeToContents) |
169 self.blameList.header().resizeSections( |
|
170 QHeaderView.ResizeMode.ResizeToContents) |
160 |
171 |
161 def __generateItem(self, revision, author, text): |
172 def __generateItem(self, revision, author, text): |
162 """ |
173 """ |
163 Private method to generate a blame item in the blame list. |
174 Private method to generate a blame item in the blame list. |
164 |
175 |
168 """ |
179 """ |
169 itm = QTreeWidgetItem( |
180 itm = QTreeWidgetItem( |
170 self.blameList, |
181 self.blameList, |
171 [revision, author, "{0:d}".format(self.lineno), text]) |
182 [revision, author, "{0:d}".format(self.lineno), text]) |
172 self.lineno += 1 |
183 self.lineno += 1 |
173 itm.setTextAlignment(0, Qt.AlignRight) |
184 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) |
174 itm.setTextAlignment(2, Qt.AlignRight) |
185 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignRight) |
175 |
186 |
176 def __readStdout(self): |
187 def __readStdout(self): |
177 """ |
188 """ |
178 Private slot to handle the readyReadStdout signal. |
189 Private slot to handle the readyReadStdout signal. |
179 |
190 |
180 It reads the output of the process, formats it and inserts it into |
191 It reads the output of the process, formats it and inserts it into |
181 the contents pane. |
192 the contents pane. |
182 """ |
193 """ |
183 self.process.setReadChannel(QProcess.StandardOutput) |
194 self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput) |
184 |
195 |
185 while self.process.canReadLine(): |
196 while self.process.canReadLine(): |
186 s = str( |
197 s = str( |
187 self.process.readLine(), self.__ioEncoding, 'replace').strip() |
198 self.process.readLine(), self.__ioEncoding, 'replace').strip() |
188 rev, s = s.split(None, 1) |
199 rev, s = s.split(None, 1) |
213 Private slot to handle the password checkbox toggled. |
224 Private slot to handle the password checkbox toggled. |
214 |
225 |
215 @param isOn flag indicating the status of the check box (boolean) |
226 @param isOn flag indicating the status of the check box (boolean) |
216 """ |
227 """ |
217 if isOn: |
228 if isOn: |
218 self.input.setEchoMode(QLineEdit.Password) |
229 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
219 else: |
230 else: |
220 self.input.setEchoMode(QLineEdit.Normal) |
231 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |
221 |
232 |
222 @pyqtSlot() |
233 @pyqtSlot() |
223 def on_sendButton_clicked(self): |
234 def on_sendButton_clicked(self): |
224 """ |
235 """ |
225 Private slot to send the input to the subversion process. |
236 Private slot to send the input to the subversion process. |