diff -r e01ae92db699 -r 31965986ecd1 eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py --- a/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py Sat Mar 06 10:00:52 2021 +0100 +++ b/eric6/Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesDefineGuardsDialog.py Sun Mar 28 15:00:11 2021 +0200 @@ -34,7 +34,7 @@ """ super(HgQueuesDefineGuardsDialog, self).__init__(parent) self.setupUi(self) - self.setWindowFlags(Qt.Window) + self.setWindowFlags(Qt.WindowType.Window) self.vcs = vcs self.extension = extension @@ -82,16 +82,18 @@ """ Public slot to start the list command. """ - self.on_patchSelector_activated("") + self.on_patchSelector_activated(0) - @pyqtSlot(str) - def on_patchSelector_activated(self, patch): + @pyqtSlot(int) + def on_patchSelector_activated(self, index): """ Private slot to get the list of guards defined for the given patch name. - @param patch selected patch name (empty for current patch) + @param index index of the selected entry + @type int """ + patch = self.patchSelector.itemText(index) if self.__dirtyList: res = E5MessageBox.question( self, @@ -137,7 +139,7 @@ else: continue itm = QListWidgetItem(icon, guard, self.guardsList) - itm.setData(Qt.UserRole, sign) + itm.setData(Qt.ItemDataRole.UserRole, sign) self.on_guardsList_itemSelectionChanged() @@ -156,7 +158,8 @@ @param guard name of the guard (string) @return reference to the guard item (QListWidgetItem) """ - items = self.guardsList.findItems(guard, Qt.MatchCaseSensitive) + items = self.guardsList.findItems( + guard, Qt.MatchFlag.MatchCaseSensitive) if items: return items[0] else: @@ -192,7 +195,7 @@ del itm itm = QListWidgetItem(icon, guard, self.guardsList) - itm.setData(Qt.UserRole, sign) + itm.setData(Qt.ItemDataRole.UserRole, sign) self.guardsList.sortItems() self.__dirtyList = True @@ -222,9 +225,13 @@ @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button(QDialogButtonBox.Apply): + if button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Apply + ): self.__applyGuards() - elif button == self.buttonBox.button(QDialogButtonBox.Close): + elif button == self.buttonBox.button( + QDialogButtonBox.StandardButton.Close + ): self.close() @pyqtSlot() @@ -236,7 +243,7 @@ guardsList = [] for row in range(self.guardsList.count()): itm = self.guardsList.item(row) - guard = itm.data(Qt.UserRole) + itm.text() + guard = itm.data(Qt.ItemDataRole.UserRole) + itm.text() guardsList.append(guard) args = self.vcs.initCommand("qguard") @@ -258,5 +265,7 @@ .format(error)) else: self.__dirtyList = False - self.on_patchSelector_activated( - self.patchNameLabel.text()) + index = self.patchSelector.findText(self.patchNameLabel.text()) + if index == -1: + index = 0 + self.on_patchSelector_activated(index)