42 @param parent parent widget (QWidget) |
42 @param parent parent widget (QWidget) |
43 """ |
43 """ |
44 super(SvnDiffDialog, self).__init__(parent) |
44 super(SvnDiffDialog, self).__init__(parent) |
45 self.setupUi(self) |
45 self.setupUi(self) |
46 |
46 |
|
47 self.refreshButton = self.buttonBox.addButton( |
|
48 self.tr("Refresh"), QDialogButtonBox.ActionRole) |
|
49 self.refreshButton.setToolTip( |
|
50 self.tr("Press to refresh the display")) |
|
51 self.refreshButton.setEnabled(False) |
47 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) |
52 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) |
48 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
53 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
49 |
54 |
50 self.searchWidget.attachTextEdit(self.contents) |
55 self.searchWidget.attachTextEdit(self.contents) |
51 |
56 |
92 if version == "WORKING": |
97 if version == "WORKING": |
93 return None |
98 return None |
94 else: |
99 else: |
95 return str(version) |
100 return str(version) |
96 |
101 |
97 def start(self, fn, versions=None, urls=None, summary=False): |
102 def start(self, fn, versions=None, urls=None, summary=False, |
|
103 refreshable=False): |
98 """ |
104 """ |
99 Public slot to start the svn diff command. |
105 Public slot to start the svn diff command. |
100 |
106 |
101 @param fn filename to be diffed (string) |
107 @param fn filename to be diffed (string) |
102 @param versions list of versions to be diffed (list of up to 2 strings |
108 @param versions list of versions to be diffed (list of up to 2 strings |
103 or None) |
109 or None) |
104 @keyparam urls list of repository URLs (list of 2 strings) |
110 @keyparam urls list of repository URLs (list of 2 strings) |
105 @keyparam summary flag indicating a summarizing diff |
111 @keyparam summary flag indicating a summarizing diff |
106 (only valid for URL diffs) (boolean) |
112 (only valid for URL diffs) (boolean) |
107 """ |
113 @keyparam refreshable flag indicating a refreshable diff (boolean) |
|
114 """ |
|
115 self.refreshButton.setVisible(refreshable) |
|
116 |
108 self.errorGroup.hide() |
117 self.errorGroup.hide() |
109 self.inputGroup.show() |
118 self.inputGroup.show() |
|
119 self.inputGroup.setEnabled(True) |
110 self.intercept = False |
120 self.intercept = False |
111 self.filename = fn |
121 self.filename = fn |
112 |
122 |
113 self.process.kill() |
123 self.process.kill() |
114 |
124 |
197 @param exitCode exit code of the process (integer) |
207 @param exitCode exit code of the process (integer) |
198 @param exitStatus exit status of the process (QProcess.ExitStatus) |
208 @param exitStatus exit status of the process (QProcess.ExitStatus) |
199 """ |
209 """ |
200 self.inputGroup.setEnabled(False) |
210 self.inputGroup.setEnabled(False) |
201 self.inputGroup.hide() |
211 self.inputGroup.hide() |
|
212 self.refreshButton.setEnabled(True) |
202 |
213 |
203 if self.paras == 0: |
214 if self.paras == 0: |
204 self.contents.setCurrentCharFormat(self.cNormalFormat) |
215 self.contents.setCurrentCharFormat(self.cNormalFormat) |
205 self.contents.setPlainText( |
216 self.contents.setPlainText( |
206 self.tr('There is no difference.')) |
217 self.tr('There is no difference.')) |
207 |
218 |
208 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(self.paras > 0) |
219 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(self.paras > 0) |
|
220 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
209 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
221 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
210 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
222 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
211 Qt.OtherFocusReason) |
223 Qt.OtherFocusReason) |
212 |
224 |
213 tc = self.contents.textCursor() |
225 tc = self.contents.textCursor() |
315 |
327 |
316 @param button button that was clicked (QAbstractButton) |
328 @param button button that was clicked (QAbstractButton) |
317 """ |
329 """ |
318 if button == self.buttonBox.button(QDialogButtonBox.Save): |
330 if button == self.buttonBox.button(QDialogButtonBox.Save): |
319 self.on_saveButton_clicked() |
331 self.on_saveButton_clicked() |
320 |
332 elif button == self.refreshButton: |
|
333 self.on_refreshButton_clicked() |
|
334 |
321 @pyqtSlot(int) |
335 @pyqtSlot(int) |
322 def on_filesCombo_activated(self, index): |
336 def on_filesCombo_activated(self, index): |
323 """ |
337 """ |
324 Private slot to handle the selection of a file. |
338 Private slot to handle the selection of a file. |
325 |
339 |
410 self.tr( |
424 self.tr( |
411 '<p>The patch file <b>{0}</b> could not be saved.' |
425 '<p>The patch file <b>{0}</b> could not be saved.' |
412 '<br>Reason: {1}</p>') |
426 '<br>Reason: {1}</p>') |
413 .format(fname, str(why))) |
427 .format(fname, str(why))) |
414 |
428 |
|
429 @pyqtSlot() |
|
430 def on_refreshButton_clicked(self): |
|
431 """ |
|
432 Private slot to refresh the display. |
|
433 """ |
|
434 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
|
435 |
|
436 self.buttonBox.button(QDialogButtonBox.Save).setEnabled(False) |
|
437 self.refreshButton.setEnabled(False) |
|
438 |
|
439 self.start(self.filename, refreshable=True) |
|
440 |
415 def on_passwordCheckBox_toggled(self, isOn): |
441 def on_passwordCheckBox_toggled(self, isOn): |
416 """ |
442 """ |
417 Private slot to handle the password checkbox toggled. |
443 Private slot to handle the password checkbox toggled. |
418 |
444 |
419 @param isOn flag indicating the status of the check box (boolean) |
445 @param isOn flag indicating the status of the check box (boolean) |