From 660671f7adf4ac893ceb38b34b0e696d5ccac4e7 Mon Sep 17 00:00:00 2001 From: DavidJForgeFlow Date: Thu, 13 Jun 2024 12:33:13 +0200 Subject: [PATCH] [IMP] web_widget_bokeh_chart: pre-commit stuff --- web_widget_bokeh_chart/README.rst | 188 ++++++++++-------- web_widget_bokeh_chart/pyproject.toml | 3 + web_widget_bokeh_chart/readme/CONTRIBUTORS.md | 7 + .../readme/CONTRIBUTORS.rst | 7 - web_widget_bokeh_chart/readme/CREDITS.md | 4 + web_widget_bokeh_chart/readme/CREDITS.rst | 4 - web_widget_bokeh_chart/readme/DESCRIPTION.md | 15 ++ web_widget_bokeh_chart/readme/DESCRIPTION.rst | 16 -- web_widget_bokeh_chart/readme/INSTALL.md | 3 + web_widget_bokeh_chart/readme/INSTALL.rst | 3 - web_widget_bokeh_chart/readme/ROADMAP.md | 1 + web_widget_bokeh_chart/readme/ROADMAP.rst | 1 - web_widget_bokeh_chart/readme/USAGE.md | 67 +++++++ web_widget_bokeh_chart/readme/USAGE.rst | 70 ------- .../static/description/index.html | 45 +++-- 15 files changed, 228 insertions(+), 206 deletions(-) create mode 100644 web_widget_bokeh_chart/pyproject.toml create mode 100644 web_widget_bokeh_chart/readme/CONTRIBUTORS.md delete mode 100644 web_widget_bokeh_chart/readme/CONTRIBUTORS.rst create mode 100644 web_widget_bokeh_chart/readme/CREDITS.md delete mode 100644 web_widget_bokeh_chart/readme/CREDITS.rst create mode 100644 web_widget_bokeh_chart/readme/DESCRIPTION.md delete mode 100644 web_widget_bokeh_chart/readme/DESCRIPTION.rst create mode 100644 web_widget_bokeh_chart/readme/INSTALL.md delete mode 100644 web_widget_bokeh_chart/readme/INSTALL.rst create mode 100644 web_widget_bokeh_chart/readme/ROADMAP.md delete mode 100644 web_widget_bokeh_chart/readme/ROADMAP.rst create mode 100644 web_widget_bokeh_chart/readme/USAGE.md delete mode 100644 web_widget_bokeh_chart/readme/USAGE.rst diff --git a/web_widget_bokeh_chart/README.rst b/web_widget_bokeh_chart/README.rst index 4624b1ed8..64ca83532 100644 --- a/web_widget_bokeh_chart/README.rst +++ b/web_widget_bokeh_chart/README.rst @@ -17,33 +17,35 @@ Web Widget Bokeh Chart :target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html :alt: License: LGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fweb-lightgray.png?logo=github - :target: https://github.com/OCA/web/tree/16.0/web_widget_bokeh_chart + :target: https://github.com/OCA/web/tree/17.0/web_widget_bokeh_chart :alt: OCA/web .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/web-16-0/web-16-0-web_widget_bokeh_chart + :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_bokeh_chart :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=16.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/web&target_branch=17.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| -This module add the possibility to insert Bokeh charts into Odoo standard views. +This module add the possibility to insert Bokeh charts into Odoo +standard views. -.. image:: https://raw.githubusercontent.com/OCA/web/16.0/web_widget_bokeh_chart/static/description/example.png - :alt: Bokeh Chart inserted into an Odoo view - :width: 600 px +|Bokeh Chart inserted into an Odoo view| -`Bokeh `__ is a Python interactive visualization -library that targets modern web browsers for presentation. Its goal is to -provide elegant, concise construction of basic exploratory and advanced -custom graphics in the style of D3.js, but also deliver this capability with -high-performance interactivity over very large or streaming datasets. Bokeh -can help anyone who would like to quickly and easily create interactive -plots, dashboards, and data applications. +`Bokeh `__ is a Python interactive +visualization library that targets modern web browsers for presentation. +Its goal is to provide elegant, concise construction of basic +exploratory and advanced custom graphics in the style of D3.js, but also +deliver this capability with high-performance interactivity over very +large or streaming datasets. Bokeh can help anyone who would like to +quickly and easily create interactive plots, dashboards, and data +applications. -If you want to see some samples of bokeh's capabilities follow this `link -`_. +If you want to see some samples of bokeh's capabilities follow this +`link `__. + +.. |Bokeh Chart inserted into an Odoo view| image:: https://raw.githubusercontent.com/OCA/web/17.0/web_widget_bokeh_chart/static/description/example.png **Table of contents** @@ -53,9 +55,11 @@ If you want to see some samples of bokeh's capabilities follow this `link Installation ============ -You need to install the python bokeh library:: +You need to install the python bokeh library: - pip3 install bokeh==3.1.1 +:: + + pip3 install bokeh==3.1.1 Usage ===== @@ -63,78 +67,93 @@ Usage To insert a Bokeh chart in a view proceed as follows: Using a Char field -~~~~~~~~~~~~~~~~~~ +------------------ -#. Declare a text computed field like this:: +1. Declare a text computed field like this: - bokeh_chart = fields.Text( - string='Bokeh Chart', - compute='_compute_bokeh_chart', - ) + :: -#. At the top of the module add the following imports:: + bokeh_chart = fields.Text( + string='Bokeh Chart', + compute='_compute_bokeh_chart', + ) - from bokeh.plotting import figure - from bokeh.embed import components - import json +2. At the top of the module add the following imports: -#. In its computed method do:: + :: - def _compute_bokeh_chart(self): - for rec in self: - # Design your bokeh figure: - p = figure() - line = p.line([0, 2], [1, 8], line_width=5) - # (...) - # fill the record field with both markup and the script of a chart. - script, div = components(p, wrap_script=False) - rec.bokeh_chart = json.dumps({"div": div, "script": script}) + from bokeh.plotting import figure + from bokeh.embed import components + import json -#. In the view, add something like this wherever you want to display your - bokeh chart:: +3. In its computed method do: -
- -
+ :: + def _compute_bokeh_chart(self): + for rec in self: + # Design your bokeh figure: + p = figure() + line = p.line([0, 2], [1, 8], line_width=5) + # (...) + # fill the record field with both markup and the script of a chart. + script, div = components(p, wrap_script=False) + rec.bokeh_chart = json.dumps({"div": div, "script": script}) + +4. In the view, add something like this wherever you want to display + your bokeh chart: + + :: + +
+ +
Using a Json field -~~~~~~~~~~~~~~~~~~ +------------------ -#. Declare a json computed field like this:: +1. Declare a json computed field like this: - bokeh_chart = fields.Json( - string='Bokeh Chart', - compute='_compute_bokeh_chart', - ) + :: -#. At the top of the module add the following imports:: + bokeh_chart = fields.Json( + string='Bokeh Chart', + compute='_compute_bokeh_chart', + ) - from bokeh.plotting import figure - from bokeh.embed import components +2. At the top of the module add the following imports: -#. In its computed method do:: + :: - def _compute_bokeh_chart(self): - for rec in self: - # Design your bokeh figure: - p = figure() - line = p.line([0, 2], [1, 8], line_width=5) - # (...) - # fill the record field with both markup and the script of a chart. - script, div = components(p, wrap_script=False) - rec.bokeh_chart = {"div": div, "script": script} + from bokeh.plotting import figure + from bokeh.embed import components -#. In the view, add something like this wherever you want to display your - bokeh chart:: +3. In its computed method do: -
- + `__ which is under the + open-source BSD 3-clause "New" or "Revised" License. Copyright (c) + 2012, Anaconda, Inc. +- Odoo Community Association (OCA) Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -198,6 +218,6 @@ Current `maintainers `__: |maintainer-LoisRForgeFlow| |maintainer-ChrisOForgeFlow| -This module is part of the `OCA/web `_ project on GitHub. +This module is part of the `OCA/web `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/web_widget_bokeh_chart/pyproject.toml b/web_widget_bokeh_chart/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/web_widget_bokeh_chart/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_widget_bokeh_chart/readme/CONTRIBUTORS.md b/web_widget_bokeh_chart/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..4795e9bc9 --- /dev/null +++ b/web_widget_bokeh_chart/readme/CONTRIBUTORS.md @@ -0,0 +1,7 @@ +- Jordi Ballester Alomar \<\> +- Lois Rilo Antelo \<\> +- Artem Kostyuk \<\> +- Christopher Ormaza \<\> +- Enric Tobella \<\> +- Oriol Miranda Garrido \<\> +- Bernat Puig Font \<\> diff --git a/web_widget_bokeh_chart/readme/CONTRIBUTORS.rst b/web_widget_bokeh_chart/readme/CONTRIBUTORS.rst deleted file mode 100644 index 1ad2fcc5f..000000000 --- a/web_widget_bokeh_chart/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,7 +0,0 @@ -* Jordi Ballester Alomar -* Lois Rilo Antelo -* Artem Kostyuk -* Christopher Ormaza -* Enric Tobella -* Oriol Miranda Garrido -* Bernat Puig Font diff --git a/web_widget_bokeh_chart/readme/CREDITS.md b/web_widget_bokeh_chart/readme/CREDITS.md new file mode 100644 index 000000000..fcad84e80 --- /dev/null +++ b/web_widget_bokeh_chart/readme/CREDITS.md @@ -0,0 +1,4 @@ +- This module uses the library [Bokeh](https://github.com/bokeh/bokeh) + which is under the open-source BSD 3-clause "New" or "Revised" + License. Copyright (c) 2012, Anaconda, Inc. +- Odoo Community Association (OCA) diff --git a/web_widget_bokeh_chart/readme/CREDITS.rst b/web_widget_bokeh_chart/readme/CREDITS.rst deleted file mode 100644 index bf90244f2..000000000 --- a/web_widget_bokeh_chart/readme/CREDITS.rst +++ /dev/null @@ -1,4 +0,0 @@ -* This module uses the library `Bokeh `__ - which is under the open-source BSD 3-clause "New" or "Revised" License. - Copyright (c) 2012, Anaconda, Inc. -* Odoo Community Association (OCA) diff --git a/web_widget_bokeh_chart/readme/DESCRIPTION.md b/web_widget_bokeh_chart/readme/DESCRIPTION.md new file mode 100644 index 000000000..d3bd90320 --- /dev/null +++ b/web_widget_bokeh_chart/readme/DESCRIPTION.md @@ -0,0 +1,15 @@ +This module add the possibility to insert Bokeh charts into Odoo +standard views. + +![Bokeh Chart inserted into an Odoo view](../static/description/example.png) + +[Bokeh](https://bokeh.pydata.org) is a Python interactive visualization +library that targets modern web browsers for presentation. Its goal is +to provide elegant, concise construction of basic exploratory and +advanced custom graphics in the style of D3.js, but also deliver this +capability with high-performance interactivity over very large or +streaming datasets. Bokeh can help anyone who would like to quickly and +easily create interactive plots, dashboards, and data applications. + +If you want to see some samples of bokeh's capabilities follow this +[link](https://bokeh.pydata.org/en/latest/docs/gallery.html). diff --git a/web_widget_bokeh_chart/readme/DESCRIPTION.rst b/web_widget_bokeh_chart/readme/DESCRIPTION.rst deleted file mode 100644 index 24d292ccc..000000000 --- a/web_widget_bokeh_chart/readme/DESCRIPTION.rst +++ /dev/null @@ -1,16 +0,0 @@ -This module add the possibility to insert Bokeh charts into Odoo standard views. - -.. image:: ../static/description/example.png - :alt: Bokeh Chart inserted into an Odoo view - :width: 600 px - -`Bokeh `__ is a Python interactive visualization -library that targets modern web browsers for presentation. Its goal is to -provide elegant, concise construction of basic exploratory and advanced -custom graphics in the style of D3.js, but also deliver this capability with -high-performance interactivity over very large or streaming datasets. Bokeh -can help anyone who would like to quickly and easily create interactive -plots, dashboards, and data applications. - -If you want to see some samples of bokeh's capabilities follow this `link -`_. diff --git a/web_widget_bokeh_chart/readme/INSTALL.md b/web_widget_bokeh_chart/readme/INSTALL.md new file mode 100644 index 000000000..f7400ae25 --- /dev/null +++ b/web_widget_bokeh_chart/readme/INSTALL.md @@ -0,0 +1,3 @@ +You need to install the python bokeh library: + + pip3 install bokeh==3.1.1 diff --git a/web_widget_bokeh_chart/readme/INSTALL.rst b/web_widget_bokeh_chart/readme/INSTALL.rst deleted file mode 100644 index 3cc1eabb2..000000000 --- a/web_widget_bokeh_chart/readme/INSTALL.rst +++ /dev/null @@ -1,3 +0,0 @@ -You need to install the python bokeh library:: - - pip3 install bokeh==3.1.1 diff --git a/web_widget_bokeh_chart/readme/ROADMAP.md b/web_widget_bokeh_chart/readme/ROADMAP.md new file mode 100644 index 000000000..205b07d36 --- /dev/null +++ b/web_widget_bokeh_chart/readme/ROADMAP.md @@ -0,0 +1 @@ +1. On 17, we could remove the char field and only use the Json Field diff --git a/web_widget_bokeh_chart/readme/ROADMAP.rst b/web_widget_bokeh_chart/readme/ROADMAP.rst deleted file mode 100644 index f63dcc409..000000000 --- a/web_widget_bokeh_chart/readme/ROADMAP.rst +++ /dev/null @@ -1 +0,0 @@ -#. On 17, we could remove the char field and only use the Json Field diff --git a/web_widget_bokeh_chart/readme/USAGE.md b/web_widget_bokeh_chart/readme/USAGE.md new file mode 100644 index 000000000..b8fe80c3e --- /dev/null +++ b/web_widget_bokeh_chart/readme/USAGE.md @@ -0,0 +1,67 @@ +To insert a Bokeh chart in a view proceed as follows: + +## Using a Char field + +1. Declare a text computed field like this: + + bokeh_chart = fields.Text( + string='Bokeh Chart', + compute='_compute_bokeh_chart', + ) + +2. At the top of the module add the following imports: + + from bokeh.plotting import figure + from bokeh.embed import components + import json + +3. In its computed method do: + + def _compute_bokeh_chart(self): + for rec in self: + # Design your bokeh figure: + p = figure() + line = p.line([0, 2], [1, 8], line_width=5) + # (...) + # fill the record field with both markup and the script of a chart. + script, div = components(p, wrap_script=False) + rec.bokeh_chart = json.dumps({"div": div, "script": script}) + +4. In the view, add something like this wherever you want to display + your bokeh chart: + +
+ +
+ +## Using a Json field + +1. Declare a json computed field like this: + + bokeh_chart = fields.Json( + string='Bokeh Chart', + compute='_compute_bokeh_chart', + ) + +2. At the top of the module add the following imports: + + from bokeh.plotting import figure + from bokeh.embed import components + +3. In its computed method do: + + def _compute_bokeh_chart(self): + for rec in self: + # Design your bokeh figure: + p = figure() + line = p.line([0, 2], [1, 8], line_width=5) + # (...) + # fill the record field with both markup and the script of a chart. + script, div = components(p, wrap_script=False) + rec.bokeh_chart = {"div": div, "script": script} + +4. In the view, add something like this wherever you want to display + your bokeh chart: + +
+ - -
- - -Using a Json field -~~~~~~~~~~~~~~~~~~ - -#. Declare a json computed field like this:: - - bokeh_chart = fields.Json( - string='Bokeh Chart', - compute='_compute_bokeh_chart', - ) - -#. At the top of the module add the following imports:: - - from bokeh.plotting import figure - from bokeh.embed import components - -#. In its computed method do:: - - def _compute_bokeh_chart(self): - for rec in self: - # Design your bokeh figure: - p = figure() - line = p.line([0, 2], [1, 8], line_width=5) - # (...) - # fill the record field with both markup and the script of a chart. - script, div = components(p, wrap_script=False) - rec.bokeh_chart = {"div": div, "script": script} - -#. In the view, add something like this wherever you want to display your - bokeh chart:: - -
- @@ -369,17 +368,20 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:3ec86c20df03bbfbb52f5eaa52fb1be16d4fe3ec0f1756f745ad65eb7cc56b66 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Production/Stable License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

-

This module add the possibility to insert Bokeh charts into Odoo standard views.

-Bokeh Chart inserted into an Odoo view -

Bokeh is a Python interactive visualization -library that targets modern web browsers for presentation. Its goal is to -provide elegant, concise construction of basic exploratory and advanced -custom graphics in the style of D3.js, but also deliver this capability with -high-performance interactivity over very large or streaming datasets. Bokeh -can help anyone who would like to quickly and easily create interactive -plots, dashboards, and data applications.

-

If you want to see some samples of bokeh’s capabilities follow this link.

+

Production/Stable License: LGPL-3 OCA/web Translate me on Weblate Try me on Runboat

+

This module add the possibility to insert Bokeh charts into Odoo +standard views.

+

Bokeh Chart inserted into an Odoo view

+

Bokeh is a Python interactive +visualization library that targets modern web browsers for presentation. +Its goal is to provide elegant, concise construction of basic +exploratory and advanced custom graphics in the style of D3.js, but also +deliver this capability with high-performance interactivity over very +large or streaming datasets. Bokeh can help anyone who would like to +quickly and easily create interactive plots, dashboards, and data +applications.

+

If you want to see some samples of bokeh’s capabilities follow this +link.

Table of contents

    @@ -441,8 +443,8 @@ def _compute_bokeh_chart(self): rec.bokeh_chart = json.dumps({"div": div, "script": script}) -
  • In the view, add something like this wherever you want to display your -bokeh chart:

    +
  • In the view, add something like this wherever you want to display +your bokeh chart:

     <div>
         <field name="bokeh_chart" widget="bokeh_chart" nolabel="1"/>
    @@ -481,8 +483,8 @@ def _compute_bokeh_chart(self):
             rec.bokeh_chart = {"div": div, "script": script}
     
  • -
  • In the view, add something like this wherever you want to display your -bokeh chart:

    +
  • In the view, add something like this wherever you want to display +your bokeh chart:

     <div>
         <field name="bokeh_chart" widget="bokeh_chart_json
    @@ -502,7 +504,7 @@ bokeh chart:

    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

@@ -529,9 +531,10 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Other credits

    -
  • This module uses the library Bokeh -which is under the open-source BSD 3-clause “New” or “Revised” License. -Copyright (c) 2012, Anaconda, Inc.
  • +
  • This module uses the library +Bokeh which is under the +open-source BSD 3-clause “New” or “Revised” License. Copyright (c) +2012, Anaconda, Inc.
  • Odoo Community Association (OCA)
@@ -544,7 +547,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

LoisRForgeFlow ChrisOForgeFlow

-

This module is part of the OCA/web project on GitHub.

+

This module is part of the OCA/web project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.