WolfgangFahl / nicegui_widgets

nicegui widgets
http://ngdemo.bitplan.com
Apache License 2.0
14 stars 2 forks source link

add setup_content_div #37

Closed WolfgangFahl closed 7 months ago

WolfgangFahl commented 7 months ago
 async def setup_content_div(self, setup_content: Optional[Callable] = None) -> None:
        """
        Sets up the content frame of the web server's user interface. This includes setting up the menu, 
        the main content as specified by the 'setup_content' callable (if provided), and the footer.

        The method orchestrates the layout and initialization of these UI components.

        Args:
            setup_content (Optional[Callable]): A callable that is responsible for setting up the main 
                                                 content of the web server's UI. This could be a function 
                                                 that adds widgets or other UI elements to the content area. 
                                                 If None, no additional content setup is performed.
                                                 Default is None.

        Returns:
            None: This method does not return anything.

        Note:
            This method is asynchronous and should be awaited when called.
        """
        # Setting up the menu
        self.setup_menu()

        with ui.element("div").classes("w-full h-full") as self.content_div:

            # If a content setup callable is provided, execute it to setup the main content
            if setup_content:
                setup_content()

        # Setting up the footer
        await self.setup_footer()