7 Module implementing the History dialog. |
7 Module implementing the History dialog. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt4.QtCore import Qt, pyqtSlot |
12 from PyQt5.QtCore import Qt, pyqtSlot |
13 from PyQt4.QtGui import QDialogButtonBox, QListWidgetItem, QApplication |
13 from PyQt5.QtWidgets import QDialogButtonBox, QListWidgetItem, QApplication |
14 |
14 |
15 from E5Gui.E5Application import e5App |
15 from E5Gui.E5Application import e5App |
16 from E5Gui import E5MessageBox |
16 from E5Gui import E5MessageBox |
17 |
17 |
18 from PreviewDialogBase import PreviewDialogBase |
18 from PreviewDialogBase import PreviewDialogBase |
42 self.__refactoring = refactoring |
42 self.__refactoring = refactoring |
43 self.__isUndo = isUndo |
43 self.__isUndo = isUndo |
44 |
44 |
45 if self.__isUndo: |
45 if self.__isUndo: |
46 self.__actionButton = self.buttonBox.addButton( |
46 self.__actionButton = self.buttonBox.addButton( |
47 self.trUtf8("&Undo"), |
47 self.tr("&Undo"), |
48 QDialogButtonBox.AcceptRole) |
48 QDialogButtonBox.AcceptRole) |
49 self.description.setText(self.trUtf8("Undoable Changes")) |
49 self.description.setText(self.tr("Undoable Changes")) |
50 title = self.trUtf8("Undo History") |
50 title = self.tr("Undo History") |
51 else: |
51 else: |
52 self.__actionButton = self.buttonBox.addButton( |
52 self.__actionButton = self.buttonBox.addButton( |
53 self.trUtf8("&Redo"), |
53 self.tr("&Redo"), |
54 QDialogButtonBox.AcceptRole) |
54 QDialogButtonBox.AcceptRole) |
55 self.description.setText(self.trUtf8("Redoable Changes")) |
55 self.description.setText(self.tr("Redoable Changes")) |
56 title = self.trUtf8("Redo History") |
56 title = self.tr("Redo History") |
57 self.buttonBox.addButton(QDialogButtonBox.Close) |
57 self.buttonBox.addButton(QDialogButtonBox.Close) |
58 self.setWindowTitle(title) |
58 self.setWindowTitle(title) |
59 |
59 |
60 # populate the list |
60 # populate the list |
61 self.__changes = {} |
61 self.__changes = {} |
96 change = self.__changes[id] |
96 change = self.__changes[id] |
97 |
97 |
98 if self.__isUndo: |
98 if self.__isUndo: |
99 res = E5MessageBox.yesNo( |
99 res = E5MessageBox.yesNo( |
100 None, |
100 None, |
101 self.trUtf8("Undo refactorings"), |
101 self.tr("Undo refactorings"), |
102 self.trUtf8("""Shall all refactorings up to <b>{0}</b>""" |
102 self.tr("""Shall all refactorings up to <b>{0}</b>""" |
103 """ be undone?""") |
103 """ be undone?""") |
104 .format(Utilities.html_encode(str(change)))) |
104 .format(Utilities.html_encode(str(change)))) |
105 else: |
105 else: |
106 res = E5MessageBox.yesNo( |
106 res = E5MessageBox.yesNo( |
107 None, |
107 None, |
108 self.trUtf8("Redo refactorings"), |
108 self.tr("Redo refactorings"), |
109 self.trUtf8("""Shall all refactorings up to <b>{0}</b>""" |
109 self.tr("""Shall all refactorings up to <b>{0}</b>""" |
110 """ be redone?""") |
110 """ be redone?""") |
111 .format(Utilities.html_encode(str(change)))) |
111 .format(Utilities.html_encode(str(change)))) |
112 if res: |
112 if res: |
113 if not self.__refactoring.confirmAllBuffersSaved(): |
113 if not self.__refactoring.confirmAllBuffersSaved(): |
114 return |
114 return |
115 |
115 |