diff -r e9e7eca7efee -r bf71ee032bb4 src/eric7/Project/TranslationPropertiesDialog.py --- a/src/eric7/Project/TranslationPropertiesDialog.py Wed Jul 13 11:16:20 2022 +0200 +++ b/src/eric7/Project/TranslationPropertiesDialog.py Wed Jul 13 14:55:47 2022 +0200 @@ -25,31 +25,32 @@ """ Class implementing the Translations Properties dialog. """ + def __init__(self, project, new, parent): """ Constructor - + @param project reference to the project object @param new flag indicating the generation of a new project @param parent parent widget of this dialog (QWidget) """ super().__init__(parent) self.setupUi(self) - + self.transPatternPicker.setMode(EricPathPickerModes.SAVE_FILE_MODE) self.transPatternPicker.setDefaultDirectory(project.ppath) self.transBinPathPicker.setMode(EricPathPickerModes.DIRECTORY_MODE) self.transBinPathPicker.setDefaultDirectory(project.ppath) - + self.project = project self.parent = parent - + self.exceptionCompleter = EricFileCompleter(self.exceptionEdit) - + self.initFilters() if not new: self.initDialog() - + def initFilters(self): """ Public method to initialize the filters. @@ -61,57 +62,57 @@ for pattern, filetype in list(self.project.pdata["FILETYPES"].items()): if filetype in patterns: patterns[filetype].append(pattern) - self.filters = self.tr("Source Files ({0});;" - ).format(" ".join(patterns["SOURCES"])) - self.filters += self.tr("Forms Files ({0});;" - ).format(" ".join(patterns["FORMS"])) + self.filters = self.tr("Source Files ({0});;").format( + " ".join(patterns["SOURCES"]) + ) + self.filters += self.tr("Forms Files ({0});;").format( + " ".join(patterns["FORMS"]) + ) self.filters += self.tr("All Files (*)") - + def initDialog(self): """ Public method to initialize the dialogs data. """ - self.buttonBox.button( - QDialogButtonBox.StandardButton.Ok).setEnabled(False) - self.transPatternPicker.setText( - self.project.pdata["TRANSLATIONPATTERN"]) - self.transBinPathPicker.setText( - self.project.pdata["TRANSLATIONSBINPATH"]) + self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False) + self.transPatternPicker.setText(self.project.pdata["TRANSLATIONPATTERN"]) + self.transBinPathPicker.setText(self.project.pdata["TRANSLATIONSBINPATH"]) self.exceptionsList.clear() for texcept in self.project.pdata["TRANSLATIONEXCEPTIONS"]: if texcept: self.exceptionsList.addItem(texcept) - + @pyqtSlot(str) def on_transPatternPicker_pathSelected(self, path): """ Private slot handling the selection of a translation path. - + @param path selected path @type str """ self.transPatternPicker.setText(self.project.getRelativePath(path)) - + @pyqtSlot(str) def on_transPatternPicker_textChanged(self, txt): """ Private slot to check the translation pattern for correctness. - + @param txt text of the transPatternPicker line edit (string) """ self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( - "%language%" in txt) - + "%language%" in txt + ) + @pyqtSlot(str) def on_transBinPathPicker_pathSelected(self, path): """ Private slot handling the selection of a binary translations path. - + @param path selected path @type str """ self.transBinPathPicker.setText(self.project.getRelativePath(path)) - + @pyqtSlot() def on_deleteExceptionButton_clicked(self): """ @@ -122,7 +123,7 @@ del itm row = self.exceptionsList.currentRow() self.on_exceptionsList_currentRowChanged(row) - + @pyqtSlot() def on_addExceptionButton_clicked(self): """ @@ -131,8 +132,8 @@ texcept = self.exceptionEdit.text() texcept = ( texcept.replace(self.parent.getPPath() + os.sep, "") - if self.project.ppath == '' else - self.project.getRelativePath(texcept) + if self.project.ppath == "" + else self.project.getRelativePath(texcept) ) if texcept.endswith(os.sep): texcept = texcept[:-1] @@ -141,7 +142,7 @@ self.exceptionEdit.clear() row = self.exceptionsList.currentRow() self.on_exceptionsList_currentRowChanged(row) - + @pyqtSlot() def on_exceptFileButton_clicked(self): """ @@ -151,10 +152,11 @@ self, self.tr("Exempt file from translation"), self.project.ppath, - self.filters) + self.filters, + ) if texcept: self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept)) - + @pyqtSlot() def on_exceptDirButton_clicked(self): """ @@ -164,30 +166,31 @@ self, self.tr("Exempt directory from translation"), self.project.ppath, - EricFileDialog.ShowDirsOnly) + EricFileDialog.ShowDirsOnly, + ) if texcept: self.exceptionEdit.setText(Utilities.toNativeSeparators(texcept)) - + def on_exceptionsList_currentRowChanged(self, row): """ Private slot to handle the currentRowChanged signal of the exceptions list. - + @param row the current row (integer) """ if row == -1: self.deleteExceptionButton.setEnabled(False) else: self.deleteExceptionButton.setEnabled(True) - + def on_exceptionEdit_textChanged(self, txt): """ Private slot to handle the textChanged signal of the exception edit. - + @param txt the text of the exception edit (string) """ self.addExceptionButton.setEnabled(txt != "") - + def storeData(self): """ Public method to store the entered/modified data.