Opened 3 years ago
Closed 3 years ago
#8362 closed defect (fixed)
Immortal context menus
| Reported by: | Elaine Meng | Owned by: | Tom Goddard |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Window Toolkit | Version: | |
| Keywords: | Cc: | Eric Pettersen | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
The following bug report has been submitted:
Platform: macOS-12.6.2-arm64-arm-64bit
ChimeraX Version: 1.6.dev202301152156 (2023-01-15 21:56:48 UTC)
Description
persistent selection context menus
Maybe system-specific, so I'm using the "report a bug" tool...
Ctrl-doubleclick something twice first shows the menu and then deselects the item but leaves its menu still shown. Screenshot attached
Log:
> open /Users/meng/Desktop/startup.cxc
> alias reset view orient; view initial
> alias start tool show $1
> alias whereprefs info path user unversioned config
> alias captut open help:user/tutorials/binding-sites.html#cap-example
> alias previewts toolshed url https://cxtoolshed-
> preview.rbvi.ucsf.edu;toolshed reload available
> alias normalts toolshed url https://cxtoolshed.rbvi.ucsf.edu;toolshed reload
> available
> alias btut open
> https://www.cgl.ucsf.edu/home/meng/chimerax/vdocs/user/tutorials/binding-
> sites.html; ui dockable false "Help Viewer"
> alias stut open https://www.rbvi.ucsf.edu/chimerax/data/conservation-
> coloring/conservation-coloring.html; ui dockable false "Help Viewer"
> alias ltut open https://www.rbvi.ucsf.edu/chimerax/data/loop-modeling/loop-
> modeling.html; ui dockable false "Help Viewer"
> alias mtut open https://www.rbvi.ucsf.edu/chimerax/data/mole-channel/mole-
> channel.html; ui dockable false "Help Viewer"; windowsize 600 800
executed startup.cxc
UCSF ChimeraX version: 1.6.dev202301152156 (2023-01-15)
© 2016-2023 Regents of the University of California. All rights reserved.
How to cite UCSF ChimeraX
> open 1zik
1zik title:
GCN4-leucine zipper core mutant ASN16LYS In the dimeric state [more info...]
Chain information for 1zik #1
---
Chain | Description | UniProt
A B | GENERAL CONTROL PROTEIN GCN4 | GCN4_YEAST 1-33
> display
> distance dashes 8 setdef true
Missing or invalid "objects" argument: invalid objects specifier
> distance style dashes 8 setDefaults true
> distance style dashes 8
> select clear
> select /B:17@OH
1 atom, 1 residue, 1 model selected
> select clear
> select /B:17@OH
1 atom, 1 residue, 1 model selected
> select add /B:7@OD1
2 atoms, 2 residues, 1 model selected
> select clear
[Repeated 3 time(s)]
> select /B:17@OH
1 atom, 1 residue, 1 model selected
> select add /A:17@OH
2 atoms, 2 residues, 1 model selected
> distance /B:17@OH /A:17@OH
Distance between /B TYR 17 OH and /A TYR 17 OH: 19.623Å
> select add /B:68@O
3 atoms, 3 residues, 1 model selected
> select subtract /B:68@O
2 atoms, 2 residues, 1 model selected
> select add /B:68@O
3 atoms, 3 residues, 1 model selected
> select subtract /B:68@O
2 atoms, 2 residues, 1 model selected
> select add /A:21@OD1
3 atoms, 3 residues, 1 model selected
> select subtract /A:21@OD1
2 atoms, 2 residues, 1 model selected
> select subtract /A:17@OH
1 atom, 1 residue, 1 model selected
OpenGL version: 4.1 Metal - 76.3
OpenGL renderer: Apple M1 Pro
OpenGL vendor: Apple
Python: 3.9.11
Locale: UTF-8
Qt version: PyQt6 6.4.0, Qt 6.4.0
Qt runtime version: 6.4.2
Qt platform: cocoa
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro18,1
Chip: Apple M1 Pro
Total Number of Cores: 10 (8 performance and 2 efficiency)
Memory: 16 GB
System Firmware Version: 8419.60.44
OS Loader Version: 7459.141.1
Software:
System Software Overview:
System Version: macOS 12.6.2 (21G320)
Kernel Version: Darwin 21.6.0
Time since boot: 4:47
Graphics/Displays:
Apple M1 Pro:
Chipset Model: Apple M1 Pro
Type: GPU
Bus: Built-In
Total Number of Cores: 16
Vendor: Apple (0x106b)
Metal Family: Supported, Metal GPUFamily Apple 7
Displays:
Color LCD:
Display Type: Built-in Liquid Retina XDR Display
Resolution: 3456 x 2234 Retina
Main Display: Yes
Mirror: Off
Online: Yes
Automatically Adjust Brightness: Yes
Connection Type: Internal
Installed Packages:
alabaster: 0.7.13
appdirs: 1.4.4
appnope: 0.1.3
asttokens: 2.2.1
Babel: 2.11.0
backcall: 0.2.0
blockdiag: 3.0.0
build: 0.8.0
certifi: 2021.10.8
cftime: 1.6.2
charset-normalizer: 2.1.1
ChimeraX-AddCharge: 1.5.8
ChimeraX-AddH: 2.2.3
ChimeraX-AlignmentAlgorithms: 2.0.1
ChimeraX-AlignmentHdrs: 3.3.1
ChimeraX-AlignmentMatrices: 2.1
ChimeraX-Alignments: 2.8
ChimeraX-AlphaFold: 1.0
ChimeraX-AltlocExplorer: 1.0.3
ChimeraX-AmberInfo: 1.0
ChimeraX-Arrays: 1.1
ChimeraX-Atomic: 1.43.5
ChimeraX-AtomicLibrary: 10.0.1
ChimeraX-AtomSearch: 2.0.1
ChimeraX-AxesPlanes: 2.3.2
ChimeraX-BasicActions: 1.1.2
ChimeraX-BILD: 1.0
ChimeraX-BlastProtein: 2.1.2
ChimeraX-BondRot: 2.0.1
ChimeraX-BugReporter: 1.0.1
ChimeraX-BuildStructure: 2.7.2
ChimeraX-Bumps: 1.0
ChimeraX-BundleBuilder: 1.2
ChimeraX-ButtonPanel: 1.0.1
ChimeraX-CageBuilder: 1.0.1
ChimeraX-CellPack: 1.0
ChimeraX-Centroids: 1.3.2
ChimeraX-ChangeChains: 1.0.2
ChimeraX-CheckWaters: 1.3.1
ChimeraX-ChemGroup: 2.0
ChimeraX-Clashes: 2.2.4
ChimeraX-ColorActions: 1.0.3
ChimeraX-ColorGlobe: 1.0
ChimeraX-ColorKey: 1.5.3
ChimeraX-CommandLine: 1.2.5
ChimeraX-ConnectStructure: 2.0.1
ChimeraX-Contacts: 1.0.1
ChimeraX-Core: 1.6.dev202301152156
ChimeraX-CoreFormats: 1.1
ChimeraX-coulombic: 1.4.2
ChimeraX-Crosslinks: 1.0
ChimeraX-Crystal: 1.0
ChimeraX-CrystalContacts: 1.0.1
ChimeraX-DataFormats: 1.2.3
ChimeraX-Dicom: 1.1
ChimeraX-DistMonitor: 1.3.1
ChimeraX-DockPrep: 1.1
ChimeraX-Dssp: 2.0
ChimeraX-EMDB-SFF: 1.0
ChimeraX-ESMFold: 1.0
ChimeraX-ExperimentalCommands: 1.0
ChimeraX-FileHistory: 1.0.1
ChimeraX-FunctionKey: 1.0.1
ChimeraX-Geometry: 1.2.1
ChimeraX-gltf: 1.0
ChimeraX-Graphics: 1.1.1
ChimeraX-Hbonds: 2.4
ChimeraX-Help: 1.2.1
ChimeraX-HKCage: 1.3
ChimeraX-IHM: 1.1
ChimeraX-ImageFormats: 1.2
ChimeraX-IMOD: 1.0
ChimeraX-IO: 1.0.1
ChimeraX-ItemsInspection: 1.0.1
ChimeraX-Label: 1.1.7
ChimeraX-ListInfo: 1.1.1
ChimeraX-Log: 1.1.5
ChimeraX-LookingGlass: 1.1
ChimeraX-Maestro: 1.8.2
ChimeraX-Map: 1.1.4
ChimeraX-MapData: 2.0
ChimeraX-MapEraser: 1.0.1
ChimeraX-MapFilter: 2.0.1
ChimeraX-MapFit: 2.0
ChimeraX-MapSeries: 2.1.1
ChimeraX-Markers: 1.0.1
ChimeraX-Mask: 1.0.2
ChimeraX-MatchMaker: 2.0.11
ChimeraX-MDcrds: 2.6
ChimeraX-MedicalToolbar: 1.0.2
ChimeraX-Meeting: 1.0.1
ChimeraX-MLP: 1.1.1
ChimeraX-mmCIF: 2.11
ChimeraX-MMTF: 2.2
ChimeraX-Modeller: 1.5.8
ChimeraX-ModelPanel: 1.3.6
ChimeraX-ModelSeries: 1.0.1
ChimeraX-Mol2: 2.0
ChimeraX-Mole: 1.0
ChimeraX-Morph: 1.0.2
ChimeraX-MouseModes: 1.2
ChimeraX-Movie: 1.0
ChimeraX-Neuron: 1.0
ChimeraX-Nucleotides: 2.0.3
ChimeraX-OpenCommand: 1.10
ChimeraX-PDB: 2.6.12
ChimeraX-PDBBio: 1.0
ChimeraX-PDBLibrary: 1.0.2
ChimeraX-PDBMatrices: 1.0
ChimeraX-PickBlobs: 1.0.1
ChimeraX-Positions: 1.0
ChimeraX-PresetMgr: 1.1
ChimeraX-PubChem: 2.1
ChimeraX-ReadPbonds: 1.0.1
ChimeraX-Registration: 1.1.1
ChimeraX-RemoteControl: 1.0
ChimeraX-RenderByAttr: 1.0
ChimeraX-RenumberResidues: 1.1
ChimeraX-ResidueFit: 1.0.1
ChimeraX-RestServer: 1.1
ChimeraX-RNALayout: 1.0
ChimeraX-RotamerLibMgr: 3.0
ChimeraX-RotamerLibsDunbrack: 2.0
ChimeraX-RotamerLibsDynameomics: 2.0
ChimeraX-RotamerLibsRichardson: 2.0
ChimeraX-SaveCommand: 1.5.1
ChimeraX-SchemeMgr: 1.0
ChimeraX-SDF: 2.0.1
ChimeraX-Segger: 1.0
ChimeraX-Segment: 1.0.1
ChimeraX-SelInspector: 1.0
ChimeraX-SeqView: 2.8.1
ChimeraX-Shape: 1.0.1
ChimeraX-Shell: 1.0.1
ChimeraX-Shortcuts: 1.1.1
ChimeraX-ShowSequences: 1.0.1
ChimeraX-SideView: 1.0.1
ChimeraX-Smiles: 2.1
ChimeraX-SmoothLines: 1.0
ChimeraX-SpaceNavigator: 1.0
ChimeraX-StdCommands: 1.10.1
ChimeraX-STL: 1.0.1
ChimeraX-Storm: 1.0
ChimeraX-StructMeasure: 1.1.1
ChimeraX-Struts: 1.0.1
ChimeraX-Surface: 1.0.1
ChimeraX-SwapAA: 2.0.1
ChimeraX-SwapRes: 2.2
ChimeraX-TapeMeasure: 1.0
ChimeraX-Test: 1.0
ChimeraX-Toolbar: 1.1.2
ChimeraX-ToolshedUtils: 1.2.1
ChimeraX-Topography: 1.0
ChimeraX-Tug: 1.0.1
ChimeraX-UI: 1.26
ChimeraX-uniprot: 2.2.2
ChimeraX-UnitCell: 1.0.1
ChimeraX-ViewDockX: 1.1.6
ChimeraX-VIPERdb: 1.0
ChimeraX-Vive: 1.1
ChimeraX-VolumeMenu: 1.0.1
ChimeraX-VTK: 1.0
ChimeraX-WavefrontOBJ: 1.0
ChimeraX-WebCam: 1.0.2
ChimeraX-WebServices: 1.1.1
ChimeraX-Zone: 1.0.1
colorama: 0.4.5
comm: 0.1.2
contourpy: 1.0.7
cxservices: 1.2
cycler: 0.11.0
Cython: 0.29.32
debugpy: 1.6.5
decorator: 5.1.1
docutils: 0.19
entrypoints: 0.4
executing: 1.2.0
filelock: 3.7.1
fonttools: 4.38.0
funcparserlib: 1.0.1
grako: 3.16.5
h5py: 3.7.0
html2text: 2020.1.16
idna: 3.4
ihm: 0.35
imagecodecs: 2022.9.26
imagesize: 1.4.1
importlib-metadata: 6.0.0
ipykernel: 6.19.2
ipython: 8.7.0
ipython-genutils: 0.2.0
jedi: 0.18.2
Jinja2: 3.1.2
jupyter-client: 7.4.8
jupyter-core: 5.1.3
kiwisolver: 1.4.4
line-profiler: 3.5.1
lxml: 4.9.1
lz4: 4.0.2
MarkupSafe: 2.1.1
matplotlib: 3.6.2
matplotlib-inline: 0.1.6
msgpack: 1.0.4
nest-asyncio: 1.5.6
netCDF4: 1.6.0
networkx: 2.8.8
numexpr: 2.8.4
numpy: 1.23.5
openvr: 1.23.701
packaging: 21.3
ParmEd: 3.4.3
parso: 0.8.3
pep517: 0.13.0
pexpect: 4.8.0
pickleshare: 0.7.5
Pillow: 9.3.0
pip: 22.2.2
pkginfo: 1.8.3
platformdirs: 2.6.2
prompt-toolkit: 3.0.36
psutil: 5.9.4
ptyprocess: 0.7.0
pure-eval: 0.2.2
pycollada: 0.7.2
pydicom: 2.3.0
Pygments: 2.12.0
PyOpenGL: 3.1.5
PyOpenGL-accelerate: 3.1.5
pyparsing: 3.0.9
PyQt6-commercial: 6.4.0
PyQt6-Qt6: 6.4.2
PyQt6-sip: 13.4.0
PyQt6-WebEngine-commercial: 6.4.0
PyQt6-WebEngine-Qt6: 6.4.2
python-dateutil: 2.8.2
pytz: 2022.7.1
pyzmq: 25.0.0
qtconsole: 5.4.0
QtPy: 2.3.0
RandomWords: 0.4.0
requests: 2.28.1
scipy: 1.9.3
setuptools: 65.1.1
setuptools-scm: 7.0.5
sfftk-rw: 0.7.2
six: 1.16.0
snowballstemmer: 2.2.0
sortedcontainers: 2.4.0
Sphinx: 5.1.1
sphinx-autodoc-typehints: 1.19.1
sphinxcontrib-applehelp: 1.0.3
sphinxcontrib-blockdiag: 3.0.0
sphinxcontrib-devhelp: 1.0.2
sphinxcontrib-htmlhelp: 2.0.0
sphinxcontrib-jsmath: 1.0.1
sphinxcontrib-qthelp: 1.0.3
sphinxcontrib-serializinghtml: 1.1.5
stack-data: 0.6.2
tables: 3.7.0
tifffile: 2022.10.10
tinyarray: 1.2.4
tomli: 2.0.1
tornado: 6.2
traitlets: 5.8.0
typing-extensions: 4.4.0
urllib3: 1.26.14
wcwidth: 0.2.6
webcolors: 1.12
wheel: 0.37.1
wheel-filename: 1.4.1
zipp: 3.11.0
File attachment: Screen Shot 2023-01-23 at 12.58.13 PM.png
Attachments (1)
Change History (10)
by , 3 years ago
| Attachment: | Screen Shot 2023-01-23 at 12.58.13 PM.png added |
|---|
comment:1 by , 3 years ago
| Cc: | added |
|---|---|
| Component: | Unassigned → Window Toolkit |
| Owner: | set to |
| Platform: | → all |
| Project: | → ChimeraX |
| Status: | new → accepted |
| Summary: | ChimeraX bug report submission → Immortal context menus |
comment:2 by , 3 years ago
Pretty humorous. In ChimeraX 1.5 on Intel Mac (macOS 13.1) each ctrl double click brings up a new context menu while keeping the old context menus. Clicking on the graphics area outside the context menus does not get rid of them. But each click in another pane such as the Log or Command Line gets rid of the most recent context menu, and clicking in another panel as many times as there are context menus gets rid of them all.
comment:3 by , 3 years ago
| Cc: | added; removed |
|---|---|
| Owner: | changed from to |
| Status: | accepted → assigned |
Reassigning to Tom, at least temporarily. The problem is that "regular" Qt is not seeing the mouse clicks going to the OpenGL window, so the menu continues to stay up. If you click _anywhere_ outside the graphics window (or, of course, on the menus themselves) the menus go away. I don't know _why_ the mouse events going to the OpenGL window are being ignored for the purposes of dismissing these context menus.
It's possible that this may have to be closed as a limitation if "normal" Qt just never gets notified of mouse clicks going to an OpenGL context.
comment:4 by , 3 years ago
Changing the context menu parent from the main window to the widget containing the graphics window did not change the behavior.
comment:5 by , 3 years ago
This bad behavior was in ChimeraX 1.4 too and no one has reported it. So it has probably not been too damaging. It was not in ChimeraX 1.3 which I think used Qt 5. The graphics window does register its own mouse event handlers. Maybe the mouse press handler can make a Qt call to get rid of any pending context menus.
comment:6 by , 3 years ago
Context menus are created in ui/gui.py in _show_context_menu() using QMenu.exec(). Mouse events on the graphics window are handled in mouse_modes/mousemodes.py in _dispatch_mouse_event(). Probably the right Qt call on mouse press would remove the QMenu but I don't see what Qt call might do that.
The problem is no doubt because the MouseModes.set_graphics_window() sets QWindow.mousePressEvent on the graphics window. A QWindow is lower level than a QWidget, and so probably that click goes undetected by the menu dismissing code.
comment:7 by , 3 years ago
The ui/gui.py context menus are tool context menus. The graphics window context menus are created in mouse_modes/std_modes.py in SelectMouseMode.mouse_double_click(). Just FYI. Doesn't really change anything.
comment:8 by , 3 years ago
Yep, I just discovered that. I'm testing whether a menu.close() call will dismiss it.
follow-up: 8 comment:9 by , 3 years ago
| Resolution: | → fixed |
|---|---|
| Status: | assigned → closed |
Fixed.
Posting a context menu calls QMenu.exec() which starts an event loop, and the exec() call does not return until the menu gets dismissed. I think it gets dismissed whenever there is a mouse click (probably keyboard events too). If the mouse click is on the menu then the menu entry is executed and if the mouse click is not on the menu then the menu disappears with no action. But it appears that the menu does not get mouse clicks on a QWindow which is a lower level object than a QWidget. The graphics area is a QWindow because we render our own OpenGL in that window so we don't want Qt to draw that area. In Qt 5 the context menus got dismissed with clicks on the graphics window. So I suspect that this is a bug in QMenu in Qt 6 that it does not detect the QWindow clicks. At any rate, to work around the problem I added routines UI.post_context_menu() and UI.dismiss_context_menu() that remember the menu that was posted and call close on it if dismiss_context_menu() is called, and I made the graphics window mouse press explicitly call dismiss_context_menu(). I hope this doesn't caused bugs due to a menu being closed twice. Testing did not reveal any problem. The Tool window context menus also use the new post_context_menu() call because graphics window clicks were not dismissing tool window context menus and I think they should.
We have seen a fair number of crash reports in the past where Qt was processing events in a sub-event loop. I'm not sure if any of these were related to context menus not going away. You could easily get into multiple layers of event loops by showing Tool and graphics window context menus. So maybe this work-around to get rid of the context menus will fix some crashes.
Added by email2trac