1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 import types, os
16 import Tkinter, Pmw
17 from math import sqrt
18
19 from MolKit.tree import TreeNode, TreeNodeSet
20 from MolKit.molecule import Molecule, Atom
21 from MolKit.protein import Residue
22
23 from ViewerFramework.VFCommand import CommandGUI
24
25 from mglutil.gui.InputForm.Tk.gui import InputFormDescr
26
27 from mglutil.gui.BasicWidgets.Tk.customizedWidgets import ListChooser, \
28 ExtendedSliderWidget, SaveButton, LoadButton
29 from mglutil.gui.BasicWidgets.Tk.thumbwheel import ThumbWheel
30 from mglutil.gui.BasicWidgets.Tk.Dial import Dial
31
32 from DejaVu.IndexedPolygons import IndexedPolygons
33
34 from Pmv.displayCommands import DisplayCommand
35 from Pmv.mvCommand import MVCommand, MVAtomICOM
36 from Pmv.msmsParser import MSMSParser
37 from Pmv.guiTools import AugmentedMoleculeChooser
38
39 import Pmv
40 if hasattr( Pmv, 'numOfSelectedVerticesToSelectTriangle') is False:
41 Pmv.numOfSelectedVerticesToSelectTriangle = 1
42
43 print "LALALALA"
44 Pmv.vf.userpref.add('sharpColorBoundariesForMsms', 'yes', ('yes','no'),
45 doc="""specifie color boundaries for msms surface (blur or sharp)""",
46 )
47
48
50 """Command reads .face and .vert file, creates the msms surface and links it to the selection if can\n
51 Package : Pmv\n
52 Module : msmsCommands\n
53 Class : ReadMSMS\n
54 Command name : readMSMS\n
55 \nSynopsis :\n
56 None--->mv.readMSMS(vertFilename,faceFilename,molName=None)\n
57 \nRequired Arguments :\n
58 vertFilename---name of the .vert file\n
59 faceFilename---name of the .face file\n
60 """
61
65
66
67
68
69
71 if self.cmdForms.has_key('readMSMS'):
72 ebn = self.cmdForms['readMSMS'].descr.entryByName
73 w = ebn['molName']['widget']
74 molNames = list(w.get())
75 molNames.append(obj.name)
76 w.clear()
77 w.setlist(molNames)
78
79
80
81
82
83
84 - def setEntry_cb(self, filename):
85 import os
86 file, ext = os.path.splitext(filename)
87 ebn = self.cmdForms['readMSMS'].descr.entryByName
88 vertEntry = ebn['vertfile']['widget']
89 faceEntry = ebn['facefile']['widget']
90 if ext == '.vert':
91 vertEntry.setentry(filename)
92 ffilename = '%s.face'%file
93 if os.path.exists(ffilename):
94 faceEntry.setentry(ffilename)
95 elif ext == '.face':
96 faceEntry.setentry(filename)
97 vfilename = '%s.vert'%file
98 if os.path.exists(vfilename):
99 vertEntry.setentry(vfilename)
100 else: return
101
102
103
167
169 val = self.showForm('readMSMS')
170 if not val: return
171 vertFilename = val['vertfile']
172 kw={'redraw':1}
173 faceFilename = val['facefile']
174 if val['molName'][0] == 'None':
175 kw['molName'] = None
176 else:
177 kw['molName'] = val['molName'][0]
178
179 apply(self.doitWrapper, (vertFilename, faceFilename), kw)
180
181
182 - def doit(self, vertFilename, faceFilename, molName=None):
183
184 vertFName = os.path.split(vertFilename)[1]
185 faceFName = os.path.split(faceFilename)[1]
186 vertName = os.path.splitext(vertFName)[0]
187 faceName = os.path.splitext(faceFName)[0]
188 assert vertName == faceName
189 msmsParser = MSMSParser()
190 self.msmsFromFile[vertName] = msmsParser
191 msmsParser.parse(vertFilename, faceFilename)
192 self.surf = IndexedPolygons(vertName+'_msms', visible=1,
193 pickableVertices=1, protected=True,)
194 if self.vf.userpref['sharpColorBoundariesForMsms']['value'] == 'blur':
195 self.surf.Set(inheritSharpColorBoundaries=False, sharpColorBoundaries=False, )
196
197
198 self.surf.Set(vertices=msmsParser.vertices, faces=msmsParser.faces,
199 vnormals=msmsParser.normals, tagModified=False)
200 self.vf.GUI.VIEWER.AddObject(self.surf)
201 if not molName is None:
202 self.vf.bindGeomToMolecularFragment(self.surf, molName,
203 topCommand=0)
204
205 - def __call__(self, vertFilename, faceFilename, molName=None, **kw):
206 """None--->mv.readMSMS(vertFilename,faceFilename,molName=None, **kw)
207 """
208 kw['molName'] = molName
209 kw['redraw'] = 1
210 apply(self.doitWrapper, (vertFilename, faceFilename), kw)
211
212 ReadMSMSGUI = CommandGUI()
213 ReadMSMSGUI.addMenuCommand('menuRoot', 'Compute', 'Read Molecular Surface',
214 cascadeName='Molecular Surface')
215
217 """The SaveMSMS commands allows the user to save a chosen MSMS surface (tri-angulated solvant excluded surface) resulting from a calculation.\n
218 Package : Pmv\n
219 Module : msmsCommands\n
220 Class : SaveMSMS\n
221 Command name : saveMSMS\n
222 \nDescription:\n
223 Two files will be created, one for
224 vertices (.vert) and one for faces (.face).
225 If the component number is 0, files called filename.vert and filename.face
226 are created.
227 For other components, the component number is inserted in the file name,
228 for example for the component number 3 the files are called
229 filename_3.vert and filename_3.face.
230
231 The face file contains three header lines followed by one triangle per
232 line. The first header line provides a comment and the filename of the
233 sphere set.
234 The second header line holds comments about the content of the third line.
235 The third header line provides the number of triangles, the number of
236 spheres in the set, the triangulation density and the probe sphere radius.
237 The first three numbers are (1 based) vertex indices. The next field
238 can be: 1 for a triangle in a toric reentrant face, 2 for a triangle in
239 a spheric reentrant face and 3 for a triangle in a contact face.
240 The last number on the line is the (1 based) face number in the
241 analytical description of the solvent excluded surface. These values
242 are written in the following format ''%6d %6d %6d %2d %6d''.
243
244 The vertex file contains three header lines (similar to the header
245 in the .face file) followed by one vertex per line and provides the
246 coordinates (x,y,z) and the normals (nx,ny,nz) followed by the number of
247 the face (in the analytical description of the solvent excluded surface)
248 to which the vertex belongs.
249 The vertices of the analytical surface have a value 0 in that field and
250 the vertices lying on edges of this surface have nega tive values.
251 The next field holds the (1 based) index of the closest sphere.
252 The next field is 1 for vertices which belong to toric reentrant faces
253 (including vertices of the analytical surface), 2 for vertices inside
254 reentrant faces and 3 for vertices inside contact faces.
255 Finally, if atom names were present in the input file, the name of the
256 closest atom is written for each vertex. These values are written in
257 the following format
258 ''%9.3f %9.3f %9.3f %9.3f %9.3f %9.3f %7d %7d %2d %s''.\n
259
260 \nSynopsis:\n
261 None <- saveMSMS(filename, mol, surfacename, withHeader=1, component=0,
262 format='MS_TSES_ASCII', **kw)\n
263 filename : name of the output file\n
264 mol : molecule associated with the surface\n
265 surfacename : name of the surface to save\n
266 withHeader : flag to either write the headers or not\n
267 component : specifies which component of the surface to write out\n
268 format : specifies in which format to save the surface.
269 It can be one of the following ,\n
270 'MS_TSES_ASCII' Triangulated surface in ASCII format\n
271 'MS_ASES_ASCII' Analytical surface in ASCII format. This is
272 actually a discrete representation of the analytical model.\n
273 'MS_TSES_ASCII_AVS' Triangulated surface in ASCII with
274 AVS header\n
275 'MS_ASES_ASCII_AVS' Analytical surface in ASCII format
276 with AVS header\n
277
278 """
279
281 self.formats = ['MS_TSES_ASCII',
282 'MS_ASES_ASCII',
283 'MS_TSES_ASCII_AVS',
284 'MS_ASES_ASCII_AVS'
285 ]
286
287
288
289
290
291
292
293
294
295
296
298 if not self.cmdForms.has_key('saveMSMS'): return
299
300 molName, srfName = value.split('/')
301 mol = filter(lambda x: x.name == molName, self.vf.Mols)[0]
302 srf = mol.geomContainer.msms[srfName][0]
303 maxComponent = srf.rsr.nb-1
304 dW = self.cmdForms['saveMSMS'].descr.entryByName['component']['widget']
305 dW.configure(max=maxComponent)
306
307 - def setEntry_cb(self, filename):
308 import os
309 file = os.path.splitext(filename)[0]
310 ebn = self.cmdForms['saveMSMS'].descr.entryByName
311 entry = ebn['filename']['widget']
312 entry.setentry(file)
313
314
315
398
400
401 if self.cmdForms.has_key('saveMSMS'):
402 w = self.cmdForms['saveMSMS'].descr.entryByName['molsrf']['widget']
403 for mol in self.vf.Mols:
404 if not hasattr(mol.geomContainer, 'msms') or \
405 not mol.geomContainer.msms.keys():
406 continue
407 molsrf = []
408 for surf in mol.geomContainer.msms.keys():
409 molsrf.append(mol.name +'/'+surf)
410 w.setlist(molsrf)
411
412 val = self.showForm('saveMSMS', force=1)
413 kw = {}
414 if not val: return
415 if val.has_key('filename'):
416 filename = val['filename']
417 kw['format'] = val['format'][0]
418 kw['component'] = val['component']
419 kw['withHeader'] = val['withHeader']
420 molsrf = val['molsrf'][0]
421 molname, surfName = molsrf.split('/')
422 apply(self.doitWrapper, (filename, molname, surfName), kw)
423
424
425 - def doit(self, filename, molName, surfName, withHeader=True, component=0,
426 format="MS_TSES_ASCII"):
427 mol = self.vf.getMolFromName(molName)
428 if mol is None: return
429 gc = mol.geomContainer
430 if not gc.msms.has_key(surfName): return
431 msmsSurf = gc.msms[surfName][0]
432 msmsAtms = gc.msms[surfName]
433 from mslib import msms
434 if not format in self.formats:
435 format = "MS_TSES_ASCII"
436 format = getattr(msms, format)
437 if component is None : component = 0
438 elif not component in range( msmsSurf.rsr.nb ):
439 self.warningMsg("%s is an invalid component"%component)
440 return
441 msmsSurf.write_triangulation(filename, no_header=not withHeader,
442 component=component, format=format)
443
444
445 - def __call__(self, filename, molName, surfName, withHeader=True,
446 component=None, format="MS_TSES_ASCII", **kw):
447 """None <--- mv.saveMSMS(filename, mol, surface, withHeader=True,component=None, format='MS_TSES_ASCII', **kw)\n
448 \nRequired Arguments:\n
449 filename --- path to the output file without an extension two files will be created filename.face and a filename.vert\n
450 mol --- Protein associated to the surface\n
451 surface --- surface name\n
452
453 \nOptional Arguments:\n
454 withHeader --- True Boolean flag to specify whether or not to write the headers in the .face and the .vert files\n
455 component --- msms component to save by default None\n
456 format --- format in which the surface will be saved. It can be,\n
457 MS_TSES_ASCII: Triangulated surface in ASCII format.\n
458 MS_ASES_ASCII: Analytical surface in ASCII format.This is a discrete representation of the analytical model.MS_TSES_ASCII_AVS: Triangulated surface in ASCII with AVS header\n
459 MS_ASES_ASCII_AVS: Analytical surface in ASCII format with AVS header\n
460
461 """
462 if not molName or not filename or not surfName: return
463 kw['withHeader'] = withHeader
464 kw['component'] = component
465 kw['format'] = format
466 apply(self.doitWrapper, (filename, molName, surfName), kw)
467
468
469 SaveMSMSGUI = CommandGUI()
470 SaveMSMSGUI.addMenuCommand('menuRoot', 'Compute', 'Save Molecular Surface',
471 cascadeName='Molecular Surface')
472
474 """The computeMSMS command will compute a triangulated solvent excluded surface for the current selection.\n
475 Package : Pmv\n
476 Module : msmsCommands\n
477 Class : ComputeMSMS\n
478 Command name : computeMSMS\n
479 \nSynopsis :\n
480 None <--- mv.computeMSMS(nodes, surfName=None, pRadius=1.5,
481 density=1.0, perMol=True,
482 display=1)\n
483 \nRequired Arguments :\n
484 nodes --- current selection\n
485 \nOptional Arguments:\n
486 surfName --- name of the surfname which will be used as the key in
487 mol.geomContainer.msms dictionary. If the surfName is
488 already a key of the msms dictionary the surface is
489 recreated. By default mol.name-MSMS\n
490 pRadius --- probe radius (1.5)\n
491 density --- triangle density to represent the surface. (1.0)\n
492 perMol --- when this flag is True a surface is computed for each molecule
493 having at least one node in the current selection
494 else the surface is computed for the current selection.
495 (True)\n
496 display --- flag when set to 1 the displayMSMS will be executed to
497 display the new msms surface.\n
498
499 """
500
501
502
503
508
510 import mslib
511
512
514 if not self.vf.commands.has_key('assignAtomsRadii'):
515 self.vf.loadCommand('editCommands', ['assignAtomsRadii',],
516 topCommand=0)
517
519 """
520 """
521 if not self.vf.hasGui: return
522 geomC = obj.geomContainer
523 geomC.nbSurf = 0
524 geomC.msms = {}
525 geomC.msmsAtoms = {}
526 geomC.msmsCurrentDisplay = {}
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
549 """Function called to map atomic properties to the vertices of the
550 geometry"""
551 if len(atoms)==0: return None
552
553 geomC = geom.mol.geomContainer
554 surfName = geom.userName
555 surf = geomC.msms[surfName][0]
556 surfNum = geomC.msms[surfName][1]
557
558 prop = []
559 if propIndex is not None:
560 for a in geomC.msmsAtoms[surfName].data:
561 d = getattr(a, propName)
562 prop.append( d[surfName] )
563 else:
564 for a in geomC.msmsAtoms[surfName].data:
565 prop.append( getattr(a, propName) )
566
567 atomIndices = []
568 indName = '__surfIndex%d__'%surfNum
569 for a in atoms.data:
570 atomIndices.append(getattr(a, indName))
571
572 dum1, vi, dum2 = surf.getTriangles(atomIndices, keepOriginalIndices=1)
573
574 mappedProp = Numeric.take(prop, vi[:, 1]-1).astype('f')
575 if hasattr(geom,'apbs_colors'):
576 colors = []
577 for i in range(len(geom.apbs_dum1)):
578 ch = geom.apbs_dum1[i] == dum1[0]
579 if not 0 in ch:
580 tmp_prop = mappedProp[0]
581 mappedProp = mappedProp[1:]
582 dum1 = dum1[1:]
583 if tmp_prop == [1.5,1.5,1.5]:
584 colors.append(geom.apbs_colors[i][:3])
585 else:
586 colors.append(tmp_prop)
587 if not dum1:
588 break
589 mappedProp = colors
590 return mappedProp
591
592
594 return None
595
596
598 """Function called to convert picked vertices into atoms"""
599
600
601
602
603
604
605 surfName = geom.userName
606 geomC = geom.mol.geomContainer
607 surfNum = geomC.msms[surfName][1]
608 indName = '__surfIndex%d__'%surfNum
609
610
611
612 mol = geom.mol
613 atomindices = []
614 indName = '__surfIndex%d__'%surfNum
615 al = mol.geomContainer.atoms[surfName]
616 for a in al:
617 atomindices.append(getattr(a, indName))
618
619 surf = geomC.msms[surfName][0]
620 dum1, vi, dum2 = surf.getTriangles(atomindices, keepOriginalIndices=1)
621
622 l = []
623 allAt = geomC.msmsAtoms[surfName]
624 for i in vertInd:
625 l.append(allAt[vi[i][1]-1])
626 return AtomSet( AtomSet( l ) )
627
628
629 - def __call__(self, nodes, surfName='MSMS-MOL', pRadius=1.5,
630 density=3.0, perMol=True, display=True, hdset='None',
631 hdensity=6.0, **kw):
632 """None <- mv.computeMSMS(nodes, surfName='MSMSMOL', pRadius=1.5,density=1.0,perMol=True, display=1)\n
633 \nRequired Arguments :\n
634 nodes --- atomic fragment (string or objects)\n
635 \nOptional Arguments :\n
636 surfName --- name of the surfname which will be used as the key in
637 mol.geomContainer.msms dictionary. If the surfName is
638 already a key of the msms dictionary the surface is
639 recomputed. (default MSMS-MOL)\n
640 pRadius --- probe radius (1.5)\n
641 density --- triangle density to represent the surface. (1.0)\n
642 perMol --- when this flag is True a surface is computed for each
643 molecule having at least one node in the current selection
644 else the surface is computed for the current selection.
645 (True)\n
646 display --- flag when set to 1 the displayMSMS will be executed with
647 the surfName else not.\n
648 hdset --- Atom set (or name) for which high density triangualtion will
649 be generated
650 hdensity --- vertex density for high density
651 """
652 nodes=self.vf.expandNodes(nodes)
653 kw['surfName'] = surfName
654 kw['pRadius'] = pRadius
655 kw['density'] = density
656 kw['perMol'] = perMol
657 kw['display'] = display
658 kw['hdset'] = hdset
659 kw['hdensity'] = hdensity
660 if type(nodes) is StringType:
661 self.nodeLogString = "'" + nodes +"'"
662 apply(self.doitWrapper, (nodes,), kw)
663
664
666 if val['hdset'] is None:
667 return val
668 if val['hdset'] == 'None':
669 val['hdset'] = None
670 return val
671 hdsetName = val['hdset'][0]
672 if hdsetName=='None' or hdsetName=='':
673 val['hdset'] = None
674 return val
675
676
678 if self.cmdForms.has_key('default'):
679 self.updateCBB()
680 val = self.showForm('default')
681 if not val: return
682 if type(val['surfName']) is types.TupleType:
683 surfName = val['surfName'][0]
684 else:
685 surfName = val['surfName']
686
687 val = self.fixValues(val)
688 del val['surfName']
689
690 apply(self.doitWrapper, (self.vf.getSelection(), surfName), val)
691
692
693 - def doit(self, nodes, surfName='MSMS-MOL', pRadius=1.5, density=1.0,
694 perMol=True, display=True, hdset=None, hdensity=6.0):
695 """Required Arguments:\n
696 nodes --- current selection\n
697 surfName --- name of the surfname which will be used as the key in
698 mol.geomContainer.msms dictionary.\n
699 \nOptional Arguments: \n
700 pRadius --- probe radius (1.5)\n
701 density --- triangle density to represent the surface. (1.0)\n
702 perMol --- when this flag is True a surface is computed for each
703 molecule having at least one node in the current selection
704 else the surface is computed for the current selection.
705 (True)\n
706 display --- flag when set to True the displayMSMS will be executed with
707 the surfName else not.\n
708 hdset --- Atom set for which high density triangualtion
709 will be generated
710 hdensity --- vertex density for high density
711 """
712
713 from mslib import MSMS
714 if nodes is None or not nodes:
715 return
716
717 if not type(density) in [types.IntType, types.FloatType] or \
718 density < 0: return 'ERROR'
719 if not type(pRadius) in [types.IntType, types.FloatType] or \
720 pRadius <0: return 'ERROR'
721
722 if hdset=='None':
723 hdset=None
724 if hdset:
725 if self.vf.sets.has_key(hdset[0]):
726 hdset = self.vf.sets[hdset[0]].findType(Atom)
727 else:
728 self.warningMsg("set %s not found"%hdset)
729 for a in hdset:
730 a.highDensity = True
731
732
733
734 if perMol:
735 molecules = nodes.top.uniq()
736 atmSets = map(lambda x: x.allAtoms, molecules)
737 else:
738 molecules, atmSets = self.vf.getNodesByMolecule(nodes, Atom)
739
740 for mol, atms in map(None, molecules, atmSets):
741 if not surfName:
742 surfName = mol.name + '-MSMS'
743 geomC = mol.geomContainer
744
745 if not geomC.msms.has_key(surfName):
746
747
748 g = IndexedPolygons(surfName, pickableVertices=1, protected=True,)
749 if self.vf.userpref['sharpColorBoundariesForMsms']['value'] == 'blur':
750 g.Set(inheritSharpColorBoundaries=False, sharpColorBoundaries=False,)
751 g.userName = surfName
752 geomC.addGeom(g)
753 self.managedGeometries.append(g)
754 geomC.geomPickToAtoms[surfName] = self.pickedVerticesToAtoms
755 geomC.geomPickToBonds[surfName] = None
756
757
758
759
760
761 geomC.atomPropToVertices[surfName] = self.atomPropToVertices
762
763 for a in mol.allAtoms:
764 a.colors[surfName] = (1.,1.,1.)
765 a.opacities[surfName] = 1.0
766
767 if self.cmdForms.has_key('default'):
768 self.updateForm(surfName)
769
770
771 geomC.msmsAtoms[surfName]=atms[:]
772 geomC.atoms[surfName] = AtomSet([])
773
774 i=0
775 indName = '__surfIndex%d__'%geomC.nbSurf
776 hd = []
777 surf = []
778 for a in atms:
779 setattr(a, indName, i)
780 i = i + 1
781 surf.append(1)
782 if hasattr(a, 'highDensity'):
783 hd.append(1)
784 else:
785 hd.append(0)
786
787
788 try:
789 atmRadii = atms.radius
790 except:
791 atmRadii = self.vf.assignAtomsRadii(mol, united=0,
792 topCommand=0)
793 atmRadii = atms.radius
794
795
796 srf = MSMS(coords=atms.coords, radii=atmRadii, surfflags=surf,
797 hdflags=hd )
798 srf.compute(probe_radius=pRadius, density=density,
799 hdensity=hdensity)
800
801
802 mol.geomContainer.msms[surfName] = (srf, geomC.nbSurf)
803
804 geomC.nbSurf += 1
805
806 if hdset:
807 for a in hdset:
808 del a.highDensity
809
810 if display:
811 if not self.vf.commands.has_key('displayMSMS'):
812 self.vf.loadCommand("msmsCommands", ['displayMSMS',],
813 topCommand=0)
814 if nodes.stringRepr is not None:
815 geomC.msmsCurrentDisplay[surfName] = \
816 "self.displayMSMS('%s', surfName=['%s'], negate=0, only=0, nbVert=%d, topCommand=0)" %(nodes.stringRepr, surfName, Pmv.numOfSelectedVerticesToSelectTriangle)
817 else:
818 geomC.msmsCurrentDisplay[surfName] = \
819 "self.displayMSMS('%s', surfName=['%s'], negate=0, only=0, nbVert=%d, topCommand=0)" %(nodes.full_name(), surfName, Pmv.numOfSelectedVerticesToSelectTriangle)
820
821 self.vf.displayMSMS(nodes, surfName=[surfName,], negate=0, only=1,
822 nbVert=Pmv.numOfSelectedVerticesToSelectTriangle, log=0)
823
824
948
949
950
951
953 srf = mol.geomContainer.msms
954 lookup = mol.geomContainer.texCoordsLookup["msms"]
955 g = mol.geomContainer.geoms['msms']
956 if g.texture:
957 g.texture.auto=0
958 if srf:
959 vf, vi, f = srf.getTriangles()
960 values.shape = (-1,1)
961 assert len(values)==len(vf)
962 i = 0
963 for v in vf:
964 lookup[str(v[0])+str(v[1])+str(v[2])] = values[i]
965 i = i + 1
966 self.updateTexCoords(mol)
967
968
970 lookup = mol.geomContainer.texCoordsLookup["msms"]
971 g = mol.geomContainer.geoms['msms']
972 tx = map(lambda v, l=lookup: l[str(v[0])+str(v[1])+str(v[2])],
973 g.vertexSet.vertices.array)
974 tx = Numeric.array(tx)
975 tx.shape = (-1,1)
976 g.Set( textureCoords=tx, tagModified=False )
977
978
979
986
987
988
989
990 - def entryValidate(self, text):
991 """
992 Method to validate the name of the msms surface. This name
993 will be used by other command to build Pmw widget so it can't
994 contain an '_'.
995 """
996 if '_' in text:
997 return Pmw.ERROR
998 else:
999 return Pmw.OK
1000
1001
1003 defaultValues = self.getLastUsedValues()
1004 ebn = self.cmdForms['default'].descr.entryByName
1005 cbb = ebn['surfName']['widget']
1006 typein = cbb.get()
1007 sel = cbb.getcurselection()
1008 if typein in sel: return
1009 sNames = []
1010 mols = self.vf.getSelection().top.uniq()
1011 for mol in mols:
1012 sNames += mol.geomContainer.msms.keys()
1013 if not typein in sNames:
1014 return
1015 else:
1016 cbb.setlist(sNames)
1017 cbb.selectitem(typein)
1018
1019 names = ['None']+self.vf.sets.keys()
1020 names.sort()
1021 cbb = ebn['hdset']['widget']
1022 cbb.setlist(names)
1023 if defaultValues['hdset'] is not None:
1024 cbb.selectitem(str(defaultValues['hdset'][0]))
1025
1027 if not self.cmdForms.has_key('default'):
1028 return
1029 ebn = self.cmdForms['default'].descr.entryByName
1030 perMol = ebn['perMol']['wcfg']['variable'].get()
1031 saveBut = ebn['saveSel']['widget']
1032 if perMol:
1033 saveBut.configure(