Opened 8 years ago
Closed 8 years ago
#684 closed defect (fixed)
Bugs in changes.py
| Reported by: | Tristan Croll | Owned by: | Tom Goddard |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | Sessions | Version: | |
| Keywords: | Cc: | Tristan Croll | |
| Blocked By: | Blocking: | ||
| Notify when closed: | Platform: | all | |
| Project: | ChimeraX |
Description
At the moment, the 'model display changed' trigger only fires when an entire model is shown or hidden, but there doesn't appear to be a trigger that fires to indicate when part of a model has changed its display. In my case I want to tie the visibility of my restraint target "atoms" and pseudobonds to the visibility of the restrained atoms, e.g.:
self._display_changed_handler = self.session.triggers.add_handler(
'model display changed', self._update_target_display)
def _update_target_display(self, model):
if model == self.master_model:
self.target_indicators.displays = self.atoms.displays
... but that doesn't appear to be possible at the moment.
Attachments (1)
Change History (5)
comment:1 by , 8 years ago
| Resolution: | → not a bug |
|---|---|
| Status: | assigned → closed |
by , 8 years ago
| Attachment: | testchanges.py added |
|---|
Python code demonstrating how to detect atom changes.
comment:2 by , 8 years ago
Ah, thanks! Sorry - was poring over the list of trigger names, and somehow that one didn't register with me.
comment:3 by , 8 years ago
| Resolution: | not a bug |
|---|---|
| Status: | closed → reopened |
| Summary: | Have 'model display changed' trigger fire when part of a model is shown/hidden → Bugs in changes.py |
| Type: | enhancement → defect |
I see now why I couldn't find it - I was unaware that more than one triggerset existed. Working now, but I did run into a couple of bugs in changes.py:
def created_atomic_structures(self):
< return _atomic_structures(self._changes["Structure"].created)
> return self._atomic_structures(self._changes["Structure"].created)
def modified_atomic_structures(self):
< return _atomic_structures(self._changes["Structure"].modified)
> return self._atomic_structures(self._changes["Structure"].modified)
def _atomic_structures(self, collection):
from . import AtomicStructure, AtomicStructures
ass = []
for g in collection:
if isinstance(g, AtomicStructure):
ass.append(g)
from . import AtomicStructures
< return AtomicStructrures(ass)
> return AtomicStructures(ass)
comment:4 by , 8 years ago
| Resolution: | → fixed |
|---|---|
| Status: | reopened → closed |
Ok, I fixed these 3 problems in atomic/changes.py
There is a trigger to detect Atom display state changes and many other molecular object changes, the "changes" trigger. The API is defined in the Changes class in
and take a look at the attached example python code.