Routing-flet


NameRouting-flet JSON
Version 0.0.4 PyPI version JSON
download
home_pagehttps://github.com/Dxsxsx/Routing_flet
SummaryEsta es la descripcion de mi paquete
upload_time2023-05-07 20:13:24
maintainer
docs_urlNone
authorDxsxsx
requires_python>=3.6
license
keywords python web template web application development
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ♾️Routing_flet -> Enrutamiento y protección de paginas facil con flet
## instalar
```
pip install Routing-flet
```
## Actualizar
```
pip install Routing-flet --upgrade
```
---
## Ejemplo:
En el archivo principal `./main.py` se implementa lo siguiente que sera la funcion principal que enrutara todas las paginasque tengra el sitio web.
```python
import flet as ft
from Routing_flet import RoutePage

def main(page: ft.Page):

    ruta = RoutePage(page)
    ruta.run()

ft.app(target=main, view=ft.WEB_BROWSER, port=9999, route_url_strategy='hash')
```
En las vistas de cada pagina se utiliza mediante clases que heredara de la clase `ViewPage`, en la clase de la vista que se creara y se encuentra ubicado en `./views/<archivo>.py` | tiene los siguientes metodos:
- Para configurar la url
```python
  def __init__(self) -> None:
        self.route = '/about/list/
```
- Configurar un ruta dinámica por defecto es estático | En consola se recibira los parametros como diccionario.
```python
def math_url(self):
        return ['id','name','edad']
```
- Para proteger una ruta | Por defecto no hay protección de ruta: 
- Al retornar `True` Se podra ingresar, en caso `False` se denegara el ingreso.
```python
def login_requi(self):
        return True
```
## Ejemplo de una pagina con enrutamiento estático y sin protección de ruta:
```python
import flet as ft
from Routing_flet import ViewPage

class View(ViewPage):
    def __init__(self):
        self.route = '/'

    def view(self, page: ft.Page):
        page.title = 'Index'

        return ft.View(
            self.route,
            controls=[
                ft.Column(
                    [
                        ft.Container(
                            content=ft.Text('index page', size=50),
                            width=450,
                            height=450,
                            bgcolor='blue800',
                            alignment=ft.alignment.center,
                        ),
                        ft.FilledButton(
                            'ir a contact',
                            width=120,
                            height=40,
                            on_click=lambda e:e.page.go('/contact')
                        ),
                    ]
                )
            ],
            vertical_alignment=ft.MainAxisAlignment.CENTER,
            horizontal_alignment=ft.CrossAxisAlignment.CENTER
        )
```
## Sitio web con enrutamiento dinámico y protección de rutas
```python
import flet as ft
from Routing_flet import ViewPage

class View(ViewPage):
    def __init__(self) -> None:
        self.route = '/about/1/2'

    def math_url(self):
        return ['id','name','edad']
     
    def login_requi(self):
        return True

    def view(self, page: ft.Page):
        page.title = 'contact'

        return ft.View(
            self.route,
            controls=[
                ft.Column(
                    [
                        ft.Container(
                            content=ft.Text('index about', size=50),
                            width=450,
                            height=450,
                            bgcolor='green800',
                            alignment=ft.alignment.center,
                        ),
                        ft.FilledButton(
                            'ir a index',
                            width=120,
                            height=40,
                            on_click=lambda e:e.page.go('/')
                        ),
                    ]
                )
            ],
            vertical_alignment=ft.MainAxisAlignment.CENTER,
            horizontal_alignment=ft.CrossAxisAlignment.CENTER
        )
```
## Correr Flet (-w : Para ejecutar en la web) | ruta : `./`
```cmd
flet run main.py -r -w -p 9999
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Dxsxsx/Routing_flet",
    "name": "Routing-flet",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "python web template,web application,development",
    "author": "Dxsxsx",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ba/87/119f27835e067025c36cf7ae63a79bff211a1f233e0be00f4d0e5115c927/Routing_flet-0.0.4.tar.gz",
    "platform": null,
    "description": "# \u267e\ufe0fRouting_flet -> Enrutamiento y protecci\u00f3n de paginas facil con flet\r\n## instalar\r\n```\r\npip install Routing-flet\r\n```\r\n## Actualizar\r\n```\r\npip install Routing-flet --upgrade\r\n```\r\n---\r\n## Ejemplo:\r\nEn el archivo principal `./main.py` se implementa lo siguiente que sera la funcion principal que enrutara todas las paginasque tengra el sitio web.\r\n```python\r\nimport flet as ft\r\nfrom Routing_flet import RoutePage\r\n\r\ndef main(page: ft.Page):\r\n\r\n    ruta = RoutePage(page)\r\n    ruta.run()\r\n\r\nft.app(target=main, view=ft.WEB_BROWSER, port=9999, route_url_strategy='hash')\r\n```\r\nEn las vistas de cada pagina se utiliza mediante clases que heredara de la clase `ViewPage`, en la clase de la vista que se creara y se encuentra ubicado en `./views/<archivo>.py` | tiene los siguientes metodos:\r\n- Para configurar la url\r\n```python\r\n  def __init__(self) -> None:\r\n        self.route = '/about/list/\r\n```\r\n- Configurar un ruta din\u00e1mica por defecto es est\u00e1tico | En consola se recibira los parametros como diccionario.\r\n```python\r\ndef math_url(self):\r\n        return ['id','name','edad']\r\n```\r\n- Para proteger una ruta | Por defecto no hay protecci\u00f3n de ruta: \r\n- Al retornar `True` Se podra ingresar, en caso `False` se denegara el ingreso.\r\n```python\r\ndef login_requi(self):\r\n        return True\r\n```\r\n## Ejemplo de una pagina con enrutamiento est\u00e1tico y sin protecci\u00f3n de ruta:\r\n```python\r\nimport flet as ft\r\nfrom Routing_flet import ViewPage\r\n\r\nclass View(ViewPage):\r\n    def __init__(self):\r\n        self.route = '/'\r\n\r\n    def view(self, page: ft.Page):\r\n        page.title = 'Index'\r\n\r\n        return ft.View(\r\n            self.route,\r\n            controls=[\r\n                ft.Column(\r\n                    [\r\n                        ft.Container(\r\n                            content=ft.Text('index page', size=50),\r\n                            width=450,\r\n                            height=450,\r\n                            bgcolor='blue800',\r\n                            alignment=ft.alignment.center,\r\n                        ),\r\n                        ft.FilledButton(\r\n                            'ir a contact',\r\n                            width=120,\r\n                            height=40,\r\n                            on_click=lambda e:e.page.go('/contact')\r\n                        ),\r\n                    ]\r\n                )\r\n            ],\r\n            vertical_alignment=ft.MainAxisAlignment.CENTER,\r\n            horizontal_alignment=ft.CrossAxisAlignment.CENTER\r\n        )\r\n```\r\n## Sitio web con enrutamiento din\u00e1mico y protecci\u00f3n de rutas\r\n```python\r\nimport flet as ft\r\nfrom Routing_flet import ViewPage\r\n\r\nclass View(ViewPage):\r\n    def __init__(self) -> None:\r\n        self.route = '/about/1/2'\r\n\r\n    def math_url(self):\r\n        return ['id','name','edad']\r\n     \r\n    def login_requi(self):\r\n        return True\r\n\r\n    def view(self, page: ft.Page):\r\n        page.title = 'contact'\r\n\r\n        return ft.View(\r\n            self.route,\r\n            controls=[\r\n                ft.Column(\r\n                    [\r\n                        ft.Container(\r\n                            content=ft.Text('index about', size=50),\r\n                            width=450,\r\n                            height=450,\r\n                            bgcolor='green800',\r\n                            alignment=ft.alignment.center,\r\n                        ),\r\n                        ft.FilledButton(\r\n                            'ir a index',\r\n                            width=120,\r\n                            height=40,\r\n                            on_click=lambda e:e.page.go('/')\r\n                        ),\r\n                    ]\r\n                )\r\n            ],\r\n            vertical_alignment=ft.MainAxisAlignment.CENTER,\r\n            horizontal_alignment=ft.CrossAxisAlignment.CENTER\r\n        )\r\n```\r\n## Correr Flet (-w : Para ejecutar en la web) | ruta : `./`\r\n```cmd\r\nflet run main.py -r -w -p 9999\r\n```\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Esta es la descripcion de mi paquete",
    "version": "0.0.4",
    "project_urls": {
        "Bug Tracker": "https://github.com/Dxsxsx/Routing_flet/issues",
        "Download": "https://github.com/Dxsxsx/Routing_flet",
        "Homepage": "https://github.com/Dxsxsx/Routing_flet"
    },
    "split_keywords": [
        "python web template",
        "web application",
        "development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9c0027b4897b833bbc0f93284b26361f05509efb83f8e4f06f02ea857a60e58d",
                "md5": "7566c16bb87cd069e43732bc7058fcea",
                "sha256": "8acaa91e846685afe02b4805e8542feaa71546ec917496c2ad4bedbf65200ace"
            },
            "downloads": -1,
            "filename": "Routing_flet-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7566c16bb87cd069e43732bc7058fcea",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8538,
            "upload_time": "2023-05-07T20:13:22",
            "upload_time_iso_8601": "2023-05-07T20:13:22.398894Z",
            "url": "https://files.pythonhosted.org/packages/9c/00/27b4897b833bbc0f93284b26361f05509efb83f8e4f06f02ea857a60e58d/Routing_flet-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ba87119f27835e067025c36cf7ae63a79bff211a1f233e0be00f4d0e5115c927",
                "md5": "a0b7c5926f51909d7a0e7e231d0ca54a",
                "sha256": "31365899e047ebcf987ba268894acd12538eb9baec88eaa7788b069132a81e23"
            },
            "downloads": -1,
            "filename": "Routing_flet-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "a0b7c5926f51909d7a0e7e231d0ca54a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 7011,
            "upload_time": "2023-05-07T20:13:24",
            "upload_time_iso_8601": "2023-05-07T20:13:24.330276Z",
            "url": "https://files.pythonhosted.org/packages/ba/87/119f27835e067025c36cf7ae63a79bff211a1f233e0be00f4d0e5115c927/Routing_flet-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-07 20:13:24",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Dxsxsx",
    "github_project": "Routing_flet",
    "github_not_found": true,
    "lcname": "routing-flet"
}
        
Elapsed time: 0.09392s