Add a "health bar" factor B)
parent
63138ccbf4
commit
0ffbb15bc7
|
@ -188,6 +188,8 @@ class FieldsForm(QWidget):
|
|||
font_size: Optional[int] = None,
|
||||
font_color: str = 'default_lightest',
|
||||
|
||||
**vbox_kwargs,
|
||||
|
||||
) -> QtGui.QLabel:
|
||||
|
||||
# add label to left of search bar
|
||||
|
@ -212,7 +214,7 @@ class FieldsForm(QWidget):
|
|||
)
|
||||
label.show()
|
||||
|
||||
self.vbox.addWidget(label)
|
||||
self.vbox.addWidget(label, **vbox_kwargs)
|
||||
self.labels[name] = label
|
||||
|
||||
return label
|
||||
|
@ -360,8 +362,29 @@ async def open_form(
|
|||
values = list(config['default_value'])
|
||||
form.add_select_field(key, values)
|
||||
|
||||
async with open_handlers(
|
||||
|
||||
list(form.fields.values()),
|
||||
event_types={QEvent.KeyPress},
|
||||
|
||||
async_handler=partial(
|
||||
handle_field_input,
|
||||
form=form,
|
||||
),
|
||||
|
||||
# block key repeats?
|
||||
filter_auto_repeats=True,
|
||||
):
|
||||
yield form
|
||||
|
||||
|
||||
def mk_health_bar(
|
||||
form: FieldsForm,
|
||||
|
||||
) -> FieldsForm:
|
||||
|
||||
form.vbox.addSpacing(6)
|
||||
form.add_field_label('fill status')
|
||||
form.add_field_label('fill status', alignment=Qt.AlignCenter)
|
||||
form.vbox.addSpacing(6)
|
||||
|
||||
fill_bar = QProgressBar(form)
|
||||
|
@ -431,18 +454,4 @@ async def open_form(
|
|||
form.vbox.addWidget(fill_bar, alignment=Qt.AlignCenter)
|
||||
|
||||
# form.vbox.addStretch()
|
||||
|
||||
async with open_handlers(
|
||||
|
||||
list(form.fields.values()),
|
||||
event_types={QEvent.KeyPress},
|
||||
|
||||
async_handler=partial(
|
||||
handle_field_input,
|
||||
form=form,
|
||||
),
|
||||
|
||||
# block key repeats?
|
||||
filter_auto_repeats=True,
|
||||
):
|
||||
yield form
|
||||
return form
|
||||
|
|
Loading…
Reference in New Issue