--- a/src/eric7/Plugins/VcsPlugins/vcsGit/GitCopyDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsGit/GitCopyDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -26,42 +26,42 @@ Class implementing a dialog to enter the data for a copy or rename operation. """ + def __init__(self, source, parent=None, move=False): """ Constructor - + @param source name of the source file/directory (string) @param parent parent widget (QWidget) @param move flag indicating a move operation (boolean) """ super().__init__(parent) self.setupUi(self) - + self.dirButton.setIcon(UI.PixmapCache.getIcon("open")) - + self.source = source if os.path.isdir(self.source): self.targetCompleter = EricDirCompleter(self.targetEdit) else: self.targetCompleter = EricFileCompleter(self.targetEdit) - + if move: - self.setWindowTitle(self.tr('Git Move')) + self.setWindowTitle(self.tr("Git Move")) else: self.forceCheckBox.setEnabled(False) - + self.sourceEdit.setText(source) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + def getData(self): """ Public method to retrieve the copy data. - + @return the target name (string) and a flag indicating the operation should be enforced (boolean) """ @@ -69,11 +69,8 @@ if not os.path.isabs(target): sourceDir = os.path.dirname(self.sourceEdit.text()) target = os.path.join(sourceDir, target) - return ( - Utilities.toNativeSeparators(target), - self.forceCheckBox.isChecked() - ) - + return (Utilities.toNativeSeparators(target), self.forceCheckBox.isChecked()) + @pyqtSlot() def on_dirButton_clicked(self): """ @@ -85,25 +82,28 @@ self, self.tr("Select target"), self.targetEdit.text(), - EricFileDialog.ShowDirsOnly) - if os.path.isdir(self.source) else - EricFileDialog.getSaveFileName( + EricFileDialog.ShowDirsOnly, + ) + if os.path.isdir(self.source) + else EricFileDialog.getSaveFileName( self, self.tr("Select target"), self.targetEdit.text(), "", - EricFileDialog.DontConfirmOverwrite) + EricFileDialog.DontConfirmOverwrite, + ) ) - + if target: self.targetEdit.setText(Utilities.toNativeSeparators(target)) - + @pyqtSlot(str) def on_targetEdit_textChanged(self, txt): """ Private slot to handle changes of the target. - + @param txt contents of the target edit (string) """ self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( - os.path.isabs(txt) or os.path.dirname(txt) == "") + os.path.isabs(txt) or os.path.dirname(txt) == "" + )