Пример #1
0
    def __init__(self, parent, enableUi,File=""):
        f = QGLFormat()
        f.setStencil(True)
        f.setRgba(True)
        f.setDepth(True)
        f.setDoubleBuffer(True)
        QGLWidget.__init__(self, f, parent=parent)        
        self.setMinimumSize(500, 500)
        self._enableUi=enableUi
        self.pymol = pymol2.PyMOL()# _pymolPool.getInstance()
        self.pymol.start()
        self.cmd = self.pymol.cmd
        # self.toPymolName = self.pymol.toPymolName ### Attribute Error
        self._pymolProcess()
        self.setFocusPolicy(Qt.ClickFocus)
        #self.Parser = self.

        if not self._enableUi:
            self.pymol.cmd.set("internal_gui",0)
            self.pymol.cmd.set("internal_feedback",0)
            self.pymol.cmd.button("double_left","None","None")
            self.pymol.cmd.button("single_right","None","None")

        self.pymol.cmd.load(File)
        
        # inFile = "./data/scTIM.pdb"
        
        if(File[-9:-1] == "scTIM.pdb"):
            self.cmd.show("cartoon", "chain B")
            self.cmd.hide("lines", "chain B")
        else:
            self.cmd.hide("all")
            self.cmd.cartoon("tube")
            self.cmd.show("cartoon")
            
        
        #self.cmd.show("cartoon")
        #self.cmd.cartoon("putty")
        self.cmd.set("cartoon_highlight_color", 1)
        #self.cmd.hide("lines")
        #self.cmd.hide("chain ")
        self.color_obj(0)
        #self.cmd.color("marine")
        self.pymol.reshape(self.width(),self.height())
        self._timer = QtCore.QTimer()
        self._timer.setSingleShot(True)
        self._timer.timeout.connect(self._pymolProcess)
        self.resizeGL(self.width(),self.height())
        #globalSettings.settingsChanged.connect(self._updateGlobalSettings)
        self._updateGlobalSettings()
        define_color(self.cmd.set_color)

        # used for save the color of residues
        self._color_cache = {}
        self._selected =[]
Пример #2
0
 def __init__(self, renderer, title):
     QApplication.__init__(self, sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle(title)
     self.window.resize(800,600)
     # Get OpenGL 4.1 context
     glformat = QGLFormat()
     glformat.setVersion(4, 1)
     glformat.setProfile(QGLFormat.CoreProfile)
     glformat.setDoubleBuffer(False)
     self.glwidget = MyGlWidget(renderer, glformat, self)
     self.window.setCentralWidget(self.glwidget)
     self.window.show()
Пример #3
0
 def __init__(self, renderer, title):
     QApplication.__init__(self, sys.argv)
     self.window = QMainWindow()
     self.window.setWindowTitle(title)
     self.window.resize(800, 600)
     # Get OpenGL 4.1 context
     glformat = QGLFormat()
     glformat.setVersion(4, 1)
     glformat.setProfile(QGLFormat.CoreProfile)
     glformat.setDoubleBuffer(False)
     self.glwidget = MyGlWidget(renderer, glformat, self)
     self.window.setCentralWidget(self.glwidget)
     self.window.show()
Пример #4
0
    def __init__(self, verts_object):
        self.verts = verts_object
        self.vert_options = args_to_dict(self.verts.draw)
        self.gl_options = args_to_dict(self.set_options)

        fmt = QGLFormat()
        fmt.setRgba(True)
        fmt.setDoubleBuffer(False)
        QGLWidget.__init__(self, fmt)
        self.glInit()

        self.setMouseTracking(True)

        self.camera = camera()
        self.camera.setSceneRadius(2)
        self.camera.reset()
        self.isPressed = False
        self.oldx = self.oldy = 0