__init__.py (pymol-open-source-2.2.0) | : | __init__.py (pymol-open-source-2.3.0) | ||
---|---|---|---|---|
skipping to change at line 437 | skipping to change at line 437 | |||
Only returns if we are running pretend GLUT. | Only returns if we are running pretend GLUT. | |||
''' | ''' | |||
if args is None: | if args is None: | |||
args = sys.argv | args = sys.argv | |||
invocation.parse_args(args) | invocation.parse_args(args) | |||
if invocation.options.gui == 'pmg_qt': | if invocation.options.gui == 'pmg_qt': | |||
if invocation.options.no_gui: | if invocation.options.no_gui: | |||
return _launch_no_gui() | return _launch_no_gui() | |||
elif invocation.options.testing: | ||||
return pymol._cmd.test2() | ||||
try: | try: | |||
from pmg_qt import pymol_qt_gui | from pmg_qt import pymol_qt_gui | |||
sys.exit(pymol_qt_gui.execapp()) | sys.exit(pymol_qt_gui.execapp()) | |||
except ImportError: | except ImportError: | |||
print('Qt not available, using GLUT/Tk interface') | print('Qt not available, using GLUT/Tk interface') | |||
invocation.options.gui = 'pmg_tk' | invocation.options.gui = 'pmg_tk' | |||
prime_pymol() | prime_pymol() | |||
_cmd.runpymol(_cmd._get_global_C_object(), block_input_hook) | _cmd.runpymol(_cmd._get_global_C_object(), block_input_hook) | |||
skipping to change at line 598 | skipping to change at line 600 | |||
# "import cmd" in pymol scripts to import the pymol.cmd module. To be more | # "import cmd" in pymol scripts to import the pymol.cmd module. To be more | |||
# strict and for compatibility with python3 we use absolute imports now, | # strict and for compatibility with python3 we use absolute imports now, | |||
# which unfortunately will import an unrelated "cmd" module from the default | # which unfortunately will import an unrelated "cmd" module from the default | |||
# python library, and even worse will corrupt the pymol namespace with it. | # python library, and even worse will corrupt the pymol namespace with it. | |||
# The following causes an import error for "import cmd": | # The following causes an import error for "import cmd": | |||
class _NoCmdFinder: | class _NoCmdFinder: | |||
def find_spec(self, fullname, path=None, target=None): | def find_spec(self, fullname, path=None, target=None): | |||
if path is None and fullname == 'cmd': | if path is None and fullname == 'cmd': | |||
msg = 'use "from pymol import cmd" instead of "import cmd"' | msg = 'use "from pymol import cmd" instead of "import cmd"' | |||
raise CmdException(msg) | print('Warning: {}'.format(msg)) | |||
return None | return None | |||
find_module = find_spec | find_module = find_spec | |||
sys.meta_path.insert(0, _NoCmdFinder()) | sys.meta_path.insert(0, _NoCmdFinder()) | |||
########## LEGACY PRINT STATEMENT FOR PYMOL COMMAND LINE ################### | ########## LEGACY PRINT STATEMENT FOR PYMOL COMMAND LINE ################### | |||
if IS_PY3: | if IS_PY3: | |||
def _print_statement(*args, **_): | def _print_statement(*args, **_): | |||
'''Legacy Python-2-like print statement for the PyMOL command line''' | '''Legacy Python-2-like print statement for the PyMOL command line''' | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 3 lines changed or added |