Skip to content

mcplot-pyqtgraph subplot expansion bug #1949

Open
@LelandWH

Description

@LelandWH

Operating System: Windows 10 Enterprise
McStas Version: 3.5.1

Bug:
Clicking on a subplot generated by mcplot-pyqtgraph does not expand the plot.

Bug Location:
click_handler subfunction in ~\mcstas-3.5.1\lib\tools\Python\mccodelib\pqtgfrontend.py

Bug Origin and Fix:
In the PyQt5 section of pqtgfrontend.py the modifiers() and button() functions associated with the sigMouseClicked event object are used to evaluate 'if' statements, namely we have the three following lines:

Line 384:	if int(event.modifiers()) != mod:
Line 387:	if click == "rclick" and event.button() != 2:
Line 389:	if click == "click" and event.button() != 1:

The lines fail because the modifiers() and buttion() functions return enums which require explicitly ripping the numerical values, ie: the lines should be changed as follows:

Line 384:	if int(event.modifiers().value) != mod:
Line 387:	if click == "rclick" and event.button().value != 2:
Line 389:	if click == "click" and event.button().value != 1:

Additional Notes:
This may be OS and PyQt version dependent behavior, or perhaps it is based on an expectation of behavior based on the QGraphicsSceneMouseEvent class upon which it is derived, which I think may return just a value for modifers() and buttion(). Thus, be wary if implemented as a fix. Cross platform testing may be necessary first.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions