4 # |
4 # |
5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog for entering the create parameters. |
7 Module implementing a dialog for entering the create parameters. |
8 """ |
8 """ |
9 |
|
10 from __future__ import unicode_literals |
|
11 try: |
|
12 str = unicode |
|
13 except NameError: |
|
14 pass |
|
15 |
9 |
16 from PyQt5.QtCore import pyqtSlot, QProcess |
10 from PyQt5.QtCore import pyqtSlot, QProcess |
17 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
11 from PyQt5.QtWidgets import QDialog, QDialogButtonBox |
18 |
12 |
19 from E5Gui import E5MessageBox |
13 from E5Gui import E5MessageBox |
48 proc.start(args[0], args[1:]) |
42 proc.start(args[0], args[1:]) |
49 procStarted = proc.waitForStarted() |
43 procStarted = proc.waitForStarted() |
50 if procStarted: |
44 if procStarted: |
51 finished = proc.waitForFinished(30000) |
45 finished = proc.waitForFinished(30000) |
52 if finished and proc.exitCode() == 0: |
46 if finished and proc.exitCode() == 0: |
53 output = \ |
47 output = str(proc.readAllStandardOutput(), |
54 str(proc.readAllStandardOutput(), |
48 Preferences.getSystem("IOEncoding"), |
55 Preferences.getSystem("IOEncoding"), |
49 'replace') |
56 'replace') |
|
57 else: |
50 else: |
58 if not finished: |
51 if not finished: |
59 errMsg = self.tr( |
52 errMsg = self.tr( |
60 "The pcreate command did not finish within 30s.") |
53 "The pcreate command did not finish within 30s.") |
61 else: |
54 else: |
112 @type str |
105 @type str |
113 @return prepared scaffold text |
106 @return prepared scaffold text |
114 @rtype str |
107 @rtype str |
115 """ |
108 """ |
116 parts = [part.strip() for part in line.split(":", 1)] |
109 parts = [part.strip() for part in line.split(":", 1)] |
117 return self.tr("{0} ({1})", "scaffold name, explanatory text")\ |
110 return self.tr( |
118 .format(*parts) |
111 "{0} ({1})", "scaffold name, explanatory text").format(*parts) |
119 |
112 |
120 def getData(self): |
113 def getData(self): |
121 """ |
114 """ |
122 Public method to get the data. |
115 Public method to get the data. |
123 |
116 |