|
5 | 5 |
|
6 | 6 | """ |
7 | 7 |
|
8 | | -import platform |
9 | | -import sys |
| 8 | +from __future__ import annotations |
10 | 9 |
|
11 | | -from qtpy import QtCore as QC |
12 | | -from qwt import QWT_VERSION_STR |
| 10 | +import guidata |
| 11 | +import qwt |
| 12 | +from guidata.widgets.about import get_general_infos |
| 13 | +from qtpy.QtWidgets import QMessageBox, QWidget |
13 | 14 |
|
14 | 15 | import plotpy |
| 16 | +from plotpy.config import _ |
15 | 17 |
|
16 | 18 |
|
17 | | -def about(html=True, copyright_only=False): |
18 | | - """Return text about this package""" |
19 | | - python_version = "{} {}".format( |
20 | | - platform.python_version(), "64 bits" if sys.maxsize > 2**32 else "32 bits" |
21 | | - ) |
| 19 | +def about(html: bool = True, copyright_only: bool = False) -> str: |
| 20 | + """Return text about this package |
| 21 | +
|
| 22 | + Args: |
| 23 | + html: return html text. Defaults to True. |
| 24 | + copyright_only: if True, return only copyright |
| 25 | +
|
| 26 | + Returns: |
| 27 | + str: text about this package |
| 28 | + """ |
22 | 29 | shortdesc = ( |
23 | 30 | f"Plotpy {plotpy.__version__}\n\n" |
24 | 31 | f"Plotpy is a set of tools for curve and image plotting.\n" |
25 | 32 | f"Created by Pierre Raybaut." |
26 | 33 | ) |
27 | | - desc = ( |
28 | | - f"Copyright © 2023 CEA\n\nPython {python_version}, " |
29 | | - f"Qt {QC.__version__}, PythonQwt {QWT_VERSION_STR} on {platform.system()}" |
30 | | - ) |
| 34 | + addinfos = f"guidata {guidata.__version__}, PythonQwt {qwt.__version__}" |
| 35 | + desc = get_general_infos(addinfos) |
31 | 36 | if not copyright_only: |
32 | 37 | desc = f"{shortdesc}\n\n{desc}" |
33 | 38 | if html: |
34 | 39 | desc = desc.replace("\n", "<br />") |
35 | 40 | return desc |
| 41 | + |
| 42 | + |
| 43 | +def show_about_dialog(parent: QWidget) -> None: |
| 44 | + """Show ``plotpy`` about dialog |
| 45 | +
|
| 46 | + Args: |
| 47 | + parent (QWidget): parent widget |
| 48 | + """ |
| 49 | + QMessageBox.about(parent, _("About") + " plotpy", about(html=True)) |
0 commit comments