Plugins/VcsPlugins/vcsMercurial/HgBundleDialog.py

changeset 1017
919147f2b518
parent 945
8cd4d08fa9f6
child 1131
7781e396c903
equal deleted inserted replaced
1016:72b6b0778e06 1017:919147f2b518
5 5
6 """ 6 """
7 Module implementing a dialog to enter the data for a bundle operation. 7 Module implementing a dialog to enter the data for a bundle operation.
8 """ 8 """
9 9
10 from PyQt4.QtGui import QDialog 10 from PyQt4.QtCore import pyqtSlot
11 from PyQt4.QtGui import QDialog, QDialogButtonBox
11 12
12 from .Ui_HgBundleDialog import Ui_HgBundleDialog 13 from .Ui_HgBundleDialog import Ui_HgBundleDialog
13 14
14 15
15 class HgBundleDialog(QDialog, Ui_HgBundleDialog): 16 class HgBundleDialog(QDialog, Ui_HgBundleDialog):
16 """ 17 """
17 Class implementing a dialog to enter the data for a bundle operation. 18 Class implementing a dialog to enter the data for a bundle operation.
18 """ 19 """
19 def __init__(self, tagsList, branchesList, parent=None): 20 def __init__(self, tagsList, branchesList, bookmarksList=None, parent=None):
20 """ 21 """
21 Constructor 22 Constructor
22 23
23 @param tagsList list of tags (list of strings) 24 @param tagsList list of tags (list of strings)
24 @param branchesList list of branches (list of strings) 25 @param branchesList list of branches (list of strings)
26 @param bookmarksList list of bookmarks (list of strings)
25 @param parent parent widget (QWidget) 27 @param parent parent widget (QWidget)
26 """ 28 """
27 QDialog.__init__(self, parent) 29 QDialog.__init__(self, parent)
28 self.setupUi(self) 30 self.setupUi(self)
29 31
32 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
33
30 self.compressionCombo.addItems(["", "bzip2", "gzip", "none"]) 34 self.compressionCombo.addItems(["", "bzip2", "gzip", "none"])
31 self.tagCombo.addItems(sorted(tagsList)) 35 self.tagCombo.addItems(sorted(tagsList))
32 self.branchCombo.addItems(["default"] + sorted(branchesList)) 36 self.branchCombo.addItems(["default"] + sorted(branchesList))
37 if bookmarksList is not None:
38 self.bookmarkCombo.addItems(sorted(bookmarksList))
39 else:
40 self.bookmarkButton.setHidden(True)
41 self.bookmarkCombo.setHidden(True)
42
43 def __updateOK(self):
44 """
45 Private slot to update the OK button.
46 """
47 enabled = True
48 if self.idButton.isChecked():
49 enabled = self.idEdit.text() != ""
50 elif self.tagButton.isChecked():
51 enabled = self.tagCombo.currentText() != ""
52 elif self.branchButton.isChecked():
53 enabled = self.branchCombo.currentText() != ""
54 elif self.bookmarkButton.isChecked():
55 enabled = self.bookmarkCombo.currentText() != ""
56
57 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(enabled)
58
59 @pyqtSlot(bool)
60 def on_idButton_toggled(self, checked):
61 """
62 Private slot to handle changes of the ID select button.
63
64 @param checked state of the button (boolean)
65 """
66 self.__updateOK()
67
68 @pyqtSlot(bool)
69 def on_tagButton_toggled(self, checked):
70 """
71 Private slot to handle changes of the Tag select button.
72
73 @param checked state of the button (boolean)
74 """
75 self.__updateOK()
76
77 @pyqtSlot(bool)
78 def on_branchButton_toggled(self, checked):
79 """
80 Private slot to handle changes of the Branch select button.
81
82 @param checked state of the button (boolean)
83 """
84 self.__updateOK()
85
86 @pyqtSlot(bool)
87 def on_bookmarkButton_toggled(self, checked):
88 """
89 Private slot to handle changes of the Bookmark select button.
90
91 @param checked state of the button (boolean)
92 """
93 self.__updateOK()
94
95 @pyqtSlot(str)
96 def on_idEdit_textChanged(self, txt):
97 """
98 Private slot to handle changes of the ID edit.
99
100 @param txt text of the edit (string)
101 """
102 self.__updateOK()
103
104 @pyqtSlot(str)
105 def on_tagCombo_editTextChanged(self, txt):
106 """
107 Private slot to handle changes of the Tag combo.
108
109 @param txt text of the combo (string)
110 """
111 self.__updateOK()
112
113 @pyqtSlot(str)
114 def on_branchCombo_editTextChanged(self, txt):
115 """
116 Private slot to handle changes of the Branch combo.
117
118 @param txt text of the combo (string)
119 """
120 self.__updateOK()
121
122 @pyqtSlot(str)
123 def on_bookmarkCombo_editTextChanged(self, txt):
124 """
125 Private slot to handle changes of the Bookmark combo.
126
127 @param txt text of the combo (string)
128 """
129 self.__updateOK()
33 130
34 def getParameters(self): 131 def getParameters(self):
35 """ 132 """
36 Public method to retrieve the bundle data. 133 Public method to retrieve the bundle data.
37 134
44 rev = self.idEdit.text() 141 rev = self.idEdit.text()
45 elif self.tagButton.isChecked(): 142 elif self.tagButton.isChecked():
46 rev = self.tagCombo.currentText() 143 rev = self.tagCombo.currentText()
47 elif self.branchButton.isChecked(): 144 elif self.branchButton.isChecked():
48 rev = self.branchCombo.currentText() 145 rev = self.branchCombo.currentText()
146 elif self.bookmarkButton.isChecked():
147 rev = self.bookmarkCombo.currentText()
49 else: 148 else:
50 rev = "" 149 rev = ""
51 150
52 return rev, self.compressionCombo.currentText(), self.allCheckBox.isChecked() 151 return rev, self.compressionCombo.currentText(), self.allCheckBox.isChecked()

eric ide

mercurial