Fix reinitializing of key label

This commit is contained in:
Florian Bruhin 2016-10-04 11:24:20 +02:00
parent 7d38430d2d
commit 051b31d101

View File

@ -343,6 +343,7 @@ class _BasePrompt(QWidget):
self._vbox = QVBoxLayout(self)
self._vbox.setSpacing(15)
self._key_grid = None
self._key_grid_item = None
def __repr__(self):
return utils.get_repr(self, question=self.question, constructor=True)
@ -358,8 +359,7 @@ class _BasePrompt(QWidget):
def _init_key_label(self):
# Remove old grid
if self._key_grid is not None:
self._key_grid.hide()
self._vbox.removeWidget(self._key_grid)
self._vbox.removeItem(self._key_grid_item)
self._key_grid = QGridLayout()
self._key_grid.setVerticalSpacing(0)
@ -387,6 +387,7 @@ class _BasePrompt(QWidget):
self._key_grid.addWidget(text_label, i, 1)
self._vbox.addLayout(self._key_grid)
self._key_grid_item = self._vbox.itemAt(self._vbox.count() - 1)
def accept(self, value=None):
raise NotImplementedError