def test_entity_reset(self): eh=mol.CreateEntity() eh2=mol.CreateEntity() go=gfx.Entity("foo",eh) go.Reset(eh) go.Reset("rnum=1") go.Reset(entity=eh2) go.Reset(eh.Select("rnum=2")) go.Reset(eh,"rnum=3",mol.MATCH_RESIDUES) go.Reset("rnum=4",eh2)
def _CopyViews(self): views_to_add=[] scene_selection=gui.SceneSelection.Instance() ent=scene_selection.GetActiveNode(0) dialog=QueryDialog('Select...') if dialog.exec_(): q=mol.Query(dialog.query) if q.IsValid(): for i in range(scene_selection.GetActiveNodeCount()): ent=scene_selection.GetActiveNode(i) selected=ent.view.Select(q, dialog.query_flags) gfx_ent=gfx.Entity(self._UniqueName(ent),selected) gfx.Scene().Add(gfx_ent) else: ost.LogError("invalid query: %s" % q.error)
def _DoLoad(self): split_ids = [] for p in str(self._line.text()).split(','): for k in p.split(): if len(k.strip()): split_ids.append(k.strip()) self._line.setText('') for split_id in split_ids: try: ent = RemoteLoad(split_id, from_repo=self._current_repo) except Exception as e: LogError(str(e)) continue g = gfx.Entity(split_id, ent) try: gfx.Scene().Add(g) except Exception as e: LogError(str(e))
delta.x() * 0.5), False) self.update() def App(title='OST Viewer', width=800, height=600): """ """ import sys app = QApplication(sys.argv) fmt = QGLFormat() fmt.setAlpha(True) fmt.setSampleBuffers(True) wnd = ThreeDWidget(fmt) wnd.resize(width, height) wnd.setWindowTitle(title) wnd.show() app.threed = wnd return app if __name__ == '__main__': from ost import io # example use app = App() structure = io.LoadPDB('1crn.pdb') obj = gfx.Entity('structure', gfx.HSC, structure) obj.SetColor(gfx.YELLOW, 'rtype=H,E') obj.SetDetailColor(gfx.RED, 'rtype=H,E') gfx.Scene().Add(obj) app.exec_()
def test_gfxobj_conv(self): e=mol.CreateEntity() gfx.Scene().Add(gfx.Entity("foo2",e)) gfx.Scene()["foo2"].SetColor(gfx.YELLOW)