--- a/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnChangeListsDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsPySvn/SvnChangeListsDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -27,10 +27,11 @@ """ Class implementing a dialog to browse the change lists. """ + def __init__(self, vcs, parent=None): """ Constructor - + @param vcs reference to the vcs object @param parent parent widget (QWidget) """ @@ -38,26 +39,24 @@ self.setupUi(self) SvnDialogMixin.__init__(self) self.setWindowFlags(Qt.WindowType.Window) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Close).setEnabled(False) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Cancel).setDefault(True) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False) + self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True) + self.vcs = vcs - + self.client = self.vcs.getClient() self.client.callback_cancel = self._clientCancelCallback self.client.callback_get_login = self._clientLoginCallback self.client.callback_ssl_server_trust_prompt = ( self._clientSslServerTrustPromptCallback ) - + @pyqtSlot(QListWidgetItem, QListWidgetItem) def on_changeLists_currentItemChanged(self, current, previous): """ Private slot to handle the selection of a new item. - + @param current current item (QListWidgetItem) @param previous previous current item (QListWidgetItem) """ @@ -65,26 +64,25 @@ if current is not None: changelist = current.text() if changelist in self.changeListsDict: - self.filesList.addItems( - sorted(self.changeListsDict[changelist])) - + self.filesList.addItems(sorted(self.changeListsDict[changelist])) + def start(self, path): """ Public slot to populate the data. - + @param path directory name to show change lists for (string) """ self.changeListsDict = {} self.cancelled = False - - self.filesLabel.setText( - self.tr("Files (relative to {0}):").format(path)) - + + self.filesLabel.setText(self.tr("Files (relative to {0}):").format(path)) + with EricOverrideCursor(): try: with EricMutexLocker(self.vcs.vcsExecutionMutex): entries = self.client.get_changelist( - path, depth=pysvn.depth.infinity) + path, depth=pysvn.depth.infinity + ) for entry in entries: file = entry[0] changelist = entry[1] @@ -96,41 +94,34 @@ except pysvn.ClientError as e: self.__showError(e.args[0]) self.__finish() - + def __finish(self): """ Private slot called when the user pressed the button. """ self.changeLists.addItems(sorted(self.changeListsDict.keys())) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Close).setEnabled(True) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Cancel).setEnabled(False) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Close).setDefault(True) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True) + self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False) + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True) + if len(self.changeListsDict) == 0: self.changeLists.addItem(self.tr("No changelists found")) - self.buttonBox.button( - QDialogButtonBox.StandardButton.Close).setFocus( - Qt.FocusReason.OtherFocusReason) + self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setFocus( + Qt.FocusReason.OtherFocusReason + ) else: self.changeLists.setCurrentRow(0) self.changeLists.setFocus(Qt.FocusReason.OtherFocusReason) - + def on_buttonBox_clicked(self, button): """ Private slot called by a button of the button box clicked. - + @param button button that was clicked (QAbstractButton) """ - if button == self.buttonBox.button( - QDialogButtonBox.StandardButton.Close - ): + if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close): self.close() - elif button == self.buttonBox.button( - QDialogButtonBox.StandardButton.Cancel - ): + elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel): self.cancelled = True self.__finish()