eric7/Plugins/VcsPlugins/vcsMercurial/HgBackoutDialog.py

branch
eric7
changeset 9025
9fe8cfa14542
parent 8881
54e42bc2437a
equal deleted inserted replaced
9024:640778fcd474 9025:9fe8cfa14542
22 def __init__(self, tagsList, branchesList, bookmarksList=None, 22 def __init__(self, tagsList, branchesList, bookmarksList=None,
23 parent=None): 23 parent=None):
24 """ 24 """
25 Constructor 25 Constructor
26 26
27 @param tagsList list of tags (list of strings) 27 @param tagsList list of tags
28 @param branchesList list of branches (list of strings) 28 @type list of str
29 @param bookmarksList list of bookmarks (list of strings) 29 @param branchesList list of branches
30 @param parent parent widget (QWidget) 30 @type list of str
31 @param bookmarksList list of bookmarks
32 @type list of str
33 @param parent parent widget
34 @type QWidget
31 """ 35 """
32 super().__init__(parent) 36 super().__init__(parent)
33 self.setupUi(self) 37 self.setupUi(self)
34 38
35 self.buttonBox.button( 39 self.buttonBox.button(
47 self.bookmarkCombo.addItems(sorted(bookmarksList)) 51 self.bookmarkCombo.addItems(sorted(bookmarksList))
48 else: 52 else:
49 self.bookmarkButton.setHidden(True) 53 self.bookmarkButton.setHidden(True)
50 self.bookmarkCombo.setHidden(True) 54 self.bookmarkCombo.setHidden(True)
51 55
56 # connect various radio buttons and input fields
57 self.idButton.toggled.connect(self.__updateOK)
58 self.tagButton.toggled.connect(self.__updateOK)
59 self.branchButton.toggled.connect(self.__updateOK)
60 self.bookmarkButton.toggled.connect(self.__updateOK)
61 self.expressionButton.toggled.connect(self.__updateOK)
62 self.noneButton.toggled.connect(self.__updateOK)
63
64 self.idEdit.textChanged.connect(self.__updateOK)
65 self.expressionEdit.textChanged.connect(self.__updateOK)
66
67 self.tagCombo.editTextChanged.connect(self.__updateOK)
68 self.branchCombo.editTextChanged.connect(self.__updateOK)
69 self.bookmarkCombo.editTextChanged.connect(self.__updateOK)
70
52 self.__initDateTime = QDateTime.currentDateTime() 71 self.__initDateTime = QDateTime.currentDateTime()
53 self.dateEdit.setDateTime(self.__initDateTime) 72 self.dateEdit.setDateTime(self.__initDateTime)
54 73
74 @pyqtSlot()
55 def __updateOK(self): 75 def __updateOK(self):
56 """ 76 """
57 Private slot to update the OK button. 77 Private slot to update the OK button.
58 """ 78 """
59 enabled = True 79 enabled = True
60 if self.noneButton.isChecked(): 80 if self.noneButton.isChecked():
61 enabled = False 81 enabled = False
62 elif self.idButton.isChecked(): 82 elif self.idButton.isChecked():
63 enabled = self.idEdit.text() != "" 83 enabled = bool(self.idEdit.text())
64 elif self.tagButton.isChecked(): 84 elif self.tagButton.isChecked():
65 enabled = self.tagCombo.currentText() != "" 85 enabled = bool(self.tagCombo.currentText())
66 elif self.branchButton.isChecked(): 86 elif self.branchButton.isChecked():
67 enabled = self.branchCombo.currentText() != "" 87 enabled = bool(self.branchCombo.currentText())
68 elif self.bookmarkButton.isChecked(): 88 elif self.bookmarkButton.isChecked():
69 enabled = self.bookmarkCombo.currentText() != "" 89 enabled = bool(self.bookmarkCombo.currentText())
90 elif self.expressionButton.isChecked():
91 enabled = enabled and bool(self.expressionEdit.text())
70 92
71 self.buttonBox.button( 93 self.buttonBox.button(
72 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled) 94 QDialogButtonBox.StandardButton.Ok).setEnabled(enabled)
73
74 @pyqtSlot(bool)
75 def on_idButton_toggled(self, checked):
76 """
77 Private slot to handle changes of the ID select button.
78
79 @param checked state of the button (boolean)
80 """
81 self.__updateOK()
82
83 @pyqtSlot(bool)
84 def on_tagButton_toggled(self, checked):
85 """
86 Private slot to handle changes of the Tag select button.
87
88 @param checked state of the button (boolean)
89 """
90 self.__updateOK()
91
92 @pyqtSlot(bool)
93 def on_branchButton_toggled(self, checked):
94 """
95 Private slot to handle changes of the Branch select button.
96
97 @param checked state of the button (boolean)
98 """
99 self.__updateOK()
100
101 @pyqtSlot(bool)
102 def on_bookmarkButton_toggled(self, checked):
103 """
104 Private slot to handle changes of the Bookmark select button.
105
106 @param checked state of the button (boolean)
107 """
108 self.__updateOK()
109
110 @pyqtSlot(bool)
111 def on_noneButton_toggled(self, checked):
112 """
113 Private slot to handle the toggling of the None revision button.
114
115 @param checked flag indicating the checked state (boolean)
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 (string)
125 """
126 self.__updateOK()
127
128 @pyqtSlot(str)
129 def on_tagCombo_editTextChanged(self, txt):
130 """
131 Private slot to handle changes of the Tag combo.
132
133 @param txt text of the combo (string)
134 """
135 self.__updateOK()
136
137 @pyqtSlot(str)
138 def on_branchCombo_editTextChanged(self, txt):
139 """
140 Private slot to handle changes of the Branch combo.
141
142 @param txt text of the combo (string)
143 """
144 self.__updateOK()
145
146 @pyqtSlot(str)
147 def on_bookmarkCombo_editTextChanged(self, txt):
148 """
149 Private slot to handle changes of the Bookmark combo.
150
151 @param txt text of the combo (string)
152 """
153 self.__updateOK()
154 95
155 def getParameters(self): 96 def getParameters(self):
156 """ 97 """
157 Public method to retrieve the backout data. 98 Public method to retrieve the backout data.
158 99
159 @return tuple naming the revision, a flag indicating a 100 @return tuple naming the revision, a flag indicating a
160 merge, the commit date, the commit user and a commit message 101 merge, the commit date, the commit user and a commit message
161 (string, boolean, string, string, string) 102 @rtype tuple of (str, bool, str, str, str)
162 """ 103 """
163 if self.numberButton.isChecked(): 104 if self.numberButton.isChecked():
164 rev = "rev({0})".format(self.numberSpinBox.value()) 105 rev = "rev({0})".format(self.numberSpinBox.value())
165 elif self.idButton.isChecked(): 106 elif self.idButton.isChecked():
166 rev = "id({0})".format(self.idEdit.text()) 107 rev = "id({0})".format(self.idEdit.text())
168 rev = self.tagCombo.currentText() 109 rev = self.tagCombo.currentText()
169 elif self.branchButton.isChecked(): 110 elif self.branchButton.isChecked():
170 rev = self.branchCombo.currentText() 111 rev = self.branchCombo.currentText()
171 elif self.bookmarkButton.isChecked(): 112 elif self.bookmarkButton.isChecked():
172 rev = self.bookmarkCombo.currentText() 113 rev = self.bookmarkCombo.currentText()
114 elif self.expressionButton.isChecked():
115 rev = self.expressionEdit.text()
173 else: 116 else:
174 rev = "" 117 rev = ""
175 118
176 date = ( 119 date = (
177 self.dateEdit.dateTime().toString("yyyy-MM-dd hh:mm") 120 self.dateEdit.dateTime().toString("yyyy-MM-dd hh:mm")

eric ide

mercurial