|
@@ -1,11 +1,8 @@
|
|
|
-import justpy as jp
|
|
|
-
|
|
|
-from ..binding import BindableProperty, BindTextMixin
|
|
|
-from .element import Element
|
|
|
+from ..binding import BindTextMixin
|
|
|
+from ..element import Element
|
|
|
|
|
|
|
|
|
class Badge(Element, BindTextMixin):
|
|
|
- text = BindableProperty()
|
|
|
|
|
|
def __init__(self, text: str = '', *,
|
|
|
color: str = 'blue', text_color: str = 'white', outline: bool = False) -> None:
|
|
@@ -19,11 +16,8 @@ class Badge(Element, BindTextMixin):
|
|
|
:param text_color: overrides text color (if needed); color name from the Quasar Color Palette (default: "white")
|
|
|
:param outline: use 'outline' design (colored text and borders only) (default: False)
|
|
|
"""
|
|
|
- view = jp.QBadge(label=text, color=color, text_color=text_color, outline=outline, temp=True)
|
|
|
- super().__init__(view)
|
|
|
-
|
|
|
- self.text = text
|
|
|
- self.bind_text_to(self.view, 'label')
|
|
|
-
|
|
|
- def set_text(self, text: str) -> None:
|
|
|
+ super().__init__('q-badge')
|
|
|
self.text = text
|
|
|
+ self._props['color'] = color
|
|
|
+ self._props['text_color'] = text_color
|
|
|
+ self._props['outline'] = outline
|