diff --git a/generate_source/build.sh b/generate_source/build.sh index 860947a7..0adacc90 100755 --- a/generate_source/build.sh +++ b/generate_source/build.sh @@ -9,4 +9,4 @@ if ! test -d "vuetify"; then cd .. fi python generate_code.py -pre-commit run --files ../ipyvuetify/vuetify_widgets.py ../js/src/Widgets.js +pre-commit run --files ../ipyvuetify/generated.py ../js/src/Widgets.js diff --git a/generate_source/generate_code.py b/generate_source/generate_code.py index b7ef0ea9..b463cc08 100644 --- a/generate_source/generate_code.py +++ b/generate_source/generate_code.py @@ -104,9 +104,29 @@ class {name[1:]}(VuetifyWidget): def generate_python(): code = textwrap.dedent( """\ - from traitlets import Unicode, Union, Float, List as TList, Dict, Bool, Any - - from .vuetify_widget import VuetifyWidget + from ipyvue import VueWidget + from traitlets import Any, Bool, Dict, Float, Unicode, Union + from traitlets import List as TList + + from ._version import semver + + + + class VuetifyWidget(VueWidget): + + _model_name = Unicode("VuetifyWidgetModel").tag(sync=True) + + _view_name = Unicode("VuetifyView").tag(sync=True) + + _view_module = Unicode("jupyter-vuetify").tag(sync=True) + + _model_module = Unicode("jupyter-vuetify").tag(sync=True) + + _view_module_version = Unicode(semver).tag(sync=True) + + _model_module_version = Unicode(semver).tag(sync=True) + + _metadata = Dict(default_value=None, allow_none=True).tag(sync=True) """ @@ -117,7 +137,7 @@ def generate_python(): code += textwrap.dedent( f"""\ - __all__ = ["{'", "'.join([name[1:] for name, _ in components])}"] + __all__ = ["VuetifyWidget", "{'", "'.join([name[1:] for name, _ in components])}"] """ ) @@ -184,7 +204,7 @@ def generate_js(): return code -with open("../ipyvuetify/vuetify_widgets.py", "w") as f: +with open("../ipyvuetify/generated.py", "w") as f: f.write(generate_python()) with open("../js/src/Widgets.js", "w") as f: diff --git a/ipyvuetify/__init__.py b/ipyvuetify/__init__.py index a7d56e70..ad543aa1 100755 --- a/ipyvuetify/__init__.py +++ b/ipyvuetify/__init__.py @@ -1,7 +1,7 @@ from ._version import __version__ +from .generated import * # noqa: F403 from .Html import Html from .Themes import theme -from .vuetify_widgets import * # noqa: F403 from .VuetifyTemplate import VuetifyTemplate diff --git a/ipyvuetify/vuetify_widgets.py b/ipyvuetify/generated.py similarity index 99% rename from ipyvuetify/vuetify_widgets.py rename to ipyvuetify/generated.py index b9c26b6c..2f480b22 100644 --- a/ipyvuetify/vuetify_widgets.py +++ b/ipyvuetify/generated.py @@ -1,7 +1,25 @@ +from ipyvue import VueWidget from traitlets import Any, Bool, Dict, Float, Unicode, Union from traitlets import List as TList -from .vuetify_widget import VuetifyWidget +from ._version import semver + + +class VuetifyWidget(VueWidget): + + _model_name = Unicode("VuetifyWidgetModel").tag(sync=True) + + _view_name = Unicode("VuetifyView").tag(sync=True) + + _view_module = Unicode("jupyter-vuetify").tag(sync=True) + + _model_module = Unicode("jupyter-vuetify").tag(sync=True) + + _view_module_version = Unicode(semver).tag(sync=True) + + _model_module_version = Unicode(semver).tag(sync=True) + + _metadata = Dict(default_value=None, allow_none=True).tag(sync=True) class Alert(VuetifyWidget): @@ -6705,6 +6723,7 @@ class WindowItem(VuetifyWidget): __all__ = [ + "VuetifyWidget", "Alert", "AlertTitle", "App", diff --git a/ipyvuetify/vuetify_widget.py b/ipyvuetify/vuetify_widget.py deleted file mode 100644 index c56d2ce3..00000000 --- a/ipyvuetify/vuetify_widget.py +++ /dev/null @@ -1,24 +0,0 @@ -from ipyvue import VueWidget -from traitlets import Dict, Unicode - -from ._version import semver - - -class VuetifyWidget(VueWidget): - - _model_name = Unicode("VuetifyWidgetModel").tag(sync=True) - - _view_name = Unicode("VuetifyView").tag(sync=True) - - _view_module = Unicode("jupyter-vuetify").tag(sync=True) - - _model_module = Unicode("jupyter-vuetify").tag(sync=True) - - _view_module_version = Unicode(semver).tag(sync=True) - - _model_module_version = Unicode(semver).tag(sync=True) - - _metadata = Dict(default_value=None, allow_none=True).tag(sync=True) - - -__all__ = ["VuetifyWidget"]