Esempio n. 1
0
	def _selectModelCB(self, tableSel):
		if self.treatmentSelAtom.get():
			from chimera import selection
			selection.clearCurrent()
			selection.addCurrent(tableSel)
			selection.addImpliedCurrent()
		if self.treatmentSelModel.get():
			from ModelPanel import ModelPanel
			from chimera import dialogs
			d = dialogs.display(ModelPanel.name)
			d.selectionChange(tableSel)
		shown = {}
		if self.treatmentHideOthers.get():
			for m in self.molList:
				key = (m.id, m.subid)
				shown[key] = m in tableSel or not tableSel
		else:
			for m in tableSel:
				key = (m.id, m.subid)
				shown[key] = True
		for m in chimera.openModels.list():
			key = (m.id, m.subid)
			try:
				m.display = shown[key]
			except KeyError:
				pass
Esempio n. 2
0
    def select(self, only=False):

        from chimera.selection import setCurrent, addCurrent
        if only:
            setCurrent(self.bond)
        else:
            addCurrent(self.bond)
Esempio n. 3
0
 def _finishDockPrep(self):
     timestamp("end _getParameters")
     from chimera import selection
     selectedAtoms = set(selection.currentAtoms())
     addSelected = []
     numAdded = 0
     for m in self.mols:
         for a in m.atoms:
             if a in self.originalAtoms:
                 continue
             numAdded += 1
             # This atom was added.  If it was added to
             # a selected atom, then we add this atom
             # into the current selection as well.
             for b in a.bonds:
                 oa = a.bonds[0].otherAtom(a)
                 if oa in selectedAtoms:
                     addSelected.append(a)
                     break
     del self.originalAtoms
     if addSelected:
         selection.addCurrent(addSelected)
     #from chimera import replyobj
     #replyobj.info("%d atoms added, %d selected\n"
     #		% (numAdded, len(addSelected)))
     self._finishInit()
Esempio n. 4
0
	def _finishDockPrep(self):
		timestamp("end _getParameters")
		from chimera import selection
		selectedAtoms = set(selection.currentAtoms())
		addSelected = []
		numAdded = 0
		for m in self.mols:
			for a in m.atoms:
				if a in self.originalAtoms:
					continue
				numAdded += 1
				# This atom was added.  If it was added to
				# a selected atom, then we add this atom
				# into the current selection as well.
				for b in a.bonds:
					oa = a.bonds[0].otherAtom(a)
					if oa in selectedAtoms:
						addSelected.append(a)
						break
		del self.originalAtoms
		if addSelected:
			selection.addCurrent(addSelected)
		#from chimera import replyobj
		#replyobj.info("%d atoms added, %d selected\n"
		#		% (numAdded, len(addSelected)))
		self._finishInit()
Esempio n. 5
0
def select_markers(markers, only=True):

    atoms = [m.atom for m in markers]
    from chimera.selection import setCurrent, addCurrent
    if only:
        setCurrent(atoms)
    else:
        addCurrent(atoms)
Esempio n. 6
0
	def _distTableSelCB(self, selDists):
		if self.distSelectsAtomsVar.get():
			select = []
			select.extend(selDists)
			for sd in selDists:
				select.extend(sd.atoms)
			selection.setCurrent(select)
		else:
			selection.removeCurrent(self.distances)
			selection.addCurrent(selDists)
Esempio n. 7
0
	def _itemsSelectAtoms(self, items, add=False):
			atoms = set()
			for item in items:
				atoms.update(item.atoms)
			if self.geomSelAtomsVar.get():
				if add:
					selection.addCurrent(atoms)
				else:
					selection.setCurrent(atoms)
			elif set(atoms) == set(selection.currentAtoms()):
				selection.removeCurrent(atoms)
def split_surfaces(plist):

    pplist = []
    for p in plist:
        pieces = split_surface_piece(p)
        pplist.extend(pieces)
        if pieces:
            # Select pieces if original surface selected.
            from chimera.selection import containedInCurrent
            if containedInCurrent(p):
                from chimera.selection import addCurrent, removeCurrent
                removeCurrent(p)  # Get error missing C++ object without this.
                p.model.removePiece(p)
                addCurrent(pieces)
    return pplist
Esempio n. 9
0
 def _selectionCB(self):
     from chimera import selection
     if not self.treatmentSelAtom:
         return
     if self.treatmentSelAtomOf == "representatives":
         # Select representative
         selection.clearCurrent()
         mList = [self.clusterInfo[id][0] for id in self._getSelected()]
         selection.addCurrent(mList)
         selection.addImpliedCurrent()
     elif self.treatmentSelAtomOf == "all members":
         # Select cluster
         selection.clearCurrent()
         mList = []
         for id in self._getSelected():
             mList.extend(self.clusterInfo[id][1])
         selection.addCurrent(mList)
         selection.addImpliedCurrent()
     else:
         # No action
         pass
Esempio n. 10
0
	def _selectionCB(self):
		from chimera import selection
		if not self.treatmentSelAtom:
			return
		if self.treatmentSelAtomOf == "representatives":
			# Select representative
			selection.clearCurrent()
			mList = [ self.clusterInfo[id][0]
					for id in self._getSelected() ]
			selection.addCurrent(mList)
			selection.addImpliedCurrent()
		elif self.treatmentSelAtomOf == "all members":
			# Select cluster
			selection.clearCurrent()
			mList = []
			for id in self._getSelected():
				mList.extend(self.clusterInfo[id][1])
			selection.addCurrent(mList)
			selection.addImpliedCurrent()
		else:
			# No action
			pass
Esempio n. 11
0
	def _tableCB(self, sels, modeChange=False):
		if self.geomSelAtomsVar.get() or modeChange:
			self._itemsSelectAtoms(sels)
		if self.geomSelObjVar.get():
			items = set(geomManager.items)
			# avoid affecting the selection if models are
			# being destroyed...
			removable = [a.model
						for a in items.difference(sels)
						if not a.model.__destroyed__]
			if removable:
				selection.removeCurrent(removable)
			addable = [a.model for a in sels if not a.model.__destroyed__]
			if addable:
				selection.addCurrent(addable)
		if modeChange:
			return
		butState = 'normal'
		if not sels:
			butState = 'disabled'
		for but in self.buttons:
			but.configure(state=butState)

		self.feedback(sels)
Esempio n. 12
0
 def select(self):
       
   selection.addCurrent(self.bond)
Esempio n. 13
0
  def select(self):

    selection.addCurrent(self.atom)