pgwidgets-python 0.4.2__tar.gz → 0.5.0__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.
Files changed (82) hide show
  1. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/PKG-INFO +2 -2
  2. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/WhatsNew.rst +42 -0
  3. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/callbacks.rst +9 -0
  4. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/widgets.rst +43 -3
  5. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/all_widgets.py +3 -1
  6. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/all_widgets_async.py +95 -27
  7. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/async_/application.py +11 -3
  8. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/async_/widget.py +37 -3
  9. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/extras/file_browser.py +3 -3
  10. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/method_types.py +13 -0
  11. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/sync/application.py +11 -3
  12. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/sync/widget.py +37 -2
  13. pgwidgets_python-0.5.0/pgwidgets/tab_model.py +186 -0
  14. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets_python.egg-info/PKG-INFO +2 -2
  15. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets_python.egg-info/SOURCES.txt +2 -0
  16. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets_python.egg-info/requires.txt +1 -1
  17. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets_python.egg-info/scm_file_list.json +2 -0
  18. pgwidgets_python-0.5.0/pgwidgets_python.egg-info/scm_version.json +8 -0
  19. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pyproject.toml +1 -12
  20. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_async_session.py +0 -1
  21. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_defs.py +2 -2
  22. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_protocol.py +0 -2
  23. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_reconstruct.py +17 -13
  24. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_session.py +21 -7
  25. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_stateful.py +19 -5
  26. pgwidgets_python-0.5.0/tests/test_tab_moves.py +164 -0
  27. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_tree_model.py +44 -0
  28. pgwidgets_python-0.4.2/pgwidgets_python.egg-info/scm_version.json +0 -8
  29. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/.flake8 +0 -0
  30. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/.github/workflows/tests.yml +0 -0
  31. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/.gitignore +0 -0
  32. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/.readthedocs.yaml +0 -0
  33. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/LICENSE.md +0 -0
  34. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/README.md +0 -0
  35. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/Makefile +0 -0
  36. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/api/async.rst +0 -0
  37. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/api/index.rst +0 -0
  38. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/api/sync.rst +0 -0
  39. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/architecture.rst +0 -0
  40. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/async.rst +0 -0
  41. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/conf.py +0 -0
  42. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/extras.rst +0 -0
  43. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/getting-started.rst +0 -0
  44. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/index.rst +0 -0
  45. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/subclassing.rst +0 -0
  46. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/sync.rst +0 -0
  47. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/utilities.rst +0 -0
  48. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/docs/web-servers.rst +0 -0
  49. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/README.md +0 -0
  50. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/demo_async.py +0 -0
  51. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/demo_sync.py +0 -0
  52. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/demo_treeview.py +0 -0
  53. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/flask-multi-process/README.md +0 -0
  54. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/flask-multi-process/gunicorn.conf.py +0 -0
  55. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/flask-multi-process/nginx.conf +0 -0
  56. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/flask-multi-process/server.py +0 -0
  57. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/examples/flask-multi-process/user_app.py +0 -0
  58. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/__init__.py +0 -0
  59. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/_json.py +0 -0
  60. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/async_/Widgets.py +0 -0
  61. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/async_/__init__.py +0 -0
  62. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/buffer.py +0 -0
  63. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/callbacks.py +0 -0
  64. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/defs.py +0 -0
  65. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/extras/__init__.py +0 -0
  66. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/icons/pgw-python-logo.png +0 -0
  67. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/sync/Widgets.py +0 -0
  68. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/sync/__init__.py +0 -0
  69. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/sync/text_source.py +0 -0
  70. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/text_model.py +0 -0
  71. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets/tree_model.py +0 -0
  72. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets_python.egg-info/dependency_links.txt +0 -0
  73. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/pgwidgets_python.egg-info/top_level.txt +0 -0
  74. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/setup.cfg +0 -0
  75. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/test_pg2.py +0 -0
  76. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/__init__.py +0 -0
  77. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_extras.py +0 -0
  78. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_fonts.py +0 -0
  79. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_resolve_kwargs.py +0 -0
  80. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_text_source.py +0 -0
  81. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tests/test_widget_classes.py +0 -0
  82. {pgwidgets_python-0.4.2 → pgwidgets_python-0.5.0}/tools/sync_async_tree_model.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pgwidgets-python
3
- Version: 0.4.2
3
+ Version: 0.5.0
4
4
  Summary: Python bindings for the pgwidgets JavaScript widget library
5
5
  Author: PGWidgets Developers
6
6
  License-Expression: BSD-3-Clause
@@ -17,7 +17,7 @@ Classifier: Topic :: Software Development :: User Interfaces
17
17
  Requires-Python: >=3.12
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE.md
20
- Requires-Dist: pgwidgets-js>=0.4.2
20
+ Requires-Dist: pgwidgets-js>=0.5.0
21
21
  Requires-Dist: websockets>=12
22
22
  Provides-Extra: dev
23
23
  Requires-Dist: sphinx; extra == "dev"
@@ -1,6 +1,48 @@
1
1
  What's New
2
2
  ==========
3
3
 
4
+ Recent changes — since ``v0.4.3``
5
+ ---------------------------------
6
+
7
+ * TabWidget: tabs can be dragged between TabWidgets and detached, with
8
+ the new pgwidgets-js ``movable``, ``detachable`` and ``group`` options
9
+ and ``page-move``, ``page-reorder`` and ``page-detach`` callbacks.
10
+ * The session follows every tab move, whether made in code
11
+ (``insert_widget()``, ``move_tab()``, ``move_tab_from()``, ``remove()``)
12
+ or by the user dragging a tab: tab order and the current tab are kept,
13
+ so a reconnecting browser gets the same layout, and the move is pushed
14
+ to the session's other browsers.
15
+ * TabWidget ``insert_widget()`` inserts at the given position (it used to
16
+ be replayed at the end on reconnect).
17
+ * These need the pgwidgets-js release after 0.4.3; the dependency floor
18
+ will be raised when it is out.
19
+
20
+ Recent changes — since ``v0.4.2``
21
+ ---------------------------------
22
+
23
+ TreeView / TableView: a column can opt out of the header-click sort
24
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25
+
26
+ A column descriptor can carry ``"sortable": False`` to take that column
27
+ out of the header-click sort on an otherwise sortable table. It guards
28
+ against an accidental sort on a column whose values are all equal --
29
+ the sort leaves nothing on screen to show it happened, and the next
30
+ edit in that column re-sorts the rows and makes the edited row jump.
31
+ The flag gates the user's click only, so ``sort_by_column()`` still
32
+ works on an opted-out column. Nothing changed on this side -- column
33
+ descriptors go to the browser as given -- but the browser honours the
34
+ flag from pgwidgets-js 0.4.3, which the dependency floor now requires.
35
+
36
+ TreeView / TableView: the column list is a private copy
37
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
38
+
39
+ ``set_columns(columns)`` and the ``columns=`` constructor option now
40
+ keep a copy of the list they are given, as ``set_tree()`` and
41
+ ``set_rows()`` already did. ``insert_column()``, ``append_column()``
42
+ and ``delete_column()`` edit the stored list in place, and before this
43
+ they edited the caller's list along with it; equally, a caller that
44
+ kept editing its own list changed what a reconnect replayed.
45
+
4
46
  Recent changes — since ``v0.4.0``
5
47
  ---------------------------------
6
48
 
@@ -82,6 +82,15 @@ common patterns:
82
82
  * - ``page-close``
83
83
  - TabWidget, StackWidget, MDIWidget
84
84
  - ``(child: Widget)``
85
+ * - ``page-move``
86
+ - TabWidget (destination)
87
+ - ``(src: TabWidget, child: Widget, index: int)``
88
+ * - ``page-reorder``
89
+ - TabWidget
90
+ - ``(child: Widget, index: int)``
91
+ * - ``page-detach``
92
+ - TabWidget
93
+ - ``(child: Widget, x: int, y: int)``
85
94
  * - ``child-added``
86
95
  - All containers
87
96
  - ``(child: Widget)``
@@ -190,12 +190,16 @@ TabWidget
190
190
 
191
191
  Tabbed container.
192
192
 
193
- - **Options:** ``closable``, ``reorderable``, ``tab_position``
194
- - **Methods:** ``add_widget(child, options)``, ``show_widget(child)``,
193
+ - **Options:** ``closable``, ``reorderable``, ``movable``,
194
+ ``detachable``, ``group``, ``tab_position``
195
+ - **Methods:** ``add_widget(child, options)``,
196
+ ``insert_widget(index, child, options)``, ``move_tab(child, index)``,
197
+ ``move_tab_from(src, child, index)``, ``show_widget(child)``,
195
198
  ``close_widget(child)``, ``set_index(index)``, ``get_index()``,
196
199
  ``get_tab_id(child)``, ``get_child(tab_id)``, ``index_of(child)``,
197
200
  ``highlight_tab(child, bgcolor)``, ``set_tab_position(tabpos)``
198
- - **Callbacks:** ``child-added``, ``child-removed``, ``page-switch``, ``page-close``
201
+ - **Callbacks:** ``child-added``, ``child-removed``, ``page-switch``,
202
+ ``page-close``, ``page-move``, ``page-reorder``, ``page-detach``
199
203
 
200
204
  .. code-block:: python
201
205
 
@@ -203,6 +207,37 @@ Tabbed container.
203
207
  tabs.add_widget(panel1, {"title": "Tab 1"})
204
208
  tabs.add_widget(panel2, {"title": "Tab 2"})
205
209
 
210
+ **Dragging tabs.** With ``reorderable`` the user can drag a tab to
211
+ another position in its tab bar. With ``movable`` a tab can be dragged
212
+ to another movable TabWidget of the same ``group`` (default ``0``). With
213
+ ``detachable`` a tab can be dropped on the page background, outside of
214
+ any window -- but only if a ``page-detach`` handler is registered, since
215
+ the handler decides where the tab goes; the tab is not removed for it.
216
+ A drop anywhere else cancels the drag. See the pgwidgets-js
217
+ documentation for the details.
218
+
219
+ The session keeps its record of the tabs in step with every move, made
220
+ in code or by the user, so a reconnecting browser gets the same tab order
221
+ and current tab, and the other browsers of the session are shown the
222
+ move.
223
+
224
+ .. code-block:: python
225
+
226
+ left = Widgets.TabWidget(movable=True, detachable=True, group=1)
227
+ right = Widgets.TabWidget(movable=True, detachable=True, group=1)
228
+
229
+ def detach(child, x, y):
230
+ # give the detached tab a window of its own, where it was dropped
231
+ tabs = Widgets.TabWidget(movable=True, detachable=True, group=1)
232
+ top = Widgets.TopLevel(title="Detached", resizable=True)
233
+ top.set_widget(tabs)
234
+ left.remove(child)
235
+ tabs.add_widget(child, {"title": "Detached"})
236
+ top.set_position(x, y)
237
+ top.show()
238
+
239
+ left.on("page-detach", detach)
240
+
206
241
  StackWidget
207
242
  ~~~~~~~~~~~
208
243
 
@@ -663,6 +698,11 @@ Each column is described by a dict with the following keys:
663
698
  - ``editable`` -- whether cells in the column can be edited via
664
699
  double-click.
665
700
  - ``icon_size`` -- pixel size for icon columns (default 16).
701
+ - ``sortable`` -- ``False`` takes the column out of the header-click
702
+ sort on a table built with ``sortable=True``. It can only narrow:
703
+ ``True`` does not make a column sortable on a table that is not.
704
+ ``sort_by_column()`` still works on the column. Needs pgwidgets-js
705
+ 0.4.3.
666
706
 
667
707
  Tree shape (``set_tree``)
668
708
  ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -142,7 +142,7 @@ def on_session(session):
142
142
  content.add_widget(W.Label("Editable:"), 0)
143
143
  combo2 = W.ComboBox(editable=True, dropdown_limit=5)
144
144
  for c in ["Red", "Orange", "Yellow", "Green", "Blue",
145
- "Indigo", "Violet"]:
145
+ "Indigo", "Violet"]:
146
146
  combo2.append_text(c)
147
147
  combo2.on("activated",
148
148
  lambda idx, text: lbl.set_text(f"Entered: {text}"))
@@ -417,6 +417,7 @@ def on_session(session):
417
417
  lambda child, idx: lbl.set_text(f"Switched to tab {idx}"))
418
418
  add_btn = W.Button("Add Tab")
419
419
  tab_counter = [3]
420
+
420
421
  def on_add_tab():
421
422
  tab_counter[0] += 1
422
423
  n = tab_counter[0]
@@ -474,6 +475,7 @@ def on_session(session):
474
475
  hbox = W.HBox(spacing=4)
475
476
  btn_add = W.Button("Add Row")
476
477
  row_counter = [8]
478
+
477
479
  def on_add_row():
478
480
  row_counter[0] += 1
479
481
  table.append_row({