Coverage for PyRx.hbonds : 47%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
"This function is to show hydrogen bonds" print molecule1.name, molecule2.name frame.statusBar.SetStatusText("No hydrogen bond found between %s and %s."%(molecule1.name, molecule2.name), 0) return
else: if not hasattr(frame, 'hbonds'): assembly = vtk.vtkAssembly() frame.renderer3D.AddActor(assembly) frame.hbonds = assembly frame.hbonds.AddPart(hbondsActor)
"This function is called from the toolbar to toggle hydrogen bonds" frame = wx.GetTopLevelWindows()[0] molecules = frame.molecules if len(molecules) == 0: dlg = wx.MessageDialog(frame, 'This tool requires at least one molecule to work with.', 'Please Read a Molecule First', wx.OK | wx.ICON_INFORMATION) dlg.ShowModal() dlg.Destroy() event.EventObject.ToggleTool(event.Id, 0) elif len(molecules) == 1: if event.Checked(): show_h_bonds(frame, molecules[0], molecules[0]) else: molecules[0].hbondsActor.SetVisibility(False) frame.mayaviEngine.scene.render() else: if event.Checked(): for i, molecule1 in enumerate(molecules): for molecule2 in molecules[i+1:]: show_h_bonds(frame, molecule1, molecule2) frame.mayaviEngine.scene.render() else: frame.renderer3D.RemoveActor(frame.hbonds) del frame.hbonds frame.mayaviEngine.scene.render() |