Falko Schindler 2 anni fa
parent
commit
0831a42103
2 ha cambiato i file con 7 aggiunte e 12 eliminazioni
  1. 6 12
      nicegui/elements/badge.py
  2. 1 0
      nicegui/ui.py

+ 6 - 12
nicegui/elements/old/badge.py → nicegui/elements/badge.py

@@ -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):
 class Badge(Element, BindTextMixin):
-    text = BindableProperty()
 
 
     def __init__(self, text: str = '', *,
     def __init__(self, text: str = '', *,
                  color: str = 'blue', text_color: str = 'white', outline: bool = False) -> None:
                  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 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)
         :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.text = text
+        self._props['color'] = color
+        self._props['text_color'] = text_color
+        self._props['outline'] = outline

+ 1 - 0
nicegui/ui.py

@@ -1,3 +1,4 @@
+from .elements.badge import Badge as badge
 from .elements.button import Button as button
 from .elements.button import Button as button
 from .elements.card import Card as card
 from .elements.card import Card as card
 from .elements.card import CardActions as card_actions
 from .elements.card import CardActions as card_actions