def setUpClass(cls): cls.data_dir = pathlib.Path(tempfile.mkdtemp()) cls.ini_file = cls.data_dir / "settings.ini" config.settings.system = QSettings(str(cls.ini_file), QSettings.IniFormat) config.LOG_PATH = cls.data_dir / "logs" FormatHandler("sscanss", "OpenGL.arrays.numpymodule.NumpyHandler", ["sscanss.core.math.matrix.Matrix44"]) cls.window = MainWindow() cls.toolbar = cls.window.findChild(QToolBar) cls.model = cls.window.presenter.model cls.window.show()
from OpenGL import contextdata from OpenGL.plugins import FormatHandler import ctypes import OpenGL OpenGL.ERROR_ON_COPY = True # -> if set to a True value before importing the numpy/lists support modules, # will cause array operations to raise OpenGL.error.CopyError if the # operation would cause a data-copy in order to make the passed data-type # match the target data-type. FormatHandler('gloo', 'OpenGL.arrays.numpymodule.NumpyHandler', [ 'gloo.buffer.VertexBuffer', 'gloo.buffer.IndexBuffer', 'gloo.atlas.Atlas', 'gloo.texture.Texture2D', 'gloo.texture.Texture1D', 'gloo.texture.FloatTexture2D', 'gloo.texture.FloatTexture1D', 'gloo.texture.TextureCube', ]) def cleanupCallback(context=None): """Create a cleanup callback to clear context-specific storage for the current context""" def callback(context=contextdata.getContext(context)): """Clean up the context, assumes that the context will *not* render again!""" contextdata.cleanupContext(context) return callback
PlatformPlugin('nt', 'OpenGL.platform.win32.Win32Platform') PlatformPlugin('linux2', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('darwin', 'OpenGL.platform.darwin.DarwinPlatform') PlatformPlugin('posix', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('osmesa', 'OpenGL.platform.osmesa.OSMesaPlatform') PlatformPlugin('egl', 'OpenGL.platform.egl.EGLPlatform') import sys if sys.version_info[0] < 3: # Python 3.x renames the built-in module _bi = '__builtin__' else: _bi = 'builtins' FormatHandler('none', 'OpenGL.arrays.nones.NoneHandler', [_bi + '.NoneType'], isOutput=False) if sys.version_info[0] < 3: FormatHandler('str', 'OpenGL.arrays.strings.StringHandler', [_bi + '.str'], isOutput=False) FormatHandler('unicode', 'OpenGL.arrays.strings.UnicodeHandler', [_bi + '.unicode'], isOutput=False) else: FormatHandler('bytes', 'OpenGL.arrays.strings.StringHandler', [_bi + '.bytes'], isOutput=False) FormatHandler('str', 'OpenGL.arrays.strings.UnicodeHandler', [_bi + '.str'],
LOG_CONFIG = json.loads(log_file.read()) with open(SOURCE_PATH / "instrument_schema.json", "r") as schema_file: INSTRUMENT_SCHEMA = json.loads(schema_file.read()) DOCS_URL = f'https://isisneutronmuon.github.io/SScanSS-2/{__version__}/index.html' UPDATE_URL = 'https://api.github.com/repos/ISISNeutronMuon/SScanSS-2/releases/latest' RELEASES_URL = 'https://github.com/ISISNeutronMuon/SScanSS-2/releases' INSTRUMENTS_PATH = SOURCE_PATH / 'instruments' CUSTOM_INSTRUMENTS_PATH = pathlib.Path.home( ) / 'Documents' / 'SScanSS 2' / 'instruments' STATIC_PATH = SOURCE_PATH / 'static' IMAGES_PATH = STATIC_PATH / 'images' # Tells OpenGL to use the NumpyHandler for the Matrix44 objects FormatHandler('sscanss', 'OpenGL.arrays.numpymodule.NumpyHandler', ['sscanss.core.math.matrix.Matrix44']) def path_for(filename): return (IMAGES_PATH / filename).as_posix() @unique class Group(Enum): """Setting groups""" General = 'General' Graphics = 'Graphics' Simulation = 'Simulation' @unique
SIZE_1_ARRAY_UNPACK = True USE_ACCELERATE = True CONTEXT_CHECKING = False FULL_LOGGING = False ALLOW_NUMPY_SCALARS = False UNSIGNED_BYTE_IMAGES_AS_STRING = True # Declarations of plugins provided by PyOpenGL itself from OpenGL.plugins import PlatformPlugin, FormatHandler PlatformPlugin('nt', 'OpenGL.platform.win32.Win32Platform') PlatformPlugin('linux2', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('darwin', 'OpenGL.platform.darwin.DarwinPlatform') PlatformPlugin('posix', 'OpenGL.platform.glx.GLXPlatform') FormatHandler('none', 'OpenGL.arrays.nones.NoneHandler') FormatHandler('str', 'OpenGL.arrays.strings.StringHandler') FormatHandler('list', 'OpenGL.arrays.lists.ListHandler', ['__builtin__.list', '__builtin__.tuple']) FormatHandler('numbers', 'OpenGL.arrays.numbers.NumberHandler') FormatHandler( 'ctypesarray', 'OpenGL.arrays.ctypesarrays.CtypesArrayHandler', [ '_ctypes.ArrayType', ], ) FormatHandler( 'ctypesparameter', 'OpenGL.arrays.ctypesparameters.CtypesParameterHandler', )
from OpenGL.version import __version__ ERROR_CHECKING = True ERROR_LOGGING = False ERROR_ON_COPY = False FULL_LOGGING = False ALLOW_NUMPY_SCALARS = False UNSIGNED_BYTE_IMAGES_AS_STRING = True # Declarations of plugins provided by PyOpenGL itself from OpenGL.plugins import PlatformPlugin, FormatHandler PlatformPlugin('nt', 'OpenGL.platform.win32.Win32Platform') PlatformPlugin('posix ', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('linux2', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('darwin', 'OpenGL.platform.darwin.DarwinPlatform') FormatHandler('none', 'OpenGL.arrays.nones.NoneHandler') FormatHandler('str', 'OpenGL.arrays.strings.StringHandler') FormatHandler('list', 'OpenGL.arrays.lists.ListHandler') FormatHandler('numbers', 'OpenGL.arrays.numbers.NumberHandler') FormatHandler('ctypesarray', 'OpenGL.arrays.ctypesarrays.CtypesArrayHandler') FormatHandler('ctypesparameter', 'OpenGL.arrays.ctypesparameters.CtypesParameterHandler') FormatHandler('ctypespointer', 'OpenGL.arrays.ctypespointers.CtypesPointerHandler') FormatHandler('numpy', 'OpenGL.arrays.numpymodule.NumpyHandler', ['numpy.ndarray']) #FormatHandler( 'numarray', 'OpenGL.arrays.numarrays.NumarrayHandler' ) #FormatHandler( 'numeric', 'OpenGL.arrays.numeric.NumericHandler', )
ALLOW_NUMPY_SCALARS = environ_key("ALLOW_NUMPY_SCALARS", False) UNSIGNED_BYTE_IMAGES_AS_STRING = environ_key("UNSIGNED_BYTE_IMAGES_AS_STRING", True) MODULE_ANNOTATIONS = False TYPE_ANNOTATIONS = False # Declarations of plugins provided by PyOpenGL itself PlatformPlugin("nt", "OpenGL.platform.win32.Win32Platform") PlatformPlugin("linux2", "OpenGL.platform.glx.GLXPlatform") PlatformPlugin("darwin", "OpenGL.platform.darwin.DarwinPlatform") PlatformPlugin("posix", "OpenGL.platform.glx.GLXPlatform") PlatformPlugin("osmesa", "OpenGL.platform.osmesa.OSMesaPlatform") PlatformPlugin("egl", "OpenGL.platform.egl.EGLPlatform") FormatHandler("none", "OpenGL.arrays.nones.NoneHandler", ["__builtin__.NoneType"], isOutput=False) FormatHandler("str", "OpenGL.arrays.strings.StringHandler", ["__builtin__.str"], isOutput=False) FormatHandler("unicode", "OpenGL.arrays.strings.UnicodeHandler", ["__builtin__.unicode"], isOutput=False) FormatHandler("list", "OpenGL.arrays.lists.ListHandler", ["__builtin__.list", "__builtin__.tuple"], isOutput=False) FormatHandler("numbers", "OpenGL.arrays.numbers.NumberHandler", ["__builtin__.int", "__builtin__.float", "__builtin__.long"], isOutput=False) FormatHandler("ctypesarrays", "OpenGL.arrays.ctypesarrays.CtypesArrayHandler", ["_ctypes.ArrayType", "_ctypes.PyCArrayType", "_ctypes.Array", "_ctypes.array.Array"], isOutput=True)
CONTEXT_CHECKING = False FULL_LOGGING = False ALLOW_NUMPY_SCALARS = False UNSIGNED_BYTE_IMAGES_AS_STRING = True MODULE_ANNOTATIONS = False # Declarations of plugins provided by PyOpenGL itself from OpenGL.plugins import PlatformPlugin, FormatHandler PlatformPlugin('nt', 'OpenGL.platform.win32.Win32Platform') PlatformPlugin('linux2', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('darwin', 'OpenGL.platform.darwin.DarwinPlatform') PlatformPlugin('posix', 'OpenGL.platform.glx.GLXPlatform') PlatformPlugin('osmesa', 'OpenGL.platform.osmesa.OSMesaPlatform') FormatHandler('none', 'OpenGL.arrays.nones.NoneHandler') import sys if sys.version_info[0] < 3: FormatHandler('str', 'OpenGL.arrays.strings.StringHandler') FormatHandler('unicode', 'OpenGL.arrays.strings.UnicodeHandler') else: FormatHandler('bytes', 'OpenGL.arrays.strings.StringHandler') FormatHandler('str', 'OpenGL.arrays.strings.UnicodeHandler') FormatHandler('list', 'OpenGL.arrays.lists.ListHandler', ['__builtin__.list', '__builtin__.tuple']) FormatHandler('numbers', 'OpenGL.arrays.numbers.NumberHandler') FormatHandler( 'ctypesarray', 'OpenGL.arrays.ctypesarrays.CtypesArrayHandler',