From e75cfb6cf6adc084b5077a06447dc92614e48b1f Mon Sep 17 00:00:00 2001 From: Franco Leyes Date: Sat, 23 Nov 2024 17:28:10 -0300 Subject: [PATCH] [IMP] web_widget_mpld3_chart: pre-commit execution --- web_widget_mpld3_chart/README.rst | 107 ++++++++++-------- .../models/abstract_mpld3_parser.py | 3 +- web_widget_mpld3_chart/pyproject.toml | 3 + web_widget_mpld3_chart/readme/CONTRIBUTORS.md | 2 + .../readme/CONTRIBUTORS.rst | 2 - web_widget_mpld3_chart/readme/CREDITS.md | 7 ++ web_widget_mpld3_chart/readme/CREDITS.rst | 8 -- web_widget_mpld3_chart/readme/DESCRIPTION.md | 6 + web_widget_mpld3_chart/readme/DESCRIPTION.rst | 5 - web_widget_mpld3_chart/readme/INSTALL.md | 3 + web_widget_mpld3_chart/readme/INSTALL.rst | 3 - web_widget_mpld3_chart/readme/USAGE.md | 33 ++++++ web_widget_mpld3_chart/readme/USAGE.rst | 33 ------ .../static/description/index.html | 43 +++---- 14 files changed, 139 insertions(+), 119 deletions(-) create mode 100644 web_widget_mpld3_chart/pyproject.toml create mode 100644 web_widget_mpld3_chart/readme/CONTRIBUTORS.md delete mode 100644 web_widget_mpld3_chart/readme/CONTRIBUTORS.rst create mode 100644 web_widget_mpld3_chart/readme/CREDITS.md delete mode 100644 web_widget_mpld3_chart/readme/CREDITS.rst create mode 100644 web_widget_mpld3_chart/readme/DESCRIPTION.md delete mode 100644 web_widget_mpld3_chart/readme/DESCRIPTION.rst create mode 100644 web_widget_mpld3_chart/readme/INSTALL.md delete mode 100644 web_widget_mpld3_chart/readme/INSTALL.rst create mode 100644 web_widget_mpld3_chart/readme/USAGE.md delete mode 100644 web_widget_mpld3_chart/readme/USAGE.rst diff --git a/web_widget_mpld3_chart/README.rst b/web_widget_mpld3_chart/README.rst index 5c40b96da..9879bcab7 100644 --- a/web_widget_mpld3_chart/README.rst +++ b/web_widget_mpld3_chart/README.rst @@ -17,22 +17,23 @@ Web Widget mpld3 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_mpld3_chart + :target: https://github.com/OCA/web/tree/17.0/web_widget_mpld3_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_mpld3_chart + :target: https://translation.odoo-community.org/projects/web-17-0/web-17-0-web_widget_mpld3_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 adds the possibility to insert mpld3 charts into Odoo standard views. -This is an interactive D3js-based viewer which brings matplotlib graphics to the browser. +This module adds the possibility to insert mpld3 charts into Odoo +standard views. This is an interactive D3js-based viewer which brings +matplotlib graphics to the browser. -If you want to see some samples of mpld3's capabilities follow this `link -`_. +If you want to see some samples of mpld3's capabilities follow this +`link `__. **Table of contents** @@ -42,46 +43,58 @@ If you want to see some samples of mpld3's capabilities follow this `link Installation ============ -You need to install the python mpld3 library:: +You need to install the python mpld3 library: - pip install mpld3 +:: + + pip install mpld3 Usage ===== To insert a mpld3 chart in a view proceed as follows: -#. You should inherit from abstract class abstract.mpld3.parser:: +1. You should inherit from abstract class abstract.mpld3.parser: - _name = 'res.partner' - _inherit = ['res.partner', 'abstract.mpld3.parser'] + :: -#. Import the required libraries:: + _name = 'res.partner' + _inherit = ['res.partner', 'abstract.mpld3.parser'] - import matplotlib.pyplot as plt +2. Import the required libraries: -#. Declare a json computed field like this:: + :: - mpld3_chart = fields.Json( - string='Mpld3 Chart', - compute='_compute_mpld3_chart', - ) + import matplotlib.pyplot as plt -#. In its computed method do:: +3. Declare a json computed field like this: - def _compute_mpld3_chart(self): - for rec in self: - # Design your mpld3 figure: - plt.scatter([1, 10], [5, 9]) - figure = plt.figure() - rec.mpld3_chart = self.convert_figure_to_json(figure) + :: -#. In the view, add something like this wherever you want to display your - mpld3 chart:: + mpld3_chart = fields.Json( + string='Mpld3 Chart', + compute='_compute_mpld3_chart', + ) -
- -
+4. In its computed method do: + + :: + + def _compute_mpld3_chart(self): + for rec in self: + # Design your mpld3 figure: + plt.scatter([1, 10], [5, 9]) + figure = plt.figure() + rec.mpld3_chart = self.convert_figure_to_json(figure) + +5. In the view, add something like this wherever you want to display + your mpld3 chart: + + :: + +
+ +
Bug Tracker =========== @@ -89,7 +102,7 @@ Bug Tracker 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. @@ -97,30 +110,30 @@ Credits ======= Authors -~~~~~~~ +------- * ForgeFlow Contributors -~~~~~~~~~~~~ +------------ -* Jordi Ballester Alomar -* Christopher Ormaza +- Jordi Ballester Alomar +- Christopher Ormaza Other credits -~~~~~~~~~~~~~ +------------- -* This module uses the library `mpld3 `__ - which is under the open-source BSD 3-clause "New" or "Revised" License. - Copyright (c) 2013, Jake Vanderplas -* This module uses the library `BeautifulSoup 4 `__ - which is under the open-source MIT License. - Copyright (c) 2014, Leonard Richardson - -* Odoo Community Association (OCA) +- This module uses the library + `mpld3 `__ which is under the + open-source BSD 3-clause "New" or "Revised" License. Copyright (c) + 2013, Jake Vanderplas +- This module uses the library `BeautifulSoup + 4 `__ which is under the + open-source MIT License. Copyright (c) 2014, Leonard Richardson +- Odoo Community Association (OCA) Maintainers -~~~~~~~~~~~ +----------- This module is maintained by the OCA. @@ -143,6 +156,6 @@ Current `maintainers `__: |maintainer-JordiBForgeFlow| |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_mpld3_chart/models/abstract_mpld3_parser.py b/web_widget_mpld3_chart/models/abstract_mpld3_parser.py index 2c778c7a8..41f1fd374 100644 --- a/web_widget_mpld3_chart/models/abstract_mpld3_parser.py +++ b/web_widget_mpld3_chart/models/abstract_mpld3_parser.py @@ -11,12 +11,11 @@ _logger = logging.getLogger(__name__) try: import mpld3 from bs4 import BeautifulSoup -except (ImportError, IOError) as err: +except (OSError, ImportError) as err: _logger.debug(err) class AbstractMpld3Parser(models.AbstractModel): - _name = "abstract.mpld3.parser" _description = "Utility to parse ploot figure to json data for widget Mpld3" diff --git a/web_widget_mpld3_chart/pyproject.toml b/web_widget_mpld3_chart/pyproject.toml new file mode 100644 index 000000000..4231d0ccc --- /dev/null +++ b/web_widget_mpld3_chart/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["whool"] +build-backend = "whool.buildapi" diff --git a/web_widget_mpld3_chart/readme/CONTRIBUTORS.md b/web_widget_mpld3_chart/readme/CONTRIBUTORS.md new file mode 100644 index 000000000..432d47f11 --- /dev/null +++ b/web_widget_mpld3_chart/readme/CONTRIBUTORS.md @@ -0,0 +1,2 @@ +- Jordi Ballester Alomar \<\> +- Christopher Ormaza \<\> diff --git a/web_widget_mpld3_chart/readme/CONTRIBUTORS.rst b/web_widget_mpld3_chart/readme/CONTRIBUTORS.rst deleted file mode 100644 index 68f3dbd59..000000000 --- a/web_widget_mpld3_chart/readme/CONTRIBUTORS.rst +++ /dev/null @@ -1,2 +0,0 @@ -* Jordi Ballester Alomar -* Christopher Ormaza diff --git a/web_widget_mpld3_chart/readme/CREDITS.md b/web_widget_mpld3_chart/readme/CREDITS.md new file mode 100644 index 000000000..3b65a3e64 --- /dev/null +++ b/web_widget_mpld3_chart/readme/CREDITS.md @@ -0,0 +1,7 @@ +- This module uses the library [mpld3](https://github.com/mpld3/mpld3) + which is under the open-source BSD 3-clause "New" or "Revised" + License. Copyright (c) 2013, Jake Vanderplas +- This module uses the library [BeautifulSoup + 4](https://pypi.org/project/beautifulsoup4/) which is under the + open-source MIT License. Copyright (c) 2014, Leonard Richardson +- Odoo Community Association (OCA) diff --git a/web_widget_mpld3_chart/readme/CREDITS.rst b/web_widget_mpld3_chart/readme/CREDITS.rst deleted file mode 100644 index 6c416e6ec..000000000 --- a/web_widget_mpld3_chart/readme/CREDITS.rst +++ /dev/null @@ -1,8 +0,0 @@ -* This module uses the library `mpld3 `__ - which is under the open-source BSD 3-clause "New" or "Revised" License. - Copyright (c) 2013, Jake Vanderplas -* This module uses the library `BeautifulSoup 4 `__ - which is under the open-source MIT License. - Copyright (c) 2014, Leonard Richardson - -* Odoo Community Association (OCA) diff --git a/web_widget_mpld3_chart/readme/DESCRIPTION.md b/web_widget_mpld3_chart/readme/DESCRIPTION.md new file mode 100644 index 000000000..732b5c2bc --- /dev/null +++ b/web_widget_mpld3_chart/readme/DESCRIPTION.md @@ -0,0 +1,6 @@ +This module adds the possibility to insert mpld3 charts into Odoo +standard views. This is an interactive D3js-based viewer which brings +matplotlib graphics to the browser. + +If you want to see some samples of mpld3's capabilities follow this +[link](http://mpld3.github.io/). diff --git a/web_widget_mpld3_chart/readme/DESCRIPTION.rst b/web_widget_mpld3_chart/readme/DESCRIPTION.rst deleted file mode 100644 index 6e2779186..000000000 --- a/web_widget_mpld3_chart/readme/DESCRIPTION.rst +++ /dev/null @@ -1,5 +0,0 @@ -This module adds the possibility to insert mpld3 charts into Odoo standard views. -This is an interactive D3js-based viewer which brings matplotlib graphics to the browser. - -If you want to see some samples of mpld3's capabilities follow this `link -`_. diff --git a/web_widget_mpld3_chart/readme/INSTALL.md b/web_widget_mpld3_chart/readme/INSTALL.md new file mode 100644 index 000000000..b33edda0b --- /dev/null +++ b/web_widget_mpld3_chart/readme/INSTALL.md @@ -0,0 +1,3 @@ +You need to install the python mpld3 library: + + pip install mpld3 diff --git a/web_widget_mpld3_chart/readme/INSTALL.rst b/web_widget_mpld3_chart/readme/INSTALL.rst deleted file mode 100644 index 7171749c6..000000000 --- a/web_widget_mpld3_chart/readme/INSTALL.rst +++ /dev/null @@ -1,3 +0,0 @@ -You need to install the python mpld3 library:: - - pip install mpld3 diff --git a/web_widget_mpld3_chart/readme/USAGE.md b/web_widget_mpld3_chart/readme/USAGE.md new file mode 100644 index 000000000..b668849d5 --- /dev/null +++ b/web_widget_mpld3_chart/readme/USAGE.md @@ -0,0 +1,33 @@ +To insert a mpld3 chart in a view proceed as follows: + +1. You should inherit from abstract class abstract.mpld3.parser: + + _name = 'res.partner' + _inherit = ['res.partner', 'abstract.mpld3.parser'] + +2. Import the required libraries: + + import matplotlib.pyplot as plt + +3. Declare a json computed field like this: + + mpld3_chart = fields.Json( + string='Mpld3 Chart', + compute='_compute_mpld3_chart', + ) + +4. In its computed method do: + + def _compute_mpld3_chart(self): + for rec in self: + # Design your mpld3 figure: + plt.scatter([1, 10], [5, 9]) + figure = plt.figure() + rec.mpld3_chart = self.convert_figure_to_json(figure) + +5. In the view, add something like this wherever you want to display + your mpld3 chart: + +
+ +
diff --git a/web_widget_mpld3_chart/readme/USAGE.rst b/web_widget_mpld3_chart/readme/USAGE.rst deleted file mode 100644 index df9ad0640..000000000 --- a/web_widget_mpld3_chart/readme/USAGE.rst +++ /dev/null @@ -1,33 +0,0 @@ -To insert a mpld3 chart in a view proceed as follows: - -#. You should inherit from abstract class abstract.mpld3.parser:: - - _name = 'res.partner' - _inherit = ['res.partner', 'abstract.mpld3.parser'] - -#. Import the required libraries:: - - import matplotlib.pyplot as plt - -#. Declare a json computed field like this:: - - mpld3_chart = fields.Json( - string='Mpld3 Chart', - compute='_compute_mpld3_chart', - ) - -#. In its computed method do:: - - def _compute_mpld3_chart(self): - for rec in self: - # Design your mpld3 figure: - plt.scatter([1, 10], [5, 9]) - figure = plt.figure() - rec.mpld3_chart = self.convert_figure_to_json(figure) - -#. In the view, add something like this wherever you want to display your - mpld3 chart:: - -
- -
diff --git a/web_widget_mpld3_chart/static/description/index.html b/web_widget_mpld3_chart/static/description/index.html index fddaa2cba..ab4c0c47f 100644 --- a/web_widget_mpld3_chart/static/description/index.html +++ b/web_widget_mpld3_chart/static/description/index.html @@ -1,4 +1,3 @@ - @@ -9,10 +8,11 @@ /* :Author: David Goodger (goodger@python.org) -:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $ +:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $ :Copyright: This stylesheet has been placed in the public domain. Default cascading style sheet for the HTML output of Docutils. +Despite the name, some widely supported CSS2 features are used. See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to customize this style sheet. @@ -275,7 +275,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code { margin-left: 2em ; margin-right: 2em } -pre.code .ln { color: grey; } /* line numbers */ +pre.code .ln { color: gray; } /* line numbers */ pre.code, code { background-color: #eeeeee } pre.code .comment, code .comment { color: #5C6576 } pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold } @@ -301,7 +301,7 @@ span.option { span.pre { white-space: pre } -span.problematic { +span.problematic, pre.problematic { color: red } span.section-subtitle { @@ -369,10 +369,12 @@ ul.auto-toc { !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:a74d15907ff4678410ffd1913b2f75b5c7d818852dc75f13bba0311a6ffeda6e !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

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

-

This module adds the possibility to insert mpld3 charts into Odoo standard views. -This is an interactive D3js-based viewer which brings matplotlib graphics to the browser.

-

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

+

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

+

This module adds the possibility to insert mpld3 charts into Odoo +standard views. This is an interactive D3js-based viewer which brings +matplotlib graphics to the browser.

+

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

Table of contents

    @@ -428,8 +430,8 @@ def _compute_mpld3_chart(self): rec.mpld3_chart = self.convert_figure_to_json(figure) -
  • In the view, add something like this wherever you want to display your -mpld3 chart:

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

     <div>
         <field name="mpld3_chart" widget="mpld3_chart" nolabel="1"/>
    @@ -443,7 +445,7 @@ mpld3 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.

@@ -464,25 +466,28 @@ If you spotted it first, help us to smash it by providing a detailed and welcome

Other credits

    -
  • This module uses the library mpld3 -which is under the open-source BSD 3-clause “New” or “Revised” License. -Copyright (c) 2013, Jake Vanderplas
  • -
  • This module uses the library BeautifulSoup 4 -which is under the open-source MIT License. -Copyright (c) 2014, Leonard Richardson
  • +
  • This module uses the library +mpld3 which is under the +open-source BSD 3-clause “New” or “Revised” License. Copyright (c) +2013, Jake Vanderplas
  • +
  • This module uses the library BeautifulSoup +4 which is under the +open-source MIT License. Copyright (c) 2014, Leonard Richardson
  • Odoo Community Association (OCA)

Maintainers

This module is maintained by the OCA.

-Odoo Community Association + +Odoo Community Association +

OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

JordiBForgeFlow 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.