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

eric ide

mercurial