Link Search Menu Expand Document

Class OGLApp_

About :

An OGLApp_ is an application using OpenGl Facilities That’s the first object to create and it is charge to dispatch events between several OGLWindows

Class diagram of class of OGLApp_.

Functions

Function summury
__init__(self, redirect=False, argv=[]) init method (more…)
main_loop(self) The main loop of the OGL viewer (more…)
add_frame_callback(self, on_frame, prepend=False) Add a callback at any frame (more…)
remove_frame_callback(self, on_frame)  
exit(self) kill the main loop (more…)
add_exit_callback(self, on_exit, prepend=False) Add a callback when a quit canvas is called (more…)
on_exit(self, canvas)  
add_mouse_callback(self, on_event, picking=True) Add a callback call when a mouse event occurs (more…)
remove_mouse_callback(self, on_event) Removes a mouse callback (more…)
add_mouse_motion_callback(self, on_event) Add a callback call when a mouse event occurs (more…)
remove_mouse__motion_callback(self, on_event) Removes a mouse callback (more…)
add_interaction_callback(self, on_event) Add a callback called when an interaction occurs (more…)
remove__interaction_callback(self, on_event) Removes a interation callback (more…)
on_event(self, canvas, events={})  
get_font(self, name) Get a font object from its name (more…)
get_image_library(self)  
get_image_library_texture(self)  
add_keyboard_callback(self, on_keyboard) set an external keyboard method (more…)
add_keyboard_ogl_node_focuss(self) add the predefined keyboard short cut callback for node focuss. enable to edit text nodes (more…)
add_keyboard_ogl_shortcut(self) add the predefined keyboard short cut callback (more…)
on_keyboard_node_focuss(self, app, canvas, key, ukey, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=-1, y=-1) predefined keyboard short cuts for node focuss. enable to edit text nodes (more…)
map_key(self, key) Trasform a key from the gui system to a compréhensive one (more…)
on_keyboard_ogl_shortcut(self, app, canvas, key, ukey, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=-1, y=-1) predefined keyboard short cuts (more…)
on_keyboard(self, canvas, key, ukey, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=-1, y=-1) Callback on keyboard events (more…)
add_canvas(self, canvas) add a canvas to the application (more…)
remove_canvas(self, canvas) remove a canvas from the application (more…)
get_canvas(self) get application canvas (more…)
trackball_draggable(self, window, x, y) Simulate a graphic node handle trackball from the mouse events (more…)
trackball_camera(self, window, x, y) Simulate a camera trackball from the mouse events (more…)
trackball_scene(self, window, space, x, y) Simulate a scene trackball from the mouse events (more…)
on_mouse_wheel_trackball(self, canvas, delta, x, y) Callaback when mouse is moved with a pressed button (more…)
on_mouse_button_trackball(self, canvas, button, mode, x, y) Callaback when a button is pressed over a canvas (more…)
on_mouse_motion(self, canvas, x, y) Callaback when mouse is moved with a pressed button (more…)
on_mouse_wheel(self, canvas, delta, x, y) Callaback when mouse is moved with a pressed button (more…)
on_mouse_button(self, canvas, button, mode, x, y) Callaback when a button is pressed over a canvas (more…)

Methods desciption :

init

def __init__(self, redirect=False, argv=[])

init method

  • → redirect False message are redirected to the current shell; True messages are sent to an extra shell
  • → argv list of input args

main_loop

def main_loop(self)

The main loop of the OGL viewer

add_frame_callback

def add_frame_callback(self, on_frame, prepend=False)

Add a callback at any frame

  • → _on_frame methods applied whenever a canvas frame is computed : prototype on_frame(oglapp)->boolean The returned boolean must be true if we continue with the next callbacks

remove_frame_callback

def remove_frame_callback(self, on_frame)

exit

def exit(self)

kill the main loop

add_exit_callback

def add_exit_callback(self, on_exit, prepend=False)

Add a callback when a quit canvas is called

  • → _on_exit methods applied whenever a canvas is quit : prototype on_exit(oglapp,canvas)->boolean The returned boolean must be true if we continue with the next callbacks

on_exit

def on_exit(self, canvas)

add_mouse_callback

def add_mouse_callback(self, on_event, picking=True)

Add a callback call when a mouse event occurs

  • → _on_event methods applied whenever an interactive event is produced : prototype
  • → on_event(canvas,button,mode,x,y,delta,select) button = 0 : left = 1 : middle = 2 : right = 3 : wheel mode : for buttons True pushed unless pulled x,y : mouse position delta = wheel motion select = None if picking not expected else select dictionary
  • → picking expected or not

remove_mouse_callback

def remove_mouse_callback(self, on_event)

Removes a mouse callback

  • → on_event : the callback function to be removed from the callback list

add_mouse_motion_callback

def add_mouse_motion_callback(self, on_event)

Add a callback call when a mouse event occurs

  • → _on_event methods applied whenever an interactive event is produced : prototype on_event(canvas,x,y) x,y : mouse position

remove_mouse__motion_callback

def remove_mouse__motion_callback(self, on_event)

Removes a mouse callback

  • → on_event : the callback function to be removed from the callback list

add_interaction_callback

def add_interaction_callback(self, on_event)

Add a callback called when an interaction occurs

  • → _on_event methods applied whenever an interactive event is produced : prototype on_event(canvas,item,event_name,value)

remove__interaction_callback

def remove__interaction_callback(self, on_event)

Removes a interation callback

  • → on_event : the callback function to be removed from the callback list

on_event

def on_event(self, canvas, events={})

get_font

def get_font(self, name)

Get a font object from its name

  • → name of the font
  • → OGLFont object

get_image_library

def get_image_library(self)

get_image_library_texture

def get_image_library_texture(self)

add_keyboard_callback

def add_keyboard_callback(self, on_keyboard)

set an external keyboard method

  • → on_keyboard function function prototype : on_keyboard(app,canvas,key,ukey,ctrl=False,shift=False,alt=False,cmd=False,meta=False,x=-1,y=-1)

add_keyboard_ogl_node_focuss

def add_keyboard_ogl_node_focuss(self)

add the predefined keyboard short cut callback for node focuss. enable to edit text nodes

add_keyboard_ogl_shortcut

def add_keyboard_ogl_shortcut(self)

add the predefined keyboard short cut callback

on_keyboard_node_focuss

def on_keyboard_node_focuss(self, app, canvas, key, ukey, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=-1, y=-1)

predefined keyboard short cuts for node focuss. enable to edit text nodes

map_key

def map_key(self, key)

Trasform a key from the gui system to a compréhensive one

on_keyboard_ogl_shortcut

def on_keyboard_ogl_shortcut(self, app, canvas, key, ukey, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=-1, y=-1)

predefined keyboard short cuts

on_keyboard

def on_keyboard(self, canvas, key, ukey, ctrl=False, shift=False, alt=False, cmd=False, meta=False, x=-1, y=-1)

Callback on keyboard events

  • → canvas : the canvas concerned when the keyboard event occurs
  • → key : keyboard key in ascii format
  • → ukey : unicode key
  • → ctrl : True if control key was active
  • → shift : True if shift key was active
  • → alt : True if alt key was active
  • → cmd : True if cmd key was active
  • → meta : True if meta key was active
  • → x,y : position of the mouse

add_canvas

def add_canvas(self, canvas)

add a canvas to the application

  • → canvas : added canvas

remove_canvas

def remove_canvas(self, canvas)

remove a canvas from the application

  • → canvas : removed canvas

get_canvas

def get_canvas(self)

get application canvas

  • ← a set of canvas

trackball_draggable

def trackball_draggable(self, window, x, y)

Simulate a graphic node handle trackball from the mouse events

  • → window the concerned cancas
  • → x,y the new position of mouse

trackball_camera

def trackball_camera(self, window, x, y)

Simulate a camera trackball from the mouse events

  • → window the concerned cancas
  • → x,y the new position of mouse

trackball_scene

def trackball_scene(self, window, space, x, y)

Simulate a scene trackball from the mouse events

  • → window the concerned cancas
  • → x,y the new position of mouse

on_mouse_wheel_trackball

def on_mouse_wheel_trackball(self, canvas, delta, x, y)

Callaback when mouse is moved with a pressed button

  • → OGLWindow where the event occurs
  • → x,y == x,y position in the window

on_mouse_button_trackball

def on_mouse_button_trackball(self, canvas, button, mode, x, y)

Callaback when a button is pressed over a canvas

  • → OGLWindow where the event occurs
  • → button == 0 : left, 1 : middle, 2 : right
  • → mode == True if the button is pushed otherwise False
  • → x,y == x,y position in the canvas

on_mouse_motion

def on_mouse_motion(self, canvas, x, y)

Callaback when mouse is moved with a pressed button

  • → OGLWindow where the event occurs
  • → x,y == x,y position in the canvas

on_mouse_wheel

def on_mouse_wheel(self, canvas, delta, x, y)

Callaback when mouse is moved with a pressed button

  • → OGLWindow where the event occurs
  • → x,y == x,y position in the window

on_mouse_button

def on_mouse_button(self, canvas, button, mode, x, y)

Callaback when a button is pressed over a canvas

  • → OGLWindow where the event occurs
  • → button == 0 : left, 1 : middle, 2 : right
  • → mode == True if the button is pushed otherwise False
  • → x,y == x,y position in the canvas