Opened 8 years ago
Closed 8 years ago
#695 closed defect (fixed)
Ribbon should not affect Atom.hide for structures with no ribbons
Reported by: | Tristan Croll | Owned by: | Conrad Huang |
---|---|---|---|
Priority: | major | Milestone: | |
Component: | Graphics | Version: | |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Notify when closed: | Platform: | all | |
Project: | ChimeraX |
Description
I have a class (subclassed from Structure) used to draw position indicators, in which I need to control "atom" visibility independently from the main GUI. It contains no bonds, and I have overridden ribbon_display_count to always return zero. In addition, I have set ribbon_hide_backbones to False for all residues it contains. Yet if I run (with no active selection):
show selAtoms ribbons
hide selAtoms ribbons
... then the hide property is still reset to False for all backbone atoms in my object. I think it would be better if the hide property were only affected for residues where a ribbon is actually drawn.
Change History (7)
comment:1 by , 8 years ago
follow-up: 2 comment:2 by , 8 years ago
Hi Conrad, But that's exactly what I want in this case. I need these atoms to remain unresponsive to show commands, since to the user they aren't actually atoms - they're position restraint indicators **attached to** atoms, and I need to be able to control exactly when they're visible and not visible. I have worked around the issue by adding a handler that detects when they've been un-hidden and sets them back according to my needs, which does work but feels a little clunky. I think it would be valuable to have some official way to take control of the hide bits away from the ribbon code for a given model. Thanks Tristan On 2017-05-31 18:42, ChimeraX wrote:
comment:3 by , 8 years ago
After looking at the code, it appears that I had thought about this before (!).
The "hide" attribute is not a boolean value but an integer mask. Currently, only the 0x1 bit is used as HIDE_RIBBON (defined in core/atomic/molobject.py). The ribbon code correctly uses "hide" as a mask and only changes the HIDE_RIBBON bit. The graphics code displays/hides atoms based on the "visible" property of atoms, which is defined as "_display & !_hide", and will therefore hide atoms with ANY bit set. So, for now, if you define HIDE_XXX (for whatever value of XXX you want) as 0x2 and use bit operators to set/clear the atom "hide" property, ChimeraX should behave as you want.
If it works, you can let us know what to use for XXX and we can add it to the ChimeraX source code to claim that bit for your package (so no one else accidentally overloads the same bit).
follow-up: 4 comment:4 by , 8 years ago
Awesome! Will try that out tomorrow. Tristan Croll Research Fellow Cambridge Institute for Medical Research University of Cambridge CB2 0XY
follow-up: 5 comment:5 by , 8 years ago
That works a charm. Could we reserve 0x2 as HIDE_ISOLDE? On 2017-05-31 19:35, ChimeraX wrote:
follow-up: 6 comment:6 by , 8 years ago
Glad it worked. I've added the constant to the ChimeraX source files. Conrad On 6/1/2017 5:14 AM, Tristan Croll wrote:
comment:7 by , 8 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The problem is that if you do not reset the hide bits for undisplayed atoms, you will not be able to display them with the "show" command later.