Fix new project info not showing after error
offlate/ui/new.py
25 | 25 | ||
26 | 26 | from ..core.config import * | |
27 | 27 | from ..systems.list import * | |
28 | - | from .multiplelineedit import MultipleLineEdit | |
29 | 28 | ||
30 | 29 | class PredefinedProjectWidget(QWidget): | |
31 | 30 | currentItemChanged = pyqtSignal() | |
… | |||
116 | 115 | ||
117 | 116 | self.setLayout(contentbox) | |
118 | 117 | ||
119 | - | self.othersystem() | |
118 | + | self.othersystem(init = True) | |
120 | 119 | ||
121 | 120 | def fill(self, data): | |
122 | 121 | self.nameWidget.setText(data['name']) | |
… | |||
160 | 159 | if spec.placeholder is not None and spec.placeholder != '': | |
161 | 160 | widget.setPlaceholderText(spec.placeholder) | |
162 | 161 | label = QLabel(spec.name) | |
163 | - | fields.append({'label': label, 'widget': widget}) | |
162 | + | fields.append({'label': label, 'widget': widget, 'key': spec.key}) | |
164 | 163 | else: | |
165 | 164 | raise Exception("Unknown spec type: " + spec) | |
166 | 165 | self.additionalFields.append(fields) | |
… | |||
184 | 183 | i = i + 1 | |
185 | 184 | return ans | |
186 | 185 | ||
187 | - | def othersystem(self): | |
186 | + | def othersystem(self, init = False): | |
188 | 187 | for system in self.additionalFields: | |
189 | 188 | for widget in system: | |
190 | 189 | self.formLayout.takeRow(widget['widget']) | |
… | |||
201 | 200 | for widget in self.followupWidgets: | |
202 | 201 | self.setTabOrder(oldwidget, widget) | |
203 | 202 | oldwidget = widget | |
203 | + | if init and self.info is not None: | |
204 | + | for widget in self.additionalFields[self.combo.currentIndex()]: | |
205 | + | widget['widget'].setText(self.info[widget['key']]) | |
204 | 206 | self.modify() | |
205 | 207 | ||
206 | 208 | def modify(self): |