pyfigures 0.2.4__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.
- {pyfigures-0.2.4/pyfigures.egg-info → pyfigures-0.2.6}/PKG-INFO +5 -5
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/__main__.py +5 -2
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/advanced_annotations.py +3 -1
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/categorized_mcp.py +2 -1
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/launch.py +7 -1
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/live_mcp.py +2 -2
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/partner_gui.py +38 -5
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/session.py +2 -1
- pyfigures-0.2.6/pyfigures/assistant/web_chat.py +299 -0
- pyfigures-0.2.6/pyfigures/gui/command_box.py +36 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/pdf_support.py +10 -3
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/pfgui.py +57 -7
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/show_me_how.py +462 -446
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/video_support.py +5 -3
- pyfigures-0.2.6/pyfigures/gui/web_chat_panel.py +591 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/zoom_links.py +25 -4
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/annotations.py +6 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/overlays.py +14 -1
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/version.py +1 -1
- {pyfigures-0.2.4 → pyfigures-0.2.6/pyfigures.egg-info}/PKG-INFO +5 -5
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures.egg-info/SOURCES.txt +9 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures.egg-info/requires.txt +4 -4
- {pyfigures-0.2.4 → pyfigures-0.2.6}/setup.py +4 -4
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_assistant_live.py +4 -0
- pyfigures-0.2.6/tests/test_command_box.py +22 -0
- pyfigures-0.2.6/tests/test_empty_inset_roi_20261106.py +62 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_tutorials.py +14 -2
- pyfigures-0.2.6/tests/test_inset_crop_margins_20261106.py +51 -0
- pyfigures-0.2.6/tests/test_lazy_loading_placeholder_20261106.py +79 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_pymupdf_offer.py +4 -0
- pyfigures-0.2.6/tests/test_row_letters_chat_style_20261106.py +80 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_user_findings_20261022.py +1 -1
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_video_support.py +3 -1
- pyfigures-0.2.6/tests/test_web_chat_20261109.py +311 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/LICENSE +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/README.md +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/images/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/album/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/album/__main__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/arrowheads.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/assistant_actions.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/existing_tools.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/figure_state.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/gui_selection.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/letter_sequence.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/live_structure.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/manual_help.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/manual_help_verified.json +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/native_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/original_registry.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/plot_lifecycle.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/pointer_context.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/readability.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/recovery.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/result_evidence.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/assistant/submission_review.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/atomic_io.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/burned_text.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/colorbar_script.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/constant_panels.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/cvd.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/equations.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/extras.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/flip.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/about_dialog_pzf.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/annotation_editor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/asingleoraspanel.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/autolettering_widget.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/bg_color_selection.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/bug_recorder.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/caption_dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/colorassistant.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/ctrl_key.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/deckcraft_blank.json +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/dimchooser.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/drag_sketch.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/drop_sketch.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/editable_export.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/editor_interaction.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/emptyimagedialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/equation_dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/ezfig.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/fonts/README.md +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/fontselectorgui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/group_builder_GUI.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/headless_ops.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/integrity_ops.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/journal_style_editor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/keep_tst_images_for_pzf.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/label_rows.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/latex_code_dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/latex_support.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/lutmultiselector.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/mcp_server_dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/pagelimitswidget.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/panelcreationwidget.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/portable_fonts.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/qc_reports.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/region_picker.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/render_headless.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/review/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/review/_template.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/review/dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/review/html_export.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/review/send.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/row_letters.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/scalebareditor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/scrollableEZFIG.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/show_me_where.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/simple_text_editor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/spaceselector.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/style_text_headless.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/svg_painter.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/textEditWatcher.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/theme.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/tipdialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/tutorial.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/user_extra_translation.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/user_prefs.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/gui/widget_for_inset.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/guides.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/history.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/icons/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/icons/pyfigures.png +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/icons/pyfigures_album.png +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/icons/pyfigures_poster.png +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/image_search.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/journal_styles.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/latex_document.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/layout_formula.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/layout_picture.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_control.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_server.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/app.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/content.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/core.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/export.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/guidance.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/image_search.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/journal.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/poster.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/qc.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/stacks.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/structure.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/upkeep.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/mcp_tools/workflow.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/office_math.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/offscreen.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/panel_source_preview.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/path_resolution.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/__init__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/__main__.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/page_presets.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_align.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_canvas.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_headless.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_layout_dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_layouts.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_recipe.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_shapes.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_source_data.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_templates.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_text_dialog.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_web_export.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/poster_window.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/poster/serialization.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/qt_exit.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/recipe.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/script_helpers.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/self_test.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/source_snapshot.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/stack_info.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures/zoom_geometry.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures.egg-info/dependency_links.txt +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/pyfigures.egg-info/top_level.txt +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/setup.cfg +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_advanced_edit_tools.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_arrow_tip.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_arrowheads.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_atomic_io.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_audit_fixes.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_audit_fixes_20261008.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_backgrounds.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_bug_recorder.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_bugs_found_by_gui_e2e.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_canvas_context_menu.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_canvas_keyboard_and_clicks.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_channels_property_20261105.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_codex_trial_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_colour_bar_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_consolidate_download.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_constant_panels.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_data_plots_and_stats.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_deserialization.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_dnd_canvas_more.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_dnd_combine_with_target.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_dnd_main_editor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_draft_figure.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_drop_sketches.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_editable_export.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_editable_plot_text.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_editor_interaction.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_editor_rotate_and_tool_20261105.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_equations.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_exception_handler.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_export_waits_for_images.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_fig_rect_cache.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_figure_colors.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_figure_diff.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_fiji_formats.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_file_io_encoding.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_file_state_tracking.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_flip.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_folder_drag_and_drop.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_fonts_available.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_forbidden_files.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_context_menu.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_coverage.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_dnd.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_image_editor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_menus.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_monkey.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_e2e_visual.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_menus_and_toolbar.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_more_actions.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_gui_workflow_actions.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_guide_routing.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_image_opacity_reload.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_image_search.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_integrity_and_stats.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_interactive_tools.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_internal_dnd_group_placement.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_inverted_luts.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_journal_styles.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_latex_code.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_latex_documents.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_latex_extras.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_latex_full.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_latex_stress_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_launchers.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_layout_canvas_geometry.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_layout_formula.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_layout_stability_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_lazy_reflow.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_lettering_restore.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_licensing.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_lif_series_reading.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_llm_feedback_20261020.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_lut_remove_20261105.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_max_height.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_mcp_audit_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_mcp_control.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_mcp_history.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_mcp_server.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_mcp_stdio_protocol.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_mcp_text_arguments.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_missing_images_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_normalization.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_offscreen_env.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_ome_zarr.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_omero.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_open_perf.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_panel_editor.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_panel_editor_more.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_panel_preview.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_parity_mcp.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_path_resolution.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_pdf_panels.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_placeholder_grid.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_portability.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_poster_files_and_recipe.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_poster_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_poster_mcp.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_poster_stress_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_poster_vector_figures.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_property_setters_validate.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_pyf_loader_thread_deadlock.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_pyf_loading.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_qc_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_qc_mcp_tools.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_qc_reports.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_qt_exit.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_recipe.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_recipe_checks_bundles.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_recipe_extra_keys.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_recipe_for_llms.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_recipe_more_keys.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_recordings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_render_export.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_restyle_texts.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_review_and_library.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_row_letters_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_ruler_labels.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_save_reminder.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_scale_bar_calibration.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_scale_consistency.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_schema_sweep_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_self_test.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_send_to_poster.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_shapes.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_show_me_how.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_show_me_where_20261105.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_source_data.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_stack_tools.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_stack_tools_gui.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_stack_with_image.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_stress_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_stress_findings_20261028.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_stress_findings_20261029.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_style_audit_calbar.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_svg_clipping_and_pdf_pages.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_svg_empty_glyph.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_tex_install.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_text_editor_and_widgets.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_tutorial_controller.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_tutorials.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_typography_tidy.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_uneven_rows_20261105.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_user_chat_findings_20261104.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_user_gui_findings_20261021.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_user_guide_menus.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_zarr_stress_findings.py +0 -0
- {pyfigures-0.2.4 → pyfigures-0.2.6}/tests/test_zoom_callout_gui.py +0 -0
- {pyfigures-0.2.4 → 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.
|
|
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
|
|
@@ -36,7 +36,7 @@ Requires-Dist: QtPy>=2.1.0
|
|
|
36
36
|
Requires-Dist: Deprecated
|
|
37
37
|
Requires-Dist: Requests
|
|
38
38
|
Requires-Dist: batoolset>=0.2.0
|
|
39
|
-
Requires-Dist: batoolset-gui>=0.2.
|
|
39
|
+
Requires-Dist: batoolset-gui>=0.2.4
|
|
40
40
|
Requires-Dist: staplot>=0.1.0
|
|
41
41
|
Requires-Dist: pyautogui
|
|
42
42
|
Requires-Dist: imagecodecs
|
|
@@ -46,7 +46,7 @@ Requires-Dist: latex2mathml
|
|
|
46
46
|
Requires-Dist: mathml2omml
|
|
47
47
|
Requires-Dist: pylatexenc
|
|
48
48
|
Requires-Dist: pypdfium2
|
|
49
|
-
Requires-Dist: qtpy-ai-sidecar>=0.1.
|
|
49
|
+
Requires-Dist: qtpy-ai-sidecar>=0.1.4
|
|
50
50
|
Requires-Dist: mcp<2,>=1.12
|
|
51
51
|
Provides-Extra: ai
|
|
52
52
|
Requires-Dist: mcp<2,>=1.12; extra == "ai"
|
|
@@ -63,10 +63,10 @@ Provides-Extra: omero
|
|
|
63
63
|
Requires-Dist: omero-py; extra == "omero"
|
|
64
64
|
Provides-Extra: chat
|
|
65
65
|
Requires-Dist: mcp<2,>=1.12; extra == "chat"
|
|
66
|
-
Requires-Dist: qtpy-ai-sidecar>=0.1.
|
|
66
|
+
Requires-Dist: qtpy-ai-sidecar>=0.1.4; extra == "chat"
|
|
67
67
|
Provides-Extra: all
|
|
68
68
|
Requires-Dist: mcp<2,>=1.12; extra == "all"
|
|
69
|
-
Requires-Dist: qtpy-ai-sidecar>=0.1.
|
|
69
|
+
Requires-Dist: qtpy-ai-sidecar>=0.1.4; extra == "all"
|
|
70
70
|
Requires-Dist: av; extra == "all"
|
|
71
71
|
Requires-Dist: opencv-python-headless; extra == "all"
|
|
72
72
|
Requires-Dist: pyimagej; extra == "all"
|
|
@@ -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
|
|
@@ -219,7 +219,9 @@ def prepare_inset(obj, changes):
|
|
|
219
219
|
allowed={'size_fraction',INSET_SIZE,'border_size','border_color'}
|
|
220
220
|
if not changes or set(changes)-allowed:
|
|
221
221
|
raise ValueError('Inset changes: size_fraction (width as a share of the panel width, 0-1; '
|
|
222
|
-
'"larger" = a bigger fraction than the current one), border_size, border_color'
|
|
222
|
+
'"larger" = a bigger fraction than the current one), border_size, border_color. '
|
|
223
|
+
'The region an inset shows comes from its ROI: edit the ROI geometry, then '
|
|
224
|
+
'remove_inset and roi_to_inset again (crops are margins per edge, not coordinates).')
|
|
223
225
|
plan={}
|
|
224
226
|
for key,v in changes.items():
|
|
225
227
|
if key in ('size_fraction',INSET_SIZE):
|
|
@@ -16,7 +16,8 @@ COMMON_CONTRACTS = ('edit_panel_letters', 'swap_live_panels', 'remove_annotation
|
|
|
16
16
|
CONTRACT_SCOPE = {
|
|
17
17
|
'swap_rows': 'exchanges WHOLE rows; to reorder panels inside one row use reorder_children',
|
|
18
18
|
'reorder_children': 'reorders the panels WITHIN one row/group, e.g. reversing a row',
|
|
19
|
-
'set_panel_letter_position': 'GLOBAL default letter placement for every panel, not one
|
|
19
|
+
'set_panel_letter_position': 'GLOBAL default letter placement for every panel (a corner INSIDE it), not one '
|
|
20
|
+
'selected panel letter; letters OUTSIDE the panels = set_panel_letter_layout row',
|
|
20
21
|
'delete_last_rows': 'removes WHOLE rows from the end; only on an explicit removal request',
|
|
21
22
|
'swap_live_panels': 'exchanges two panels, keeping their letters in place',
|
|
22
23
|
}
|
|
@@ -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:
|
|
@@ -126,7 +126,7 @@ def run_live_pyfigures_tools(session_id: str, expected_revision: int, request_id
|
|
|
126
126
|
|
|
127
127
|
@mcp.tool()
|
|
128
128
|
def set_panel_letter_position(placement: str = 'top left') -> dict:
|
|
129
|
-
"""Move the existing automatic PANEL LETTERS (A, B, C...) to a corner of every image. Updates the figure's global lettering position so GUI auto-lettering preserves it on refresh. Use top left, top right, bottom left or bottom right. Preserve letters, font, size, colors and other annotations. One GUI undo step; no source save. For moving panel letters use this instead of deleting them or adding ordinary corner labels, which auto-lettering can replace."""
|
|
129
|
+
"""Move the existing automatic PANEL LETTERS (A, B, C...) to a corner of every image. Updates the figure's global lettering position so GUI auto-lettering preserves it on refresh. Use top left, top right, bottom left or bottom right. Preserve letters, font, size, colors and other annotations. One GUI undo step; no source save. For moving panel letters use this instead of deleting them or adding ordinary corner labels, which auto-lettering can replace. Letters OUTSIDE the panels (one per row, in a left margin) are set_panel_letter_layout(letter_layout="row"), not a placement."""
|
|
130
130
|
return call_live('bulk_letters', {'action': 'style', 'placement': placement})
|
|
131
131
|
|
|
132
132
|
|
|
@@ -143,7 +143,7 @@ def edit_panel_letters(action: Literal['style','remove','restore','renumber'] =
|
|
|
143
143
|
color: str | int | None = None, background: str | int | None = None,
|
|
144
144
|
start_letter: str | None = None, replace_overrides: bool = False,
|
|
145
145
|
removal_request: str | None = None) -> dict:
|
|
146
|
-
"""Scope rules: use scope=all for all panel letters and omit panel_ids/group_path. scope=panels requires a nonempty panel_ids list; scope=selection uses the current selection. Pass ONLY changed fields, never the full letter_styles readback: opacity/bold/italic/underline are not accepted. For italic/bold/underline, call restyle_texts(target=letters) directly; do not call this operation first. Preferred ONE-CALL bulk operation for panel-letter placement, font family/size, color/background, removal and restoration. For bold/italic/underline use restyle_texts(target=letters); those are not fields of this function. placement accepts center/centre/middle or a corner. action=style preserves existing text; renumber scope=all creates a complete unique sequence for a newly constructed figure when asked to letter the panels; partial restore preserves existing IDs and is not a whole-figure renumber; remove requires removal_request quoting an explicit user request to remove/hide letters (never a swap), and hides panel letters persistently without deleting captions/scale bars; restore without start_letter preserves an existing or hidden panel text and otherwise uses its automatic position; explicit start_letter sets a new sequence; renumber changes sequence. scope=auto infers panels from panel_ids, group from group_path, otherwise all; explicit panels/group/selection/all are supported. Supplying panel_ids can never broaden to all panels. For WHITE Arial 12 with NO background use color="white", font_family="Arial", font_size=12, background="none". Black is a color, NOT transparent. Unspecified appearance is preserved. Per-panel overrides survive whole-figure style changes unless replace_overrides=true. One undo step. Returns actual styles, changed/skipped counts, and recovery status. Do not loop over individual annotations for figure/group requests."""
|
|
146
|
+
"""Scope rules: use scope=all for all panel letters and omit panel_ids/group_path. scope=panels requires a nonempty panel_ids list; scope=selection uses the current selection. Pass ONLY changed fields, never the full letter_styles readback: opacity/bold/italic/underline are not accepted. For italic/bold/underline, call restyle_texts(target=letters) directly; do not call this operation first. Preferred ONE-CALL bulk operation for panel-letter placement, font family/size, color/background, removal and restoration. For bold/italic/underline use restyle_texts(target=letters); those are not fields of this function. placement accepts center/centre/middle or a corner (inside the panel); letters OUTSIDE the panels = set_panel_letter_layout(letter_layout="row"). action=style preserves existing text; renumber scope=all creates a complete unique sequence for a newly constructed figure when asked to letter the panels; partial restore preserves existing IDs and is not a whole-figure renumber; remove requires removal_request quoting an explicit user request to remove/hide letters (never a swap), and hides panel letters persistently without deleting captions/scale bars; restore without start_letter preserves an existing or hidden panel text and otherwise uses its automatic position; explicit start_letter sets a new sequence; renumber changes sequence. scope=auto infers panels from panel_ids, group from group_path, otherwise all; explicit panels/group/selection/all are supported. Supplying panel_ids can never broaden to all panels. For WHITE Arial 12 with NO background use color="white", font_family="Arial", font_size=12, background="none". Black is a color, NOT transparent. Unspecified appearance is preserved. Per-panel overrides survive whole-figure style changes unless replace_overrides=true. One undo step. Returns actual styles, changed/skipped counts, and recovery status. Do not loop over individual annotations for figure/group requests. With one letter per row (letter_layout row) the row letters share the figure letter style: action=style scope=all restyles them (font, size, color, background; row_letters_restyled lists them, outcome VERIFIED_CHANGE)."""
|
|
147
147
|
if scope == 'panels' and not panel_ids:
|
|
148
148
|
raise ValueError('scope=panels requires a nonempty panel_ids list. For an explicit all-panel lettering request use scope=all and omit panel_ids; otherwise inspect and provide the intended panel IDs. No edit was submitted.')
|
|
149
149
|
if panel_ids and scope in ('auto', 'all'):
|
|
@@ -695,6 +695,21 @@ class PartnerGUI(BaseGUI):
|
|
|
695
695
|
raise ValueError('group_path is required for group scope')
|
|
696
696
|
if scope == 'panels' and not panel_ids:
|
|
697
697
|
raise ValueError('panel_ids from inspect_panel_letters are required')
|
|
698
|
+
from pyfigures.gui.row_letters import normalise_layout
|
|
699
|
+
row_mode = normalise_layout(getattr(self.paint.EZFIG_panel, 'letter_layout', None)) == 'row'
|
|
700
|
+
if row_mode and action == 'style' and scope != 'all':
|
|
701
|
+
raise ValueError('The figure has one letter per row (outside the rows): those letters share one '
|
|
702
|
+
'style, so style them with scope="all".')
|
|
703
|
+
if placement is not None and re.search(r'\b(outside|outer|margin|per row|beside)\b', str(placement).lower()):
|
|
704
|
+
# "put letters outside": a model passed placement="outside", got
|
|
705
|
+
# "Use a corner", undid the row letters it had just set and searched
|
|
706
|
+
# until stopped (2026-11-06)
|
|
707
|
+
if row_mode:
|
|
708
|
+
raise ValueError('ALREADY_DONE: the letters are already outside the panels (one per row, in a '
|
|
709
|
+
'margin on the left). Nothing to change; report that to the user.')
|
|
710
|
+
raise ValueError('Letters outside the panels: call set_panel_letter_layout(letter_layout="row") '
|
|
711
|
+
'(one letter per row, in a margin left of the row). Letters of single panels '
|
|
712
|
+
'always sit in a corner inside the panel; placement takes a corner.')
|
|
698
713
|
if placement is not None:
|
|
699
714
|
placement = ' '.join(placement.lower().replace('-', ' ').split())
|
|
700
715
|
placement = placement.replace('upper', 'top').replace('lower', 'bottom')
|
|
@@ -744,13 +759,15 @@ class PartnerGUI(BaseGUI):
|
|
|
744
759
|
return {'matched': len(candidates)}
|
|
745
760
|
changed, skipped = [], []
|
|
746
761
|
before_states = {pid: [letter_info(a) for a in letters(panel)] for pid, panel in candidates}
|
|
762
|
+
row_style_before = self._row_letter_style() if row_mode else None
|
|
747
763
|
for pid, panel in candidates:
|
|
748
764
|
existing = letters(panel)
|
|
749
765
|
policy = json.loads(getattr(panel, POLICY, '{}'))
|
|
750
766
|
if not policy.get('base') and existing:
|
|
751
767
|
policy['base'] = letter_info(existing[0])
|
|
752
768
|
if action == 'style' and not existing:
|
|
753
|
-
|
|
769
|
+
if not row_mode: # lettered per row: no letter in a panel is expected
|
|
770
|
+
skipped.append({'panel_id': pid, 'reason': 'No panel letter; use restore to add it'})
|
|
754
771
|
continue
|
|
755
772
|
local = set(policy.get('local_fields', []))
|
|
756
773
|
if replace_overrides and scope == 'all':
|
|
@@ -811,10 +828,26 @@ class PartnerGUI(BaseGUI):
|
|
|
811
828
|
self.serializable_font.background = None if fill is None else int(fill[1:], 16)
|
|
812
829
|
self.update_letters()
|
|
813
830
|
changed = [pid for pid, panel in candidates if before_states[pid] != [letter_info(a) for a in letters(panel)]]
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
831
|
+
report = {'matched': len(candidates), 'matched_panel_ids': [pid for pid, _ in candidates],
|
|
832
|
+
'changed': len(changed), 'changed_panel_ids': changed,
|
|
833
|
+
'skipped': skipped, 'scope': scope, 'action': action,
|
|
834
|
+
'warnings': ['Explicit colors are honored; white on bright image content may be hard to see.'] if foreground == '#ffffff' and fill is None else []}
|
|
835
|
+
if row_mode:
|
|
836
|
+
# the row letters are drawn from the figure letter font set above:
|
|
837
|
+
# report them, or "0 changed" sent the chat looking for another
|
|
838
|
+
# tool for a minute although the edit was done (2026-11-06)
|
|
839
|
+
restyled = self._row_letter_style() != row_style_before
|
|
840
|
+
report['letter_layout'] = 'row'
|
|
841
|
+
report['row_letters_restyled'] = (
|
|
842
|
+
[t.getPlainText() for _, t in self.paint.EZFIG_panel._row_letter_texts()] if restyled else [])
|
|
843
|
+
if placement is not None:
|
|
844
|
+
report['warnings'].append('Row letters always sit outside the rows on the left; placement '
|
|
845
|
+
'only applies to letters inside panels.')
|
|
846
|
+
return report
|
|
847
|
+
|
|
848
|
+
def _row_letter_style(self):
|
|
849
|
+
f = self.serializable_font
|
|
850
|
+
return (f.toString(), getattr(f, 'foreground', None), getattr(f, 'background', None))
|
|
818
851
|
|
|
819
852
|
def swap_panels(self, first, second, target='images', validate_only=False):
|
|
820
853
|
if target not in ('images', 'letters'):
|
|
@@ -450,7 +450,8 @@ class Session:
|
|
|
450
450
|
report['visible_letter_count_after'] = verified['visible_letter_count']
|
|
451
451
|
report['unlettered_panel_ids'] = verified['unlettered_panel_ids']
|
|
452
452
|
report['outcome'] = ('LETTERS_REMOVED' if report['action'] == 'remove' else
|
|
453
|
-
'NO_VISIBLE_CHANGE' if not report['changed']
|
|
453
|
+
'NO_VISIBLE_CHANGE' if not report['changed'] and not report.get('row_letters_restyled')
|
|
454
|
+
else 'VERIFIED_CHANGE')
|
|
454
455
|
if ungroup:
|
|
455
456
|
report['outcome'] = ('LAYOUT_REFRESHED' if report.get('layout_changed') else 'ALREADY_UNGROUPED') if report['already_ungrouped'] else 'VERIFIED_STRUCTURE_CHANGE'
|
|
456
457
|
affected = set(report['changed_panel_ids'])
|
|
@@ -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 =
|
|
113
|
-
|
|
114
|
-
|
|
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',
|