Loading
+23 −0
Original line number Diff line number Diff line
"""Module for the main model."""

from pydantic import BaseModel, Field


class MainModel(BaseModel):
    """
    A model class.

    This class uses Pydantic (https://docs.pydantic.dev/latest/),
    which allows for defining data validation rules,
    titles, descriptions, and examples that can be used in GUI elements or
    other interfaces for improved clarity and usability.
    """

    username: str = Field(
        default="test_name",
        min_length=1,
        title="User Name",
        description="Please provide the name of the user",
        examples=["user"],
    )
    password: str = Field(default="test_password", title="User Password")
+0 −1
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@ from pydantic import BaseModel, Field, computed_field

IRIS_DATA = iris()


class PlotlyConfig(BaseModel):
    """Configuration class for the Plotly example."""

+0 −0

File mode changed from 100755 to 100644.

+0 −0

File mode changed from 100755 to 100644.

+14 −0
Original line number Diff line number Diff line
"""Module for the factory that creates viewmodels used in the application."""

from nova.mvvm.interface import BindingInterface

from .models.main_model import MainModel
from .view_models.main import MainViewModel


def create_viewmodels(binding: BindingInterface) -> dict:
    model = MainModel()
    vm: dict = {}
    vm["main"] = MainViewModel(model, binding)

    return vm
Loading