Esempio n. 1
0
	def _sessionAngleSaveCB(self, trigName, myData, sessionFile):
		from SimpleSession import sessionID, sesRepr
		sesData = []
		for atoms in self.angleInfo:
			sesData.append([sessionID(a) for a in atoms])
		print>>sessionFile, "angleInfo = %s" % sesRepr(sesData)
		print>>sessionFile, """
Esempio n. 2
0
	def _sessionSaveCB(self, trigName, myData, sessionFile):
		from SimpleSession import sesRepr
		geomData = {}
		for manager in self.managers:
			geomData[manager.__class__.__name__] = manager._sessionData()
		print>>sessionFile, "geomData = %s" % sesRepr(geomData)
		print>>sessionFile, """
Esempio n. 3
0
def _saveSessionCB(trigName, myArg, session):
	from SimpleSession import sessionID, sesRepr
	info = []
	for seq, mav in _seqInspectors.items():
		info.append((seq.name, sessionID(seq.molecule),
			[seq.saveInfo() for seq in mav.seqs], mav.saveInfo()))
	print>>session, """
try:
	from ModelPanel import restoreSeqInspectors
	restoreSeqInspectors(%s)
except:
	reportRestoreError("Error restoring sequence viewers")
""" % sesRepr(info)
Esempio n. 4
0
    def _sessionSave(self, trigger, myData, session):
        if not self.rotations:
            return

        from SimpleSession import sesRepr, sessionID
        print >> session, """info = %s
try:
	from BondRotMgr import bondRotMgr
	bondRotMgr._sessionRestore(info)
except:
	reportRestoreError("Error restoring bond rotations")
""" % sesRepr([(sessionID(br.bond), sessionID(br.anchorSide), br.get(), br.id)
               for br in self.rotations.values()])
def _saveSessionCB(trigName, myArg, session):
    from SimpleSession import sessionID, sesRepr
    info = []
    for seq, mav in _seqInspectors.items():
        info.append((seq.name, sessionID(seq.molecule),
                     [seq.saveInfo() for seq in mav.seqs], mav.saveInfo()))
    print >> session, """
try:
	from ModelPanel import restoreSeqInspectors
	restoreSeqInspectors(%s)
except:
	reportRestoreError("Error restoring sequence viewers")
""" % sesRepr(info)
Esempio n. 6
0
def saveSession(trigger, data, f):
	import scaling, xsection, atoms
	import chimera
	from SimpleSession import sessionID, sesRepr, autoRestorable
	userScalings = scaling.sessionSaveUsed()
	userXSections = xsection.sessionSaveUsed()
	userResidueClasses = atoms.sessionSaveUsed()
	residueData = []
	for m in chimera.openModels.list(modelTypes=[chimera.Molecule]):
		if not autoRestorable(m):
			continue
		for r in m.residues:
			ident = sessionID(r)
			sc = scaling.sessionSaveResidue(r)
			xs = xsection.sessionSaveResidue(r)
			rc = atoms.sessionSaveResidue(r)
			residueData.append((ident, sc, xs, rc))
	restoringCode = \
"""
def restoreSession_RibbonStyleEditor():
	import SimpleSession
	import RibbonStyleEditor
	userScalings = %s
	userXSections = %s
	userResidueClasses = %s
	residueData = %s
	flags = RibbonStyleEditor.NucleicDefault1
	SimpleSession.registerAfterModelsCB(RibbonStyleEditor.restoreState,
				(userScalings, userXSections,
				userResidueClasses, residueData, flags))
try:
	restoreSession_RibbonStyleEditor()
except:
	reportRestoreError("Error restoring RibbonStyleEditor state")
"""
	f.write(restoringCode % (sesRepr(userScalings), sesRepr(userXSections),
			sesRepr(userResidueClasses), sesRepr(residueData)))
Esempio n. 7
0
	def _sessionSaveCB(self, trigName, myData, sessionFile):
		from SimpleSession import sesRepr, sessionID
		targetMap = {}
		for surfMap in self._surfMap.values():
			for atom, pieceMap in surfMap.items():
				if not isinstance(atom, Atom):
					continue
				colors = []
				for geom in ["ellipsoid", "axes", "ellipses"]:
					if pieceMap.get(geom, None):
						color = pieceMap[geom][0].color
					else:
						color = None
					colors.append(color)
				targetMap.setdefault((pieceMap["anisoParams"],
					tuple(colors)), []).append(sessionID(atom))
		print>>sessionFile, "targetMap = %s" % sesRepr(targetMap)
		print>>sessionFile, """