--- a/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Plugins/VcsPlugins/vcsMercurial/HgArchiveDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -21,34 +21,27 @@ """ Class implementing a dialog to enter the archive data. """ + def __init__(self, vcs, parent=None): """ Constructor - + @param vcs reference to the Mercurial object (Hg) @param parent reference to the parent widget (QWidget) """ super().__init__(parent) self.setupUi(self) - - self.archivePicker.setMode( - EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE) - - self.typeComboBox.addItem( - self.tr("Detect Automatically"), "") - self.typeComboBox.addItem( - self.tr("Directory of Files"), "files") - self.typeComboBox.addItem( - self.tr("Uncompressed TAR-Archive"), "tar") - self.typeComboBox.addItem( - self.tr("Bzip2 compressed TAR-Archive"), "tbz2") - self.typeComboBox.addItem( - self.tr("Gzip compressed TAR-Archive"), "tgz") - self.typeComboBox.addItem( - self.tr("Uncompressed ZIP-Archive"), "uzip") - self.typeComboBox.addItem( - self.tr("Compressed ZIP-Archive"), "zip") - + + self.archivePicker.setMode(EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE) + + self.typeComboBox.addItem(self.tr("Detect Automatically"), "") + self.typeComboBox.addItem(self.tr("Directory of Files"), "files") + self.typeComboBox.addItem(self.tr("Uncompressed TAR-Archive"), "tar") + self.typeComboBox.addItem(self.tr("Bzip2 compressed TAR-Archive"), "tbz2") + self.typeComboBox.addItem(self.tr("Gzip compressed TAR-Archive"), "tgz") + self.typeComboBox.addItem(self.tr("Uncompressed ZIP-Archive"), "uzip") + self.typeComboBox.addItem(self.tr("Compressed ZIP-Archive"), "zip") + self.__unixFileFilters = [ self.tr("Bzip2 compressed TAR-Archive (*.tar.bz2)"), self.tr("Gzip compressed TAR-Archive (*.tar.gz)"), @@ -56,17 +49,17 @@ ] self.__windowsFileFilters = [ self.tr("Compressed ZIP-Archive (*.zip)"), - self.tr("Uncompressed ZIP-Archive (*.uzip)") + self.tr("Uncompressed ZIP-Archive (*.uzip)"), ] fileFilters = ( ";;".join(self.__windowsFileFilters + self.__unixFileFilters) - if Utilities.isWindowsPlatform() else - ";;".join(self.__unixFileFilters + self.__windowsFileFilters) + if Utilities.isWindowsPlatform() + else ";;".join(self.__unixFileFilters + self.__windowsFileFilters) ) fileFilters += ";;" + self.tr("All Files (*)") - + self.archivePicker.setFilters(fileFilters) - + self.__typeFilters = { "tar": ["*.tar"], "tbz2": ["*.tar.bz2", "*.tbz2"], @@ -74,34 +67,34 @@ "uzip": ["*.uzip", "*.zip"], "zip": ["*.zip"], } - + self.subReposCheckBox.setEnabled(vcs.hasSubrepositories()) - - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - + + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + self.__projectPath = ( vcs.getPlugin().getProjectHelper().getProject().getProjectPath() ) - + msh = self.minimumSizeHint() self.resize(max(self.width(), msh.width()), msh.height()) - + @pyqtSlot(str) def on_archivePicker_textChanged(self, archive): """ Private slot to handle changes of the archive name. - + @param archive name of the archive (string) """ - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(archive != "") - + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( + archive != "" + ) + @pyqtSlot(int) def on_typeComboBox_activated(self, index): """ Private slot to react on changes of the selected archive type. - + @param index index of the selected type (integer) """ type_ = self.typeComboBox.itemData(index) @@ -109,17 +102,17 @@ self.archivePicker.setMode(EricPathPickerModes.DIRECTORY_MODE) else: self.archivePicker.setMode( - EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE) + EricPathPickerModes.SAVE_FILE_ENSURE_EXTENSION_MODE + ) if type_ in self.__typeFilters: - self.archivePicker.setNameFilters( - self.__typeFilters[type_]) + self.archivePicker.setNameFilters(self.__typeFilters[type_]) else: self.archivePicker.setNameFilters([]) - + def getData(self): """ Public method to retrieve the data. - + @return tuple giving the archive name (string), the archive type (string), the directory prefix 8string) and a flag indicating to recurse into subrepositories (boolean)