mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 00:04:15 +02:00
[ui] fix -> random C++ wrapper errors with some forms due to missing references
This commit is contained in:
@@ -42,6 +42,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
- history: the top commit is returned as "(null)"
|
- history: the top commit is returned as "(null)"
|
||||||
- UI
|
- UI
|
||||||
- crashing when nothing can be upgraded
|
- crashing when nothing can be upgraded
|
||||||
|
- random C++ wrapper errors with some forms due to missing references
|
||||||
|
|
||||||
|
|
||||||
## [0.9.6] 2020-06-26
|
## [0.9.6] 2020-06-26
|
||||||
|
|||||||
@@ -696,35 +696,46 @@ class FormQt(QGroupBox):
|
|||||||
if model.spaces:
|
if model.spaces:
|
||||||
self.layout().addRow(QLabel(), QLabel())
|
self.layout().addRow(QLabel(), QLabel())
|
||||||
|
|
||||||
for c in model.components:
|
for idx, c in enumerate(model.components):
|
||||||
if isinstance(c, TextInputComponent):
|
if isinstance(c, TextInputComponent):
|
||||||
label, field = self._new_text_input(c)
|
label, field = self._new_text_input(c)
|
||||||
self.layout().addRow(label, field)
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, SingleSelectComponent):
|
elif isinstance(c, SingleSelectComponent):
|
||||||
label = self._new_label(c)
|
label = self._new_label(c)
|
||||||
field = FormComboBoxQt(c) if c.type == SelectViewType.COMBO else FormRadioSelectQt(c)
|
form = FormComboBoxQt(c) if c.type == SelectViewType.COMBO else FormRadioSelectQt(c)
|
||||||
self.layout().addRow(label, self._wrap(field, c))
|
field = self._wrap(form, c)
|
||||||
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, RangeInputComponent):
|
elif isinstance(c, RangeInputComponent):
|
||||||
label = self._new_label(c)
|
label = self._new_label(c)
|
||||||
self.layout().addRow(label, self._wrap(self._new_range_input(c), c))
|
field = self._wrap(self._new_range_input(c), c)
|
||||||
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, FileChooserComponent):
|
elif isinstance(c, FileChooserComponent):
|
||||||
label, field = self._new_file_chooser(c)
|
label, field = self._new_file_chooser(c)
|
||||||
self.layout().addRow(label, field)
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, FormComponent):
|
elif isinstance(c, FormComponent):
|
||||||
self.layout().addRow(FormQt(c, self.i18n))
|
label, field = None, FormQt(c, self.i18n)
|
||||||
|
self.layout().addRow(field)
|
||||||
elif isinstance(c, TwoStateButtonComponent):
|
elif isinstance(c, TwoStateButtonComponent):
|
||||||
label = self._new_label(c)
|
label, field = self._new_label(c), TwoStateButtonQt(c)
|
||||||
self.layout().addRow(label, TwoStateButtonQt(c))
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, MultipleSelectComponent):
|
elif isinstance(c, MultipleSelectComponent):
|
||||||
label = self._new_label(c)
|
label, field = self._new_label(c), FormMultipleSelectQt(c)
|
||||||
self.layout().addRow(label, FormMultipleSelectQt(c))
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, TextComponent):
|
elif isinstance(c, TextComponent):
|
||||||
self.layout().addRow(self._new_label(c), QWidget())
|
label, field = self._new_label(c), QWidget()
|
||||||
|
self.layout().addRow(label, field)
|
||||||
elif isinstance(c, RangeInputComponent):
|
elif isinstance(c, RangeInputComponent):
|
||||||
self.layout()
|
label, field = self._new_label(c), self._new_range_input(c)
|
||||||
|
self.layout().addRow(label, field)
|
||||||
else:
|
else:
|
||||||
raise Exception('Unsupported component type {}'.format(c.__class__.__name__))
|
raise Exception('Unsupported component type {}'.format(c.__class__.__name__))
|
||||||
|
|
||||||
|
if label: # to prevent C++ wrap errors
|
||||||
|
setattr(self, 'label_{}'.format(idx), label)
|
||||||
|
|
||||||
|
if field: # to prevent C++ wrap errors
|
||||||
|
setattr(self, 'field_{}'.format(idx), field)
|
||||||
|
|
||||||
if model.spaces:
|
if model.spaces:
|
||||||
self.layout().addRow(QLabel(), QLabel())
|
self.layout().addRow(QLabel(), QLabel())
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user