7 Module implementing the Changes preview dialog. |
7 Module implementing the Changes preview dialog. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import Qt, pyqtSlot |
12 from PyQt4.QtCore import Qt, pyqtSlot |
13 from PyQt5.QtWidgets import QDialogButtonBox, QListWidgetItem |
13 from PyQt4.QtGui import QDialogButtonBox, QListWidgetItem |
14 |
14 |
15 from PreviewDialogBase import PreviewDialogBase |
15 from PreviewDialogBase import PreviewDialogBase |
16 |
16 |
17 |
17 |
18 class ChangesPreviewDialog(PreviewDialogBase): |
18 class ChangesPreviewDialog(PreviewDialogBase): |
30 @param parent reference to the parent widget (QWidget) |
30 @param parent reference to the parent widget (QWidget) |
31 """ |
31 """ |
32 PreviewDialogBase.__init__(self, parent) |
32 PreviewDialogBase.__init__(self, parent) |
33 |
33 |
34 self.buttonBox.addButton( |
34 self.buttonBox.addButton( |
35 self.tr("&Apply Changes"), QDialogButtonBox.AcceptRole) |
35 self.trUtf8("&Apply Changes"), QDialogButtonBox.AcceptRole) |
36 self.buttonBox.addButton(QDialogButtonBox.Cancel) |
36 self.buttonBox.addButton(QDialogButtonBox.Cancel) |
37 |
37 |
38 self.description.setText(changes.description) |
38 self.description.setText(changes.description) |
39 for change in changes.changes: |
39 for change in changes.changes: |
40 itm = QListWidgetItem(str(change), self.changesList) |
40 itm = QListWidgetItem(str(change), self.changesList) |
41 try: |
41 try: |
42 changeDescription = change.get_description() |
42 changeDescription = change.get_description() |
43 except AttributeError: |
43 except AttributeError: |
44 changeDescription = self.tr("No changes available.") |
44 changeDescription = self.trUtf8("No changes available.") |
45 itm.setData(ChangesPreviewDialog.ChangeRole, |
45 itm.setData(ChangesPreviewDialog.ChangeRole, |
46 changeDescription) |
46 changeDescription) |
47 if self.changesList.count(): |
47 if self.changesList.count(): |
48 self.changesList.item(0).setSelected(True) |
48 self.changesList.item(0).setSelected(True) |
49 |
49 |