def __init__(self, *args, **kwargs): GLCanvas.__init__(self, *args, **kwargs) glutInit(sys.argv) self.Bind(wx.EVT_PAINT, self.OnPaint) # self.Bind(wx.EVT_SIZE, self.OnResize) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Bind(wx.EVT_MOTION, self.OnMouse) self.Bind(wx.EVT_KEY_DOWN, self.onKeyPressed) self.init = False self.width, self.height = self.GetSize() self.selectedX = 0 self.selectedY = 0 self.selectedZ = 0 self.selectionCounter = 0 self.alpha = 0 self.beta = 0 self.distance = 12.0 self.oldX = 0 self.oldY = 0 self.leftDown = False self.rightDown = False self.axes = False self.led = [[[0 for x in range(8)] for y in range(8)] for z in range(8)] for z in range(8): for y in range(8): for x in range(8): self.led[z][y][x] = Led(x-4,y-4,z-4,color=(255,0,0,255)) # subtract 4 to align the cube in the center of the screen
def __init__(self, parent, data, tick = 100, size = (250, 250)): GLCanvas.__init__(self, parent, size = size, style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_CHAR(self, self.OnKey) self.Bind(wx.EVT_SIZE, self.processSizeEvent, self) self.data = data self.InitGL() self.z = 0.0 self.xspeed = 0.0 self.yspeed = 0.0 self.xrot = 0.0 self.yrot = 0.0 self.stars = [star(x) for x in xrange(50)] for s in self.stars: s.init(self.stars) self.textures = self.load_textures() TIMER_ID = wx.NewId() self.timer = wx.Timer(self, TIMER_ID) # message will be sent to the panel # milliseconds self.timer.Start(tick) wx.EVT_TIMER(self, TIMER_ID, self.tick) # call the on_timer function
def __init__(self, parent, drwmng): GLCanvas.__init__(self, parent, -1, attribList=(wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_DEPTH_SIZE, 24)) wx.EVT_PAINT(self, self.on_draw) wx.EVT_SIZE(self, self.on_size) wx.EVT_WINDOW_DESTROY(self, self.on_destroy) wx.EVT_LEFT_UP(self, self.on_mouse) self.SetSize((500, 500)) self.drwmng = drwmng self._redraw = False self._flag_flush = False self._exit_flag = False self._lock = threading.Lock() glMatrixMode(GL_PROJECTION) glLoadIdentity() gluOrtho2D(-1, 1, -1, 1) glMatrixMode(GL_MODELVIEW) glLoadIdentity()
def __init__(self, parent, color = [1.0,0.,0.,1.]): GLCanvas.__init__(self, parent,-1) wx.EVT_PAINT(self, self.OnPaint) self.init = 0 self.color = color wx.EVT_CHAR(self, self.OnKey) return
def __init__(self, *args, **kwargs): BaseCanvasBackend.__init__(self, *args) p = self._process_backend_kwargs(kwargs) # WX supports OS double-click events, so we set this here to # avoid double events self._double_click_supported = True # Set config self._gl_attribs = _set_config(p.context.config) # Deal with context p.context.shared.add_ref('wx', self) if p.context.shared.ref is self: self._gl_context = None # set for real once we init the GLCanvas else: self._gl_context = p.context.shared.ref._gl_context if p.parent is None: style = (wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLIP_CHILDREN) style |= wx.NO_BORDER if not p.decorate else wx.RESIZE_BORDER style |= wx.STAY_ON_TOP if p.always_on_top else 0 self._frame = wx.Frame(None, wx.ID_ANY, p.title, p.position, p.size, style) if not p.resizable: self._frame.SetSizeHints(p.size[0], p.size[1], p.size[0], p.size[1]) if p.fullscreen is not False: if p.fullscreen is not True: logger.warning('Cannot specify monitor number for wx ' 'fullscreen, using default') self._fullscreen = True else: self._fullscreen = False _wx_app.SetTopWindow(self._frame) parent = self._frame self._frame.Raise() self._frame.Bind(wx.EVT_CLOSE, self.on_close) else: parent = p.parent self._frame = None self._fullscreen = False self._init = False GLCanvas.__init__(self, parent, wx.ID_ANY, pos=p.position, size=p.size, style=0, name='GLCanvas', attribList=self._gl_attribs) if self._gl_context is None: self._gl_context = glcanvas.GLContext(self) self.SetFocus() self._vispy_set_title(p.title) self._size = None self.Bind(wx.EVT_SIZE, self.on_resize) self.Bind(wx.EVT_PAINT, self.on_draw) self.Bind(wx.EVT_KEY_DOWN, self.on_key_down) self.Bind(wx.EVT_KEY_UP, self.on_key_up) self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event) self._size_init = p.size self._vispy_set_visible(p.show)
def __init__(self, *args, **kwargs): glutInit(['lmfao']) GLCanvas.__init__(self, *args, **kwargs) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnResize) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Bind(wx.EVT_MOTION, self.OnMouse) self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) self.init = False self.width, self.height = self.GetSize() self.alpha = 0 self.beta = 0 self.distance = 100.0 self.viewX = 0 self.viewY = 0 self.viewZ = 0 self.oldX = 0 self.oldY = 0 self.oldZ = 0 self.leftDown = False self.rightDown = False
def __init__(self, *args, **kwargs): BaseCanvasBackend.__init__(self, *args) title, size, position, show, vsync, resize, dec, fs, parent, context, \ = self._process_backend_kwargs(kwargs) # Set config self._gl_attribs = _set_config(context.config) # Deal with context context.shared.add_ref('wx', self) if context.shared.ref is self: self._gl_context = None # set for real once we init the GLCanvas else: self._gl_context = context.shared.ref._gl_context if parent is None: style = (wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLIP_CHILDREN) style |= wx.NO_BORDER if not dec else wx.RESIZE_BORDER self._frame = wx.Frame(None, wx.ID_ANY, title, position, size, style) if not resize: self._frame.SetSizeHints(size[0], size[1], size[0], size[1]) if fs is not False: if fs is not True: logger.warning('Cannot specify monitor number for wx ' 'fullscreen, using default') self._fullscreen = True else: self._fullscreen = False _wx_app.SetTopWindow(self._frame) parent = self._frame self._frame.Raise() self._frame.Bind(wx.EVT_CLOSE, self.on_close) else: self._frame = None self._fullscreen = False self._init = False GLCanvas.__init__(self, parent, wx.ID_ANY, pos=position, size=size, style=0, name='GLCanvas', attribList=self._gl_attribs) if self._gl_context is None: self._gl_context = glcanvas.GLContext(self) self.SetFocus() self._vispy_set_title(title) self._size = None self.Bind(wx.EVT_SIZE, self.on_resize) self.Bind(wx.EVT_PAINT, self.on_paint) self.Bind(wx.EVT_KEY_DOWN, self.on_key_down) self.Bind(wx.EVT_KEY_UP, self.on_key_up) self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event) self._size_init = size self._vispy_set_visible(show)
def __init__(self, parent): GLCanvas.__init__(self, parent, -1, attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER]) self.t_graph = TransferGraph(self) wx.EVT_PAINT(self, self.OnDraw) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_LEFT_DOWN(self, self.OnMouseLeftDown) wx.EVT_LEFT_UP(self, self.OnMouseLeftUp) wx.EVT_ERASE_BACKGROUND(self, lambda e: None) wx.EVT_CLOSE(self, self.OnClose) wx.EVT_CHAR(self, self.OnKeyDown) self.SetFocus() # So we know when new values are added / changed on the tgraph self.t_graph.Connect(-1, -1, wx.wxEVT_COMMAND_SLIDER_UPDATED, self.OnTGraphUpdate) self.init = False self.rotation_y = 0.0 self.rotation_x = 0.0 self.prev_y = 0 self.prev_x = 0 self.mouse_down = False self.width = 400 self.height = 400 self.fragment_shader_src = ''' uniform sampler1D TransferFunction; uniform sampler3D VolumeData; void main(void) { gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0); } ''' self.vertex_shader_src = ''' void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } ''' self.fragment_src_file = 'earth.f.c' self.vertex_src_file = 'earth.v.c' self.lighting = False self.light_count = 1 # List of textures that need to be freed self.texture_list = [] # List of VBOs that need to be freed self.buffers_list = [] # This is the transfer graph self.t_graph.Show()
def __init__(self, parent, color = [1.0,0.,0.,1.]): GLCanvas.__init__(self, parent,-1) wx.EVT_PAINT(self, self.OnPaint) self.init = 0 self.color = color wx.EVT_CHAR(self, self.OnKey) self.Bind(wx.EVT_SIZE, self.processSizeEvent, self)
def __init__(self, parent): """This needs to be given the parent in the GUI hierarchy so we can properly initialize the canvas""" GLCanvas.__init__(self, parent, -1) self.init = 0 self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) return
def __init__(self, parent): GLCanvas.__init__(self, parent,-1, attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER]) wx.EVT_PAINT(self, self.OnDraw) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) self.init = True
def __init__(self, parent): GLCanvas.__init__(self, parent, -1, attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER]) self.t_graph = TransferGraph(self) wx.EVT_PAINT(self, self.OnDraw) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_LEFT_DOWN(self, self.OnMouseLeftDown) wx.EVT_LEFT_UP(self, self.OnMouseLeftUp) wx.EVT_ERASE_BACKGROUND(self, lambda e: None) wx.EVT_CLOSE(self, self.OnClose) wx.EVT_CHAR(self, self.OnKeyDown) self.SetFocus() # So we know when new values are added / changed on the tgraph self.t_graph.Connect(-1, -1, wx.wxEVT_COMMAND_SLIDER_UPDATED, self.OnTGraphUpdate) self.init = False self.rotation_y = 0.0 self.rotation_x = 0.0 self.prev_y = 0 self.prev_x = 0 self.mouse_down = False self.width = 400 self.height = 400 self.fragment_shader_src = ''' uniform sampler1D TransferFunction; uniform sampler3D VolumeData; void main(void) { gl_FragColor = vec4(1.0, 0.0, 0.0, 0.0); } ''' self.vertex_shader_src = ''' void main(void) { gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex; } ''' #self.fragment_src_file = 'earth.f.c' #self.vertex_src_file = 'earth.v.c' self.lighting = False self.light_count = 1 # List of textures that need to be freed self.texture_list = [] # List of VBOs that need to be freed self.buffers_list = [] # This is the transfer graph self.t_graph.Show()
def __init__(self, parent): wxGLCanvas.__init__(self, parent, -1) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_MENU, self.OnMenu, None, 10000, 12000) self.viewport = HeeksCAD.Viewport() self.Resize() self.paint_callbacks = [] self.context_menu_enabled = True
def __init__(self, parent): wxGLCanvas.__init__(self, parent,-1) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouse) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) self.Bind(wx.EVT_MENU, self.OnMenu, None, 10000, 12000) self.viewport = HeeksCAD.Viewport() self.Resize() self.paint_callbacks = [] self.context_menu_enabled = True
def __init__(self, parent): attribList = (glcanvas.WX_GL_RGBA, # RGBA glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit GLCanvas.__init__(self, parent, -1, attribList=attribList) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) #wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_LEFT_DOWN(self, self.OnMouseLeftDown) wx.EVT_LEFT_UP(self, self.OnMouseLeftUp) wx.EVT_ERASE_BACKGROUND(self, lambda e: None) # wx.EVT_CLOSE(self, self.OnClose) # wx.EVT_CHAR(self, self.OnKeyDown) self.n_channels=10 self.n_timepoints= 10000 self.SetFocus() self.GLinitialized = False self.init = False self.rotation_y = 0.0 self.rotation_x = 0.0 self.prev_y = 0 self.prev_x = 0 self.mouse_down = False self.is_on_draw =False self.width = 400 self.height = 400 #Sizer = wx.BoxSizer(wx.VERTICAL) #Sizer.Add(self.canvas, 1, wx.EXPAND|wx.ALL, 5) #self.SetSizerAndFit(Sizer) self.srate=1024.15 self.data = None self.timepoints=None self.vbo_id=0 self._init_data() # self.vbo = VertexBuffer(self.data_vbo) # print "OK" # self.vbo = JuMEGVertexBuffer(self.data_vbo) self.vbo = JuMEGVertexBuffer()
def __init__(self, parent): attribList = ( glcanvas.WX_GL_RGBA, # RGBA glcanvas.WX_GL_DOUBLEBUFFER, # Double Buffered glcanvas.WX_GL_DEPTH_SIZE, 24) # 24 bit GLCanvas.__init__(self, parent, -1, attribList=attribList) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) #wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_LEFT_DOWN(self, self.OnMouseLeftDown) wx.EVT_LEFT_UP(self, self.OnMouseLeftUp) wx.EVT_ERASE_BACKGROUND(self, lambda e: None) # wx.EVT_CLOSE(self, self.OnClose) # wx.EVT_CHAR(self, self.OnKeyDown) self.n_channels = 10 self.n_timepoints = 10000 self.SetFocus() self.GLinitialized = False self.init = False self.rotation_y = 0.0 self.rotation_x = 0.0 self.prev_y = 0 self.prev_x = 0 self.mouse_down = False self.is_on_draw = False self.width = 400 self.height = 400 #Sizer = wx.BoxSizer(wx.VERTICAL) #Sizer.Add(self.canvas, 1, wx.EXPAND|wx.ALL, 5) #self.SetSizerAndFit(Sizer) self.srate = 1024.15 self.data = None self.timepoints = None self.vbo_id = 0 self._init_data() # self.vbo = VertexBuffer(self.data_vbo) # print "OK" # self.vbo = JuMEGVertexBuffer(self.data_vbo) self.vbo = JuMEGVertexBuffer()
def __init__(self, parent): GLCanvas.__init__(self, parent,-1) self._captureMouse = False self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_IDLE, self.OnIdle) self.Bind(wx.EVT_CHAR, self.OnChar) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_MOUSE_EVENTS, self.OnMouseEvent) # this seems to cause a blank rendering #wx.EVT_SIZE(self, self.OnSize) self.init = 0 return
def __init__(self, *args, **kwargs): """Creates rendering context and initialises GLCanvas""" # Initialise the c++ object GLCanvas.__init__(self, *args, **kwargs) # Prevent opengl calls until _InitGL has been called self._init = False self._idles = 0 # Bind the event handlers used here self.Bind(wx.EVT_PAINT, self.__OnPaint) self.Bind(wx.EVT_ERASE_BACKGROUND, lambda event: None) # stops flicker self.Bind(wx.EVT_SIZE, self.__OnSize) self.Bind(wx.EVT_IDLE, self.__OnIdle)
def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs): GLCanvas.__init__(self, parent, id, *args, **kwargs) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnResize) wx.EVT_ERASE_BACKGROUND(self, self.EraseBackground) self.init = 0 self.SetCurrent() self.texBorder = self.LoadTexture(os.path.join(locationsettings.data_dir, 'images/border.png')) self.texFateBack = self.LoadTexture(os.path.join(locationsettings.data_dir, 'images/fate_back.jpg')) self.texDynastyBack = self.LoadTexture(os.path.join(locationsettings.data_dir, 'images/dynasty_back.jpg')) self.texCard = {} self.texGeneric = {}
def __init__(self, parent): """This needs to be given the parent in the GUI hierarchy so we can properly initialize the canvas""" GLCanvas.__init__(self, parent, -1) self.init = 0 self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_TIMER, self.HandleTime) self.camera = Camera([30, 30, 30], [0, 0, 0]) self.angle = 0 self.timer = wx.Timer(self) self.timer.Start(20) return
def __init__(self, parent): GLCanvas.__init__(self, parent, -1, size=(850, 700), pos=(0, 0)) # init context self.init = False self.context = GLContext(self) self.SetCurrent(self.context) # init objects self.room_directories = {} self.current_room_name = 'Nothing' self.room = None self.furniture = {} self.camera = Camera() self.input = InputManager(850, 700, self.room, self.furniture, self.camera) # load rooms and furniture # select all the folders in rooms and furniture folders that have one png file and one room file # TODO need to handle when those two files aren't png and room for root, directory, file in os.walk('../res/Models/rooms'): if len(file) == 2: png, room = (os.path.join(root, x) for x in file) self.add_room_directory(png, room, file[0].split('.')[0]) for root, directory, file in os.walk('../res/Models/furniture'): if len(file) == 2: obj, png = (os.path.join(root, x) for x in file) self.add_furniture(png, obj, file[0].split('.')[0]) # init canvas glClearColor(42 / 256, 49 / 256, 50 / 256, 0.8) # glClearDepth(1) glEnable(GL_DEPTH_TEST) glDepthFunc(GL_LESS) self.resize(None) # bind function self.Bind(wx.EVT_SIZE, self.resize) self.Bind(wx.EVT_PAINT, self.paint) self.Bind(wx.EVT_KEY_DOWN, self.input.keyboard) self.Bind(wx.EVT_KEY_UP, self.input.keyboard_up) self.Bind(wx.EVT_MOTION, self.input.mouse_passive_motion) self.Bind(wx.EVT_MOUSEWHEEL, self.input.mouse_wheel_func) self.Bind(wx.EVT_IDLE, self.OnIdle)
def __init__(self, parent, id=wx.ID_ANY, *args, **kwargs): GLCanvas.__init__(self, parent, id, *args, **kwargs) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnResize) wx.EVT_ERASE_BACKGROUND(self, self.EraseBackground) self.init = 0 self.SetCurrent() self.texBorder = self.LoadTexture( os.path.join(locationsettings.data_dir, 'images/border.png')) self.texFateBack = self.LoadTexture( os.path.join(locationsettings.data_dir, 'images/fate_back.jpg')) self.texDynastyBack = self.LoadTexture( os.path.join(locationsettings.data_dir, 'images/dynasty_back.jpg')) self.texCard = {} self.texGeneric = {}
def __init__(self, parent, data, tick = 100, size = (250, 250)): GLCanvas.__init__(self, parent, size = size, style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_CHAR(self, self.OnKey) self.Bind(wx.EVT_SIZE, self.processSizeEvent, self) self.data = data self.zOffset = 0. self.InitGL() self.rtri = 0.0 self.rquad = 0.0 TIMER_ID = wx.NewId() self.timer = wx.Timer(self, TIMER_ID) # message will be sent to the panel # milliseconds self.timer.Start(tick) wx.EVT_TIMER(self, TIMER_ID, self.tick) # call the on_timer function
def __init__(self, parent): """This needs to be given the parent in the GUI hierarchy so we can properly initialize the canvas""" GLCanvas.__init__(self, parent, -1) self.init = 0 self.SetCurrent() self.startingpoints = [[0, 0, 0, 1], [0, 10, 0, 1], [10, 10, 0, 1], [10, 0, 0, 1]] self.points = [] self.currentpoints = self.startingpoints self.AppendCurrentPoints() self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.command = [] self.macro = {} self.macrostate = 0 self.displaylist = None return
def _create_control(self, parent, wid, pos=wx.DefaultPosition, size=wx.DefaultSize): return GLCanvas(parent, wid, pos, size, style=wx.CLIP_CHILDREN | wx.WANTS_CHARS)
def __init__(self, figure, parent, *args, **kwargs): # make sure the window is double buffered (Thanks David!) kwargs.update({ 'attribList': [wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER] }) # call GLCanvas' init method GLCanvas.__init__(self, parent, *args, **kwargs) self._glContext = GLContext(self) self._glContext.SetCurrent(self) self.figure = figure # find root window root = self.GetParent() while root.GetParent(): root = root.GetParent() # make bindings for events self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick) self.Bind(wx.EVT_RIGHT_DCLICK, self.OnDoubleClick) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) # self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_SIZE, self.OnResize) root.Bind(wx.EVT_CLOSE, self.OnClose) # Note root # self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SET_FOCUS, self.OnFocus) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) root.Bind(wx.EVT_ACTIVATE, self.OnActivate) # Note root # Needs to focus to catch key events self.SetFocus()
def __init__(self, parent): GLCanvas.__init__(self, parent,-1, attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER]) wx.EVT_PAINT(self, self.OnDraw) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOTION(self, self.OnMouseMotion) self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp) self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseDown) self.Bind(wx.EVT_RIGHT_UP, self.OnMouseUp) wx.EVT_WINDOW_DESTROY(self, self.OnDestroy) self.init = True # initial mouse position self.lastx = self.x = 30 self.lasty = self.y = 30 self.mouseDown = False self.rMouseDown = False self.size = None
def __init__(self, figure, parent, *args, **kwargs): # make sure the window is double buffered (Thanks David!) kwargs.update({'attribList' : [wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER]}) # call GLCanvas' init method GLCanvas.__init__(self, parent, *args, **kwargs) self._glContext = GLContext(self ) self._glContext.SetCurrent(self) self.figure = figure # find root window root = self.GetParent() while root.GetParent(): root = root.GetParent() # make bindings for events self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Bind(wx.EVT_LEFT_DCLICK, self.OnDoubleClick) self.Bind(wx.EVT_RIGHT_DCLICK, self.OnDoubleClick) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel) # self.Bind(wx.EVT_MOTION, self.OnMotion) self.Bind(wx.EVT_ENTER_WINDOW, self.OnEnter) self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeave) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown) self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_SIZE, self.OnResize) root.Bind(wx.EVT_CLOSE, self.OnClose) # Note root # self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SET_FOCUS, self.OnFocus) self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground) root.Bind(wx.EVT_ACTIVATE, self.OnActivate) # Note root # Needs to focus to catch key events self.SetFocus()
def __init__(self, parent): """This needs to be given the parent in the GUI hierarchy so we can properly initialize the canvas""" self.arena = None self.pillar = [] self.temppoint = [] self.ray = [] self.currentray = None self.geomcalc = GeomCalc() self.nexttime = -1 self.nextline = None self.t = 0 GLCanvas.__init__(self, parent, -1) self.init = 0 self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_LEFT_DOWN, self.HandleClick) self.Bind(wx.EVT_TIMER, self.HandleTime) self.timer = wx.Timer(self) self.timer.Start(100) return
def __init__(self, parent): """This needs to be given the parent in the GUI hierarchy so we can properly initialize the canvas""" GLCanvas.__init__(self, parent,-1) self.init = 0 glEnable(GL_NORMALIZE) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_TIMER, self.HandleTime) #Create the terrain, run the algorithm and find all the normals self.terrain = Terrain(2, [0, 0, 0, 0]) self.terrain.Seed() self.PushAllNormals() #Get the height range [self.min, self.max] = self.GetHeightRange() self.wirelist = None self.skinlist = None #Instantiate the camera self.camera = Camera([25, 25, 25], [1, 1, 1]) #Start the timer. The value here may be adjusted for peak peformance for whatever machine you're running this on. self.timer = wx.Timer(self) self.timer.Start(10) self.spinangle = 0.0 self.spinvelocity = 0.0 #Start with a wireframe self.skinmode = -1 self.reskin = 1 self.rewire = 1 return
def __init__(self, *args, **kwargs): GLCanvas.__init__(self, *args, **kwargs) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnResize) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) self.Bind(wx.EVT_MOTION, self.OnMouse) self.init = False self.width, self.height = self.GetSize() self.alpha = 0 self.beta = 0 self.distance = 5.0 self.oldX = 0 self.oldY = 0 self.leftDown = False self.rightDown = False self.axes = False
def __init__(self, parent, sim): GLCanvas.__init__(self, parent, -1, size=(1024, 1024), attribList=(wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_DOUBLEBUFFER, wx.glcanvas.WX_GL_DEPTH_SIZE, 24)) self.context = GLContext(self) self.SetCurrent(self.context) self.context_initialized = False self.sim = sim self.projection_matrix = None self.rotate = False self.beginx = 0.0; self.beginy = 0.0 wx.EVT_SIZE(self, self.OnSize) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_RIGHT_DOWN(self, self.OnMouseMDown) wx.EVT_RIGHT_UP(self, self.OnMouseMUp) wx.EVT_MOUSEWHEEL(self, self.OnMouseWheel) wx.EVT_MOTION(self, self.OnMouseMotion) wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) self.OnSize(None) #Set up initial viewport size glutInit() #Initialize GLUT
def __init__(self, parent, cartographer): GLCanvas.__init__(self, parent, -1, style=wx.SUNKEN_BORDER, attribList=[wx.glcanvas.WX_GL_DOUBLEBUFFER]) self.context = glcanvas.GLContext(self) self.cartographer = cartographer self.init = False self.posx = 0 self.posy = 0 self.posz = 0 self.earthx = 0 self.earthy = 0 self.earthz = 0 self.x = 0 self.y = 0 self.z = 0 self.lastx = 0 self.lasty = 0 self.lastz = 0 self.size = None self.view_distance = -15.0 self.earth_radius = 2.0 self.standard_parallel1 = 15 self.standard_parallel2 = 15 self.earth_texture = None self.earth_quad = None self.plain_texture = None self.plain_quad = None self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp) self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseDown) self.Bind(wx.EVT_RIGHT_UP, self.OnMouseUp) self.Bind(wx.EVT_MOTION, self.OnMouseMotion) self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
def __init__(self, parent, show_lut=True, display_mode='2D', view=None): print("New Canvas") attribute_list = [ wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_STENCIL_SIZE, 8, wx.glcanvas.WX_GL_DOUBLEBUFFER ] num_antialias_samples = int(config.get('VisGUI-antialias_samples', 4)) if num_antialias_samples > 0: attribute_list.extend([ wx.glcanvas.WX_GL_SAMPLE_BUFFERS, 1, wx.glcanvas.WX_GL_SAMPLES, num_antialias_samples ]) GLCanvas.__init__(self, parent, -1, attribList=attribute_list) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_MOUSEWHEEL, self.OnWheel) self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown) self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp) self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMiddleDown) self.Bind(wx.EVT_MIDDLE_UP, self.OnMiddleUp) self.Bind(wx.EVT_RIGHT_DOWN, self.OnMiddleDown) self.Bind(wx.EVT_RIGHT_UP, self.OnMiddleUp) self.Bind(wx.EVT_MOTION, self.OnMouseMove) self.Bind(wx.EVT_KEY_DOWN, self.OnKeyPress) # wx.EVT_MOVE(self, self.OnMove) try: self.gl_context = wx.glcanvas.GLContext(self) except: logger.exception( 'Error creating OpenGL context, try modifying the number of anti-aliasing samples using the "VisGUI-antialias_samples" config setting (0 to disable antialiasing)' ) raise self.displayMode = display_mode # 3DPersp' #one of 3DPersp, 3DOrtho, 2D self.parent = parent self._scaleBarLength = 1000 self.clear_colour = [0, 0, 0, 1.0] self.LUTDraw = show_lut self.zmin = -10 self.zmax = 10 self.angup = 0 self.angright = 0 if view is None: self.view = views.View() else: self.view = view self.sx = 100 self.sy = 100 self.zc_o = 0 self.stereo = False self.eye_dist = .01 self.dragging = False self.panning = False self.selectionSettings = SelectionSettings() self.selectionDragging = False self.layers = [] self.overlays = [] self.underlays = [ ] #draw these before data (assuming depth-testing is disabled) self.wantViewChangeNotification = WeakSet() self.pointSelectionCallbacks = [] self.on_screen = True self.view_port_size = (self.Size[0], self.Size[1]) self._old_bbox = None
def __init__(self, parent): attriblist = [ wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_STENCIL_SIZE, 8, wx.glcanvas.WX_GL_DOUBLEBUFFER, 16 ] GLCanvas.__init__(self, parent, -1, attribList=attriblist) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOUSEWHEEL(self, self.OnWheel) wx.EVT_LEFT_DOWN(self, self.OnLeftDown) wx.EVT_LEFT_UP(self, self.OnLeftUp) wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) wx.EVT_MIDDLE_UP(self, self.OnMiddleUp) wx.EVT_MOTION(self, self.OnMouseMove) wx.EVT_KEY_DOWN(self, self.OnKeyPress) #wx.EVT_MOVE(self, self.OnMove) self.gl_context = wx.glcanvas.GLContext(self) self.init = 0 self.nVertices = 0 self.IScale = [1.0, 1.0, 1.0] self.zeroPt = [0, 1.0 / 3, 2.0 / 3] self.cmap = pylab.cm.hsv self.clim = [0, 1] self.alim = [0, 1] self.wireframe = False self.parent = parent self.pointSize = 5 #default point size = 5nm self.pixelsize = 5. / 800 self.xmin = 0 self.xmax = self.pixelsize * self.Size[0] self.ymin = 0 self.ymax = self.pixelsize * self.Size[1] self.scaleBarLength = 200 self.scaleBarOffset = (20.0, 20.0) #pixels from corner self.scaleBarDepth = 10.0 #pixels self.scaleBarColour = [1, 1, 0] self.mode = 'triang' self.colouring = 'area' self.drawModes = { 'triang': GL_TRIANGLES, 'quads': GL_QUADS, 'edges': GL_LINES, 'points': GL_POINTS } self.c = numpy.array([1, 1, 1]) self.a = numpy.array([1, 1, 1]) self.zmin = -10 self.zmax = 10 self.angup = 0 self.angright = 0 self.vecUp = numpy.array([0, 1, 0]) self.vecRight = numpy.array([1, 0, 0]) self.vecBack = numpy.array([0, 0, 1]) self.xc = 0 self.yc = 0 self.zc = 0 self.scale = 1 self.stereo = True self.eye_dist = .1 self.dragging = False self.panning = False self.edgeThreshold = 200 self.layers = [] return
def __init__(self, *args, **kwargs): BaseCanvasBackend.__init__(self, *args) p = self._process_backend_kwargs(kwargs) # WX supports OS double-click events, so we set this here to # avoid double events self._double_click_supported = True # Set config self._gl_attribs = _set_config(p.context.config) # Deal with context p.context.shared.add_ref('wx', self) if p.context.shared.ref is self: self._gl_context = None # set for real once we init the GLCanvas else: self._gl_context = p.context.shared.ref._gl_context if p.position is None: pos = wx.DefaultPosition else: pos = p.position if p.parent is None: style = (wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX | wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLIP_CHILDREN) style |= wx.NO_BORDER if not p.decorate else wx.RESIZE_BORDER style |= wx.STAY_ON_TOP if p.always_on_top else 0 self._frame = wx.Frame(None, wx.ID_ANY, p.title, pos, p.size, style) if not p.resizable: self._frame.SetSizeHints(p.size[0], p.size[1], p.size[0], p.size[1]) if p.fullscreen is not False: if p.fullscreen is not True: logger.warning('Cannot specify monitor number for wx ' 'fullscreen, using default') self._fullscreen = True else: self._fullscreen = False _wx_app.SetTopWindow(self._frame) parent = self._frame self._frame.Show() self._frame.Raise() self._frame.Bind(wx.EVT_CLOSE, self.on_close) else: parent = p.parent self._frame = None self._fullscreen = False self._init = False GLCanvas.__init__(self, parent, wx.ID_ANY, pos=pos, size=p.size, style=0, name='GLCanvas', attribList=self._gl_attribs) if self._gl_context is None: self._gl_context = glcanvas.GLContext(self) self.SetFocus() self._vispy_set_title(p.title) self._size = None self.Bind(wx.EVT_SIZE, self.on_resize) self.Bind(wx.EVT_PAINT, self.on_draw) self.Bind(wx.EVT_KEY_DOWN, self.on_key_down) self.Bind(wx.EVT_KEY_UP, self.on_key_up) self.Bind(wx.EVT_MOUSE_EVENTS, self.on_mouse_event) self._size_init = p.size self._vispy_set_visible(p.show)
def __init__(self, parent, trackSelection=True, vp = None, vpVoxSize = None): attriblist = [wx.glcanvas.WX_GL_RGBA,wx.glcanvas.WX_GL_STENCIL_SIZE,8, wx.glcanvas.WX_GL_DOUBLEBUFFER, 16] GLCanvas.__init__(self, parent,-1, attribList = attriblist) #GLCanvas.__init__(self, parent,-1) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOUSEWHEEL(self, self.OnWheel) wx.EVT_LEFT_DOWN(self, self.OnLeftDown) wx.EVT_LEFT_UP(self, self.OnLeftUp) wx.EVT_LEFT_DCLICK(self, self.OnLeftDClick) if trackSelection: wx.EVT_MOTION(self, self.OnMouseMove) #wx.EVT_ERASE_BACKGROUND(self, self.OnEraseBackground) #wx.EVT_IDLE(self, self.OnIdle) self.gl_context = wx.glcanvas.GLContext(self) #self.gl_context.SetCurrent() self.init = False self.nVertices = 0 self.IScale = [1.0, 1.0, 1.0] self.zeroPt = [0, 1.0/3, 2.0/3] self.cmap = cm_hot self.clim = [0,1] self.parent = parent self.vp = vp self.vpVoxSize = vpVoxSize self.pointSize=5 #default point size = 5nm self.pixelsize = 10 self.xmin =0 self.xmax = self.pixelsize*self.Size[0] self.ymin = 0 self.ymax = self.pixelsize*self.Size[1] self.scaleBarLength = 200 self.scaleBarOffset = (20.0, 20.0) #pixels from corner self.scaleBarDepth = 10.0 #pixels self.scaleBarColour = [1,1,0] self.crosshairColour = [0,1,1] self.centreCross=False self.numBlurSamples = 1 self.blurSigma = 0.0 self.LUTDraw = True self.mode = 'triang' self.backgroundImage = False self.colouring = 'area' self.drawModes = {'triang':GL_TRIANGLES, 'quads':GL_QUADS, 'edges':GL_LINES, 'points':GL_POINTS, 'tracks': GL_LINE_STRIP} self.c = numpy.array([1,1,1]) self.zmin = -1 self.zmax = 1 self.ang = 0 self.selectionDragging = False self.selectionStart = (0,0) self.selectionFinish = (0,0) self.selection = False self.wantViewChangeNotification = WeakSet() self.pointSelectionCallbacks = []
def __init__(self, parent): """This needs to be given the parent in the GUI hierarchy so we can properly initialize the canvas""" GLCanvas.__init__(self, parent, -1) self.init = 0 self.displaylist = None self.camera = Camera([25, 55, 25], [1, 1, 1]) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_TIMER, self.HandleTime) glEnable(GL_DEPTH_TEST) #The following calls create a tree with root sun #The center of the system self.sun = AstralBody(0, 30, 30, 0, glutWireSphere, [10, 6, 3], None, [1, 0, 0], [1, 0, 0], [.2, .4, .6]) #Planets self.sun.AddChild( AstralBody(40, 180, 20, 0, glutWireSphere, [10, 60, 60], self.sun, [0, 0, 1], [1, 0, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(80, 40, 40, 90, glutWireSphere, [10, 60, 60], self.sun, [0, 1, 0], [1, 1, 0], [.8, .2, .3])) self.sun.AddChild( AstralBody(120, 30, 80, 180, glutWireSphere, [10, 60, 60], self.sun, [0, 0, 1], [1, 1, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(160, 50, 90, 270, glutWireSphere, [10, 60, 60], self.sun, [1, 0, 0], [0, 0, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(200, 25, 60, 90, glutWireSphere, [10, 60, 60], self.sun, [0, 0, 1], [0, 1, 0], [.8, .2, .3])) self.sun.AddChild( AstralBody(240, 80, 35, 180, glutWireSphere, [10, 60, 60], self.sun, [1, 0, 1], [0, 1, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(280, 120, 45, 270, glutWireSphere, [10, 60, 60], self.sun, [0, 0, 1], [1, 0, 0], [.8, .2, .3])) self.sun.AddChild( AstralBody(320, 140, 25, 95, glutWireSphere, [10, 60, 60], self.sun, [0, 0, 1], [1, 0, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(360, 10, 95, 110, glutWireSphere, [10, 60, 60], self.sun, [1, 0, 1], [1, 1, 0], [.8, .2, .3])) self.sun.AddChild( AstralBody(400, 35, 105, 135, glutWireSphere, [10, 60, 60], self.sun, [0, 0, 1], [1, 1, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(440, 45, 165, 97, glutWireSphere, [10, 60, 60], self.sun, [0, 1, 0], [0, 0, 1], [.8, .2, .3])) self.sun.AddChild( AstralBody(480, 90, 180, 157, glutWireSphere, [10, 60, 60], self.sun, [1, 0, 0], [0, 1, 0], [.8, .2, .3])) #My rotating rings self.sun.AddChild( AstralBody(60, 130, 130, 45, self.DrawRing, [10, .1], self.sun, [1, 0, 0], [0, 0, 1], [.4, .8, .1])) self.sun.AddChild( AstralBody(60, 130, 130, 45, self.DrawRing, [10, .1], self.sun, [1, 0, 0], [1, 0, 0], [.4, .8, .1])) self.sun.AddChild( AstralBody(60, 130, 130, 45, self.DrawRing, [10, .1], self.sun, [1, 0, 0], [1, 0, 1], [.4, .8, .1])) self.sun.AddChild( AstralBody(60, 130, 130, 45, self.DrawRing, [10, .1], self.sun, [1, 0, 0], [1, 1, 1], [.4, .8, .1])) #My ringed world #DrawRingedWorld(self, distance, startrev, radius, numrings, ringraddist, ringdistance, granularity, parent, revvector, rotvector, revspeed, rotspeed, planetcolor, ringcolor, ringrotvector) self.DrawRingedWorld(180, 0, 30, 5, 4, 3, .5, self.sun, [1, 1, 0], [0, 1, 1], 100, 70, [.6, 0, .8], [.3, .7, .9], [0, 0, 1]) #My moons self.sun.GetChild(1).AddChild( AstralBody(20, 130, 180, 0, glutWireSphere, [5, 30, 30], self.sun.GetChild(1), [0, 0, 1], [1, 1, 0], [.8, .7, .3])) self.sun.GetChild(2).AddChild( AstralBody(20, 90, 70, 0, glutWireSphere, [5, 30, 30], self.sun.GetChild(2), [1, 0, 0], [0, 1, 0], [.8, .7, .3])) #My satellite (just for kicks) self.sun.GetChild(2).GetChild(0).AddChild( AstralBody(6, 140, 180, 0, glutWireSphere, [2, 15, 15], self.sun.GetChild(2).GetChild(0), [0, 1, 0], [1, 1, 0], [.7, 1, 0])) self.timer = wx.Timer(self) self.timer.Start(20) return
def __init__(self, parent): GLCanvas.__init__(self, parent, -1) self.Bind(wx.EVT_PAINT, self.OnPaint) self.Bind(wx.EVT_SIZE, self.OnSize) self.init = False return
def __init__(self, parent): attriblist = [ wx.glcanvas.WX_GL_RGBA, wx.glcanvas.WX_GL_STENCIL_SIZE, 8, wx.glcanvas.WX_GL_DOUBLEBUFFER, 16 ] GLCanvas.__init__(self, parent, -1, attribList=attriblist) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOUSEWHEEL(self, self.OnWheel) wx.EVT_LEFT_DOWN(self, self.OnLeftDown) wx.EVT_LEFT_UP(self, self.OnLeftUp) wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) wx.EVT_MIDDLE_UP(self, self.OnMiddleUp) wx.EVT_RIGHT_DOWN(self, self.OnMiddleDown) wx.EVT_RIGHT_UP(self, self.OnMiddleUp) wx.EVT_MOTION(self, self.OnMouseMove) wx.EVT_KEY_DOWN(self, self.OnKeyPress) #wx.EVT_MOVE(self, self.OnMove) self.gl_context = wx.glcanvas.GLContext(self) self.nVertices = 0 self.IScale = [1.0, 1.0, 1.0] self.zeroPt = [0, 1.0 / 3, 2.0 / 3] self.cmap = pylab.cm.hsv self.clim = [0, 1] self.alim = [0, 1] self.displayMode = '2D' #3DPersp' #one of 3DPersp, 3DOrtho, 2D self.wireframe = False self.parent = parent self.pointSize = 5 #default point size = 5nm #self.pixelsize = 5./800 #self.xmin =0 #self.xmax = self.pixelsize*self.Size[0] #self.ymin = 0 #self.ymax = self.pixelsize*self.Size[1] self.scaleBarLength = 1000 self.scaleBarOffset = (10, 10) #pixels from corner self.scaleBarDepth = 10.0 #pixels self.scaleBarColour = [1, 1, 0] self.centreCross = False self.LUTDraw = True self.mode = 'triang' self.colouring = 'area' self.drawModes = { 'triang': GL_TRIANGLES, 'quads': GL_QUADS, 'edges': GL_LINES, 'points': GL_POINTS } self.c = numpy.array([1, 1, 1]) self.a = numpy.array([1, 1, 1]) self.zmin = -10 self.zmax = 10 self.angup = 0 self.angright = 0 self.vecUp = numpy.array([0, 1, 0]) self.vecRight = numpy.array([1, 0, 0]) self.vecBack = numpy.array([0, 0, 1]) self.xc = 0 self.yc = 0 self.zc = 0 self.zc_o = 0 self.sx = 100 self.sy = 100 self.scale = 1 self.stereo = False self.eye_dist = .01 self.dragging = False self.panning = False self.edgeThreshold = 20 self.selectionSettings = SelectionSettings() self.selectionDragging = False self.layers = [] self.overlays = [] self.messageOverlay = MessageOverlay() self.overlays.append(self.messageOverlay) self.wantViewChangeNotification = WeakSet() self.pointSelectionCallbacks = [] return
'''
def __init__(self, parent): attriblist = [wx.glcanvas.WX_GL_RGBA,wx.glcanvas.WX_GL_STENCIL_SIZE,8, wx.glcanvas.WX_GL_DOUBLEBUFFER, 16] GLCanvas.__init__(self, parent,-1, attribList = attriblist) wx.EVT_PAINT(self, self.OnPaint) wx.EVT_SIZE(self, self.OnSize) wx.EVT_MOUSEWHEEL(self, self.OnWheel) wx.EVT_LEFT_DOWN(self, self.OnLeftDown) wx.EVT_LEFT_UP(self, self.OnLeftUp) wx.EVT_MIDDLE_DOWN(self, self.OnMiddleDown) wx.EVT_MIDDLE_UP(self, self.OnMiddleUp) wx.EVT_MOTION(self, self.OnMouseMove) wx.EVT_KEY_DOWN(self, self.OnKeyPress) #wx.EVT_MOVE(self, self.OnMove) self.gl_context = wx.glcanvas.GLContext(self) self.init = 0 self.nVertices = 0 self.IScale = [1.0, 1.0, 1.0] self.zeroPt = [0, 1.0/3, 2.0/3] self.cmap = pylab.cm.hsv self.clim = [0,1] self.alim = [0,1] self.wireframe = False self.parent = parent self.pointSize=5 #default point size = 5nm self.pixelsize = 5./800 self.xmin =0 self.xmax = self.pixelsize*self.Size[0] self.ymin = 0 self.ymax = self.pixelsize*self.Size[1] self.scaleBarLength = 200 self.scaleBarOffset = (20.0, 20.0) #pixels from corner self.scaleBarDepth = 10.0 #pixels self.scaleBarColour = [1,1,0] self.mode = 'triang' self.colouring = 'area' self.drawModes = {'triang':GL_TRIANGLES, 'quads':GL_QUADS, 'edges':GL_LINES, 'points':GL_POINTS} self.c = numpy.array([1,1,1]) self.a = numpy.array([1,1,1]) self.zmin = -10 self.zmax = 10 self.angup = 0 self.angright = 0 self.vecUp = numpy.array([0,1,0]) self.vecRight = numpy.array([1,0,0]) self.vecBack = numpy.array([0,0,1]) self.xc = 0 self.yc = 0 self.zc = 0 self.scale = 1 self.stereo = True self.eye_dist = .1 self.dragging = False self.panning = False self.edgeThreshold = 200 self.layers = [] return