__init__.py (pymol-v1.8.6.0.tar.bz2) | : | __init__.py (pymol-v2.1.0.tar.bz2) | ||
---|---|---|---|---|
skipping to change at line 55 | skipping to change at line 55 | |||
def draw(self): | def draw(self): | |||
_cmd._draw(self._COb) | _cmd._draw(self._COb) | |||
def button(self, button, state, x, y, modifiers): | def button(self, button, state, x, y, modifiers): | |||
_cmd._button(self._COb, button, state, x, y, modifiers) | _cmd._button(self._COb, button, state, x, y, modifiers) | |||
def drag(self, x, y, modifiers): | def drag(self, x, y, modifiers): | |||
_cmd._drag(self._COb, x, y, modifiers) | _cmd._drag(self._COb, x, y, modifiers) | |||
def start(self): | def start(self): | |||
pymol.prime_pymol() | ||||
cmd = pymol.cmd | cmd = pymol.cmd | |||
if cmd._COb is not None: | if cmd._COb is not None: | |||
raise RuntimeError('can only start SingletonPyMOL once') | raise RuntimeError('can only start SingletonPyMOL once') | |||
with pymol2_lock: | with pymol2_lock: | |||
cmd._COb = _cmd._new(pymol, pymol.invocation.options) | cmd._COb = _cmd._new(pymol, pymol.invocation.options) | |||
_cmd._start(cmd._COb, cmd) | _cmd._start(cmd._COb, cmd) | |||
# this instance tracking is redundant with the "cmd" module itself | # this instance tracking is redundant with the "cmd" module itself | |||
self._COb = cmd._COb | self._COb = cmd._COb | |||
self.cmd = cmd | self.cmd = cmd | |||
def stop(self): | ||||
with pymol2_lock: | ||||
_cmd._stop(self._COb) | ||||
_cmd._del(self._COb) | ||||
pymol.cmd._COb = None | ||||
class PyMOL(SingletonPyMOL): | class PyMOL(SingletonPyMOL): | |||
''' | ''' | |||
Start a non-exclusive PyMOL instance, multiple instances are possible | Start a non-exclusive PyMOL instance, multiple instances are possible | |||
''' | ''' | |||
def __getattr__(self, key): | def __getattr__(self, key): | |||
# Make this a proxy to the "pymol" module. | # Make this a proxy to the "pymol" module. | |||
return getattr(pymol, key) | return getattr(pymol, key) | |||
def __init__(self,scheme=None): # initialize a PyMOL instance | def __init__(self,scheme=None): # initialize a PyMOL instance | |||
skipping to change at line 118 | skipping to change at line 123 | |||
# initialize the cmd API | # initialize the cmd API | |||
self.cmd = Cmd(self,self._COb) | self.cmd = Cmd(self,self._COb) | |||
# begin assembling the instance member by member | # begin assembling the instance member by member | |||
self.glutThread = None | self.glutThread = None | |||
def __del__(self): | def __del__(self): | |||
_cmd._del(self._COb) | _cmd._del(self._COb) | |||
self.cmd.__dict__.clear() | ||||
def start(self): | def start(self): | |||
with pymol2_lock: | with pymol2_lock: | |||
_cmd._start(self._COb, self.cmd) | _cmd._start(self._COb, self.cmd) | |||
def startWithTclTk(self, gui = None, skin=None): | def startWithTclTk(self, gui = None, skin=None): | |||
self.start() | self.start() | |||
if gui == None: | if gui == None: | |||
gui = self.invocation.options.gui | gui = self.invocation.options.gui | |||
if skin == None: | if skin == None: | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 8 lines changed or added |