squap 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.
- squap-0.0.1/LICENSE +21 -0
- squap-0.0.1/PKG-INFO +19 -0
- squap-0.0.1/README.md +2 -0
- squap-0.0.1/pyproject.toml +24 -0
- squap-0.0.1/setup.cfg +4 -0
- squap-0.0.1/setup.py +9 -0
- squap-0.0.1/squap/__init__.py +480 -0
- squap-0.0.1/squap/__init__.pyi +71 -0
- squap-0.0.1/squap/customisation.py +317 -0
- squap-0.0.1/squap/helper_funcs.py +214 -0
- squap-0.0.1/squap/variables.py +27 -0
- squap-0.0.1/squap/widgets/__init__.py +11 -0
- squap-0.0.1/squap/widgets/input_widget.py +1507 -0
- squap-0.0.1/squap/widgets/main_window.py +793 -0
- squap-0.0.1/squap/widgets/plot_manager.py +187 -0
- squap-0.0.1/squap/widgets/plot_widget.py +1194 -0
- squap-0.0.1/squap/widgets/table_manager.py +212 -0
- squap-0.0.1/squap.egg-info/PKG-INFO +19 -0
- squap-0.0.1/squap.egg-info/SOURCES.txt +19 -0
- squap-0.0.1/squap.egg-info/dependency_links.txt +1 -0
- squap-0.0.1/squap.egg-info/top_level.txt +1 -0
squap-0.0.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Rik Mulder
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
squap-0.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: squap
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Package for animated plots, focussed on simplicity and speed.
|
|
5
|
+
Author-email: Rik Mulder <rikmulder7@proton.me>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: documentation, https://squap.readthedocs.io/en/latest/
|
|
8
|
+
Project-URL: source, https://github.com/squaplib/squap
|
|
9
|
+
Classifier: Development Status :: 2 - Pre-Alpha
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Operating System :: OS Independent
|
|
12
|
+
Requires-Python: >=3.9
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
License-File: LICENSE
|
|
15
|
+
Dynamic: license-file
|
|
16
|
+
Dynamic: requires-python
|
|
17
|
+
|
|
18
|
+
# squap
|
|
19
|
+
A python package for animated plots, focussed on simplicity and speed. Its name stands for Simple QUick Animated Plots. It is based on pyqtgraph using PySide6. It is much simpler and user-friendly than pyqtgraph, sacrificing as little performance as possible.
|
squap-0.0.1/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "squap"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
authors = [
|
|
9
|
+
{ name="Rik Mulder", email="rikmulder7@proton.me" },
|
|
10
|
+
]
|
|
11
|
+
description = "Package for animated plots, focussed on simplicity and speed."
|
|
12
|
+
readme = "README.md"
|
|
13
|
+
requires-python = ">=3.9"
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
]
|
|
19
|
+
license = "MIT"
|
|
20
|
+
license-files = ["LICEN[CS]E*"]
|
|
21
|
+
|
|
22
|
+
[project.urls]
|
|
23
|
+
documentation = "https://squap.readthedocs.io/en/latest/"
|
|
24
|
+
source = "https://github.com/squaplib/squap"
|
squap-0.0.1/setup.cfg
ADDED
squap-0.0.1/setup.py
ADDED
|
@@ -0,0 +1,480 @@
|
|
|
1
|
+
# starts off by creating an instance of main_window, containing a plot widget.
|
|
2
|
+
from typing import Callable, Iterable # Iterable is necessary for docs compiler
|
|
3
|
+
|
|
4
|
+
from . import widgets
|
|
5
|
+
from .widgets import (MainWindow, PlotManager, TableManager, PlotWidget, InputTable, Box, PlotCurve, ErrorbarCurve,
|
|
6
|
+
TextCurve, InfLine, ImageCurve, GridCurve)
|
|
7
|
+
from .variables import Variables
|
|
8
|
+
from .customisation import get_font, get_gradient, get_cmap, cmap_to_colors
|
|
9
|
+
from .helper_funcs import ColorType, ColorsType
|
|
10
|
+
|
|
11
|
+
import functools # for copy_docstring decorator
|
|
12
|
+
import inspect
|
|
13
|
+
|
|
14
|
+
from pyqtgraph import setConfigOption
|
|
15
|
+
from PySide6.QtCore import QTimer
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
"widgets", "ColorType", "ColorsType", # things not in __init__.pyi
|
|
19
|
+
"var", "plot", "scatter", "errorbar", "set_xlim", "set_ylim", "xlim", "ylim", "legend", "set_title", "lock_zoom", "subplots",
|
|
20
|
+
"remove_item", "get_gradient", "get_cmap", "inf_dline", "inf_hline", "inf_vline", "grid", "plot_text", "merge_plots", "set_interval",
|
|
21
|
+
"on_refresh", "on_mouse_click", "on_mouse_move", "get_mouse_pos", "on_key_press", "add_slider", "add_checkbox", "add_inputbox", "add_button",
|
|
22
|
+
"add_dropdown", "add_rate_slider", "link_boxes", "add_input_table", "set_active_tab", "rename_tab", "get_all_boxes", "display_fps", "resize", "benchmark", "set_input_width",
|
|
23
|
+
"set_input_partition", "is_alive", "refresh", "show_window", "show", "clear", "export", "export_video", "start_recording", "get_font",
|
|
24
|
+
"cmap_to_colors"
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
_window = None
|
|
28
|
+
_input_table = None
|
|
29
|
+
_table_manager = None
|
|
30
|
+
var = Variables()
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _copy_docstring(method):
|
|
34
|
+
def decorator(func):
|
|
35
|
+
original_module = func.__module__
|
|
36
|
+
sig = inspect.signature(method)
|
|
37
|
+
params = list(sig.parameters.values())
|
|
38
|
+
if params and params[0].name == 'self':
|
|
39
|
+
params = params[1:]
|
|
40
|
+
new_sig = sig.replace(parameters=params)
|
|
41
|
+
functools.update_wrapper(func, method)
|
|
42
|
+
if hasattr(func, '__wrapped__'):
|
|
43
|
+
del func.__wrapped__
|
|
44
|
+
func.__module__ = original_module
|
|
45
|
+
func.__signature__ = new_sig
|
|
46
|
+
return func
|
|
47
|
+
return decorator
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def get_window() -> MainWindow:
|
|
51
|
+
global _window
|
|
52
|
+
if _window is None:
|
|
53
|
+
_window = widgets.MainWindow(var)
|
|
54
|
+
return _window
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def get_input_table() -> InputTable:
|
|
58
|
+
global _input_table
|
|
59
|
+
if _input_table is None:
|
|
60
|
+
if get_window().table_manager.main_input_widget: # it is possible to init table widget without this function
|
|
61
|
+
_input_table = get_window().table_manager.main_input_widget
|
|
62
|
+
else:
|
|
63
|
+
_input_table = get_window().init_first_tab()
|
|
64
|
+
return _input_table
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def get_table_manager():
|
|
68
|
+
"""Makes sure that when a function from table_manager is called, the input table is initialised."""
|
|
69
|
+
global _table_manager
|
|
70
|
+
if _table_manager is None:
|
|
71
|
+
get_input_table()
|
|
72
|
+
_table_manager = get_window().table_manager
|
|
73
|
+
return _table_manager
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
# <editor-fold desc="wrapped functions">
|
|
77
|
+
@_copy_docstring(widgets.PlotWidget.plot)
|
|
78
|
+
def plot(*args, **kwargs):
|
|
79
|
+
return get_window().plot_manager.plot_widget.plot(*args, **kwargs)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@_copy_docstring(widgets.PlotWidget.scatter)
|
|
83
|
+
def scatter(*args, **kwargs):
|
|
84
|
+
return get_window().plot_manager.plot_widget.scatter(*args, **kwargs)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@_copy_docstring(widgets.PlotWidget.errorbar)
|
|
88
|
+
def errorbar(*args, **kwargs):
|
|
89
|
+
return get_window().plot_manager.plot_widget.errorbar(*args, **kwargs)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@_copy_docstring(widgets.PlotWidget.inf_dline)
|
|
93
|
+
def inf_dline(*args, **kwargs):
|
|
94
|
+
return get_window().plot_manager.plot_widget.inf_dline(*args, **kwargs)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@_copy_docstring(widgets.PlotWidget.inf_hline)
|
|
98
|
+
def inf_hline(*args, **kwargs):
|
|
99
|
+
return get_window().plot_manager.plot_widget.inf_hline(*args, **kwargs)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
@_copy_docstring(widgets.PlotWidget.inf_vline)
|
|
103
|
+
def inf_vline(*args, **kwargs):
|
|
104
|
+
return get_window().plot_manager.plot_widget.inf_vline(*args, **kwargs)
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@_copy_docstring(widgets.PlotWidget.grid)
|
|
108
|
+
def grid(*args, **kwargs):
|
|
109
|
+
return get_window().plot_manager.plot_widget.grid(*args, **kwargs)
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
@_copy_docstring(widgets.PlotWidget.plot_text)
|
|
113
|
+
def plot_text(*args, **kwargs):
|
|
114
|
+
return get_window().plot_manager.plot_widget.plot_text(*args, **kwargs)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
@_copy_docstring(widgets.PlotWidget.imshow)
|
|
118
|
+
def imshow(*args, **kwargs):
|
|
119
|
+
return get_window().plot_manager.plot_widget.imshow(*args, **kwargs)
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
@_copy_docstring(widgets.PlotWidget.set_xlim)
|
|
123
|
+
def set_xlim(*args, **kwargs):
|
|
124
|
+
return get_window().plot_manager.plot_widget.set_xlim(*args, **kwargs)
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
@_copy_docstring(widgets.PlotWidget.set_ylim)
|
|
128
|
+
def set_ylim(*args, **kwargs):
|
|
129
|
+
return get_window().plot_manager.plot_widget.set_ylim(*args, **kwargs)
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
@_copy_docstring(widgets.PlotWidget.xlim)
|
|
133
|
+
def xlim(*args, **kwargs):
|
|
134
|
+
return get_window().plot_manager.plot_widget.xlim(*args, **kwargs)
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
@_copy_docstring(widgets.PlotWidget.ylim)
|
|
138
|
+
def ylim(*args, **kwargs):
|
|
139
|
+
return get_window().plot_manager.plot_widget.ylim(*args, **kwargs)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
@_copy_docstring(widgets.PlotWidget.enable_autoscale)
|
|
143
|
+
def enable_autoscale(*args, **kwargs):
|
|
144
|
+
return get_window().plot_manager.plot_widget.enable_autoscale(*args, **kwargs)
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
@_copy_docstring(widgets.PlotWidget.disable_autoscale)
|
|
148
|
+
def disable_autoscale(*args, **kwargs):
|
|
149
|
+
return get_window().plot_manager.plot_widget.disable_autoscale(*args, **kwargs)
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
@_copy_docstring(widgets.PlotWidget.legend)
|
|
153
|
+
def legend(*args, **kwargs):
|
|
154
|
+
return get_window().plot_manager.plot_widget.legend(*args, **kwargs)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
@_copy_docstring(widgets.PlotWidget.set_title)
|
|
158
|
+
def set_title(*args, **kwargs):
|
|
159
|
+
return get_window().plot_manager.plot_widget.set_title(*args, **kwargs)
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
@_copy_docstring(widgets.PlotWidget.lock_zoom)
|
|
163
|
+
def lock_zoom(*args, **kwargs):
|
|
164
|
+
return get_window().plot_manager.plot_widget.lock_zoom(*args, **kwargs)
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
@_copy_docstring(widgets.PlotManager.create_subplots)
|
|
168
|
+
def subplots(*args, **kwargs):
|
|
169
|
+
return get_window().plot_manager.create_subplots(*args, **kwargs)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
@_copy_docstring(widgets.PlotManager.remove_item)
|
|
173
|
+
def remove_item(*args, **kwargs):
|
|
174
|
+
return get_window().plot_manager.remove_item(*args, **kwargs)
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
@_copy_docstring(widgets.PlotManager.merge_plots)
|
|
178
|
+
def merge_plots(*args, **kwargs):
|
|
179
|
+
return get_window().plot_manager.merge_plots(*args, **kwargs)
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
@_copy_docstring(widgets.MainWindow.set_interval)
|
|
183
|
+
def set_interval(*args, **kwargs):
|
|
184
|
+
return get_window().set_interval(*args, **kwargs)
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
@_copy_docstring(widgets.MainWindow.is_alive)
|
|
188
|
+
def is_alive():
|
|
189
|
+
return get_window().is_alive()
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
@_copy_docstring(widgets.InputTable.add_slider)
|
|
193
|
+
def add_slider(*args, **kwargs):
|
|
194
|
+
return get_input_table().add_slider(*args, **kwargs)
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
@_copy_docstring(widgets.InputTable.add_checkbox)
|
|
198
|
+
def add_checkbox(*args, **kwargs):
|
|
199
|
+
return get_input_table().add_checkbox(*args, **kwargs)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
@_copy_docstring(widgets.InputTable.add_inputbox)
|
|
203
|
+
def add_inputbox(*args, **kwargs):
|
|
204
|
+
return get_input_table().add_inputbox(*args, **kwargs)
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
@_copy_docstring(widgets.input_widget.InputTable.add_button)
|
|
208
|
+
def add_button(*args, **kwargs):
|
|
209
|
+
return get_input_table().add_button(*args, **kwargs)
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
@_copy_docstring(widgets.InputTable.add_dropdown)
|
|
213
|
+
def add_dropdown(*args, **kwargs):
|
|
214
|
+
return get_input_table().add_dropdown(*args, **kwargs)
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
@_copy_docstring(widgets.InputTable.add_rate_slider)
|
|
218
|
+
def add_rate_slider(*args, **kwargs):
|
|
219
|
+
return get_input_table().add_rate_slider(*args, **kwargs)
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
@_copy_docstring(widgets.InputTable.add_color_picker)
|
|
223
|
+
def add_color_picker(*args, **kwargs):
|
|
224
|
+
return get_input_table().add_color_picker(*args, **kwargs)
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
@_copy_docstring(widgets.MainWindow.on_mouse_click)
|
|
228
|
+
def on_mouse_click(*args, **kwargs):
|
|
229
|
+
return get_window().on_mouse_click(*args, **kwargs)
|
|
230
|
+
|
|
231
|
+
|
|
232
|
+
@_copy_docstring(widgets.MainWindow.on_mouse_move)
|
|
233
|
+
def on_mouse_move(*args, **kwargs):
|
|
234
|
+
return get_window().on_mouse_move(*args, **kwargs)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
@_copy_docstring(widgets.MainWindow.get_mouse_pos)
|
|
238
|
+
def get_mouse_pos(*args, **kwargs):
|
|
239
|
+
return get_window().get_mouse_pos(*args, **kwargs)
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
@_copy_docstring(widgets.MainWindow.on_key_press)
|
|
243
|
+
def on_key_press(*args, **kwargs):
|
|
244
|
+
return get_window().on_key_press(*args, **kwargs)
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
@_copy_docstring(widgets.MainWindow.add_table)
|
|
248
|
+
def add_input_table(*args, **kwargs):
|
|
249
|
+
return get_window().add_table(*args, **kwargs)
|
|
250
|
+
|
|
251
|
+
|
|
252
|
+
@_copy_docstring(widgets.TableManager.rename_tab)
|
|
253
|
+
def rename_tab(*args, **kwargs):
|
|
254
|
+
return get_table_manager().rename_tab(*args, **kwargs)
|
|
255
|
+
|
|
256
|
+
|
|
257
|
+
@_copy_docstring(widgets.TableManager.set_active_tab)
|
|
258
|
+
def set_active_tab(*args, **kwargs):
|
|
259
|
+
return get_table_manager().set_active_tab(*args, **kwargs)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
@_copy_docstring(widgets.TableManager.get_all_tabs)
|
|
263
|
+
def get_all_tabs():
|
|
264
|
+
return get_table_manager().get_all_tabs()
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
@_copy_docstring(widgets.TableManager.get_all_boxes)
|
|
268
|
+
def get_all_boxes():
|
|
269
|
+
return get_table_manager().get_all_boxes()
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
@_copy_docstring(widgets.TableManager.get_current_row)
|
|
273
|
+
def get_current_row():
|
|
274
|
+
return get_table_manager().get_current_row()
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
@_copy_docstring(widgets.TableManager.link_boxes)
|
|
278
|
+
def link_boxes(*args, **kwargs):
|
|
279
|
+
return get_table_manager().link_boxes(*args, **kwargs)
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
@_copy_docstring(widgets.TableManager.set_input_partition)
|
|
283
|
+
def set_input_partition(*args, **kwargs):
|
|
284
|
+
return get_table_manager().set_input_partition(*args, **kwargs)
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
@_copy_docstring(widgets.MainWindow.resize_window)
|
|
288
|
+
def resize(*args, **kwargs):
|
|
289
|
+
return get_window().resize_window(*args, **kwargs)
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
@_copy_docstring(widgets.MainWindow.window_size)
|
|
293
|
+
def size():
|
|
294
|
+
return get_window().window_size()
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
@_copy_docstring(widgets.MainWindow.set_input_width_ratio)
|
|
298
|
+
def set_input_width(*args, **kwargs):
|
|
299
|
+
return get_window().set_input_width_ratio(*args, **kwargs)
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
@_copy_docstring(widgets.MainWindow.display_fps)
|
|
303
|
+
def display_fps(*args, **kwargs):
|
|
304
|
+
return get_window().display_fps(*args, **kwargs)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
@_copy_docstring(widgets.MainWindow.benchmark)
|
|
308
|
+
def benchmark(*args, **kwargs):
|
|
309
|
+
return get_window().benchmark(*args, **kwargs)
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
@_copy_docstring(widgets.MainWindow.refresh)
|
|
313
|
+
def refresh(*args, **kwargs):
|
|
314
|
+
return get_window().refresh(*args, **kwargs)
|
|
315
|
+
|
|
316
|
+
|
|
317
|
+
@_copy_docstring(widgets.MainWindow.show_window)
|
|
318
|
+
def show_window():
|
|
319
|
+
return get_window().show_window()
|
|
320
|
+
|
|
321
|
+
|
|
322
|
+
@_copy_docstring(widgets.MainWindow.on_refresh)
|
|
323
|
+
def on_refresh(*args, **kwargs):
|
|
324
|
+
return get_window().on_refresh(*args, **kwargs)
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
@_copy_docstring(widgets.MainWindow.start)
|
|
328
|
+
def show():
|
|
329
|
+
return get_window().start()
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
def close_window():
|
|
333
|
+
"""Closes the window."""
|
|
334
|
+
return get_window().close()
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+
@_copy_docstring(widgets.MainWindow.clear)
|
|
338
|
+
def clear():
|
|
339
|
+
return get_window().clear()
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
@_copy_docstring(widgets.MainWindow.export)
|
|
343
|
+
def export(*args, **kwargs):
|
|
344
|
+
return get_window().export(*args, **kwargs)
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
@_copy_docstring(widgets.MainWindow.export_video)
|
|
348
|
+
def export_video(*args, **kwargs):
|
|
349
|
+
return get_window().export_video(*args, **kwargs)
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
@_copy_docstring(widgets.MainWindow.start_recording)
|
|
353
|
+
def start_recording(*args, **kwargs):
|
|
354
|
+
return get_window().start_recording(*args, **kwargs)
|
|
355
|
+
# </editor-fold>
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
def enable_numba(enable: bool = True):
|
|
359
|
+
"""Enable numba. Can be a little faster, but takes longer to initialize. """
|
|
360
|
+
setConfigOption('useNumba', enable)
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
def on_next_refresh(func: Callable): # todo: only works in eventloop, not in show_window style.
|
|
364
|
+
"""Calls a function upon next refresh only. """
|
|
365
|
+
QTimer.singleShot(0, func)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
# def init_3D():
|
|
369
|
+
# window.init_3D()
|
|
370
|
+
#
|
|
371
|
+
#
|
|
372
|
+
# def add_grid(diagonal):
|
|
373
|
+
# """
|
|
374
|
+
# :param diagonal: A tuple of two points that span the diagonal of a rectangle that lies on or parallel to the
|
|
375
|
+
# xy, yz, or zx plane.
|
|
376
|
+
# :return:
|
|
377
|
+
# """
|
|
378
|
+
# if window.plot_style_3D:
|
|
379
|
+
# window.plot_widget.add_grid(diagonal)
|
|
380
|
+
# else:
|
|
381
|
+
# raise RuntimeError("This function only works in 3D. 3D mode needs to be initialised first. (1003)")
|
|
382
|
+
#
|
|
383
|
+
#
|
|
384
|
+
# def add_grids(size=(0.0, 5.0)):
|
|
385
|
+
# """
|
|
386
|
+
# Adds square grids on the xy, yz and zx planes, spanning from size[0] to size[1].
|
|
387
|
+
#
|
|
388
|
+
# :param size: the size of each grid.
|
|
389
|
+
# """
|
|
390
|
+
# if window.plot_style_3D:
|
|
391
|
+
# window.plot_widget.add_grids(size)
|
|
392
|
+
# else:
|
|
393
|
+
# raise RuntimeError("This function only works in 3D. 3D mode needs to be initialised first. (1003)")
|
|
394
|
+
#
|
|
395
|
+
#
|
|
396
|
+
# def align_camera():
|
|
397
|
+
# window.plot_widget.animated = True
|
|
398
|
+
# current_params = window.plot_widget.cameraParams()
|
|
399
|
+
# add_rate_slider("distance", current_params["distance"], changerate=2)
|
|
400
|
+
# row_js_1 = get_current_row()
|
|
401
|
+
# slider_1 = add_slider("azimuth", current_params["azimuth"], 0, 360, n_ticks=72)
|
|
402
|
+
# slider_2 = add_slider("elevation", current_params["elevation"], -90, 90, n_ticks=180)
|
|
403
|
+
# slider_3 = add_slider("fov", current_params["fov"], 0, 180, n_ticks=180)
|
|
404
|
+
# add_rate_slider("x", 0, absolute=True, changerate=5) # todo: change init_value to current_params.center.x
|
|
405
|
+
# row_js_x = get_current_row()
|
|
406
|
+
# add_rate_slider("y", 0, absolute=True, changerate=5)
|
|
407
|
+
# row_js_y = get_current_row()
|
|
408
|
+
# add_rate_slider("z", 0, absolute=True, changerate=5)
|
|
409
|
+
# row_js_z = get_current_row()
|
|
410
|
+
#
|
|
411
|
+
# def update_cam_params():
|
|
412
|
+
# window.plot_widget.setCameraParams(
|
|
413
|
+
# distance=var.distance,
|
|
414
|
+
# azimuth=var.azimuth,
|
|
415
|
+
# elevation=var.elevation,
|
|
416
|
+
# fov=var.fov
|
|
417
|
+
# )
|
|
418
|
+
#
|
|
419
|
+
# def rate_slider_update(row):
|
|
420
|
+
# if row == row_js_1:
|
|
421
|
+
# update_cam_params()
|
|
422
|
+
#
|
|
423
|
+
# def update_cam_pos():
|
|
424
|
+
# vector = QtGui.QVector3D(
|
|
425
|
+
# var.x,
|
|
426
|
+
# var.y,
|
|
427
|
+
# var.z
|
|
428
|
+
# )
|
|
429
|
+
# window.plot_widget.setCameraPosition(
|
|
430
|
+
# vector
|
|
431
|
+
# )
|
|
432
|
+
#
|
|
433
|
+
# def rate_slider_pos_update(row):
|
|
434
|
+
# if row == row_js_x or row == row_js_y or row == row_js_z:
|
|
435
|
+
# update_cam_pos()
|
|
436
|
+
#
|
|
437
|
+
# slider_1.valueChanged.connect(update_cam_params)
|
|
438
|
+
# slider_2.valueChanged.connect(update_cam_params)
|
|
439
|
+
# slider_3.valueChanged.connect(update_cam_params)
|
|
440
|
+
# window.input_widget.cellChanged.connect(rate_slider_update)
|
|
441
|
+
# window.input_widget.cellChanged.connect(rate_slider_pos_update)
|
|
442
|
+
# update_cam_params()
|
|
443
|
+
#
|
|
444
|
+
# def get_params():
|
|
445
|
+
# print(
|
|
446
|
+
# f"The following function would get you this camera postition: \n"
|
|
447
|
+
# f"squap.set_camera(\n"
|
|
448
|
+
# f" x={var.x}, y={var.y}, z={var.z}, \n"
|
|
449
|
+
# f" distance={var.distance}, azimuth={var.azimuth}, "
|
|
450
|
+
# f"elevation={var.elevation}, fov={var.fov}\n)"
|
|
451
|
+
# )
|
|
452
|
+
#
|
|
453
|
+
# add_button("print camera parameters", get_params)
|
|
454
|
+
#
|
|
455
|
+
#
|
|
456
|
+
# def set_camera(x=None, y=None, z=None, distance=None, azimuth=None, elevation=None, fov=None):
|
|
457
|
+
# """
|
|
458
|
+
# Sets the camera position, rotation and fov using the given arguments.
|
|
459
|
+
#
|
|
460
|
+
# :param x:
|
|
461
|
+
# :type x: float
|
|
462
|
+
# :param fov: field of view of the camera
|
|
463
|
+
#
|
|
464
|
+
# """
|
|
465
|
+
# cam_params_kwargs = {}
|
|
466
|
+
#
|
|
467
|
+
# if distance is not None:
|
|
468
|
+
# cam_params_kwargs["distance"] = distance
|
|
469
|
+
# if azimuth is not None:
|
|
470
|
+
# cam_params_kwargs["azimuth"] = azimuth
|
|
471
|
+
# if elevation is not None:
|
|
472
|
+
# cam_params_kwargs["elevation"] = elevation
|
|
473
|
+
# if fov is not None:
|
|
474
|
+
# cam_params_kwargs["fov"] = fov
|
|
475
|
+
#
|
|
476
|
+
# window.plot_widget.setCameraParams(**cam_params_kwargs)
|
|
477
|
+
# if x is not None or y is not None or z is not None: # todo: fix this. When only z is given there is an error.
|
|
478
|
+
# window.plot_widget.setCameraPosition(
|
|
479
|
+
# QtGui.QVector3D(x, y, z)
|
|
480
|
+
# )
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from . import widgets
|
|
2
|
+
from .helper_funcs import ColorType, ColorsType
|
|
3
|
+
from .customisation import Font
|
|
4
|
+
from typing import Callable, Iterable, Union, Optional, Any, ForwardRef
|
|
5
|
+
import typing
|
|
6
|
+
import numpy
|
|
7
|
+
|
|
8
|
+
import PySide6
|
|
9
|
+
import pyqtgraph
|
|
10
|
+
from pyqtgraph import mkColor
|
|
11
|
+
import matplotlib.colors
|
|
12
|
+
|
|
13
|
+
from .variables import Variables
|
|
14
|
+
from .helper_funcs import ColorType, ColorsType
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var: Variables
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def plot(*args, color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float, Iterable[ForwardRef('ColorsType')]] = 'y', width: int = 1, dashed: bool = False, dash_pattern: Optional[Iterable[int]] = None, connect: str | numpy.ndarray = 'auto', gradient: Optional[PySide6.QtGui.QGradient] = None, line_style: Optional[str] = None, antialias: bool = False, auto_downsample: bool = False, downsample: int = 1, downsample_method: str = 'mean', skip_finite_check: bool = False, **kwargs) -> 'PlotCurve': ...
|
|
21
|
+
def scatter(*args, color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float, Iterable[ForwardRef('ColorsType')]] = 'y', size: int = 7, edge_width: int = -1, edge_color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'white', pixel_mode: bool = True, downsample: int = 1, downsample_method: str = 'mean', auto_downsample: bool = False, antialias: bool = False, **kwargs) -> 'PlotCurve': ...
|
|
22
|
+
def errorbar(*args, x_err=None, y_err=None, color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'y', width: int = 1, errorbar_width: int = 1, beam_size: float = 0, dashed: bool = False, dash_pattern: Iterable[int] = None, connect: str = 'auto', gradient: Optional[PySide6.QtGui.QGradient] = None, line_style: Optional[str] = None, antialias: bool = False, auto_downsample: bool = False, downsample: int = 1, downsample_method: str = 'mean', skip_finite_check: bool = False, **kwargs) -> 'PlotCurve': ...
|
|
23
|
+
def set_xlim(x_min: float, x_max: float): ...
|
|
24
|
+
def set_ylim(y_min: float, y_max: float): ...
|
|
25
|
+
def xlim() -> tuple[float]: ...
|
|
26
|
+
def ylim() -> tuple[float]: ...
|
|
27
|
+
def legend(): ...
|
|
28
|
+
def set_title(text: str | typing.Any): ...
|
|
29
|
+
def lock_zoom(curves: 'Iterable[PlotCurve]'): ...
|
|
30
|
+
def subplots(nrows: int = 1, ncols: int = 1, heightratios: Optional[list[int]] = None, widthratios: Optional[list[int]] = None) -> list: ...
|
|
31
|
+
def remove_item(item: pyqtgraph.graphicsItems.GraphicsObject.GraphicsObject): ...
|
|
32
|
+
def get_gradient(cmap: Union[str, matplotlib.colors.Colormap, Iterable, dict], style: str = 'horizontal', position: Optional[Iterable] = None, extend: str = 'pad', resolution: int = 256) -> PySide6.QtGui.QGradient: ...
|
|
33
|
+
def get_cmap(data: Union[str, dict[float, Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float]], Iterable[Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float]]], source: str = 'matplotlib'): ...
|
|
34
|
+
def inf_dline(pos: float | tuple[float], angle: float = 45, color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'y', width: int = 1, dashed: bool = False, dash_pattern: Optional[Iterable[int]] = None, line_style: Optional[str] = None, movable: bool = False, bounds: Optional[Iterable[int]] = None, span: tuple = (0, 1), line_movable: Optional[bool] = None, label: bool = False, label_text: str = '{value}', label_movable: Optional[Iterable[int]] = None, label_position: float = 0.5, label_anchors: Optional[list[tuple]] = None, hover_color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'red', hover_width: int = 1, name: Optional[str] = None, **kwargs): ...
|
|
35
|
+
def inf_hline(pos: float | tuple[float], color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'y', width: int = 1, dashed: bool = False, dash_pattern: Optional[Iterable[int]] = None, line_style: Optional[str] = None, movable: bool = False, bounds: Optional[Iterable[int]] = None, span: tuple = (0, 1), line_movable: Optional[bool] = None, label: bool = False, label_text: str = '{value}', label_movable: Optional[Iterable[int]] = None, label_position: float = 0.5, label_anchors: Optional[list[tuple]] = None, hover_color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'red', hover_width: int = 1, name: Optional[str] = None, **kwargs): ...
|
|
36
|
+
def inf_vline(pos: float | tuple[float], color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'y', width: int = 1, dashed: bool = False, dash_pattern: Optional[Iterable[int]] = None, line_style: Optional[str] = None, movable: bool = False, bounds: Optional[Iterable[int]] = None, span: tuple = (0, 1), line_movable: Optional[bool] = None, label: bool = False, label_text: str = '{value}', label_movable: Optional[Iterable[int]] = None, label_position: float = 0.5, label_anchors: Optional[list[tuple]] = None, hover_color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = 'red', hover_width: int = 1, name: Optional[str] = None, **kwargs): ...
|
|
37
|
+
def grid(tick_spacing: Union[tuple, float, None] = None, color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float, None] = None, width: int = 1, **kwargs): ...
|
|
38
|
+
def plot_text(text: str, pos: Iterable[float], color: Union[PySide6.QtGui.QColor, mkColor, str, Iterable[float], float] = (0.8, 0.8, 0.8), angle: float = 0, font: Union[str, squap.customisation.Font, None] = None, font_size: Optional[int] = None, html: Optional[str] = None, text_width: Optional[int] = None, **kwargs): ...
|
|
39
|
+
def merge_plots(plots: Iterable[widgets.plot_widget.PlotWidget]) -> widgets.plot_widget.PlotWidget: ...
|
|
40
|
+
def set_interval(interval: float): ...
|
|
41
|
+
def on_refresh(func: Callable, disconnect: bool = False): ...
|
|
42
|
+
def on_mouse_click(func: Callable, pixel_mode: bool = False, ax: Optional[widgets.plot_widget.PlotWidget] = None): ...
|
|
43
|
+
def on_mouse_move(func: Callable, pixel_mode: bool = False, ax: Optional[widgets.plot_widget.PlotWidget] = None): ...
|
|
44
|
+
def get_mouse_pos(pixel_mode=False, ax: Optional[widgets.plot_widget.PlotWidget] = None) -> tuple: ...
|
|
45
|
+
def on_key_press(func: Callable, accept_modifier: bool = False, modifier_arg: bool = False, event_arg: bool = False) -> Callable: ...
|
|
46
|
+
def add_slider(name: str, init_value: float = 1.0, min_value: float = 0.0, max_value: float = 10.0, n_ticks: int = 51, tick_interval: Optional[float] = None, only_ints: bool = False, logscale: bool = False, custom_arr: Optional[Iterable] = None, var_name: Optional[str] = None, print_value: bool = False, row: Optional[int] = None) -> 'InputTable.Slider': ...
|
|
47
|
+
def add_checkbox(name: str, init_value: bool = False, var_name: Optional[str] = None, print_value: bool = False, row: Optional[int] = None) -> 'InputTable.CheckBox': ...
|
|
48
|
+
def add_inputbox(name: str, init_value: Any = 1.0, type_func: Optional[Callable] = None, var_name: Optional[str] = None, print_value: bool = False, row: Optional[int] = None) -> 'InputTable.InputBox': ...
|
|
49
|
+
def add_button(name: str, func: Optional[Callable] = None, row: Optional[int] = None) -> 'InputTable.Button': ...
|
|
50
|
+
def add_dropdown(name: str, options: list, init_index: int = 0, option_names: Optional[Iterable[str]] = None, var_name: Optional[str] = None, print_value: bool = False, row: Optional[int] = None) -> 'InputTable.Dropdown': ...
|
|
51
|
+
def add_rate_slider(name: str, init_value: float = 1.0, change_rate: float = 10.0, absolute: bool = False, time_var: Optional[str] = None, custom_func: Optional[Callable] = None, var_name: Optional[str] = None, print_value: bool = False, row: Optional[int] = None) -> 'InputTable.RateSlider': ...
|
|
52
|
+
def link_boxes(boxes: Iterable[widgets.input_widget.Box | int], only_update_boxes: list | None = None): ...
|
|
53
|
+
def add_table(name: Optional[str] = None) -> widgets.input_widget.InputTable: ...
|
|
54
|
+
def set_active_tab(*args: int | widgets.input_widget.InputTable | str, index: int | None = None, tab: widgets.input_widget.InputTable | None = None, name: str | None = None) -> widgets.input_widget.InputTable: ...
|
|
55
|
+
def rename_tab(name: str, index: Optional[int] = 0, old_name: Optional[str] = None) -> widgets.input_widget.InputTable: ...
|
|
56
|
+
def get_all_boxes() -> list[widgets.input_widget.Box]: ...
|
|
57
|
+
def display_fps(update_speed: float = 0.2, get_fps: bool = False, optimized: bool = False, ax: Optional[widgets.plot_widget.PlotWidget] = None): ...
|
|
58
|
+
def resize_window(width: int, height: int): ...
|
|
59
|
+
def benchmark(n_frames: Optional[int] = None, duration: Optional[float] = None): ...
|
|
60
|
+
def set_input_width_ratio(fraction: float = 0.5): ...
|
|
61
|
+
def set_input_partition(fraction: float = 0.3333333333333333): ...
|
|
62
|
+
def is_alive() -> bool: ...
|
|
63
|
+
def refresh(wait_interval: bool = True, call_update_funcs: bool = True): ...
|
|
64
|
+
def show_window(): ...
|
|
65
|
+
def start(): ...
|
|
66
|
+
def clear(): ...
|
|
67
|
+
def export(filename: str, widget: str = 'window'): ...
|
|
68
|
+
def export_video(filename: str, fps: float = 30.0, n_frames: Optional[int] = None, duration: Optional[float] = None, stop_func: Optional[Callable] = None, skip_frames: int = 0, display_window: bool = False, widget: str = 'window', save_on_close: bool = False): ...
|
|
69
|
+
def start_recording(filename: str, fps: float = 30.0, skip_frames: int = 0, widget: str = 'window') -> Callable: ...
|
|
70
|
+
def get_font(font_name: str = 'Segoe UI', font_size: Optional[int] = None, bold: bool = False, italic: bool = False, underline: bool = False, strikethrough: bool = False, overline: bool = False, kerning: bool = False, stretch: int = 100, letter_spacing: float = 0.0, word_spacing: float = 0.0, **kwargs) -> squap.customisation.Font: ...
|
|
71
|
+
def cmap_to_colors(cmap: Callable, N_points: int) -> numpy.ndarray: ...
|