Exemplo n.º 1
0
class Complication:
    """
    The configuration of a Watch Complication, which is a set of different layouts.

    Use the `widgets <widgets.html>`_ APIs to build a complication UI.
    """

    rectangular: wd.WidgetLayout = wd.WidgetLayout()
    """
    A :class:`~widgets.WidgetLayout` object which UI's will be used for rectangular complications.
    """

    circular: wd.WidgetLayout = wd.WidgetLayout()
    """
    A :class:`~widgets.WidgetLayout` object which UI's will be used for circular complications.
    """

    circular_extra_large: wd.WidgetLayout = wd.WidgetLayout()
    """
    A :class:`~widgets.WidgetLayout` object which UI's will be used for extra large circular complications.
    """
    def __init__(self):
        self.rectangular = wd.WidgetLayout()
        self.circular = wd.WidgetLayout()
        self.circular_extra_large = wd.WidgetLayout()

    def add_row(
        self,
        row: List[wd.WidgetComponent],
        background_color: wd.Color = None,
        corner_radius: float = 0,
        link: str = None,
    ):

        for component in row:
            if "color" not in dir(component):
                continue

            if component.color.__py_color__ == wd.COLOR_LABEL.__py_color__.managed:
                component.color = wd.COLOR_WHITE

        for layout in [
                self.rectangular, self.circular, self.circular_extra_large
        ]:
            layout.add_row(row, background_color, corner_radius, link)
Exemplo n.º 2
0
def make_interface() -> wd.WidgetLayout:
    """
    Creates and returns a :class:`~widget.WidgetLayout` instance.
    When the script finishes running, the content of the returned object will be passed and displayed in the Apple Watch.
    This function must be called from the script configured in the Apple Watch.

    :rtype: wd.WidgetLayout
    """

    global __cached_ui__

    view = wd.WidgetLayout()
    __cached_ui__ = view.__widget_view__
    return view
Exemplo n.º 3
0
 def __init__(self):
     self.rectangular = wd.WidgetLayout()
     self.circular = wd.WidgetLayout()
     self.circular_extra_large = wd.WidgetLayout()