def isValidPython(self): import sys if sys.platform == 'cli': return True message = """\ Leo requires Python 2.2.1 or higher. You may download Python from http://python.org/download/ """ try: # This will fail if True/False are not defined. import leo.core.leoGlobals as g # print('leoBridge:isValidPython:g',g) # Set leoGlobals.g here, rather than in leoGlobals.py. leoGlobals = g # Don't set g.g, it would pollute the autocompleter. leoGlobals.g = g except ImportError: print("isValidPython: can not import leo.core.leoGlobals as leoGlobals") return 0 except Exception: print("isValidPytyhon: unexpected exception: import leo.core.leoGlobals as leoGlobals.py as g") import traceback; traceback.print_exc() return 0 try: version = '.'.join([str(sys.version_info[i]) for i in (0, 1, 2)]) ok = g.CheckVersion(version, '2.2.1') if not ok: print(message) g.app.gui.runAskOkDialog(None, "Python version error", message=message, text="Exit") return ok except Exception: print("isValidPython: unexpected exception: g.CheckVersion") import traceback; traceback.print_exc() return 0
from PyQt4 import QtGui from PyQt4.QtCore import QUrl assert QUrl # for pyflakes. QtConst = QtCore.Qt QtWidgets = QtGui printsupport = QtWidgets except ImportError: print('leoQt.py: can not fully import PyQt4.') # Define qt_version if fail: pass else: qt_version = QtCore.QT_VERSION_STR if 0: import leo.core.leoGlobals as g isNewQt = g.CheckVersion(qt_version, '4.5.0') # Define phonon,Qsci,QtSvg,QtWebKit,QtWebKitWidgets,uic. # These imports may fail without affecting the isQt5 constant. if fail: pass elif isQt5: try: QString = QtCore.QString except Exception: QString = g.u # Use default try: import PyQt5.QtDeclarative as QtDeclarative except ImportError: QtDeclarative = None try: import PyQt5.phonon as phonon