eric7/Plugins/VcsPlugins/vcsMercurial/StripExtension/HgStripDialog.py

branch
eric7
changeset 9028
b3a7f0368163
parent 8881
54e42bc2437a
equal deleted inserted replaced
9027:f259edcf185a 9028:b3a7f0368163
40 self.branchCombo.addItems(["default"] + sorted(branchesList)) 40 self.branchCombo.addItems(["default"] + sorted(branchesList))
41 if bookmarksList is not None: 41 if bookmarksList is not None:
42 self.bookmarkCombo.addItems([""] + sorted(bookmarksList)) 42 self.bookmarkCombo.addItems([""] + sorted(bookmarksList))
43 self.idEdit.setText(rev) 43 self.idEdit.setText(rev)
44 44
45 # connect various radio buttons and input fields
46 self.numberButton.toggled.connect(self.__updateOK)
47 self.idButton.toggled.connect(self.__updateOK)
48 self.tagButton.toggled.connect(self.__updateOK)
49 self.branchButton.toggled.connect(self.__updateOK)
50 self.expressionButton.toggled.connect(self.__updateOK)
51
52 self.numberSpinBox.valueChanged.connect(self.__updateOK)
53
54 self.idEdit.textChanged.connect(self.__updateOK)
55 self.expressionEdit.textChanged.connect(self.__updateOK)
56
57 self.tagCombo.editTextChanged.connect(self.__updateOK)
58 self.branchCombo.editTextChanged.connect(self.__updateOK)
59
45 msh = self.minimumSizeHint() 60 msh = self.minimumSizeHint()
46 self.resize(max(self.width(), msh.width()), msh.height()) 61 self.resize(max(self.width(), msh.width()), msh.height())
47 62
48 self.__updateOK() 63 self.__updateOK()
49 64
50 self.idEdit.setFocus() 65 self.idEdit.setFocus()
51 66
67 @pyqtSlot()
52 def __updateOK(self): 68 def __updateOK(self):
53 """ 69 """
54 Private slot to update the OK button. 70 Private slot to update the OK button.
55 """ 71 """
56 enabled = True 72 enabled = True
57 if self.numberButton.isChecked(): 73 if self.numberButton.isChecked():
58 enabled = enabled and self.numberSpinBox.value() >= 0 74 enabled = enabled and self.numberSpinBox.value() >= 0
59 elif self.idButton.isChecked(): 75 elif self.idButton.isChecked():
60 enabled = enabled and self.idEdit.text() != "" 76 enabled = enabled and bool(self.idEdit.text())
61 elif self.tagButton.isChecked(): 77 elif self.tagButton.isChecked():
62 enabled = enabled and self.tagCombo.currentText() != "" 78 enabled = enabled and bool(self.tagCombo.currentText())
63 elif self.branchButton.isChecked(): 79 elif self.branchButton.isChecked():
64 enabled = enabled and self.branchCombo.currentText() != "" 80 enabled = enabled and bool(self.branchCombo.currentText())
81 elif self.expressionButton.isChecked():
82 enabled = enabled and bool(self.expressionEdit.text())
65 83
66 self.buttonBox.button( 84 self.buttonBox.button(
67 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) 85 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
68
69 @pyqtSlot(bool)
70 def on_numberButton_toggled(self, checked):
71 """
72 Private slot to handle changes of the Number select button.
73
74 @param checked state of the button
75 @type bool
76 """
77 self.__updateOK()
78
79 @pyqtSlot(bool)
80 def on_idButton_toggled(self, checked):
81 """
82 Private slot to handle changes of the ID select button.
83
84 @param checked state of the button
85 @type bool
86 """
87 self.__updateOK()
88
89 @pyqtSlot(bool)
90 def on_tagButton_toggled(self, checked):
91 """
92 Private slot to handle changes of the Tag select button.
93
94 @param checked state of the button
95 @type bool
96 """
97 self.__updateOK()
98
99 @pyqtSlot(bool)
100 def on_branchButton_toggled(self, checked):
101 """
102 Private slot to handle changes of the Branch select button.
103
104 @param checked state of the button
105 @type bool
106 """
107 self.__updateOK()
108
109 @pyqtSlot(int)
110 def on_numberSpinBox_valueChanged(self, val):
111 """
112 Private slot to handle changes of the Number spin box.
113
114 @param val value of the spin box
115 @type int
116 """
117 self.__updateOK()
118
119 @pyqtSlot(str)
120 def on_idEdit_textChanged(self, txt):
121 """
122 Private slot to handle changes of the ID edit.
123
124 @param txt text of the edit
125 @type str
126 """
127 self.__updateOK()
128
129 @pyqtSlot(str)
130 def on_tagCombo_editTextChanged(self, txt):
131 """
132 Private slot to handle changes of the Tag combo.
133
134 @param txt text of the combo
135 @type str
136 """
137 self.__updateOK()
138
139 @pyqtSlot(str)
140 def on_branchCombo_editTextChanged(self, txt):
141 """
142 Private slot to handle changes of the Branch combo.
143
144 @param txt text of the combo
145 @type str
146 """
147 self.__updateOK()
148 86
149 def __getRevision(self): 87 def __getRevision(self):
150 """ 88 """
151 Private method to generate the revision. 89 Private method to generate the revision.
152 90
159 return "id({0})".format(self.idEdit.text()) 97 return "id({0})".format(self.idEdit.text())
160 elif self.tagButton.isChecked(): 98 elif self.tagButton.isChecked():
161 return self.tagCombo.currentText() 99 return self.tagCombo.currentText()
162 elif self.branchButton.isChecked(): 100 elif self.branchButton.isChecked():
163 return self.branchCombo.currentText() 101 return self.branchCombo.currentText()
102 elif self.expressionButton.isChecked():
103 return self.expressionEdit.text()
164 else: 104 else:
165 # should not happen 105 # should not happen
166 return "" 106 return ""
167 107
168 def getData(self): 108 def getData(self):

eric ide

mercurial