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