|
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 __future__ import unicode_literals |
|
11 |
|
12 from PyQt4.QtCore import pyqtSlot |
|
13 from PyQt4.QtGui import QDialog, QDialogButtonBox |
|
14 |
|
15 from .Ui_LfRevisionsInputDialog import Ui_LfRevisionsInputDialog |
|
16 |
|
17 |
|
18 class LfRevisionsInputDialog(QDialog, Ui_LfRevisionsInputDialog): |
|
19 """ |
|
20 Class implementing a dialog to enter a series of revisions. |
|
21 """ |
|
22 def __init__(self, parent=None): |
|
23 """ |
|
24 Constructor |
|
25 |
|
26 @param parent reference to the parent widget (QWidget) |
|
27 """ |
|
28 super(LfRevisionsInputDialog, self).__init__(parent) |
|
29 self.setupUi(self) |
|
30 |
|
31 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False) |
|
32 |
|
33 @pyqtSlot() |
|
34 def on_revisionsEdit_textChanged(self): |
|
35 """ |
|
36 Private slot handling a change of revisions. |
|
37 """ |
|
38 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled( |
|
39 bool(self.revisionsEdit.toPlainText())) |
|
40 |
|
41 def getRevisions(self): |
|
42 """ |
|
43 Public method to retrieve the entered revisions. |
|
44 |
|
45 @return list of revisions (list of string) |
|
46 """ |
|
47 return self.revisionsEdit.toPlainText().splitlines() |