def removeAniso(self, targets): if isinstance(targets, dict): molMap = targets else: molMap = self._makeMolMap(targets) someShowing = bool(self._surfMap) for m, atoms in molMap.items(): if m not in self._surfMap: continue surfMap = self._surfMap[m] for a in atoms: try: pieceInfo = surfMap[a] except KeyError: continue if not a.__destroyed__: a.labelOffset = None for key, pieces in pieceInfo.items(): if key == "anisoParams" or not pieces: continue for piece in pieces: piece.model.removePiece(piece) del surfMap[a] del self._atomMolLookup[a] if len(surfMap) == 1: openModels.close([surfMap.pop("model")]) del self._surfMap[m] if someShowing and not self._surfMap: triggers.deleteHandler('Atom', self._handlerID)
def stop_playing(self): from chimera import triggers triggers.deleteHandler('new frame', self.play_handler) self.play_handler = None if self.recording: self.finish_recording()
def cmdUndetectClash(cmdName, args): import DetectClash if DetectClash._continuousID != None: from chimera import triggers triggers.deleteHandler('OpenState', DetectClash._continuousID) DetectClash._continuousID = None DetectClash.nukeGroup()
def remove_molecule_change_handler(self): h = self.molecule_handler if h: from chimera import triggers as t t.deleteHandler('Molecule', h) self.molecule_handler = None
def cmdUndetectClash(cmdName, args): import DetectClash if DetectClash._continuousID != None: from chimera import triggers triggers.deleteHandler('OpenState', DetectClash._continuousID) DetectClash._continuousID = None DetectClash.nukeGroup()
def remove_molecule_change_handler(self): h = self.molecule_handler if h: from chimera import triggers as t t.deleteHandler('Molecule', h) self.molecule_handler = None
def stop(self): if self.handler is None: return from chimera import triggers as t t.deleteHandler('new frame', self.handler) self.handler = None self.inext = None
def removeItems(self, items): self.table.setData(geomManager.items) for item in items: if item in self.renameDialogs: self.renameDialogs[item].destroy() del self.renameDialogs[item] if items and not geomManager.items: triggers.deleteHandler("selection changed", self._selHandlerID)
def destroy(self): if self._motionHandler != None: from chimera import triggers, MOTION_STOP triggers.deleteHandler(MOTION_STOP, self._motionHandler) self._motionHandler = None from MultAlignViewer.HeaderSequence import \ DynamicStructureHeaderSequence DynamicStructureHeaderSequence.destroy(self)
def destroy(self): if self._motionHandler != None: from chimera import triggers, MOTION_STOP triggers.deleteHandler(MOTION_STOP, self._motionHandler) self._motionHandler = None from MultAlignViewer.HeaderSequence import \ DynamicStructureHeaderSequence DynamicStructureHeaderSequence.destroy(self)
def stop(self): if self.handler is None: return from chimera import triggers as t t.deleteHandler('new frame', self.handler) self.handler = None self.inext = None
def realtime_cb(self): from chimera import triggers as t if self.realtime_update.get(): if self.xform_handler is None: h = t.addHandler('OpenState', self.xform_changed_cb, None) self.xform_handler = h elif self.xform_handler: t.deleteHandler('OpenState', self.xform_handler) self.xform_handler = None
def realtime_cb(self): from chimera import triggers as t if self.realtime_update.get(): if self.xform_handler is None: h = t.addHandler('OpenState', self.xform_changed_cb, None) self.xform_handler = h elif self.xform_handler: t.deleteHandler('OpenState', self.xform_handler) self.xform_handler = None
def play_stop_cb(self): from chimera import triggers if self.play_handler: triggers.deleteHandler('new frame', self.play_handler) self.play_handler = None self.play_stop_button['text'] = 'Play' else: h = triggers.addHandler('new frame', self.next_time_cb, None) self.play_handler = h self.play_stop_button['text'] = 'Stop'
def register_new_marker_handler(self, register): if register: if self.new_marker_handler == None: from chimera import triggers h = triggers.addHandler('Atom', self.new_marker_cb, None) self.new_marker_handler = h else: if self.new_marker_handler: from chimera import triggers triggers.deleteHandler('Atom', self.new_marker_handler) self.new_marker_handler = None
def track_surface_changes(self, surface): from _surface import SurfaceModel if isinstance(surface, SurfaceModel): if self.surface_change_handler is None: from chimera import triggers as t h = t.addHandler('SurfacePiece', self.surface_changed_cb, None) self.surface_change_handler = h elif self.surface_change_handler: from chimera import triggers as t t.deleteHandler('SurfacePiece', self.surface_change_handler) self.surface_change_handler = None
def rotate_box(self, rotate): self.activate_models(not rotate) from chimera import triggers as t rt = self.rotation_handler if rotate: if rt is None: self.rotation_handler = t.addHandler('OpenState', self.rotation_cb, None) elif rt: t.deleteHandler('OpenState', rt) self.rotation_handler = None
def new_frame_cb(self, tname, cdata, tdata): fc = self.frame_count self.frame_count += 1 fp = self.frame_params if fc >= len(fp): from chimera import triggers as t self.handler = t.deleteHandler('new frame', self.handler) return # Camera parameters from chimera import Point, viewer as v from math import exp c = v.camera cp = fp[fc][:8] v.scaleFactor = exp(cp[0]) v.viewSize = cp[1] c.center = tuple(cp[2:5]) c.nearFar = tuple(cp[5:7]) c.focal = cp[7] # Model positions for i,os in enumerate(self.open_states): op = fp[fc][10*i+8:10*i+18] rotq = op[0:4] rotc = op[4:7] trans = op[7:10] os.xform = parameter_xform(rotq, rotc, trans)
def _cleanup(self): if not hasattr(self, 'molecule'): return # invalidate first since TRIG_DELETE will remove # sequence from _SequenceSequences if not self.molecule.__destroyed__ \ and hasattr(self.molecule, '_SequenceSequences') \ and self in self.molecule._SequenceSequences[0]: # not a copy invalidate(self.molecule) self.triggers.activateTrigger(self.TRIG_DELETE, self) delattr(self, 'molecule') delattr(self, 'residues') delattr(self, 'resMap') from chimera import triggers triggers.deleteHandler("Molecule", self._removeHandlerID) delattr(self, '_removeHandlerID') triggers.deleteHandler("Residue", self._residueHandlerID) delattr(self, '_residueHandlerID')
def _cacheCheck(trigName, info, trigData): from chimera.triggerSet import ONESHOT from chimera import triggers molecule, additions = info try: seqList, seqDict, trigIDs = molecule._SequenceSequences except AttributeError: # didn't have a cache anyway! return ONESHOT try: resList = molecule.residues except: # we must be in molecule destructor triggers.deleteHandler('Residue', molecule.__cacheHandlerID) return ONESHOT # modifications and deletions "take care of themselves", so we # only care about additions that are in chains that haven't added # themselves into current sequences for r in additions: kids = r.oslChildren() if len(kids) == molecule.rootForAtom(kids[0], True).size.numAtoms: continue incorporated = False for seq in seqList: if r in seq.resMap: incorporated = True break if not incorporated: delattr(molecule, '_SequenceSequences') for i, seq in enumerate(seqList): seq.triggers.deleteHandler(seq.TRIG_DELETE, trigIDs[i]) triggers.deleteHandler('Residue', molecule.__cacheHandlerID) break return ONESHOT
def delete_ae_handler(triggerName, handler, data): from chimera import triggers try: triggers.deleteHandler(AEV_TRIGGER, handler) except (KeyError, ValueError): pass
def delayed_show(trigger_name, h, fnum): from chimera import triggers triggers.deleteHandler('new frame', h[0]) toplevel_volume_menu('show')
def enable_shortcuts(trigger_name, handler, command_text): t.deleteHandler(command_entered_trigger, handler[0]) import Accelerators Accelerators.activate_accelerators(True)
def _deleteHandlers(self): if not self._handlers: return while self._handlers: triggers, trigName, handler = self._handlers.pop() triggers.deleteHandler(trigName, handler)
def _deleteHandlers(self): if not self._handlers: return while self._handlers: triggers, trigName, handler = self._handlers.pop() triggers.deleteHandler(trigName, handler)
def unmap(self, *args): triggers.deleteHandler("CoordSet", self.handler) self.handler = None
def unmap(self, event=None): from chimera import triggers triggers.deleteHandler('selection changed', self.sel_handler) self.sel_handler = None
def delayed_show(trigger_name, h, fnum): from chimera import triggers triggers.deleteHandler('new frame', h[0]) toplevel_volume_menu('show')
def delete_ae_handler(triggerName, handler, data): from chimera import triggers try: triggers.deleteHandler(AEV_TRIGGER, handler) except (KeyError, ValueError): pass