oasys2 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- oasys2-0.0.1/LICENSE.TXT +28 -0
- oasys2-0.0.1/MANIFEST.in +12 -0
- oasys2-0.0.1/PKG-INFO +30 -0
- oasys2-0.0.1/README.md +2 -0
- oasys2-0.0.1/oasys2/__init__.py +46 -0
- oasys2-0.0.1/oasys2/canvas/__init__.py +46 -0
- oasys2-0.0.1/oasys2/canvas/__main__.py +6 -0
- oasys2-0.0.1/oasys2/canvas/config.py +210 -0
- oasys2-0.0.1/oasys2/canvas/icons/oasys-splash-screen.png +0 -0
- oasys2-0.0.1/oasys2/canvas/icons/oasys.png +0 -0
- oasys2-0.0.1/oasys2/canvas/main.py +82 -0
- oasys2-0.0.1/oasys2/canvas/menus/__init__.py +1 -0
- oasys2-0.0.1/oasys2/canvas/menus/menu.py +93 -0
- oasys2-0.0.1/oasys2/canvas/styles/__init__.py +46 -0
- oasys2-0.0.1/oasys2/widget/__init__.py +46 -0
- oasys2-0.0.1/oasys2/widget/gui.py +386 -0
- oasys2-0.0.1/oasys2/widget/util/__init__.py +46 -0
- oasys2-0.0.1/oasys2/widget/util/congruence.py +111 -0
- oasys2-0.0.1/oasys2/widget/util/exchange.py +42 -0
- oasys2-0.0.1/oasys2/widget/util/oasys_util.py +165 -0
- oasys2-0.0.1/oasys2/widget/widget.py +159 -0
- oasys2-0.0.1/oasys2/widgets/__init__.py +79 -0
- oasys2-0.0.1/oasys2/widgets/loops/__init__.py +24 -0
- oasys2-0.0.1/oasys2/widgets/loops/icons/cycle.png +0 -0
- oasys2-0.0.1/oasys2/widgets/loops/icons/loops.png +0 -0
- oasys2-0.0.1/oasys2/widgets/loops/icons/pin.png +0 -0
- oasys2-0.0.1/oasys2/widgets/loops/ow_node_point.py +182 -0
- oasys2-0.0.1/oasys2/widgets/loops/ow_pin.py +50 -0
- oasys2-0.0.1/oasys2/widgets/test/__init__.py +70 -0
- oasys2-0.0.1/oasys2/widgets/test/icons/test.png +0 -0
- oasys2-0.0.1/oasys2/widgets/test/owtest.py +81 -0
- oasys2-0.0.1/oasys2.egg-info/PKG-INFO +30 -0
- oasys2-0.0.1/oasys2.egg-info/SOURCES.txt +40 -0
- oasys2-0.0.1/oasys2.egg-info/dependency_links.txt +1 -0
- oasys2-0.0.1/oasys2.egg-info/entry_points.txt +3 -0
- oasys2-0.0.1/oasys2.egg-info/requires.txt +4 -0
- oasys2-0.0.1/oasys2.egg-info/top_level.txt +1 -0
- oasys2-0.0.1/pyproject.toml +3 -0
- oasys2-0.0.1/setup.cfg +23 -0
- oasys2-0.0.1/setup.py +106 -0
oasys2-0.0.1/LICENSE.TXT
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025, Organization managing the OASYS project
|
|
4
|
+
|
|
5
|
+
Redistribution and use in source and binary forms, with or without
|
|
6
|
+
modification, are permitted provided that the following conditions are met:
|
|
7
|
+
|
|
8
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
9
|
+
list of conditions and the following disclaimer.
|
|
10
|
+
|
|
11
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
12
|
+
this list of conditions and the following disclaimer in the documentation
|
|
13
|
+
and/or other materials provided with the distribution.
|
|
14
|
+
|
|
15
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
16
|
+
contributors may be used to endorse or promote products derived from
|
|
17
|
+
this software without specific prior written permission.
|
|
18
|
+
|
|
19
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
20
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
21
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
22
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
23
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
24
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
25
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
26
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
27
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
28
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
oasys2-0.0.1/MANIFEST.in
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
include LICENSE.txt README.md
|
|
2
|
+
recursive-include oasys2 *.pyx *.py *.c *.cpp README* LICENSE
|
|
3
|
+
|
|
4
|
+
recursive-include oasys2/canvas *ico *.png *.svg *.ico
|
|
5
|
+
recursive-include oasys2/canvas/workflows *.ows
|
|
6
|
+
recursive-include oasys2/widgets *.png *.svg *.js *.css *.html
|
|
7
|
+
|
|
8
|
+
include README.md
|
|
9
|
+
include LICENSE.TXT
|
|
10
|
+
include setup.py
|
|
11
|
+
include setup.cfg
|
|
12
|
+
include pyproject.toml
|
oasys2-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: oasys2
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Core component of OASYS 2.0
|
|
5
|
+
Home-page: https://www.aps.anl.gov/Science/Scientific-Software/OASYS
|
|
6
|
+
Author: Manuel Sanchez del Rio & Luca Rebuffi
|
|
7
|
+
Author-email: lrebuffi@aps.gov
|
|
8
|
+
License: BSD3
|
|
9
|
+
Project-URL: Bug Reports, https://github.com/oasys-kit/OASYS2/issues
|
|
10
|
+
Project-URL: Source, https://github.com/oasys-kit/OASYS2
|
|
11
|
+
Project-URL: Documentation, https://orange-canvas-core.readthedocs.io/en/latest/
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
14
|
+
Classifier: Environment :: Console
|
|
15
|
+
Classifier: Environment :: Plugins
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Operating System :: POSIX
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
22
|
+
Classifier: Intended Audience :: Education
|
|
23
|
+
Classifier: Intended Audience :: Science/Research
|
|
24
|
+
Classifier: Intended Audience :: Developers
|
|
25
|
+
Requires-Python: >=3.11
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE.txt
|
|
28
|
+
|
|
29
|
+
# OASYS2
|
|
30
|
+
New release of OASYS, fully in python
|
oasys2-0.0.1/README.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ----------------------------------------------------------------------- #
|
|
4
|
+
# Copyright (c) 2025, UChicago Argonne, LLC. All rights reserved. #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright 2025. UChicago Argonne, LLC. This software was produced #
|
|
7
|
+
# under U.S. Government contract DE-AC02-06CH11357 for Argonne National #
|
|
8
|
+
# Laboratory (ANL), which is operated by UChicago Argonne, LLC for the #
|
|
9
|
+
# U.S. Department of Energy. The U.S. Government has rights to use, #
|
|
10
|
+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR #
|
|
11
|
+
# UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR #
|
|
12
|
+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is #
|
|
13
|
+
# modified to produce derivative works, such modified software should #
|
|
14
|
+
# be clearly marked, so as not to confuse it with the version available #
|
|
15
|
+
# from ANL. #
|
|
16
|
+
# #
|
|
17
|
+
# Additionally, redistribution and use in source and binary forms, with #
|
|
18
|
+
# or without modification, are permitted provided that the following #
|
|
19
|
+
# conditions are met: #
|
|
20
|
+
# #
|
|
21
|
+
# * Redistributions of source code must retain the above copyright #
|
|
22
|
+
# notice, this list of conditions and the following disclaimer. #
|
|
23
|
+
# #
|
|
24
|
+
# * Redistributions in binary form must reproduce the above copyright #
|
|
25
|
+
# notice, this list of conditions and the following disclaimer in #
|
|
26
|
+
# the documentation and/or other materials provided with the #
|
|
27
|
+
# distribution. #
|
|
28
|
+
# #
|
|
29
|
+
# * Neither the name of UChicago Argonne, LLC, Argonne National #
|
|
30
|
+
# Laboratory, ANL, the U.S. Government, nor the names of its #
|
|
31
|
+
# contributors may be used to endorse or promote products derived #
|
|
32
|
+
# from this software without specific prior written permission. #
|
|
33
|
+
# #
|
|
34
|
+
# THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS #
|
|
35
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
|
|
36
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #
|
|
37
|
+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago #
|
|
38
|
+
# Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #
|
|
39
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #
|
|
40
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
|
|
41
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
|
|
42
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #
|
|
43
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
|
|
44
|
+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
45
|
+
# POSSIBILITY OF SUCH DAMAGE. #
|
|
46
|
+
# ----------------------------------------------------------------------- #
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ----------------------------------------------------------------------- #
|
|
4
|
+
# Copyright (c) 2025, UChicago Argonne, LLC. All rights reserved. #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright 2025. UChicago Argonne, LLC. This software was produced #
|
|
7
|
+
# under U.S. Government contract DE-AC02-06CH11357 for Argonne National #
|
|
8
|
+
# Laboratory (ANL), which is operated by UChicago Argonne, LLC for the #
|
|
9
|
+
# U.S. Department of Energy. The U.S. Government has rights to use, #
|
|
10
|
+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR #
|
|
11
|
+
# UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR #
|
|
12
|
+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is #
|
|
13
|
+
# modified to produce derivative works, such modified software should #
|
|
14
|
+
# be clearly marked, so as not to confuse it with the version available #
|
|
15
|
+
# from ANL. #
|
|
16
|
+
# #
|
|
17
|
+
# Additionally, redistribution and use in source and binary forms, with #
|
|
18
|
+
# or without modification, are permitted provided that the following #
|
|
19
|
+
# conditions are met: #
|
|
20
|
+
# #
|
|
21
|
+
# * Redistributions of source code must retain the above copyright #
|
|
22
|
+
# notice, this list of conditions and the following disclaimer. #
|
|
23
|
+
# #
|
|
24
|
+
# * Redistributions in binary form must reproduce the above copyright #
|
|
25
|
+
# notice, this list of conditions and the following disclaimer in #
|
|
26
|
+
# the documentation and/or other materials provided with the #
|
|
27
|
+
# distribution. #
|
|
28
|
+
# #
|
|
29
|
+
# * Neither the name of UChicago Argonne, LLC, Argonne National #
|
|
30
|
+
# Laboratory, ANL, the U.S. Government, nor the names of its #
|
|
31
|
+
# contributors may be used to endorse or promote products derived #
|
|
32
|
+
# from this software without specific prior written permission. #
|
|
33
|
+
# #
|
|
34
|
+
# THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS #
|
|
35
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
|
|
36
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #
|
|
37
|
+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago #
|
|
38
|
+
# Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #
|
|
39
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #
|
|
40
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
|
|
41
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
|
|
42
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #
|
|
43
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
|
|
44
|
+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
45
|
+
# POSSIBILITY OF SUCH DAMAGE. #
|
|
46
|
+
# ----------------------------------------------------------------------- #
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ----------------------------------------------------------------------- #
|
|
4
|
+
# Copyright (c) 2025, UChicago Argonne, LLC. All rights reserved. #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright 2025. UChicago Argonne, LLC. This software was produced #
|
|
7
|
+
# under U.S. Government contract DE-AC02-06CH11357 for Argonne National #
|
|
8
|
+
# Laboratory (ANL), which is operated by UChicago Argonne, LLC for the #
|
|
9
|
+
# U.S. Department of Energy. The U.S. Government has rights to use, #
|
|
10
|
+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR #
|
|
11
|
+
# UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR #
|
|
12
|
+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is #
|
|
13
|
+
# modified to produce derivative works, such modified software should #
|
|
14
|
+
# be clearly marked, so as not to confuse it with the version available #
|
|
15
|
+
# from ANL. #
|
|
16
|
+
# #
|
|
17
|
+
# Additionally, redistribution and use in source and binary forms, with #
|
|
18
|
+
# or without modification, are permitted provided that the following #
|
|
19
|
+
# conditions are met: #
|
|
20
|
+
# #
|
|
21
|
+
# * Redistributions of source code must retain the above copyright #
|
|
22
|
+
# notice, this list of conditions and the following disclaimer. #
|
|
23
|
+
# #
|
|
24
|
+
# * Redistributions in binary form must reproduce the above copyright #
|
|
25
|
+
# notice, this list of conditions and the following disclaimer in #
|
|
26
|
+
# the documentation and/or other materials provided with the #
|
|
27
|
+
# distribution. #
|
|
28
|
+
# #
|
|
29
|
+
# * Neither the name of UChicago Argonne, LLC, Argonne National #
|
|
30
|
+
# Laboratory, ANL, the U.S. Government, nor the names of its #
|
|
31
|
+
# contributors may be used to endorse or promote products derived #
|
|
32
|
+
# from this software without specific prior written permission. #
|
|
33
|
+
# #
|
|
34
|
+
# THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS #
|
|
35
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
|
|
36
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #
|
|
37
|
+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago #
|
|
38
|
+
# Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #
|
|
39
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #
|
|
40
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
|
|
41
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
|
|
42
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #
|
|
43
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
|
|
44
|
+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
45
|
+
# POSSIBILITY OF SUCH DAMAGE. #
|
|
46
|
+
# ----------------------------------------------------------------------- #
|
|
47
|
+
import os
|
|
48
|
+
import sys
|
|
49
|
+
import logging
|
|
50
|
+
import warnings
|
|
51
|
+
import typing
|
|
52
|
+
import pkgutil
|
|
53
|
+
|
|
54
|
+
from typing import Dict, Optional, Tuple, List, Union, Iterable, Any
|
|
55
|
+
|
|
56
|
+
import packaging.version
|
|
57
|
+
|
|
58
|
+
from AnyQt.QtGui import (
|
|
59
|
+
QPainter, QFont, QFontMetrics, QColor, QPixmap, QImage, QIcon
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
from AnyQt.QtCore import (
|
|
63
|
+
Qt, QCoreApplication, QPoint, QRect
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
from orangecanvas.utils.pkgmeta import EntryPoint, entry_points
|
|
67
|
+
|
|
68
|
+
import orangecanvas.config as orangeconfig
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
#: Entry point by which widgets are registered.
|
|
72
|
+
WIDGETS_ENTRY = "oasys2.widgets"
|
|
73
|
+
MENU_ENTRY = "oasys2.menus"
|
|
74
|
+
|
|
75
|
+
#: Entry point by which add-ons register with importlib.metadata
|
|
76
|
+
ADDONS_ENTRY = "oasys2.addon"
|
|
77
|
+
|
|
78
|
+
#: Parameters for searching add-on packages in PyPi using xmlrpc api.
|
|
79
|
+
ADDON_PYPI_SEARCH_SPEC = {"keywords": ["oasys2", "add-on"]}
|
|
80
|
+
|
|
81
|
+
EXAMPLE_WORKFLOWS_ENTRY = "oasys2.examples"
|
|
82
|
+
|
|
83
|
+
class Default(orangeconfig.Config):
|
|
84
|
+
|
|
85
|
+
OrganizationDomain = "Oasys Organization"
|
|
86
|
+
ApplicationName = "Oasys"
|
|
87
|
+
ApplicationVersion = "2.0"
|
|
88
|
+
|
|
89
|
+
@staticmethod
|
|
90
|
+
def application_icon():
|
|
91
|
+
"""
|
|
92
|
+
Return the main application icon.
|
|
93
|
+
"""
|
|
94
|
+
contents = pkgutil.get_data(__name__, "icons/oasys.png")
|
|
95
|
+
img = QImage.fromData(contents, "png")
|
|
96
|
+
pm = QPixmap.fromImage(img)
|
|
97
|
+
return QIcon(pm)
|
|
98
|
+
|
|
99
|
+
@staticmethod
|
|
100
|
+
def splash_screen():
|
|
101
|
+
# type: () -> Tuple[QPixmap, QRect]
|
|
102
|
+
"""
|
|
103
|
+
Return a splash screen pixmap and an text area within it.
|
|
104
|
+
|
|
105
|
+
The text area is used for displaying text messages during application
|
|
106
|
+
startup.
|
|
107
|
+
|
|
108
|
+
The default implementation returns a bland rectangle splash screen.
|
|
109
|
+
|
|
110
|
+
Returns
|
|
111
|
+
-------
|
|
112
|
+
t : Tuple[QPixmap, QRect]
|
|
113
|
+
A QPixmap and a rect area within it.
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
contents = pkgutil.get_data(__name__, "icons/oasys-splash-screen.png")
|
|
117
|
+
img = QImage.fromData(contents, "png")
|
|
118
|
+
pm = QPixmap.fromImage(img)
|
|
119
|
+
version = QCoreApplication.applicationVersion()
|
|
120
|
+
if version:
|
|
121
|
+
version_parsed = packaging.version.Version(version)
|
|
122
|
+
version_comp = version_parsed.release
|
|
123
|
+
version = ".".join(map(str, version_comp[:2]))
|
|
124
|
+
size = 21 if len(version) < 5 else 16
|
|
125
|
+
font = QFont()
|
|
126
|
+
font.setPixelSize(size)
|
|
127
|
+
font.setBold(True)
|
|
128
|
+
font.setItalic(True)
|
|
129
|
+
font.setLetterSpacing(QFont.AbsoluteSpacing, 2)
|
|
130
|
+
metrics = QFontMetrics(font)
|
|
131
|
+
br = metrics.boundingRect(version).adjusted(-5, 0, 5, 0)
|
|
132
|
+
#br.moveBottomRight(QPoint(pm.width() - 15, pm.height() - 15))
|
|
133
|
+
br.moveCenter(QPoint(412, 214))
|
|
134
|
+
|
|
135
|
+
p = QPainter(pm)
|
|
136
|
+
p.setRenderHint(QPainter.Antialiasing)
|
|
137
|
+
p.setRenderHint(QPainter.TextAntialiasing)
|
|
138
|
+
p.setFont(font)
|
|
139
|
+
p.setPen(QColor("#231F20"))
|
|
140
|
+
p.drawText(br, Qt.AlignCenter, version)
|
|
141
|
+
p.end()
|
|
142
|
+
textarea = QRect(15, 15, 170, 20)
|
|
143
|
+
return pm, textarea
|
|
144
|
+
|
|
145
|
+
@staticmethod
|
|
146
|
+
def widgets_entry_points() -> Iterable[EntryPoint]:
|
|
147
|
+
"""
|
|
148
|
+
Return an iterator over entry points defining the set of
|
|
149
|
+
'nodes/widgets' available to the workflow model.
|
|
150
|
+
"""
|
|
151
|
+
return iter(entry_points(group=WIDGETS_ENTRY))
|
|
152
|
+
|
|
153
|
+
@staticmethod
|
|
154
|
+
def addon_entry_points() -> Iterable[EntryPoint]:
|
|
155
|
+
return iter(entry_points(group=ADDONS_ENTRY))
|
|
156
|
+
|
|
157
|
+
@staticmethod
|
|
158
|
+
def addon_pypi_search_spec():
|
|
159
|
+
return dict(ADDON_PYPI_SEARCH_SPEC)
|
|
160
|
+
|
|
161
|
+
@staticmethod
|
|
162
|
+
def addon_defaults_list(session=None):
|
|
163
|
+
"""
|
|
164
|
+
Return a list of default add-ons.
|
|
165
|
+
|
|
166
|
+
The return value must be a list with meta description following the
|
|
167
|
+
`PyPI JSON api`_ specification. At the minimum 'info.name' and
|
|
168
|
+
'info.version' must be supplied. e.g.
|
|
169
|
+
|
|
170
|
+
`[{'info': {'name': 'Super Pkg', 'version': '4.2'}}]
|
|
171
|
+
|
|
172
|
+
.. _`PyPI JSON api`:
|
|
173
|
+
https://warehouse.readthedocs.io/api-reference/json/
|
|
174
|
+
"""
|
|
175
|
+
return []
|
|
176
|
+
|
|
177
|
+
@staticmethod
|
|
178
|
+
def core_packages():
|
|
179
|
+
# type: () -> List[str]
|
|
180
|
+
"""
|
|
181
|
+
Return a list of core packages.
|
|
182
|
+
|
|
183
|
+
List of packages that are core of the product. Most importantly,
|
|
184
|
+
if they themselves define add-on/plugin entry points they must
|
|
185
|
+
not be 'uninstalled' via a package manager, they can only be
|
|
186
|
+
updated.
|
|
187
|
+
|
|
188
|
+
Return
|
|
189
|
+
------
|
|
190
|
+
packages : List[str]
|
|
191
|
+
A list of package names (can also contain PEP-440 version
|
|
192
|
+
specifiers).
|
|
193
|
+
"""
|
|
194
|
+
return ["orange-canvas-core >= 0.0, < 0.1a"]
|
|
195
|
+
|
|
196
|
+
@staticmethod
|
|
197
|
+
def examples_entry_points():
|
|
198
|
+
return iter(entry_points(group=EXAMPLE_WORKFLOWS_ENTRY))
|
|
199
|
+
|
|
200
|
+
@staticmethod
|
|
201
|
+
def widget_discovery(*args, **kwargs):
|
|
202
|
+
from orangecanvas import registry
|
|
203
|
+
return registry.WidgetDiscovery(*args, **kwargs)
|
|
204
|
+
|
|
205
|
+
@staticmethod
|
|
206
|
+
def workflow_constructor(*args, **kwargs):
|
|
207
|
+
from orangecanvas import scheme
|
|
208
|
+
return scheme.Scheme(*args, **kwargs)
|
|
209
|
+
|
|
210
|
+
orangeconfig.default = Default()
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"""
|
|
2
|
+
"""
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
import logging
|
|
6
|
+
import pickle
|
|
7
|
+
import time
|
|
8
|
+
|
|
9
|
+
from orangecanvas import localization
|
|
10
|
+
from orangecanvas import utils, config
|
|
11
|
+
|
|
12
|
+
from orangecanvas.registry import WidgetRegistry
|
|
13
|
+
from orangecanvas.registry.qt import QtRegistryHandler
|
|
14
|
+
from orangecanvas.registry import cache
|
|
15
|
+
|
|
16
|
+
log = logging.getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
from orangecanvas.main import Main as OrangeMain
|
|
19
|
+
from oasys2.canvas import config as oasysconfig
|
|
20
|
+
|
|
21
|
+
class Main(OrangeMain):
|
|
22
|
+
def __init__(self):
|
|
23
|
+
super(Main, self).__init__()
|
|
24
|
+
|
|
25
|
+
def activate_default_config(self):
|
|
26
|
+
"""
|
|
27
|
+
Activate the default configuration (:mod:`config`)
|
|
28
|
+
"""
|
|
29
|
+
cfg = oasysconfig.Default()
|
|
30
|
+
self.config = cfg
|
|
31
|
+
config.set_default(cfg)
|
|
32
|
+
# Init config
|
|
33
|
+
config.init()
|
|
34
|
+
|
|
35
|
+
def run_discovery(self) -> WidgetRegistry:
|
|
36
|
+
"""
|
|
37
|
+
Run the widget discovery and return the resulting registry.
|
|
38
|
+
"""
|
|
39
|
+
options = self.options
|
|
40
|
+
language_changed = localization.language_changed()
|
|
41
|
+
if not (options.force_discovery or language_changed):
|
|
42
|
+
reg_cache = cache.registry_cache()
|
|
43
|
+
else:
|
|
44
|
+
reg_cache = None
|
|
45
|
+
|
|
46
|
+
widget_registry = WidgetRegistry()
|
|
47
|
+
handler = QtRegistryHandler(registry=widget_registry)
|
|
48
|
+
handler.found_category.connect(
|
|
49
|
+
lambda cd: self.show_splash_message(cd.name)
|
|
50
|
+
)
|
|
51
|
+
widget_discovery = self.config.widget_discovery(
|
|
52
|
+
handler, cached_descriptions=reg_cache
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
if widget_discovery.cached_descriptions is None or len(widget_discovery.cached_descriptions.keys()) == 1:
|
|
56
|
+
self.show_splash_message("Welcome to OASYS")
|
|
57
|
+
|
|
58
|
+
cache_filename = os.path.join(config.cache_dir(), "widget-registry.pck")
|
|
59
|
+
if options.no_discovery:
|
|
60
|
+
with open(cache_filename, "rb") as f:
|
|
61
|
+
widget_registry = pickle.load(f)
|
|
62
|
+
widget_registry = WidgetRegistry(widget_registry)
|
|
63
|
+
else:
|
|
64
|
+
widget_discovery.run(self.config.widgets_entry_points())
|
|
65
|
+
|
|
66
|
+
# Store cached descriptions
|
|
67
|
+
cache.save_registry_cache(widget_discovery.cached_descriptions)
|
|
68
|
+
with open(cache_filename, "wb") as f:
|
|
69
|
+
pickle.dump(WidgetRegistry(widget_registry), f)
|
|
70
|
+
self.registry = widget_registry
|
|
71
|
+
if language_changed:
|
|
72
|
+
localization.update_last_used_language()
|
|
73
|
+
self.close_splash_screen()
|
|
74
|
+
return widget_registry
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def main(argv=None):
|
|
78
|
+
return Main().run(argv)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
if __name__ == "__main__":
|
|
82
|
+
sys.exit(main())
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__author__ = 'labx'
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
__author__ = 'labx'
|
|
2
|
+
__menu__="just for discovery"
|
|
3
|
+
|
|
4
|
+
SEPARATOR = "OMENU_SEPARATOR"
|
|
5
|
+
OPEN_CONTAINER = "OPEN_CONTAINER"
|
|
6
|
+
CLOSE_CONTAINER = "CLOSE_CONTAINER"
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
from PyQt5 import QtWidgets
|
|
10
|
+
from orangecanvas.scheme.link import SchemeLink
|
|
11
|
+
|
|
12
|
+
class OMenu():
|
|
13
|
+
|
|
14
|
+
def __init__(self, name="NewMenu"):
|
|
15
|
+
self.name = name
|
|
16
|
+
self.canvas_main_window=None
|
|
17
|
+
self.sub_menu_names = []
|
|
18
|
+
|
|
19
|
+
def setCanvasMainWindow(self, canvas_main_window):
|
|
20
|
+
self.canvas_main_window = canvas_main_window
|
|
21
|
+
|
|
22
|
+
def addSubMenu(self, name):
|
|
23
|
+
self.sub_menu_names.append(name)
|
|
24
|
+
|
|
25
|
+
def addSeparator(self):
|
|
26
|
+
self.sub_menu_names.append(SEPARATOR)
|
|
27
|
+
|
|
28
|
+
def openContainer(self):
|
|
29
|
+
self.sub_menu_names.append(OPEN_CONTAINER)
|
|
30
|
+
|
|
31
|
+
def closeContainer(self):
|
|
32
|
+
self.sub_menu_names.append(CLOSE_CONTAINER)
|
|
33
|
+
|
|
34
|
+
def addContainer(self, name):
|
|
35
|
+
self.sub_menu_names.append(name)
|
|
36
|
+
|
|
37
|
+
def isSeparator(self, name):
|
|
38
|
+
return name == SEPARATOR
|
|
39
|
+
|
|
40
|
+
def isOpenContainer(self, name):
|
|
41
|
+
return name == OPEN_CONTAINER
|
|
42
|
+
|
|
43
|
+
def isCloseContainer(self, name):
|
|
44
|
+
return name == CLOSE_CONTAINER
|
|
45
|
+
|
|
46
|
+
def getSubMenuNamesList(self):
|
|
47
|
+
return self.sub_menu_names
|
|
48
|
+
|
|
49
|
+
def showConfirmMessage(self, message, informative_text=None):
|
|
50
|
+
msgBox = QtWidgets.QMessageBox()
|
|
51
|
+
msgBox.setIcon(QtWidgets.QMessageBox.Question)
|
|
52
|
+
msgBox.setText(message)
|
|
53
|
+
msgBox.setInformativeText(message if informative_text is None else informative_text)
|
|
54
|
+
msgBox.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)
|
|
55
|
+
msgBox.setDefaultButton(QtWidgets.QMessageBox.No)
|
|
56
|
+
ret = msgBox.exec_()
|
|
57
|
+
return ret
|
|
58
|
+
|
|
59
|
+
def showWarningMessage(self, message):
|
|
60
|
+
msgBox = QtWidgets.QMessageBox()
|
|
61
|
+
msgBox.setIcon(QtWidgets.QMessageBox.Warning)
|
|
62
|
+
msgBox.setText(message)
|
|
63
|
+
msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
64
|
+
msgBox.exec_()
|
|
65
|
+
|
|
66
|
+
def showCriticalMessage(self, message):
|
|
67
|
+
msgBox = QtWidgets.QMessageBox()
|
|
68
|
+
msgBox.setIcon(QtWidgets.QMessageBox.Critical)
|
|
69
|
+
msgBox.setText(message)
|
|
70
|
+
msgBox.setStandardButtons(QtWidgets.QMessageBox.Ok)
|
|
71
|
+
msgBox.exec_()
|
|
72
|
+
|
|
73
|
+
def getWidgetFromNode(self, node):
|
|
74
|
+
return self.canvas_main_window.current_document().scheme().widget_for_node(node)
|
|
75
|
+
|
|
76
|
+
def createLinks(self, nodes, excluded_names=[], source_channel="In", sink_channel="Out"):
|
|
77
|
+
previous_node = None
|
|
78
|
+
for node in nodes:
|
|
79
|
+
if not (isinstance(node, str) and node in excluded_names):
|
|
80
|
+
if not previous_node is None :
|
|
81
|
+
if not (isinstance(previous_node, str) and previous_node in excluded_names):
|
|
82
|
+
link = SchemeLink(source_node=previous_node, source_channel=source_channel, sink_node=node, sink_channel=sink_channel)
|
|
83
|
+
self.canvas_main_window.current_document().addLink(link=link)
|
|
84
|
+
previous_node = node
|
|
85
|
+
|
|
86
|
+
def getWidgetDesc(self, widget_name, excluded_names=[]):
|
|
87
|
+
if widget_name in excluded_names: return widget_name
|
|
88
|
+
else: return self.canvas_main_window.widget_registry.widget(widget_name)
|
|
89
|
+
|
|
90
|
+
def createNewNode(self, widget_desc):
|
|
91
|
+
return self.canvas_main_window.current_document().createNewNode(widget_desc)
|
|
92
|
+
|
|
93
|
+
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ----------------------------------------------------------------------- #
|
|
4
|
+
# Copyright (c) 2025, UChicago Argonne, LLC. All rights reserved. #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright 2025. UChicago Argonne, LLC. This software was produced #
|
|
7
|
+
# under U.S. Government contract DE-AC02-06CH11357 for Argonne National #
|
|
8
|
+
# Laboratory (ANL), which is operated by UChicago Argonne, LLC for the #
|
|
9
|
+
# U.S. Department of Energy. The U.S. Government has rights to use, #
|
|
10
|
+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR #
|
|
11
|
+
# UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR #
|
|
12
|
+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is #
|
|
13
|
+
# modified to produce derivative works, such modified software should #
|
|
14
|
+
# be clearly marked, so as not to confuse it with the version available #
|
|
15
|
+
# from ANL. #
|
|
16
|
+
# #
|
|
17
|
+
# Additionally, redistribution and use in source and binary forms, with #
|
|
18
|
+
# or without modification, are permitted provided that the following #
|
|
19
|
+
# conditions are met: #
|
|
20
|
+
# #
|
|
21
|
+
# * Redistributions of source code must retain the above copyright #
|
|
22
|
+
# notice, this list of conditions and the following disclaimer. #
|
|
23
|
+
# #
|
|
24
|
+
# * Redistributions in binary form must reproduce the above copyright #
|
|
25
|
+
# notice, this list of conditions and the following disclaimer in #
|
|
26
|
+
# the documentation and/or other materials provided with the #
|
|
27
|
+
# distribution. #
|
|
28
|
+
# #
|
|
29
|
+
# * Neither the name of UChicago Argonne, LLC, Argonne National #
|
|
30
|
+
# Laboratory, ANL, the U.S. Government, nor the names of its #
|
|
31
|
+
# contributors may be used to endorse or promote products derived #
|
|
32
|
+
# from this software without specific prior written permission. #
|
|
33
|
+
# #
|
|
34
|
+
# THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS #
|
|
35
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
|
|
36
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #
|
|
37
|
+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago #
|
|
38
|
+
# Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #
|
|
39
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #
|
|
40
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
|
|
41
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
|
|
42
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #
|
|
43
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
|
|
44
|
+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
45
|
+
# POSSIBILITY OF SUCH DAMAGE. #
|
|
46
|
+
# ----------------------------------------------------------------------- #
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# ----------------------------------------------------------------------- #
|
|
4
|
+
# Copyright (c) 2025, UChicago Argonne, LLC. All rights reserved. #
|
|
5
|
+
# #
|
|
6
|
+
# Copyright 2025. UChicago Argonne, LLC. This software was produced #
|
|
7
|
+
# under U.S. Government contract DE-AC02-06CH11357 for Argonne National #
|
|
8
|
+
# Laboratory (ANL), which is operated by UChicago Argonne, LLC for the #
|
|
9
|
+
# U.S. Department of Energy. The U.S. Government has rights to use, #
|
|
10
|
+
# reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR #
|
|
11
|
+
# UChicago Argonne, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR #
|
|
12
|
+
# ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is #
|
|
13
|
+
# modified to produce derivative works, such modified software should #
|
|
14
|
+
# be clearly marked, so as not to confuse it with the version available #
|
|
15
|
+
# from ANL. #
|
|
16
|
+
# #
|
|
17
|
+
# Additionally, redistribution and use in source and binary forms, with #
|
|
18
|
+
# or without modification, are permitted provided that the following #
|
|
19
|
+
# conditions are met: #
|
|
20
|
+
# #
|
|
21
|
+
# * Redistributions of source code must retain the above copyright #
|
|
22
|
+
# notice, this list of conditions and the following disclaimer. #
|
|
23
|
+
# #
|
|
24
|
+
# * Redistributions in binary form must reproduce the above copyright #
|
|
25
|
+
# notice, this list of conditions and the following disclaimer in #
|
|
26
|
+
# the documentation and/or other materials provided with the #
|
|
27
|
+
# distribution. #
|
|
28
|
+
# #
|
|
29
|
+
# * Neither the name of UChicago Argonne, LLC, Argonne National #
|
|
30
|
+
# Laboratory, ANL, the U.S. Government, nor the names of its #
|
|
31
|
+
# contributors may be used to endorse or promote products derived #
|
|
32
|
+
# from this software without specific prior written permission. #
|
|
33
|
+
# #
|
|
34
|
+
# THIS SOFTWARE IS PROVIDED BY UChicago Argonne, LLC AND CONTRIBUTORS #
|
|
35
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT #
|
|
36
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS #
|
|
37
|
+
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL UChicago #
|
|
38
|
+
# Argonne, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, #
|
|
39
|
+
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, #
|
|
40
|
+
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #
|
|
41
|
+
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER #
|
|
42
|
+
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT #
|
|
43
|
+
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN #
|
|
44
|
+
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE #
|
|
45
|
+
# POSSIBILITY OF SUCH DAMAGE. #
|
|
46
|
+
# ----------------------------------------------------------------------- #
|