|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2014 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter a series of revisions. |
|
8 """ |
|
9 |
|
10 from PyQt4.QtCore import pyqtSlot |
|
11 from PyQt4.QtGui import QDialog, QDialogButtonBox |
|
12 |
|
13 from .Ui_LfRevisionsInputDialog import Ui_LfRevisionsInputDialog |
|
14 |
|
15 |
|
16 class LfRevisionsInputDialog(QDialog, Ui_LfRevisionsInputDialog): |
|
17 """ |
|
18 Class implementing a dialog to enter a series of revisions. |
|
19 """ |
|
20 def __init__(self, parent=None): |
|
21 """ |
|
22 Constructor |
|
23 |
|
24 @param parent reference to the parent widget (QWidget) |
|
25 """ |
|
26 super().__init__(parent) |
|
27 self.setupUi(self) |
|
28 |
|
29 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
|
30 |
|
31 @pyqtSlot() |
|
32 def on_revisionsEdit_textChanged(self): |
|
33 """ |
|
34 Private slot handling a change of revisions. |
|
35 """ |
|
36 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
|
37 bool(self.revisionsEdit.toPlainText())) |
|
38 |
|
39 def getRevisions(self): |
|
40 """ |
|
41 Public method to retrieve the entered revisions. |
|
42 |
|
43 @return list of revisions (list of string) |
|
44 """ |
|
45 return self.revisionsEdit.toPlainText().splitlines() |