Skip to content

Simplify drop event logic in sub_plot_widget.py #10

@miker2

Description

@miker2

The dropEvent method has become quite long and handles several distinct cases (reordering within the same subplot, moving a plot item from another subplot, and adding a new item from VarListWidget). This complexity can make the method harder to understand, debug, and maintain.

Would it be possible to refactor this method by extracting the logic for each main scenario into its own private helper method? For example:

  • _handle_custom_plot_item_drop(self, event, mime_data, plot_name, actual_source_widget, idx_for_insertion)
    • This could then further delegate to _handle_reorder_within_subplot(...) and _handle_move_between_subplots(...).
  • _handle_data_item_drop(self, event, mime_data)

This could improve readability and separation of concerns.

Originally posted by @gemini-code-assist[bot] in #2 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions