Plugins/VcsPlugins/vcsGit/GitBundleDialog.py

changeset 6020
baf6da1ae288
child 6048
82ad8ec9548c
equal deleted inserted replaced
6019:58ecdaf0b789 6020:baf6da1ae288
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter the data for a bundle operation.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtCore import pyqtSlot
13 from PyQt5.QtWidgets import QDialog, QDialogButtonBox
14
15 from .Ui_GitBundleDialog import Ui_GitBundleDialog
16
17
18 class GitBundleDialog(QDialog, Ui_GitBundleDialog):
19 """
20 Class implementing a dialog to enter the data for a bundle operation.
21 """
22 def __init__(self, tagsList, branchesList, parent=None):
23 """
24 Constructor
25
26 @param tagsList list of tags (list of strings)
27 @param branchesList list of branches (list of strings)
28 @param parent parent widget (QWidget)
29 """
30 super(GitBundleDialog, self).__init__(parent)
31 self.setupUi(self)
32
33 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
34
35 self.tagCombo.addItems(sorted(tagsList))
36 self.branchCombo.addItems(["master"] + sorted(branchesList))
37
38 def __updateOK(self):
39 """
40 Private slot to update the OK button.
41 """
42 enabled = True
43 if self.revisionsButton.isChecked():
44 enabled = self.revisionsEdit.text() != ""
45 elif self.tagButton.isChecked():
46 enabled = self.tagCombo.currentText() != ""
47 elif self.branchButton.isChecked():
48 enabled = self.branchCombo.currentText() != ""
49
50 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
51
52 @pyqtSlot(bool)
53 def on_revisionsButton_toggled(self, checked):
54 """
55 Private slot to handle changes of the revisions select button.
56
57 @param checked state of the button (boolean)
58 """
59 self.__updateOK()
60
61 @pyqtSlot(bool)
62 def on_tagButton_toggled(self, checked):
63 """
64 Private slot to handle changes of the Tag select button.
65
66 @param checked state of the button (boolean)
67 """
68 self.__updateOK()
69
70 @pyqtSlot(bool)
71 def on_branchButton_toggled(self, checked):
72 """
73 Private slot to handle changes of the Branch select button.
74
75 @param checked state of the button (boolean)
76 """
77 self.__updateOK()
78
79 @pyqtSlot(str)
80 def on_revisionsEdit_textChanged(self, txt):
81 """
82 Private slot to handle changes of the Revisions edit.
83
84 @param txt text of the line edit (string)
85 """
86 self.__updateOK()
87
88 @pyqtSlot(str)
89 def on_tagCombo_editTextChanged(self, txt):
90 """
91 Private slot to handle changes of the Tag combo.
92
93 @param txt text of the combo (string)
94 """
95 self.__updateOK()
96
97 @pyqtSlot(str)
98 def on_branchCombo_editTextChanged(self, txt):
99 """
100 Private slot to handle changes of the Branch combo.
101
102 @param txt text of the combo (string)
103 """
104 self.__updateOK()
105
106 def getData(self):
107 """
108 Public method to retrieve the bundle data.
109
110 @return list of revision expressions (list of strings)
111 """
112 if self.revisionsButton.isChecked():
113 revs = self.revisionsEdit.text().strip().split()
114 elif self.tagButton.isChecked():
115 revs = [self.tagCombo.currentText()]
116 elif self.branchButton.isChecked():
117 revs = [self.branchCombo.currentText()]
118 else:
119 revs = []
120
121 return revs

eric ide

mercurial