ProjectPyramid/DistributionTypeSelectionDialog.py

changeset 138
72ebb74aa42d
parent 132
c0d53fb9a0e0
child 143
4ef44e854b39
equal deleted inserted replaced
137:be24be92ed0f 138:72ebb74aa42d
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 __future__ import unicode_literals
11 try:
12 str = unicode
13 except NameError:
14 pass
15
16 from PyQt5.QtCore import Qt, QProcess 10 from PyQt5.QtCore import Qt, QProcess
17 from PyQt5.QtWidgets import QDialog, QListWidgetItem 11 from PyQt5.QtWidgets import QDialog, QListWidgetItem
18 12
19 from E5Gui import E5MessageBox 13 from E5Gui import E5MessageBox
20 14
21 from .Ui_DistributionTypeSelectionDialog import \ 15 from .Ui_DistributionTypeSelectionDialog import (
22 Ui_DistributionTypeSelectionDialog 16 Ui_DistributionTypeSelectionDialog
17 )
23 18
24 import Preferences 19 import Preferences
25 20
26 21
27 class DistributionTypeSelectionDialog( 22 class DistributionTypeSelectionDialog(
52 proc.start(cmd, args) 47 proc.start(cmd, args)
53 procStarted = proc.waitForStarted() 48 procStarted = proc.waitForStarted()
54 if procStarted: 49 if procStarted:
55 finished = proc.waitForFinished(30000) 50 finished = proc.waitForFinished(30000)
56 if finished and proc.exitCode() == 0: 51 if finished and proc.exitCode() == 0:
57 output = \ 52 output = str(proc.readAllStandardOutput(),
58 str(proc.readAllStandardOutput(), 53 Preferences.getSystem("IOEncoding"),
59 Preferences.getSystem("IOEncoding"), 54 'replace')
60 'replace')
61 else: 55 else:
62 if not finished: 56 if not finished:
63 errMsg = self.tr( 57 errMsg = self.tr(
64 "The python setup.py command did not finish within" 58 "The python setup.py command did not finish within"
65 " 30s.") 59 " 30s.")
67 errMsg = self.tr("Could not start the python executable.") 61 errMsg = self.tr("Could not start the python executable.")
68 if not errMsg: 62 if not errMsg:
69 for line in output.splitlines(): 63 for line in output.splitlines():
70 line = line.strip() 64 line = line.strip()
71 if line.startswith("--formats="): 65 if line.startswith("--formats="):
72 fileFormat, description = line.replace("--formats=", "")\ 66 fileFormat, description = (
73 .split(None, 1) 67 line.replace("--formats=", "").split(None, 1))
74 itm = QListWidgetItem( 68 itm = QListWidgetItem(
75 "{0} ({1})".format(fileFormat, description), 69 "{0} ({1})".format(fileFormat, description),
76 self.formatsList) 70 self.formatsList)
77 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) 71 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable)
78 itm.setCheckState(Qt.Unchecked) 72 itm.setCheckState(Qt.Unchecked)

eric ide

mercurial