ProjectPyramid/DistributionTypeSelectionDialog.py

branch
eric7
changeset 147
eb28b4b6f7f5
parent 144
5c3684ee818e
child 148
dcbd3a96f03c
equal deleted inserted replaced
146:7d955b1995d5 147:eb28b4b6f7f5
5 5
6 """ 6 """
7 Module implementing a dialog to select the distribution file formats. 7 Module implementing a dialog to select the distribution file formats.
8 """ 8 """
9 9
10 from PyQt5.QtCore import Qt, QProcess 10 from PyQt6.QtCore import Qt, QProcess
11 from PyQt5.QtWidgets import QDialog, QListWidgetItem 11 from PyQt6.QtWidgets import QDialog, QListWidgetItem
12 12
13 from E5Gui import E5MessageBox 13 from EricWidgets import EricMessageBox
14 14
15 from .Ui_DistributionTypeSelectionDialog import ( 15 from .Ui_DistributionTypeSelectionDialog import (
16 Ui_DistributionTypeSelectionDialog 16 Ui_DistributionTypeSelectionDialog
17 ) 17 )
18 18
27 def __init__(self, project, projectPath, parent=None): 27 def __init__(self, project, projectPath, parent=None):
28 """ 28 """
29 Constructor 29 Constructor
30 30
31 @param project reference to the project object 31 @param project reference to the project object
32 (ProjectPyramid.Project.Project) 32 @type Project
33 @param projectPath path of the Pyramid project (string) 33 @param projectPath path of the Pyramid project
34 @param parent reference to the parent widget (QWidget) 34 @type str
35 @param parent reference to the parent widget
36 @type QWidget
35 """ 37 """
36 super().__init__(parent) 38 super().__init__(parent)
37 self.setupUi(self) 39 self.setupUi(self)
38 40
39 errMsg = "" 41 errMsg = ""
66 fileFormat, description = ( 68 fileFormat, description = (
67 line.replace("--formats=", "").split(None, 1)) 69 line.replace("--formats=", "").split(None, 1))
68 itm = QListWidgetItem( 70 itm = QListWidgetItem(
69 "{0} ({1})".format(fileFormat, description), 71 "{0} ({1})".format(fileFormat, description),
70 self.formatsList) 72 self.formatsList)
71 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) 73 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable)
72 itm.setCheckState(Qt.Unchecked) 74 itm.setCheckState(Qt.CheckState.Unchecked)
73 else: 75 else:
74 E5MessageBox.critical( 76 EricMessageBox.critical(
75 None, 77 None,
76 self.tr('Process Generation Error'), 78 self.tr('Process Generation Error'),
77 errMsg) 79 errMsg)
78 80
79 def getFormats(self): 81 def getFormats(self):
80 """ 82 """
81 Public method to retrieve the checked formats. 83 Public method to retrieve the checked formats.
82 84
83 @return list of selected formats (list of string) 85 @return list of selected formats
86 @rtype list of str
84 """ 87 """
85 formats = [] 88 formats = []
86 for row in range(self.formatsList.count()): 89 for row in range(self.formatsList.count()):
87 itm = self.formatsList.item(row) 90 itm = self.formatsList.item(row)
88 if itm.checkState() == Qt.Checked: 91 if itm.checkState() == Qt.CheckState.Checked:
89 fileFormat = itm.text().split(None, 1)[0].strip() 92 fileFormat = itm.text().split(None, 1)[0].strip()
90 if fileFormat: 93 if fileFormat:
91 formats.append(fileFormat) 94 formats.append(fileFormat)
92 95
93 return formats 96 return formats

eric ide

mercurial