Example #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 =[]