Пример #1
0
    def __init__(self, audioPath, avbinPath=None):
        super(AudioEngine, self).__init__()
        self.audioPath = audioPath
        if avbinPath:
            load_library(str(avbinPath))
            pyglet.has_avbin = True
        self._volume = 1.0
        self.listener = AbstractAudioDriver.get_listener()

        self.ambientPlayer = AmbientPlayer(self)
Пример #2
0
import numpy as np
from pyglet.gl import *
from pyglet.lib import load_library
glib=load_library('GL')
from fos.actor.axes import Axes
from fos import Actor,World, Window, WindowManager

class Line(Actor):
    """ Lines, curves, tracks actor

    """

    def __init__(self,tracks,colors=None, line_width=2.,affine=None):
	if affine==None:
		self.affine=np.eye(4)
	else: self.affine=affine
	self.tracks_no=len(tracks)
	self.tracks_len=[len(t) for t in tracks]
	self.tracks=tracks
        self.vertices = np.ascontiguousarray(np.concatenate(self.tracks).astype('f4'))        
	if colors==None:
        	self.colors = np.ascontiguousarray(np.ones((len(self.vertices),4)).astype('f4'))
	else:
            if isinstance(colors, (list, tuple)):
                self.colors = np.tile(colors,(np.sum(self.tracks_len),1))            
            self.colors = np.ascontiguousarray(colors.astype('f4'))	
        self.vptr=self.vertices.ctypes.data
        self.cptr=self.colors.ctypes.data        
        self.count=np.array(self.tracks_len, dtype=np.int32)
        self.first=np.r_[0,np.cumsum(self.count)[:-1]].astype(np.int32)
        self.firstptr=self.first.ctypes.data
Пример #3
0
from ctypes import CFUNCTYPE, byref, c_void_p, c_int, c_ubyte, c_bool, c_uint32, c_uint64

from .controller import get_mapping
from .base import Device, AbsoluteAxis, RelativeAxis, Button
from .base import Joystick, Controller, AppleRemote

from pyglet.libs.darwin.cocoapy import CFSTR, CFIndex, CFTypeID, known_cftypes
from pyglet.libs.darwin.cocoapy import kCFRunLoopDefaultMode, CFAllocatorRef, cf
from pyglet.libs.darwin.cocoapy import cfset_to_set, cftype_to_value, cfarray_to_list
from pyglet.lib import load_library

__LP64__ = (sys.maxsize > 2**32)

# Uses the HID API introduced in Mac OS X version 10.5
# http://developer.apple.com/library/mac/#technotes/tn2007/tn2187.html
iokit = load_library(framework='IOKit')

# IOKit constants from
# /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDKeys.h
kIOHIDOptionsTypeNone = 0x00
kIOHIDOptionsTypeSeizeDevice = 0x01

kIOHIDElementTypeInput_Misc = 1
kIOHIDElementTypeInput_Button = 2
kIOHIDElementTypeInput_Axis = 3
kIOHIDElementTypeInput_ScanCodes = 4
kIOHIDElementTypeOutput = 129
kIOHIDElementTypeFeature = 257
kIOHIDElementTypeCollection = 513

# /System/Library/Frameworks/IOKit.framework/Headers/hid/IOHIDUsageTables.h
Пример #4
0
import sys
import numpy as np
#from fos import *
from pyglet.gl import *
from pyglet.lib import load_library

glib = load_library('GL')
from ctypes import *
from fos.actor import Actor


class Line(Actor):
    ''' Lines, curves, tracks actor

    '''
    def __init__(self, name, tracks, colors=None, line_width=2., affine=None):

        super(Line, self).__init__(name)
        #if affine==None:
        #   self.affine=np.eye(4)
        #else: self.affine=affine
        self.tracks_no = len(tracks)
        self.tracks_len = [len(t) for t in tracks]
        self.tracks = tracks
        self.vertices = np.ascontiguousarray(
            np.concatenate(self.tracks).astype('f4'))
        if colors == None:
            self.colors = np.ascontiguousarray(
                np.ones((len(self.vertices), 4)).astype('f4'))
        else:
            self.colors = np.ascontiguousarray(colors.astype('f4'))
Пример #5
0
import fos.interact.collision as cll
from pyglet.gl import *
from pyglet.lib import load_library

# dipy modules
from dipy.segment.quickbundles import QuickBundles
from dipy.io.dpy import Dpy
from dipy.io.pickles import load_pickle
from dipy.viz.colormap import orient2rgb
from dipy.tracking.metrics import downsample

# other
import copy
import cPickle as pickle

glib = load_library("GL")

from dipy.tracking.vox2track import track_counts
import Tkinter, tkFileDialog

from PySide.QtCore import Qt

question_message = """
>>>>Track Labeler
P : select/unselect the representative track.
E : expand/collapse the selected tracks 
F : keep selected tracks rerun QuickBundles and hide everything else.
A : select all representative tracks which are currently visible.
I : invert selected tracks to unselected
H : hide/show all representative tracks.
>>>Mouse