diff -r 24582cac737e -r d4e7f5a389e6 ProjectPyramid/DistributionTypeSelectionDialog.py --- a/ProjectPyramid/DistributionTypeSelectionDialog.py Thu Dec 30 12:17:44 2021 +0100 +++ b/ProjectPyramid/DistributionTypeSelectionDialog.py Wed Sep 21 16:24:54 2022 +0200 @@ -12,22 +12,20 @@ from EricWidgets import EricMessageBox -from .Ui_DistributionTypeSelectionDialog import ( - Ui_DistributionTypeSelectionDialog -) +from .Ui_DistributionTypeSelectionDialog import Ui_DistributionTypeSelectionDialog import Preferences -class DistributionTypeSelectionDialog( - QDialog, Ui_DistributionTypeSelectionDialog): +class DistributionTypeSelectionDialog(QDialog, Ui_DistributionTypeSelectionDialog): """ Class implementing a dialog to select the distribution file formats. """ + def __init__(self, project, projectPath, parent=None): """ Constructor - + @param project reference to the project object @type Project @param projectPath path of the Pyramid project @@ -37,12 +35,11 @@ """ super().__init__(parent) self.setupUi(self) - + errMsg = "" proc = QProcess() cmd = project.getPyramidCommand( - "python", - virtualEnv=project.getProjectVirtualEnvironment() + "python", virtualEnv=project.getProjectVirtualEnvironment() ) args = [] args.append("setup.py") @@ -54,37 +51,37 @@ if procStarted: finished = proc.waitForFinished(30000) if finished and proc.exitCode() == 0: - output = str(proc.readAllStandardOutput(), - Preferences.getSystem("IOEncoding"), - 'replace') + output = str( + proc.readAllStandardOutput(), + Preferences.getSystem("IOEncoding"), + "replace", + ) else: if not finished: errMsg = self.tr( - "The python setup.py command did not finish within" - " 30s.") + "The python setup.py command did not finish within" " 30s." + ) else: errMsg = self.tr("Could not start the python executable.") if not errMsg: for line in output.splitlines(): line = line.strip() if line.startswith("--formats="): - fileFormat, description = ( - line.replace("--formats=", "").split(None, 1)) + fileFormat, description = line.replace("--formats=", "").split( + None, 1 + ) itm = QListWidgetItem( - "{0} ({1})".format(fileFormat, description), - self.formatsList) + "{0} ({1})".format(fileFormat, description), self.formatsList + ) itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) itm.setCheckState(Qt.CheckState.Unchecked) else: - EricMessageBox.critical( - None, - self.tr('Process Generation Error'), - errMsg) - + EricMessageBox.critical(None, self.tr("Process Generation Error"), errMsg) + def getFormats(self): """ Public method to retrieve the checked formats. - + @return list of selected formats @rtype list of str """ @@ -95,5 +92,5 @@ fileFormat = itm.text().split(None, 1)[0].strip() if fileFormat: formats.append(fileFormat) - + return formats