pgwidgets-python 0.3.1__py3-none-any.whl → 0.3.3__py3-none-any.whl
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.
- pgwidgets/async_/application.py +18 -1
- pgwidgets/icons/pgw-python-logo.png +0 -0
- pgwidgets/method_types.py +1 -1
- pgwidgets/sync/application.py +41 -8
- {pgwidgets_python-0.3.1.dist-info → pgwidgets_python-0.3.3.dist-info}/METADATA +5 -1
- {pgwidgets_python-0.3.1.dist-info → pgwidgets_python-0.3.3.dist-info}/RECORD +11 -8
- pgwidgets_python-0.3.3.dist-info/scm_file_list.json +68 -0
- pgwidgets_python-0.3.3.dist-info/scm_version.json +8 -0
- {pgwidgets_python-0.3.1.dist-info → pgwidgets_python-0.3.3.dist-info}/WHEEL +0 -0
- {pgwidgets_python-0.3.1.dist-info → pgwidgets_python-0.3.3.dist-info}/licenses/LICENSE.md +0 -0
- {pgwidgets_python-0.3.1.dist-info → pgwidgets_python-0.3.3.dist-info}/top_level.txt +0 -0
pgwidgets/async_/application.py
CHANGED
|
@@ -1557,6 +1557,15 @@ class Application:
|
|
|
1557
1557
|
}
|
|
1558
1558
|
self._broadcast_font_msg(self._font_default_msg())
|
|
1559
1559
|
|
|
1560
|
+
def open_url(self, url):
|
|
1561
|
+
"""Ask the connected browser(s) to open *url* in a new tab/window.
|
|
1562
|
+
|
|
1563
|
+
Fire-and-forget app-level command; opens the link in the *user's*
|
|
1564
|
+
browser rather than on the host running Python. (Reuses the
|
|
1565
|
+
generic per-session broadcast helper.)
|
|
1566
|
+
"""
|
|
1567
|
+
self._broadcast_font_msg({"type": "open-url", "url": str(url)})
|
|
1568
|
+
|
|
1560
1569
|
def _font_register_msg(self, entry):
|
|
1561
1570
|
return {
|
|
1562
1571
|
"type": "register-font",
|
|
@@ -1788,8 +1797,14 @@ class Application:
|
|
|
1788
1797
|
The newly created session.
|
|
1789
1798
|
"""
|
|
1790
1799
|
if session_id is None:
|
|
1800
|
+
# skip ids already taken by explicitly-created sessions
|
|
1801
|
+
# (e.g. a pre-created default session) so we never
|
|
1802
|
+
# silently overwrite an existing session
|
|
1791
1803
|
session_id = self._next_session_id
|
|
1792
1804
|
self._next_session_id += 1
|
|
1805
|
+
while session_id in self._sessions:
|
|
1806
|
+
session_id = self._next_session_id
|
|
1807
|
+
self._next_session_id += 1
|
|
1793
1808
|
elif session_id in self._sessions:
|
|
1794
1809
|
# If the existing session was auto-created by a browser
|
|
1795
1810
|
# reconnect with the same token, return it so the user's
|
|
@@ -1954,12 +1969,14 @@ class Application:
|
|
|
1954
1969
|
|
|
1955
1970
|
In the async API, callbacks are dispatched by the asyncio event
|
|
1956
1971
|
loop directly, so this simply yields control for the requested
|
|
1957
|
-
duration.
|
|
1972
|
+
duration. A *timeout* of ``0`` yields once (a non-blocking drain
|
|
1973
|
+
of ready callbacks), matching the sync API's contract.
|
|
1958
1974
|
|
|
1959
1975
|
Parameters
|
|
1960
1976
|
----------
|
|
1961
1977
|
timeout : float
|
|
1962
1978
|
Seconds to yield to the event loop (default 0.1).
|
|
1979
|
+
Use ``0`` for a single non-blocking yield.
|
|
1963
1980
|
"""
|
|
1964
1981
|
await asyncio.sleep(timeout)
|
|
1965
1982
|
|
|
Binary file
|
pgwidgets/method_types.py
CHANGED
pgwidgets/sync/application.py
CHANGED
|
@@ -1828,6 +1828,20 @@ class Application:
|
|
|
1828
1828
|
except Exception:
|
|
1829
1829
|
pass
|
|
1830
1830
|
|
|
1831
|
+
def open_url(self, url):
|
|
1832
|
+
"""Ask the connected browser(s) to open *url* in a new tab/window.
|
|
1833
|
+
|
|
1834
|
+
Fire-and-forget app-level command (mirrors set_default_font's
|
|
1835
|
+
per-session send). This opens the link in the *user's* browser
|
|
1836
|
+
rather than on the host running Python.
|
|
1837
|
+
"""
|
|
1838
|
+
msg = {"type": "open-url", "url": str(url)}
|
|
1839
|
+
for session in list(self._sessions.values()):
|
|
1840
|
+
try:
|
|
1841
|
+
session._send(msg)
|
|
1842
|
+
except Exception:
|
|
1843
|
+
pass
|
|
1844
|
+
|
|
1831
1845
|
def _font_register_msg(self, entry):
|
|
1832
1846
|
return {
|
|
1833
1847
|
"type": "register-font",
|
|
@@ -2062,8 +2076,14 @@ class Application:
|
|
|
2062
2076
|
"""
|
|
2063
2077
|
with self._session_lock:
|
|
2064
2078
|
if session_id is None:
|
|
2079
|
+
# skip ids already taken by explicitly-created sessions
|
|
2080
|
+
# (e.g. a pre-created default session) so we never
|
|
2081
|
+
# silently overwrite an existing session
|
|
2065
2082
|
session_id = self._next_session_id
|
|
2066
2083
|
self._next_session_id += 1
|
|
2084
|
+
while session_id in self._sessions:
|
|
2085
|
+
session_id = self._next_session_id
|
|
2086
|
+
self._next_session_id += 1
|
|
2067
2087
|
elif session_id in self._sessions:
|
|
2068
2088
|
# If the existing session was auto-created by a browser
|
|
2069
2089
|
# reconnect with the same token, return it so the user's
|
|
@@ -2279,22 +2299,35 @@ class Application:
|
|
|
2279
2299
|
``concurrent`` modes, callbacks already run on their own threads
|
|
2280
2300
|
so this method simply yields control briefly.
|
|
2281
2301
|
|
|
2302
|
+
A *timeout* of ``0`` drains every callback currently queued and
|
|
2303
|
+
returns immediately without blocking -- useful when pumping from
|
|
2304
|
+
within another event loop (e.g. a Jupyter kernel's asyncio loop).
|
|
2305
|
+
|
|
2282
2306
|
Parameters
|
|
2283
2307
|
----------
|
|
2284
2308
|
timeout : float
|
|
2285
2309
|
Maximum seconds to spend processing events (default 0.1).
|
|
2310
|
+
Use ``0`` for a non-blocking drain of the pending queue.
|
|
2286
2311
|
"""
|
|
2287
2312
|
if self._concurrency == "serialized":
|
|
2313
|
+
non_blocking = (timeout == 0)
|
|
2288
2314
|
deadline = time.monotonic() + timeout
|
|
2289
2315
|
while not self._shutdown.is_set():
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2316
|
+
if non_blocking:
|
|
2317
|
+
try:
|
|
2318
|
+
handler, args, kwargs, result_slot = \
|
|
2319
|
+
self._cb_queue.get_nowait()
|
|
2320
|
+
except queue.Empty:
|
|
2321
|
+
break
|
|
2322
|
+
else:
|
|
2323
|
+
remaining = deadline - time.monotonic()
|
|
2324
|
+
if remaining <= 0:
|
|
2325
|
+
break
|
|
2326
|
+
try:
|
|
2327
|
+
handler, args, kwargs, result_slot = \
|
|
2328
|
+
self._cb_queue.get(timeout=min(remaining, 0.5))
|
|
2329
|
+
except queue.Empty:
|
|
2330
|
+
continue
|
|
2298
2331
|
try:
|
|
2299
2332
|
rv = handler(*args, **kwargs)
|
|
2300
2333
|
if result_slot is not None:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pgwidgets-python
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.3
|
|
4
4
|
Summary: Python bindings for the pgwidgets JavaScript widget library
|
|
5
5
|
Author: PGWidgets Developers
|
|
6
6
|
License: BSD-3-Clause
|
|
@@ -27,6 +27,10 @@ Provides-Extra: test
|
|
|
27
27
|
Requires-Dist: pytest; extra == "test"
|
|
28
28
|
Dynamic: license-file
|
|
29
29
|
|
|
30
|
+
<p align="center">
|
|
31
|
+
<img src="pgwidgets/icons/pgw-python-logo.png" alt="pgwidgets-python logo" width="500">
|
|
32
|
+
</p>
|
|
33
|
+
|
|
30
34
|
# pgwidgets — Python Bindings
|
|
31
35
|
|
|
32
36
|
Python bindings for the [pgwidgets](https://github.com/naojsoft/pgwidgets-js)
|
|
@@ -3,19 +3,22 @@ pgwidgets/_json.py,sha256=o21qywJ6yAldbqxTq3nLwgK9O67r3a8JxhvI_WAJnMY,2184
|
|
|
3
3
|
pgwidgets/buffer.py,sha256=BYj_nb6fuyGsBqUp3_Z1YrzUm4h5VmoWPGKvpTjWrYk,4048
|
|
4
4
|
pgwidgets/callbacks.py,sha256=gA2FnX0N5BmbmOMyEV35yHySgAfVjfAZcZhZbo7j4-c,3314
|
|
5
5
|
pgwidgets/defs.py,sha256=Q8qhvTeansFU1Av6j5ncdwF2xSNHrpXuKErdHWQ3HiA,436
|
|
6
|
-
pgwidgets/method_types.py,sha256=
|
|
6
|
+
pgwidgets/method_types.py,sha256=_-rdE5BOYLra8x3BMKv5-QS4Z8YB29DBhUCDsGiB-Gw,18314
|
|
7
7
|
pgwidgets/async_/Widgets.py,sha256=vld2xkvusBBEVbhbezaJsjBRRj3L7c17Up0pOVs8PGo,723
|
|
8
8
|
pgwidgets/async_/__init__.py,sha256=rXB-v9XRrYt1imYuYikhkzIyiRqaYhlTpQei2LHaQ18,564
|
|
9
|
-
pgwidgets/async_/application.py,sha256=
|
|
9
|
+
pgwidgets/async_/application.py,sha256=2RJNRerXu5LXG_UcMSi9HWOCAlEOu96TrRaoIcUZ86Q,80957
|
|
10
10
|
pgwidgets/async_/widget.py,sha256=gO7eJh9LV3UY7yRLdeml_0gqmHnFB5VU3NWlDURLtfc,38042
|
|
11
11
|
pgwidgets/extras/__init__.py,sha256=AXUmFtnn4RSlp6pJX6z55j-m_29VmfzpYIjQvAy7pO0,325
|
|
12
12
|
pgwidgets/extras/file_browser.py,sha256=CXQSfJx1VQ-fJfhKNrVyqrkKTJEQngmiP954y70Fjo0,17229
|
|
13
|
+
pgwidgets/icons/pgw-python-logo.png,sha256=_Rxicp9EKy2Pzz1HtobxEnntSI-y5TtAVPlIzZIsfYs,2428840
|
|
13
14
|
pgwidgets/sync/Widgets.py,sha256=7SaocMVMzFHhi51pjuEAr47Wez90b_a61kDbiv0jOfM,706
|
|
14
15
|
pgwidgets/sync/__init__.py,sha256=SF5RTAvtu8BbYBWzpiCPipy6DJzNXf6nqk9xdvwxUhQ,542
|
|
15
|
-
pgwidgets/sync/application.py,sha256=
|
|
16
|
+
pgwidgets/sync/application.py,sha256=tcAJvSVdijfT_KBP4llY1tyg2AAmQM-1qocw8Zf51nM,96240
|
|
16
17
|
pgwidgets/sync/widget.py,sha256=yrScNkZB34u0JXn3-kCB-1mPLxLysVbuaPsCjC8kq0E,38343
|
|
17
|
-
pgwidgets_python-0.3.
|
|
18
|
-
pgwidgets_python-0.3.
|
|
19
|
-
pgwidgets_python-0.3.
|
|
20
|
-
pgwidgets_python-0.3.
|
|
21
|
-
pgwidgets_python-0.3.
|
|
18
|
+
pgwidgets_python-0.3.3.dist-info/licenses/LICENSE.md,sha256=LoM3fMTiMnQuHRCJghdjOtjnCrL8soBpu2PFk24Xvyg,1528
|
|
19
|
+
pgwidgets_python-0.3.3.dist-info/METADATA,sha256=zGKe1dIOc9aQaTS5ROZQu5NFO0rXlqfv3FuavZmjKsA,4683
|
|
20
|
+
pgwidgets_python-0.3.3.dist-info/WHEEL,sha256=aeYiig01lYGDzBgS8HxWXOg3uV61G9ijOsup-k9o1sk,91
|
|
21
|
+
pgwidgets_python-0.3.3.dist-info/scm_file_list.json,sha256=EpRYjywwhXPISys2-onyGmwpWbD6-PyVRKtlpIbaRsM,1943
|
|
22
|
+
pgwidgets_python-0.3.3.dist-info/scm_version.json,sha256=QuXBS8rkNOzsOyOLL_7d599vXJRfhJZxVPwFnAqG4fk,160
|
|
23
|
+
pgwidgets_python-0.3.3.dist-info/top_level.txt,sha256=wwL6fBq0gU-JwzlM6TdduY1qYpu39ysqnnbQT-1bqAs,10
|
|
24
|
+
pgwidgets_python-0.3.3.dist-info/RECORD,,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".flake8",
|
|
4
|
+
"test_pg2.py",
|
|
5
|
+
"README.md",
|
|
6
|
+
"pyproject.toml",
|
|
7
|
+
"LICENSE.md",
|
|
8
|
+
".readthedocs.yaml",
|
|
9
|
+
".gitignore",
|
|
10
|
+
"docs/web-servers.rst",
|
|
11
|
+
"docs/WhatsNew.rst",
|
|
12
|
+
"docs/subclassing.rst",
|
|
13
|
+
"docs/sync.rst",
|
|
14
|
+
"docs/utilities.rst",
|
|
15
|
+
"docs/extras.rst",
|
|
16
|
+
"docs/async.rst",
|
|
17
|
+
"docs/architecture.rst",
|
|
18
|
+
"docs/widgets.rst",
|
|
19
|
+
"docs/conf.py",
|
|
20
|
+
"docs/Makefile",
|
|
21
|
+
"docs/index.rst",
|
|
22
|
+
"docs/callbacks.rst",
|
|
23
|
+
"docs/getting-started.rst",
|
|
24
|
+
"docs/api/async.rst",
|
|
25
|
+
"docs/api/sync.rst",
|
|
26
|
+
"docs/api/index.rst",
|
|
27
|
+
"tests/test_protocol.py",
|
|
28
|
+
"tests/__init__.py",
|
|
29
|
+
"tests/test_stateful.py",
|
|
30
|
+
"tests/test_resolve_kwargs.py",
|
|
31
|
+
"tests/test_async_session.py",
|
|
32
|
+
"tests/test_defs.py",
|
|
33
|
+
"tests/test_fonts.py",
|
|
34
|
+
"tests/test_session.py",
|
|
35
|
+
"tests/test_extras.py",
|
|
36
|
+
"tests/test_widget_classes.py",
|
|
37
|
+
"tests/test_reconstruct.py",
|
|
38
|
+
"pgwidgets/_json.py",
|
|
39
|
+
"pgwidgets/__init__.py",
|
|
40
|
+
"pgwidgets/callbacks.py",
|
|
41
|
+
"pgwidgets/method_types.py",
|
|
42
|
+
"pgwidgets/buffer.py",
|
|
43
|
+
"pgwidgets/defs.py",
|
|
44
|
+
"pgwidgets/sync/Widgets.py",
|
|
45
|
+
"pgwidgets/sync/__init__.py",
|
|
46
|
+
"pgwidgets/sync/application.py",
|
|
47
|
+
"pgwidgets/sync/widget.py",
|
|
48
|
+
"pgwidgets/extras/__init__.py",
|
|
49
|
+
"pgwidgets/extras/file_browser.py",
|
|
50
|
+
"pgwidgets/icons/pgw-python-logo.png",
|
|
51
|
+
"pgwidgets/async_/Widgets.py",
|
|
52
|
+
"pgwidgets/async_/application.py",
|
|
53
|
+
"pgwidgets/async_/__init__.py",
|
|
54
|
+
"pgwidgets/async_/widget.py",
|
|
55
|
+
"examples/demo_sync.py",
|
|
56
|
+
"examples/all_widgets.py",
|
|
57
|
+
"examples/all_widgets_async.py",
|
|
58
|
+
"examples/README.md",
|
|
59
|
+
"examples/demo_treeview.py",
|
|
60
|
+
"examples/demo_async.py",
|
|
61
|
+
"examples/flask-multi-process/server.py",
|
|
62
|
+
"examples/flask-multi-process/README.md",
|
|
63
|
+
"examples/flask-multi-process/nginx.conf",
|
|
64
|
+
"examples/flask-multi-process/gunicorn.conf.py",
|
|
65
|
+
"examples/flask-multi-process/user_app.py",
|
|
66
|
+
".github/workflows/tests.yml"
|
|
67
|
+
]
|
|
68
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|