Exemplo n.º 1
0
    def start(self):
        cmd = pymol.cmd
        if cmd._COb is not None:
            raise RuntimeError('can only start SingletonPyMOL once')

        with pymol2_lock:
            cmd._COb = _cmd._new(pymol, pymol.invocation.options)
            _cmd._start(cmd._COb, cmd)

        # this instance tracking is redundant with the "cmd" module itself
        self._COb = cmd._COb
        self.cmd = cmd
Exemplo n.º 2
0
    def __init__(self, scheme=None):  # initialize a PyMOL instance
        pymol2_lock.acquire(1)
        try:

            pymol._init_internals(self)

            self.invocation = self._invocation

            options = self.invocation.options

            if scheme != None:  #
                if scheme == "presentation":
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 0
                    options.no_quit = 1
                    options.internal_gui = 0
                    options.presentation = 1
                elif scheme == "widget":  # An embedded widget of some type
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 1
                    options.no_quit = 1
            else:
                options.show_splash = 0  # suppress this annoyance by default

            self._COb = _cmd._new(self, self.invocation.options)

            # initialize the cmd API

            self.cmd = Cmd(self, self._COb)

            # begin assembling the instance member by member

            # key instance methods

            self.exec_str = pymol.exec_str
            self.adapt_to_hardware = pymol.adapt_to_hardware
            self.exec_deferred = pymol.exec_deferred

            # Python components

            self.util = pymol.util
            self.menu = pymol.menu
            self.setting = pymol.setting
            self.povray = pymol.povray
            self.preset = pymol.preset

        except:
            traceback.print_exc()
            pymol2_lock.release()
Exemplo n.º 3
0
    def start(self):
        cmd = pymol.cmd
        if cmd._COb is not None:
            raise RuntimeError('can only start SingletonPyMOL once')

        with pymol2_lock:
            cmd._COb = _cmd._new(pymol, pymol.invocation.options)
            _cmd._start(cmd._COb, cmd)

        # this instance tracking is redundant with the "cmd" module itself
        self._COb = cmd._COb
        self.cmd = cmd
Exemplo n.º 4
0
    def __init__(self,scheme=None): # initialize a PyMOL instance
        pymol2_lock.acquire(1)
        try:

            pymol._init_internals(self)

            self.invocation = self._invocation

            options = self.invocation.options

            if scheme!=None: #
                if scheme == 'presentation':
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 0
                    options.no_quit = 1
                    options.internal_gui = 0
                    options.presentation = 1
                elif scheme == 'widget': # An embedded widget of some type
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 1
                    options.no_quit = 1
            else:
                options.show_splash = 0 # suppress this annoyance by default
                    
            self._COb = _cmd._new(self,self.invocation.options)

            # initialize the cmd API

            self.cmd = Cmd(self,self._COb)
            
            # begin assembling the instance member by member

            # key instance methods

            self.exec_str = pymol.exec_str
            self.adapt_to_hardware = pymol.adapt_to_hardware
            self.exec_deferred = pymol.exec_deferred

            # Python components

            self.util = pymol.util
            self.menu = pymol.menu
            self.setting = pymol.setting
            self.povray = pymol.povray
            self.preset = pymol.preset
            
        except:
            traceback.print_exc()
            pymol2_lock.release()
Exemplo n.º 5
0
    def __init__(self, parent, enable_ui, filename="", unit_cell=False):
        f = QGLFormat()
        f.setStencil(True)
        f.setRgba(True)
        f.setDepth(True)
        f.setDoubleBuffer(True)
        QGLWidget.__init__(self, f, parent=parent)
        self.setMinimumSize(250, 250)
        self._enable_ui = enable_ui

        # set pymol invocation options
        self.pymol = pymol2.PyMOL()  # _pymolPool.getInstance()
        self.pymol.invocation.options.quiet = 1
        del (self.pymol._COb, self.pymol.cmd)
        self.pymol._COb = _cmd._new(self.pymol, self.pymol.invocation.options)
        self.pymol.cmd = pymol2.cmd2.Cmd(self.pymol, self.pymol._COb)

        self.pymol.start()

        # other initialisation
        self.cmd = self.pymol.cmd
        self.model_name = os.path.basename(os.path.splitext(filename)[0])
        self.zoom_level = 1
        # self.toPymolName = self.pymol.toPymolName ### Attribute Error
        self._pymolProcess()

        if not self._enable_ui:
            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.start()

        self.pymol.cmd.bg_color(color="white")
        self.load(filename)
        self.pymol.cmd.do("set antialias, 1")
        self.pymol.cmd.do("set ray_trace_mode, 1")
        self.pymol.cmd.do("show_as spheres")
        self.pymol.cmd.do("set sphere_mode, 4")
        self.pymol.cmd.do("set internal_gui=0")
        self.pymol.cmd.do("zoom center, {}".format(self.zoom_level))
        self._show_cell(unit_cell)
        self.pymol.reshape(self.width(), self.height())
        self.pymol.cmd.viewport(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()
Exemplo n.º 6
0
    def __init__(self, scheme=None):  # initialize a PyMOL instance
        from .cmd2 import Cmd

        with pymol2_lock:
            pymol._init_internals(self)

            self.invocation = self._invocation

            options = self.invocation.options

            if scheme != None:  #
                if scheme == 'presentation':
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 0
                    options.no_quit = 1
                    options.internal_gui = 0
                    options.presentation = 1
                elif scheme == 'widget':  # An embedded widget of some type
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 1
                    options.no_quit = 1
            else:
                options.show_splash = 0  # suppress this annoyance by default

            self._COb = _cmd._new(self, self.invocation.options)

            # initialize the cmd API

            self.cmd = Cmd(self, self._COb)

            # begin assembling the instance member by member

            self.glutThread = None
Exemplo n.º 7
0
    def __init__(self,scheme=None): # initialize a PyMOL instance
        from .cmd2 import Cmd

        with pymol2_lock:
            pymol._init_internals(self)

            self.invocation = self._invocation

            options = self.invocation.options

            if scheme!=None: #
                if scheme == 'presentation':
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 0
                    options.no_quit = 1
                    options.internal_gui = 0
                    options.presentation = 1
                elif scheme == 'widget': # An embedded widget of some type
                    options.quiet = 0
                    options.show_splash = 0
                    options.external_gui = 0
                    options.internal_feedback = 1
                    options.no_quit = 1
            else:
                options.show_splash = 0 # suppress this annoyance by default
                    
            self._COb = _cmd._new(self,self.invocation.options)

            # initialize the cmd API

            self.cmd = Cmd(self,self._COb)
            
            # begin assembling the instance member by member

            self.glutThread = None