42 |
42 |
43 self.file1Picker.setMode(E5PathPickerModes.OpenFileMode) |
43 self.file1Picker.setMode(E5PathPickerModes.OpenFileMode) |
44 self.file2Picker.setMode(E5PathPickerModes.OpenFileMode) |
44 self.file2Picker.setMode(E5PathPickerModes.OpenFileMode) |
45 |
45 |
46 self.diffButton = self.buttonBox.addButton( |
46 self.diffButton = self.buttonBox.addButton( |
47 self.tr("Compare"), QDialogButtonBox.ActionRole) |
47 self.tr("Compare"), QDialogButtonBox.ButtonRole.ActionRole) |
48 self.diffButton.setToolTip( |
48 self.diffButton.setToolTip( |
49 self.tr("Press to perform the comparison of the two files")) |
49 self.tr("Press to perform the comparison of the two files")) |
50 self.saveButton = self.buttonBox.addButton( |
50 self.saveButton = self.buttonBox.addButton( |
51 self.tr("Save"), QDialogButtonBox.ActionRole) |
51 self.tr("Save"), QDialogButtonBox.ButtonRole.ActionRole) |
52 self.saveButton.setToolTip( |
52 self.saveButton.setToolTip( |
53 self.tr("Save the output to a patch file")) |
53 self.tr("Save the output to a patch file")) |
54 self.diffButton.setEnabled(False) |
54 self.diffButton.setEnabled(False) |
55 self.saveButton.setEnabled(False) |
55 self.saveButton.setEnabled(False) |
56 self.diffButton.setDefault(True) |
56 self.diffButton.setDefault(True) |
198 self.__generateContextDiff( |
198 self.__generateContextDiff( |
199 lines1, lines2, self.filename1, self.filename2, |
199 lines1, lines2, self.filename1, self.filename2, |
200 filemtime1, filemtime2) |
200 filemtime1, filemtime2) |
201 |
201 |
202 tc = self.contents.textCursor() |
202 tc = self.contents.textCursor() |
203 tc.movePosition(QTextCursor.Start) |
203 tc.movePosition(QTextCursor.MoveOperation.Start) |
204 self.contents.setTextCursor(tc) |
204 self.contents.setTextCursor(tc) |
205 self.contents.ensureCursorVisible() |
205 self.contents.ensureCursorVisible() |
206 |
206 |
207 self.saveButton.setEnabled(True) |
207 self.saveButton.setEnabled(True) |
208 |
208 |
211 Private method to append text to the end of the contents pane. |
211 Private method to append text to the end of the contents pane. |
212 |
212 |
213 @param txt text to insert (string) |
213 @param txt text to insert (string) |
214 """ |
214 """ |
215 tc = self.contents.textCursor() |
215 tc = self.contents.textCursor() |
216 tc.movePosition(QTextCursor.End) |
216 tc.movePosition(QTextCursor.MoveOperation.End) |
217 self.contents.setTextCursor(tc) |
217 self.contents.setTextCursor(tc) |
218 self.contents.insertPlainText(txt) |
218 self.contents.insertPlainText(txt) |
219 |
219 |
220 def __generateUnifiedDiff(self, a, b, fromfile, tofile, |
220 def __generateUnifiedDiff(self, a, b, fromfile, tofile, |
221 fromfiledate, tofiledate): |
221 fromfiledate, tofiledate): |
303 |
303 |
304 @param obj reference to the object the event is meant for (QObject) |
304 @param obj reference to the object the event is meant for (QObject) |
305 @param event reference to the event object (QEvent) |
305 @param event reference to the event object (QEvent) |
306 @return flag indicating, whether the event was handled (boolean) |
306 @return flag indicating, whether the event was handled (boolean) |
307 """ |
307 """ |
308 if event.type() == QEvent.Close: |
308 if event.type() == QEvent.Type.Close: |
309 QApplication.exit() |
309 QApplication.exit() |
310 return True |
310 return True |
311 |
311 |
312 return False |
312 return False |