pyfigures 0.2.5__tar.gz → 0.2.6__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 (328) hide show
  1. {pyfigures-0.2.5/pyfigures.egg-info → pyfigures-0.2.6}/PKG-INFO +1 -1
  2. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/__main__.py +5 -2
  3. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/launch.py +7 -1
  4. pyfigures-0.2.6/pyfigures/assistant/web_chat.py +299 -0
  5. pyfigures-0.2.6/pyfigures/gui/command_box.py +36 -0
  6. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/pdf_support.py +10 -3
  7. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/pfgui.py +36 -7
  8. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/show_me_how.py +462 -446
  9. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/video_support.py +5 -3
  10. pyfigures-0.2.6/pyfigures/gui/web_chat_panel.py +591 -0
  11. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/version.py +1 -1
  12. {pyfigures-0.2.5 → pyfigures-0.2.6/pyfigures.egg-info}/PKG-INFO +1 -1
  13. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures.egg-info/SOURCES.txt +5 -0
  14. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_assistant_live.py +4 -0
  15. pyfigures-0.2.6/tests/test_command_box.py +22 -0
  16. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_tutorials.py +14 -2
  17. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_pymupdf_offer.py +4 -0
  18. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_video_support.py +3 -1
  19. pyfigures-0.2.6/tests/test_web_chat_20261109.py +311 -0
  20. {pyfigures-0.2.5 → pyfigures-0.2.6}/LICENSE +0 -0
  21. {pyfigures-0.2.5 → pyfigures-0.2.6}/README.md +0 -0
  22. {pyfigures-0.2.5 → pyfigures-0.2.6}/images/__init__.py +0 -0
  23. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/__init__.py +0 -0
  24. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/album/__init__.py +0 -0
  25. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/album/__main__.py +0 -0
  26. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/arrowheads.py +0 -0
  27. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/__init__.py +0 -0
  28. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/advanced_annotations.py +0 -0
  29. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/assistant_actions.py +0 -0
  30. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/categorized_mcp.py +0 -0
  31. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/existing_tools.py +0 -0
  32. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/figure_state.py +0 -0
  33. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/gui_selection.py +0 -0
  34. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/letter_sequence.py +0 -0
  35. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/live_mcp.py +0 -0
  36. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/live_structure.py +0 -0
  37. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/manual_help.py +0 -0
  38. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/manual_help_verified.json +0 -0
  39. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/native_gui.py +0 -0
  40. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/original_registry.py +0 -0
  41. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/partner_gui.py +0 -0
  42. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/plot_lifecycle.py +0 -0
  43. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/pointer_context.py +0 -0
  44. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/readability.py +0 -0
  45. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/recovery.py +0 -0
  46. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/result_evidence.py +0 -0
  47. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/session.py +0 -0
  48. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/assistant/submission_review.py +0 -0
  49. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/atomic_io.py +0 -0
  50. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/burned_text.py +0 -0
  51. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/colorbar_script.py +0 -0
  52. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/constant_panels.py +0 -0
  53. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/cvd.py +0 -0
  54. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/equations.py +0 -0
  55. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/extras.py +0 -0
  56. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/flip.py +0 -0
  57. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/__init__.py +0 -0
  58. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/about_dialog_pzf.py +0 -0
  59. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/annotation_editor.py +0 -0
  60. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/asingleoraspanel.py +0 -0
  61. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/autolettering_widget.py +0 -0
  62. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/bg_color_selection.py +0 -0
  63. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/bug_recorder.py +0 -0
  64. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/caption_dialog.py +0 -0
  65. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/colorassistant.py +0 -0
  66. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/ctrl_key.py +0 -0
  67. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/deckcraft_blank.json +0 -0
  68. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/dimchooser.py +0 -0
  69. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/drag_sketch.py +0 -0
  70. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/drop_sketch.py +0 -0
  71. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/editable_export.py +0 -0
  72. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/editor_interaction.py +0 -0
  73. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/emptyimagedialog.py +0 -0
  74. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/equation_dialog.py +0 -0
  75. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/ezfig.py +0 -0
  76. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/fonts/README.md +0 -0
  77. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/fontselectorgui.py +0 -0
  78. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/group_builder_GUI.py +0 -0
  79. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/headless_ops.py +0 -0
  80. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/integrity_ops.py +0 -0
  81. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/journal_style_editor.py +0 -0
  82. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/keep_tst_images_for_pzf.py +0 -0
  83. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/label_rows.py +0 -0
  84. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/latex_code_dialog.py +0 -0
  85. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/latex_support.py +0 -0
  86. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/lutmultiselector.py +0 -0
  87. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/mcp_server_dialog.py +0 -0
  88. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/pagelimitswidget.py +0 -0
  89. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/panelcreationwidget.py +0 -0
  90. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/portable_fonts.py +0 -0
  91. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/qc_reports.py +0 -0
  92. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/region_picker.py +0 -0
  93. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/render_headless.py +0 -0
  94. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/review/__init__.py +0 -0
  95. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/review/_template.py +0 -0
  96. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/review/dialog.py +0 -0
  97. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/review/html_export.py +0 -0
  98. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/review/send.py +0 -0
  99. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/row_letters.py +0 -0
  100. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/scalebareditor.py +0 -0
  101. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/scrollableEZFIG.py +0 -0
  102. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/show_me_where.py +0 -0
  103. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/simple_text_editor.py +0 -0
  104. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/spaceselector.py +0 -0
  105. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/style_text_headless.py +0 -0
  106. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/svg_painter.py +0 -0
  107. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/textEditWatcher.py +0 -0
  108. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/theme.py +0 -0
  109. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/tipdialog.py +0 -0
  110. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/tutorial.py +0 -0
  111. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/user_extra_translation.py +0 -0
  112. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/user_prefs.py +0 -0
  113. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/widget_for_inset.py +0 -0
  114. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/gui/zoom_links.py +0 -0
  115. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/guides.py +0 -0
  116. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/history.py +0 -0
  117. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/icons/__init__.py +0 -0
  118. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/icons/pyfigures.png +0 -0
  119. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/icons/pyfigures_album.png +0 -0
  120. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/icons/pyfigures_poster.png +0 -0
  121. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/image_search.py +0 -0
  122. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/journal_styles.py +0 -0
  123. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/latex_document.py +0 -0
  124. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/layout_formula.py +0 -0
  125. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/layout_picture.py +0 -0
  126. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_control.py +0 -0
  127. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_server.py +0 -0
  128. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/__init__.py +0 -0
  129. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/annotations.py +0 -0
  130. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/app.py +0 -0
  131. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/content.py +0 -0
  132. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/core.py +0 -0
  133. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/export.py +0 -0
  134. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/guidance.py +0 -0
  135. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/image_search.py +0 -0
  136. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/journal.py +0 -0
  137. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/overlays.py +0 -0
  138. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/poster.py +0 -0
  139. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/qc.py +0 -0
  140. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/stacks.py +0 -0
  141. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/structure.py +0 -0
  142. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/upkeep.py +0 -0
  143. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/mcp_tools/workflow.py +0 -0
  144. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/office_math.py +0 -0
  145. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/offscreen.py +0 -0
  146. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/panel_source_preview.py +0 -0
  147. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/path_resolution.py +0 -0
  148. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/__init__.py +0 -0
  149. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/__main__.py +0 -0
  150. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/page_presets.py +0 -0
  151. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_align.py +0 -0
  152. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_canvas.py +0 -0
  153. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_headless.py +0 -0
  154. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_layout_dialog.py +0 -0
  155. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_layouts.py +0 -0
  156. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_recipe.py +0 -0
  157. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_shapes.py +0 -0
  158. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_source_data.py +0 -0
  159. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_templates.py +0 -0
  160. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_text_dialog.py +0 -0
  161. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_web_export.py +0 -0
  162. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/poster_window.py +0 -0
  163. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/poster/serialization.py +0 -0
  164. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/qt_exit.py +0 -0
  165. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/recipe.py +0 -0
  166. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/script_helpers.py +0 -0
  167. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/self_test.py +0 -0
  168. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/source_snapshot.py +0 -0
  169. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/stack_info.py +0 -0
  170. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures/zoom_geometry.py +0 -0
  171. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures.egg-info/dependency_links.txt +0 -0
  172. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures.egg-info/requires.txt +0 -0
  173. {pyfigures-0.2.5 → pyfigures-0.2.6}/pyfigures.egg-info/top_level.txt +0 -0
  174. {pyfigures-0.2.5 → pyfigures-0.2.6}/setup.cfg +0 -0
  175. {pyfigures-0.2.5 → pyfigures-0.2.6}/setup.py +0 -0
  176. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_advanced_edit_tools.py +0 -0
  177. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_arrow_tip.py +0 -0
  178. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_arrowheads.py +0 -0
  179. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_atomic_io.py +0 -0
  180. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_audit_fixes.py +0 -0
  181. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_audit_fixes_20261008.py +0 -0
  182. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_backgrounds.py +0 -0
  183. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_bug_recorder.py +0 -0
  184. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_bugs_found_by_gui_e2e.py +0 -0
  185. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_canvas_context_menu.py +0 -0
  186. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_canvas_keyboard_and_clicks.py +0 -0
  187. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_channels_property_20261105.py +0 -0
  188. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_codex_trial_findings.py +0 -0
  189. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_colour_bar_gui.py +0 -0
  190. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_consolidate_download.py +0 -0
  191. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_constant_panels.py +0 -0
  192. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_data_plots_and_stats.py +0 -0
  193. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_deserialization.py +0 -0
  194. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_dnd_canvas_more.py +0 -0
  195. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_dnd_combine_with_target.py +0 -0
  196. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_dnd_main_editor.py +0 -0
  197. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_draft_figure.py +0 -0
  198. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_drop_sketches.py +0 -0
  199. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_editable_export.py +0 -0
  200. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_editable_plot_text.py +0 -0
  201. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_editor_interaction.py +0 -0
  202. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_editor_rotate_and_tool_20261105.py +0 -0
  203. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_empty_inset_roi_20261106.py +0 -0
  204. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_equations.py +0 -0
  205. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_exception_handler.py +0 -0
  206. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_export_waits_for_images.py +0 -0
  207. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_fig_rect_cache.py +0 -0
  208. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_figure_colors.py +0 -0
  209. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_figure_diff.py +0 -0
  210. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_fiji_formats.py +0 -0
  211. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_file_io_encoding.py +0 -0
  212. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_file_state_tracking.py +0 -0
  213. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_flip.py +0 -0
  214. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_folder_drag_and_drop.py +0 -0
  215. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_fonts_available.py +0 -0
  216. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_forbidden_files.py +0 -0
  217. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_context_menu.py +0 -0
  218. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_coverage.py +0 -0
  219. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_dnd.py +0 -0
  220. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_image_editor.py +0 -0
  221. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_menus.py +0 -0
  222. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_monkey.py +0 -0
  223. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_e2e_visual.py +0 -0
  224. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_menus_and_toolbar.py +0 -0
  225. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_more_actions.py +0 -0
  226. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_gui_workflow_actions.py +0 -0
  227. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_guide_routing.py +0 -0
  228. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_image_opacity_reload.py +0 -0
  229. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_image_search.py +0 -0
  230. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_inset_crop_margins_20261106.py +0 -0
  231. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_integrity_and_stats.py +0 -0
  232. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_interactive_tools.py +0 -0
  233. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_internal_dnd_group_placement.py +0 -0
  234. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_inverted_luts.py +0 -0
  235. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_journal_styles.py +0 -0
  236. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_latex_code.py +0 -0
  237. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_latex_documents.py +0 -0
  238. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_latex_extras.py +0 -0
  239. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_latex_full.py +0 -0
  240. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_latex_stress_findings.py +0 -0
  241. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_launchers.py +0 -0
  242. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_layout_canvas_geometry.py +0 -0
  243. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_layout_formula.py +0 -0
  244. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_layout_stability_gui.py +0 -0
  245. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_lazy_loading_placeholder_20261106.py +0 -0
  246. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_lazy_reflow.py +0 -0
  247. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_lettering_restore.py +0 -0
  248. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_licensing.py +0 -0
  249. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_lif_series_reading.py +0 -0
  250. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_llm_feedback_20261020.py +0 -0
  251. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_lut_remove_20261105.py +0 -0
  252. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_max_height.py +0 -0
  253. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_mcp_audit_findings.py +0 -0
  254. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_mcp_control.py +0 -0
  255. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_mcp_history.py +0 -0
  256. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_mcp_server.py +0 -0
  257. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_mcp_stdio_protocol.py +0 -0
  258. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_mcp_text_arguments.py +0 -0
  259. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_missing_images_gui.py +0 -0
  260. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_normalization.py +0 -0
  261. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_offscreen_env.py +0 -0
  262. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_ome_zarr.py +0 -0
  263. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_omero.py +0 -0
  264. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_open_perf.py +0 -0
  265. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_panel_editor.py +0 -0
  266. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_panel_editor_more.py +0 -0
  267. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_panel_preview.py +0 -0
  268. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_parity_mcp.py +0 -0
  269. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_path_resolution.py +0 -0
  270. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_pdf_panels.py +0 -0
  271. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_placeholder_grid.py +0 -0
  272. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_portability.py +0 -0
  273. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_poster_files_and_recipe.py +0 -0
  274. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_poster_gui.py +0 -0
  275. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_poster_mcp.py +0 -0
  276. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_poster_stress_findings.py +0 -0
  277. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_poster_vector_figures.py +0 -0
  278. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_property_setters_validate.py +0 -0
  279. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_pyf_loader_thread_deadlock.py +0 -0
  280. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_pyf_loading.py +0 -0
  281. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_qc_gui.py +0 -0
  282. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_qc_mcp_tools.py +0 -0
  283. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_qc_reports.py +0 -0
  284. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_qt_exit.py +0 -0
  285. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_recipe.py +0 -0
  286. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_recipe_checks_bundles.py +0 -0
  287. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_recipe_extra_keys.py +0 -0
  288. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_recipe_for_llms.py +0 -0
  289. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_recipe_more_keys.py +0 -0
  290. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_recordings.py +0 -0
  291. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_render_export.py +0 -0
  292. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_restyle_texts.py +0 -0
  293. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_review_and_library.py +0 -0
  294. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_row_letters_chat_style_20261106.py +0 -0
  295. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_row_letters_gui.py +0 -0
  296. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_ruler_labels.py +0 -0
  297. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_save_reminder.py +0 -0
  298. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_scale_bar_calibration.py +0 -0
  299. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_scale_consistency.py +0 -0
  300. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_schema_sweep_findings.py +0 -0
  301. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_self_test.py +0 -0
  302. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_send_to_poster.py +0 -0
  303. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_shapes.py +0 -0
  304. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_show_me_how.py +0 -0
  305. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_show_me_where_20261105.py +0 -0
  306. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_source_data.py +0 -0
  307. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_stack_tools.py +0 -0
  308. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_stack_tools_gui.py +0 -0
  309. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_stack_with_image.py +0 -0
  310. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_stress_findings.py +0 -0
  311. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_stress_findings_20261028.py +0 -0
  312. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_stress_findings_20261029.py +0 -0
  313. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_style_audit_calbar.py +0 -0
  314. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_svg_clipping_and_pdf_pages.py +0 -0
  315. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_svg_empty_glyph.py +0 -0
  316. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_tex_install.py +0 -0
  317. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_text_editor_and_widgets.py +0 -0
  318. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_tutorial_controller.py +0 -0
  319. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_tutorials.py +0 -0
  320. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_typography_tidy.py +0 -0
  321. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_uneven_rows_20261105.py +0 -0
  322. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_user_chat_findings_20261104.py +0 -0
  323. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_user_findings_20261022.py +0 -0
  324. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_user_gui_findings_20261021.py +0 -0
  325. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_user_guide_menus.py +0 -0
  326. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_zarr_stress_findings.py +0 -0
  327. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_zoom_callout_gui.py +0 -0
  328. {pyfigures-0.2.5 → pyfigures-0.2.6}/tests/test_zoom_callout_lut.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyfigures
3
- Version: 0.2.5
3
+ Version: 0.2.6
4
4
  Summary: PyFigures will assist you assemble publication ready scientific figures in no time.
5
5
  Home-page: https://github.com/baigouy/PyFigures
6
6
  Author: Benoit Aigouy
@@ -26,7 +26,10 @@ def run_pyfigures():
26
26
  ij_reader = None
27
27
  _use_ij_reader = False
28
28
 
29
- # Initialize the QApplication
29
+ # Initialize the QApplication. Shared GL contexts first: Qt WebEngine (Tools →
30
+ # Chat in a web page) can then be imported later, when the panel opens
31
+ from qtpy.QtCore import QCoreApplication, Qt as _Qt
32
+ QCoreApplication.setAttribute(_Qt.ApplicationAttribute.AA_ShareOpenGLContexts)
30
33
  app = QApplication(sys.argv)
31
34
  from pyfigures.icons import set_app_identity
32
35
  set_app_identity('pyfigures')
@@ -282,7 +285,7 @@ def run_pyfigures():
282
285
  from pyfigures.assistant import sidecar_available
283
286
  if load_chat_at_start() and '--chat' not in sys.argv and sidecar_available():
284
287
  sys.argv.append('--chat') # View → Open the chat at start-up
285
- share = '--share' in sys.argv or '--chat' in sys.argv
288
+ share = '--share' in sys.argv or '--chat' in sys.argv or '--web-chat' in sys.argv
286
289
  if share:
287
290
  # a window that can share its figure with `python -m pyfigures.assistant.live_mcp`
288
291
  from pyfigures.assistant.partner_gui import PartnerGUI
@@ -210,7 +210,13 @@ def sidecar_config(descriptor=None):
210
210
 
211
211
  def apply_launch_flags(window, argv):
212
212
  """``--share``: share the figure with the MCP server at start-up;
213
- ``--chat``: also dock the chat (qtpy_ai_sidecar)."""
213
+ ``--chat``: also dock the chat (qtpy_ai_sidecar); ``--web-chat``: dock
214
+ an online chat page instead (pyfigures.gui.web_chat_panel)."""
215
+ if '--web-chat' in argv:
216
+ window = start_live_session(window).window
217
+ from pyfigures.gui.web_chat_panel import attach
218
+ attach(window)
219
+ return window
214
220
  if '--chat' in argv:
215
221
  return attach_sidecar(window).parent()
216
222
  if '--share' in argv:
@@ -0,0 +1,299 @@
1
+ """Edit the figure from an online chat page (Mistral Le Chat / Emmy, ChatGPT,
2
+ Claude, Gemini…) instead of an API: no key, the user's own login.
3
+
4
+ The page has no tool calls, so the model is asked to write the operations it
5
+ wants as JSON between two marker lines::
6
+
7
+ PYFIGURES-CALLS
8
+ [{"tool": "find_pyfigures_tools", "arguments": {"query": "scale bar"}}]
9
+ END-PYFIGURES-CALLS
10
+
11
+ PyFigures reads them from the page text (any site: no per-site selectors),
12
+ runs them on the shared figure when the user clicks Apply (look-ups may run
13
+ by themselves), and writes the results into the chat box; the user presses
14
+ Send. The operations are those of the chat sidebar (categorized_mcp), run
15
+ in this process through the live session's local bridge, so they must run
16
+ off the Qt thread (the session answers on it).
17
+
18
+ Qt-free here; the panel is pyfigures.gui.web_chat_panel.
19
+ """
20
+ from __future__ import annotations
21
+
22
+ import asyncio
23
+ import base64
24
+ import hashlib
25
+ import json
26
+ import re
27
+ import threading
28
+
29
+ BEGIN = 'PYFIGURES-CALLS'
30
+ END = 'END-PYFIGURES-CALLS'
31
+ RESULTS = 'PYFIGURES-RESULTS'
32
+ TEMPLATE = 'TOOL_NAME' # the placeholder of the example block, never a real call
33
+ _BLOCK = re.compile(r'(?<![A-Z-])' + re.escape(BEGIN) + r'\s*(.*?)\s*' + re.escape(END), re.S)
34
+
35
+ # look-ups: change nothing, so they may run without a click
36
+ READ_ONLY = frozenset({'inspect_figure', 'preview_figure', 'list_pyfigures_categories', 'find_pyfigures_tools'})
37
+
38
+ # chat pages offered in the panel; any other address can be typed (and is remembered)
39
+ PRESETS = (
40
+ # the login page first: in Qt WebEngine 6.4 (Chrome 102) the terms dialog
41
+ # shown before it never closes ("Accept and continue" does nothing) and
42
+ # covers the page's own "Sign in"; once logged in it goes on to the chat
43
+ ('Mistral Le Chat', 'https://chat.mistral.ai/login?return_to=%2Fchat'),
44
+ ('ChatGPT', 'https://chatgpt.com/'),
45
+ ('Claude', 'https://claude.ai/new'),
46
+ ('Gemini', 'https://gemini.google.com/app'),
47
+ )
48
+
49
+ MAX_RESULT_CHARS = 6000 # per call, in the message written back into the chat box
50
+
51
+
52
+ class Block:
53
+ """One PYFIGURES-CALLS block read from the page: its calls, or why it
54
+ could not be read."""
55
+
56
+ def __init__(self, raw, calls=None, error=None):
57
+ self.raw = raw
58
+ self.calls = calls or []
59
+ self.error = error
60
+ self.key = hashlib.sha1(re.sub(r'\s+', '', raw).encode('utf-8')).hexdigest()
61
+
62
+ @property
63
+ def read_only(self):
64
+ return bool(self.calls) and all(c['tool'] in READ_ONLY for c in self.calls)
65
+
66
+ def describe(self):
67
+ if self.error:
68
+ return 'Unreadable request: ' + self.error
69
+ return '\n'.join(describe_call(c) for c in self.calls)
70
+
71
+
72
+ def describe_call(call):
73
+ """One line for the user: the operation and its arguments."""
74
+ tool, args = call['tool'], call.get('arguments') or {}
75
+ if tool == 'use_pyfigures_tool':
76
+ tool, args = args.get('tool_name', '?'), args.get('arguments') or {}
77
+ text = json.dumps(args, ensure_ascii=False)
78
+ return f'{tool} {text if len(text) < 200 else text[:197] + "…"}'
79
+
80
+
81
+ def _strip_fences(text):
82
+ text = text.strip()
83
+ text = re.sub(r'^```[a-zA-Z]*\s*', '', text)
84
+ return re.sub(r'\s*```$', '', text).strip()
85
+
86
+
87
+ def _load(text):
88
+ """JSON as models write it in a chat: smart quotes and trailing commas
89
+ are tolerated."""
90
+ text = _strip_fences(text)
91
+ text = text.replace('“', '"').replace('”', '"').replace(' ', ' ')
92
+ # a page's code block adds its own words around the JSON ("json", "Copy code")
93
+ starts = [i for i in (text.find('['), text.find('{')) if i >= 0]
94
+ end = max(text.rfind(']'), text.rfind('}'))
95
+ if starts and end > min(starts):
96
+ text = text[min(starts):end + 1]
97
+ try:
98
+ return json.loads(text)
99
+ except ValueError:
100
+ return json.loads(re.sub(r',\s*([\]}])', r'\1', text))
101
+
102
+
103
+ def parse_blocks(text, tool_names=None):
104
+ """Every complete PYFIGURES-CALLS block in *text* (a page or a pasted
105
+ reply), in order. A call to an inner operation by its own name is
106
+ wrapped into use_pyfigures_tool, as the sidebar's model would call it.
107
+ Blocks that are not JSON (such as the example in the instructions) come
108
+ back with an error."""
109
+ names = set(tool_names or ()) | READ_ONLY | {'use_pyfigures_tool', 'undo_redo', 'select_live_objects'}
110
+ blocks = []
111
+ for match in _BLOCK.finditer(text or ''):
112
+ raw = match.group(1)
113
+ if TEMPLATE in raw:
114
+ continue # the example of the instructions, shown on the page once sent
115
+ try:
116
+ value = _load(raw)
117
+ except ValueError as exc:
118
+ blocks.append(Block(raw, error=f'not valid JSON ({exc})'))
119
+ continue
120
+ if isinstance(value, dict) and 'calls' in value:
121
+ value = value['calls']
122
+ if isinstance(value, dict):
123
+ value = [value]
124
+ calls, error = [], None
125
+ if not isinstance(value, list) or not value:
126
+ error = 'expected a list of {"tool": …, "arguments": {…}}'
127
+ else:
128
+ for item in value:
129
+ if not isinstance(item, dict) or not isinstance(item.get('tool') or item.get('name'), str):
130
+ error = 'each call needs "tool" and "arguments"'
131
+ break
132
+ tool = item.get('tool') or item.get('name')
133
+ args = item.get('arguments', item.get('args', {}))
134
+ if not isinstance(args, dict):
135
+ error = f'the arguments of {tool} must be a JSON object'
136
+ break
137
+ if tool not in names:
138
+ args = {'tool_name': tool, 'arguments': args}
139
+ tool = 'use_pyfigures_tool'
140
+ calls.append({'tool': tool, 'arguments': args})
141
+ blocks.append(Block(raw, calls=None if error else calls, error=error))
142
+ return blocks
143
+
144
+
145
+ def instructions_prompt(tools, server_instructions, state=None, request=None):
146
+ """The first message: how to ask for operations, the operations, the
147
+ figure as it is now. The user adds their request after it."""
148
+ lines = [
149
+ 'You are helping me edit a scientific figure that is open in PyFigures on my computer. '
150
+ 'IMPORTANT: in this conversation do not use any tool, sandbox, code execution, file or web access of '
151
+ 'your own: PyFigures runs on my computer and you cannot reach it. Its only way in is the text block '
152
+ 'described here, which I run for you. "Let me look at the figure" without such a block does nothing: '
153
+ 'to look, put inspect_figure or preview_figure in a block. '
154
+ 'So, when you want PyFigures to run operations, '
155
+ 'end your answer with a JSON list of calls between the two marker lines of this example '
156
+ '(each marker alone on its line):',
157
+ '',
158
+ BEGIN,
159
+ '[{"tool": "' + TEMPLATE + '", "arguments": {...}}]',
160
+ END,
161
+ '',
162
+ 'Rules:',
163
+ '- Use only the tools listed below, with their exact argument names. Inner operations found with '
164
+ 'find_pyfigures_tools are run through use_pyfigures_tool(tool_name, arguments).',
165
+ '- Write at most one block per answer, then stop and wait: I run it in PyFigures and paste back a '
166
+ f'message starting with {RESULTS}. Never invent results.',
167
+ '- Look up the exact arguments of an operation (find_pyfigures_tools) before its first use.',
168
+ '- Put the JSON in a code block if you like, but write the two marker lines exactly as shown.',
169
+ '- When no operation is needed (a question, a how-to), answer normally without a block.',
170
+ '',
171
+ 'PyFigures guidance:',
172
+ server_instructions.strip(),
173
+ '',
174
+ 'Tools:',
175
+ ]
176
+ for tool in tools:
177
+ schema = dict(tool.get('inputSchema') or {})
178
+ schema.pop('title', None)
179
+ lines.append(f'- {tool["name"]}: {(tool.get("description") or "").strip()}')
180
+ lines.append(' arguments schema: ' + json.dumps(schema, ensure_ascii=False, separators=(',', ':')))
181
+ if state is not None:
182
+ lines += ['', 'The figure now (inspect_figure):', _truncate(json.dumps(state, ensure_ascii=False), 8000)]
183
+ if request:
184
+ lines += ['', 'My request: ' + request.strip()]
185
+ else:
186
+ lines += ['', 'Reply "Ready" and wait for my request.']
187
+ return '\n'.join(lines)
188
+
189
+
190
+ def _truncate(text, limit):
191
+ return text if len(text) <= limit else text[:limit] + f'… [{len(text) - limit} more characters cut]'
192
+
193
+
194
+ def results_message(outcomes):
195
+ """The message written back into the chat box after a block ran:
196
+ outcomes = [(call, ok, text)]."""
197
+ lines = [f'{RESULTS} (from PyFigures):']
198
+ for i, (call, ok, text) in enumerate(outcomes, 1):
199
+ lines.append(f'{i}. {describe_call(call)} -> {"OK" if ok else "ERROR"}')
200
+ lines.append(_truncate(text, MAX_RESULT_CHARS))
201
+ # a reminder each time: models drift back to their own tools ("Let me look…") after a few turns.
202
+ # Never both marker words here: the page would show them as a block.
203
+ lines.append('Continue with the next step (operations only in a block between the two marker lines, as at the '
204
+ 'start; no tools of your own), or tell me what changed if the request is done.')
205
+ return '\n'.join(lines)
206
+
207
+
208
+ def _content_text(blocks, images):
209
+ """Text of MCP content blocks; images are kept aside (PNG bytes)."""
210
+ parts = []
211
+ for block in blocks:
212
+ kind = getattr(block, 'type', None)
213
+ if kind == 'text':
214
+ parts.append(block.text)
215
+ elif kind == 'image':
216
+ images.append(base64.b64decode(block.data))
217
+ parts.append('[image: a preview PyFigures keeps for you; ask me to paste it if you need to see it]')
218
+ else:
219
+ parts.append(str(block))
220
+ return '\n'.join(parts)
221
+
222
+
223
+ class ToolRunner:
224
+ """The chat sidebar's operations (categorized_mcp over live_mcp's
225
+ bridge), called in this process. Every call blocks until the shared
226
+ window answered, so call only from a worker thread (run_async)."""
227
+
228
+ def __init__(self, server=None):
229
+ self._server = server
230
+ self._lock = threading.Lock()
231
+
232
+ @property
233
+ def server(self):
234
+ with self._lock:
235
+ if self._server is None:
236
+ from . import live_mcp
237
+ from .categorized_mcp import build_server
238
+ self._server = build_server(live_mcp.mcp, live_mcp.request)
239
+ return self._server
240
+
241
+ def tools(self):
242
+ """[{name, description, inputSchema}] of the advertised operations."""
243
+ listed = asyncio.run(self.server.list_tools())
244
+ return [{'name': t.name, 'description': t.description, 'inputSchema': t.inputSchema} for t in listed]
245
+
246
+ def instructions(self):
247
+ return self.server.instructions or ''
248
+
249
+ def call(self, tool, arguments):
250
+ """(ok, text, images) of one operation."""
251
+ images = []
252
+ try:
253
+ result = asyncio.run(self.server.call_tool(tool, dict(arguments or {})))
254
+ except Exception as exc:
255
+ return False, str(exc), images
256
+ if isinstance(result, tuple):
257
+ result = result[0]
258
+ if isinstance(result, dict):
259
+ return True, json.dumps(result, ensure_ascii=False), images
260
+ return True, _content_text(result, images), images
261
+
262
+ def first_prompt(self, request=None):
263
+ """The instructions message, with the figure as it is now."""
264
+ ok, text, _ = self.call('inspect_figure', {})
265
+ state = None
266
+ if ok:
267
+ try:
268
+ state = json.loads(text)
269
+ except ValueError:
270
+ state = text
271
+ return instructions_prompt(self.tools(), self.instructions(), state, request)
272
+
273
+ def run_block(self, block):
274
+ """[(call, ok, text)] and the images, calls in order; stops at the
275
+ first failed edit (the next ones assumed it worked)."""
276
+ outcomes, images = [], []
277
+ for call in block.calls:
278
+ ok, text, imgs = self.call(call['tool'], call['arguments'])
279
+ outcomes.append((call, ok, text))
280
+ images += imgs
281
+ if not ok and call['tool'] not in READ_ONLY:
282
+ for rest in block.calls[len(outcomes):]:
283
+ outcomes.append((rest, False, 'Not run: an earlier operation in this block failed.'))
284
+ break
285
+ return outcomes, images
286
+
287
+
288
+ def run_async(function, done, *args):
289
+ """function(*args) on a worker thread; done(result or exception) is
290
+ called on that thread (the panel re-posts it to the Qt thread)."""
291
+ def work():
292
+ try:
293
+ value = function(*args)
294
+ except Exception as exc: # handed to the panel, which shows it
295
+ value = exc
296
+ done(value)
297
+ thread = threading.Thread(target=work, daemon=True, name='pyfigures-web-chat')
298
+ thread.start()
299
+ return thread
@@ -0,0 +1,36 @@
1
+ """Message boxes that show a shell command (pip install …) the user can
2
+ select and copy: the text is selectable and a "Copy the command" button puts
3
+ the command on the clipboard without closing the box."""
4
+ from qtpy.QtCore import Qt
5
+ from qtpy.QtWidgets import QApplication, QMessageBox
6
+
7
+ COPY_LABEL = 'Copy the command'
8
+
9
+
10
+ def command_box(parent, title, text, command, warning=False):
11
+ """The (not yet shown) QMessageBox: *text* is selectable, its Copy button
12
+ copies *command* and stays open; OK closes."""
13
+ box = QMessageBox(parent)
14
+ box.setIcon(QMessageBox.Icon.Warning if warning else QMessageBox.Icon.Information)
15
+ box.setWindowTitle(title)
16
+ box.setText(text)
17
+ box.setTextInteractionFlags(Qt.TextInteractionFlag.TextSelectableByMouse)
18
+ copy = box.addButton(COPY_LABEL, QMessageBox.ButtonRole.ActionRole)
19
+ copy.setToolTip(command)
20
+ # QMessageBox closes on any button: drop its own connection, copy instead
21
+ copy.clicked.disconnect()
22
+
23
+ def copied(_checked=False):
24
+ QApplication.clipboard().setText(command)
25
+ copy.setText('Copied')
26
+ copy.clicked.connect(copied)
27
+ box.addButton(QMessageBox.StandardButton.Ok)
28
+ box.setDefaultButton(QMessageBox.StandardButton.Ok)
29
+ return box
30
+
31
+
32
+ def show_command(parent, title, text, command, warning=False):
33
+ """Show the box modally; returns it once closed."""
34
+ box = command_box(parent, title, text, command, warning)
35
+ box.exec()
36
+ return box
@@ -109,9 +109,16 @@ def offer_pymupdf(parent, reason='add', panels=None, force=False) -> bool:
109
109
  hint = ('\n\nCheck the internet connection (or a proxy or firewall blocking '
110
110
  'pypi.org), then try again from Tools → Vector PDF panels.')
111
111
  else:
112
- hint = '\n\nYou can install it yourself with: pip install pymupdf'
113
- QMessageBox.warning(parent, 'Vector PDF panels',
114
- 'PyMuPDF could not be installed:\n' + msg + hint)
112
+ hint = None
113
+ if hint is None:
114
+ from pyfigures.gui.command_box import show_command
115
+ show_command(parent, 'Vector PDF panels',
116
+ 'PyMuPDF could not be installed:\n' + msg
117
+ + '\n\nYou can install it yourself with: pip install pymupdf',
118
+ 'pip install pymupdf', warning=True)
119
+ else:
120
+ QMessageBox.warning(parent, 'Vector PDF panels',
121
+ 'PyMuPDF could not be installed:\n' + msg + hint)
115
122
  return False
116
123
  redone = revectorise(panels or [])
117
124
  QMessageBox.information(parent, 'Vector PDF panels',
@@ -1797,6 +1797,12 @@ class EZFIG_GUI(QMainWindow):
1797
1797
  "server (optional package qtpy-ai-sidecar)")
1798
1798
  tools_menu.addAction(chat_action)
1799
1799
  chat_action.triggered.connect(lambda _checked=False: self.open_chat_sidebar())
1800
+ web_chat_action = QAction("Chat in a web page (experimental, not recommended)…", self)
1801
+ web_chat_action.setToolTip("Dock an online chat page (your own login, no API key): the model "
1802
+ "proposes operations, you click Apply, PyFigures runs them on this figure. "
1803
+ "Check the chat site's terms of service first; the chat sidebar works better")
1804
+ tools_menu.addAction(web_chat_action)
1805
+ web_chat_action.triggered.connect(lambda _checked=False: self.open_web_chat())
1800
1806
  self.pdf_vector_action = QAction("Vector PDF panels (PyMuPDF)…", self)
1801
1807
  tools_menu.addAction(self.pdf_vector_action)
1802
1808
  self.pdf_vector_action.triggered.connect(lambda *_: (self._offer_vector_pdf('menu'),
@@ -6272,13 +6278,16 @@ class EZFIG_GUI(QMainWindow):
6272
6278
  if not sidecar_available():
6273
6279
  # installed with PyFigures and bundled in the apps: only a broken or
6274
6280
  # hand-trimmed install gets here
6275
- QMessageBox.information(self, 'Chat sidebar',
6276
- "The chat sidebar's package, qtpy-ai-sidecar, is missing from this "
6277
- "installation. Reinstall it with\n\n"
6278
- " pip install -U qtpy-ai-sidecar\n\n"
6279
- "(or download the standalone app again), then choose this entry "
6280
- "again. MCP clients (Claude, LM Studio…) work without it: "
6281
- "Tools → Share the open figure with the MCP server.")
6281
+ from pyfigures.gui.command_box import show_command
6282
+ show_command(self, 'Chat sidebar',
6283
+ "The chat sidebar's package, qtpy-ai-sidecar, is missing from this "
6284
+ "installation. Reinstall it with\n\n"
6285
+ " pip install -U qtpy-ai-sidecar\n\n"
6286
+ "(\"Copy the command\" puts it on the clipboard; or download the "
6287
+ "standalone app again), then choose this entry again. MCP clients "
6288
+ "(Claude, LM Studio…) work without it: "
6289
+ "Tools → Share the open figure with the MCP server.",
6290
+ 'pip install -U qtpy-ai-sidecar')
6282
6291
  return None
6283
6292
  if not launch.is_sharing(self) and not self._confirm_share_handover():
6284
6293
  return None
@@ -6301,6 +6310,23 @@ class EZFIG_GUI(QMainWindow):
6301
6310
  "server.\n\nHelp → Chat & MCP Tutorial walks you through it.")
6302
6311
  return dock
6303
6312
 
6313
+ def open_web_chat(self, use_web=True):
6314
+ """Tools > Chat in a web page (CLI: --web-chat): dock an online chat
6315
+ page that edits this figure through the same operations as the chat
6316
+ sidebar, run only when the user clicks Apply
6317
+ (pyfigures/gui/web_chat_panel.py)."""
6318
+ from pyfigures.assistant import launch
6319
+ if not launch.is_sharing(self) and not self._confirm_share_handover():
6320
+ return None
6321
+ try:
6322
+ window = launch.start_live_session(self).window
6323
+ except Exception as e:
6324
+ QMessageBox.warning(self, 'Chat in a web page', str(e))
6325
+ return None
6326
+ window.share_figure_action.setChecked(True)
6327
+ from pyfigures.gui.web_chat_panel import attach
6328
+ return attach(window, use_web=use_web)
6329
+
6304
6330
  def mcp_history_dialog(self):
6305
6331
  """Show the MCP calls logged for the saved figure, with an 'Undo last
6306
6332
  MCP change' button (pyfigures/history.py — same as the list_history /
@@ -8334,6 +8360,9 @@ if __name__ == '__main__':
8334
8360
  threading.Thread(target=ij_reader.init_ij, daemon=True).start()
8335
8361
  # else: not cached — init will happen lazily on first image open
8336
8362
 
8363
+ # Qt WebEngine (Tools → Chat in a web page) may then be imported later
8364
+ from qtpy.QtCore import QCoreApplication
8365
+ QCoreApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts)
8337
8366
  app = QApplication(sys.argv)
8338
8367
  try:
8339
8368
  from pyfigures.gui.portable_fonts import register_portable_fonts