/ipyvuetify_app

Templates for ipyvuetify web apps.

Primary LanguagePythonMIT LicenseMIT

ipyvuetify_app

GitHub last commit GitHub license<space><space> PyPI PyPI - Python Version

ipyvuetify_app is a python package (py>=3.7) with a simple template for writing ipyvuetify application

pic1 pic2

Application from the box supports theme switcher and navigation over different content by menus on top

pic3 pic4

pip install ipyvuetify_app
To create an application by the given template you need to create a routing class
That will be in charge of what to show in the main application section
For every selected menu item -> subitem
Then you just give the router to ipyvuetify_app.VueApp(...) and it does all the magic for you
from ipyvuetify_app import VueApp
from ipyvuetify_app import VueAppRouter

vue_app_router_example = VueAppRouter()
VueApp(vue_app_router_example)
Every router should satisfy 2 conditions:
1) It has method get_main_content(self, item, subitem) which should return page's main content
2) It has attribute self.dict_list_subitems_by_item with all subitems for every menu item
class VueAppRouter():

    def __init__(self):
        self.dict_list_subitems_by_item = {}
        for item in range(5):
            list_subitems = [str(subitem) for subitem in range(item, 5 + item)]
            self.dict_list_subitems_by_item[str(item)] = list_subitems

    def get_main_content(self, item, subitem):
        return f"{item} -> {subitem}"
VueApp(
    vue_app_router,
    list_vw_fab_app_bar_left=None,
    list_vw_fab_app_bar_right=None,
    list_footer_vw_children=None,
    app_css_style=None,
)

Arguments:

  1. list_vw_fab_app_bar_left:
    List with ipyvuetify fab icon buttons to put on the left side of Application Header Bar
  2. list_vw_fab_app_bar_right:
    List with ipyvuetify fab icon buttons to put on the right side of Application Header Bar
  3. list_footer_vw_children:
    List with ipyvuetify widgets to put in the footer
    If empty then footer is not shown at all
  4. app_css_style:
    String with css styles to apply on v.App

VuaApp is a child of v.App so it has all the parent methods and attributes

  1. self.vw_appbar:
    v.AppBar(app=True, ...) - Application top bar
  2. self.vw_navigation_drawer:
    v.NavigationDrawer(app=True, ...) - Navigation Drawer at the left side
  3. self.vw_app_main:
    v.Content() - Main section of the application
  4. self.vw_footer:
    v.Footer(app=True, ...) - Footer of the application
  1. self.update_app_routing():
    When router items were updated please call this method to update application menus

This project is licensed under the MIT License.