16 from PyQt4.QtCore import Qt, QProcess |
16 from PyQt4.QtCore import Qt, QProcess |
17 from PyQt4.QtGui import QDialog, QListWidgetItem |
17 from PyQt4.QtGui import QDialog, QListWidgetItem |
18 |
18 |
19 from E5Gui import E5MessageBox |
19 from E5Gui import E5MessageBox |
20 |
20 |
21 from .Ui_DistributionTypeSelectionDialog import Ui_DistributionTypeSelectionDialog |
21 from .Ui_DistributionTypeSelectionDialog import \ |
|
22 Ui_DistributionTypeSelectionDialog |
22 |
23 |
23 import Preferences |
24 import Preferences |
24 |
25 |
25 |
26 |
26 class DistributionTypeSelectionDialog(QDialog, Ui_DistributionTypeSelectionDialog): |
27 class DistributionTypeSelectionDialog( |
|
28 QDialog, Ui_DistributionTypeSelectionDialog): |
27 """ |
29 """ |
28 Class implementing a dialog to select the distribution file formats. |
30 Class implementing a dialog to select the distribution file formats. |
29 """ |
31 """ |
30 def __init__(self, project, projectPath, parent=None): |
32 def __init__(self, project, projectPath, parent=None): |
31 """ |
33 """ |
32 Constructor |
34 Constructor |
33 |
35 |
34 @param project reference to the project object (ProjectPyramid.Project.Project) |
36 @param project reference to the project object |
|
37 (ProjectPyramid.Project.Project) |
35 @param projectPath path of the Pyramid project (string) |
38 @param projectPath path of the Pyramid project (string) |
36 @param parent reference to the parent widget (QWidget) |
39 @param parent reference to the parent widget (QWidget) |
37 """ |
40 """ |
38 super(DistributionTypeSelectionDialog, self).__init__(parent) |
41 super(DistributionTypeSelectionDialog, self).__init__(parent) |
39 self.setupUi(self) |
42 self.setupUi(self) |
56 Preferences.getSystem("IOEncoding"), |
59 Preferences.getSystem("IOEncoding"), |
57 'replace') |
60 'replace') |
58 else: |
61 else: |
59 if not finished: |
62 if not finished: |
60 errMsg = self.trUtf8( |
63 errMsg = self.trUtf8( |
61 "The python setup.py command did not finish within 30s.") |
64 "The python setup.py command did not finish within" |
|
65 " 30s.") |
62 else: |
66 else: |
63 errMsg = self.trUtf8("Could not start the pcreate executable.") |
67 errMsg = self.trUtf8("Could not start the pcreate executable.") |
64 if not errMsg: |
68 if not errMsg: |
65 for line in output.splitlines(): |
69 for line in output.splitlines(): |
66 line = line.strip() |
70 line = line.strip() |
67 if line.startswith("--formats="): |
71 if line.startswith("--formats="): |
68 format, description = line.replace("--formats=", "").split(None, 1) |
72 format, description = line.replace("--formats=", "")\ |
69 itm = QListWidgetItem("{0} ({1})".format(format, description), |
73 .split(None, 1) |
70 self.formatsList) |
74 itm = QListWidgetItem( |
|
75 "{0} ({1})".format(format, description), |
|
76 self.formatsList) |
71 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
77 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
72 itm.setCheckState(Qt.Unchecked) |
78 itm.setCheckState(Qt.Unchecked) |
73 else: |
79 else: |
74 E5MessageBox.critical(None, |
80 E5MessageBox.critical( |
|
81 None, |
75 self.trUtf8('Process Generation Error'), |
82 self.trUtf8('Process Generation Error'), |
76 errMsg) |
83 errMsg) |
77 |
84 |
78 def getFormats(self): |
85 def getFormats(self): |
79 """ |
86 """ |