浏览代码

update card and separator

Falko Schindler 2 年之前
父节点
当前提交
f17455a0ed
共有 5 个文件被更改,包括 39 次插入35 次删除
  1. 24 0
      nicegui/elements/card.py
  2. 0 21
      nicegui/elements/old/card.py
  3. 0 14
      nicegui/elements/old/menu_separator.py
  4. 11 0
      nicegui/elements/separator.py
  5. 4 0
      nicegui/ui.py

+ 24 - 0
nicegui/elements/card.py

@@ -0,0 +1,24 @@
+from ..element import Element
+
+
+class Card(Element):
+
+    def __init__(self) -> None:
+        """Card
+
+        Provides a container with a dropped shadow.
+        """
+        super().__init__('q-card')
+        self.classes('column items-start q-pa-md gap-4')
+
+
+class CardSection(Element):
+
+    def __init__(self) -> None:
+        super().__init__('q-card-section')
+
+
+class CardActions(Element):
+
+    def __init__(self) -> None:
+        super().__init__('q-card-actions')

+ 0 - 21
nicegui/elements/old/card.py

@@ -1,21 +0,0 @@
-import justpy as jp
-
-from .group import Group
-
-
-class Card(Group):
-
-    def __init__(self):
-        """Card
-
-        Provides a container with a dropped shadow.
-        """
-        view = jp.QCard(classes='column items-start q-pa-md gap-4', delete_flag=False, temp=False)
-        super().__init__(view)
-
-
-class CardSection(Group):
-
-    def __init__(self):
-        view = jp.QCardSection(delete_flag=False, temp=False)
-        super().__init__(view)

+ 0 - 14
nicegui/elements/old/menu_separator.py

@@ -1,14 +0,0 @@
-import justpy as jp
-
-from .element import Element
-
-
-class MenuSeparator(Element):
-
-    def __init__(self):
-        """Menu Item Separator
-
-        A separator for menus.
-        """
-        view = jp.QSeparator(temp=False)
-        super().__init__(view)

+ 11 - 0
nicegui/elements/separator.py

@@ -0,0 +1,11 @@
+from ..element import Element
+
+
+class Separator(Element):
+
+    def __init__(self) -> None:
+        """Separator
+
+        A separator for cards, menus and other component containers.
+        """
+        super().__init__('q-separator')

+ 4 - 0
nicegui/ui.py

@@ -1,7 +1,11 @@
 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 CardActions as card_actions
+from .elements.card import CardSection as card_section
 from .elements.column import Column as column
 from .elements.column import Column as column
 from .elements.label import Label as label
 from .elements.label import Label as label
 from .elements.row import Row as row
 from .elements.row import Row as row
+from .elements.separator import Separator as separator
 from .notify import notify
 from .notify import notify
 from .page import page
 from .page import page
 from .run import run
 from .run import run