コード例 #1
0
ファイル: glutwindow.py プロジェクト: padeler/PyGLer
 def _keyboard( self, code, x, y ):
     symbol = self._keyboard_translate(code)
     modifiers = glut.glutGetModifiers()
     modifiers = self._modifiers_translate(modifiers)
     state= self.dispatch_event('on_key_press', symbol, modifiers)
     if not state and symbol == key.ESCAPE: #FIXME 
         raise Exception," FIX EXIT MODE " #sys.exit()
コード例 #2
0
ファイル: _glut.py プロジェクト: MatthieuDartiailh/vispy
 def _modifiers(self, query_now=True):
     if query_now:
         glutmod = glut.glutGetModifiers()
         mod = ()
         if glut.GLUT_ACTIVE_SHIFT & glutmod:
             mod += keys.SHIFT,
         if glut.GLUT_ACTIVE_CTRL & glutmod:
             mod += keys.CONTROL,
         if glut.GLUT_ACTIVE_ALT & glutmod:
             mod += keys.ALT,
         self._modifiers_cache = mod
     return self._modifiers_cache
コード例 #3
0
ファイル: window.py プロジェクト: sehoonha/pydart2
 def motionFunc(self, x, y):
     dx = x - self.mouseLastPos[0]
     dy = y - self.mouseLastPos[1]
     modifiers = GLUT.glutGetModifiers()
     tb = self.scene.tb
     if modifiers == GLUT.GLUT_ACTIVE_SHIFT:
         tb.zoom_to(dx, -dy)
     elif modifiers == GLUT.GLUT_ACTIVE_CTRL:
         tb.trans_to(dx, -dy)
     else:
         tb.drag_to(x, y, dx, -dy)
     self.mouseLastPos = np.array([x, y])
コード例 #4
0
ファイル: viewer_app.py プロジェクト: luchak/radiosity-viewer
  def Mouse(self, button, state, x, y):
    if state == 0:
      self.mouse_last_drag_pos = (x, y)
      modifiers = GLUT.glutGetModifiers()
      if (button == 1) or (modifiers & GLUT.GLUT_ACTIVE_ALT):
        self.mouse_drag_mode = 'dolly'
      elif (button == 2) or (modifiers & GLUT.GLUT_ACTIVE_CTRL):
        self.mouse_drag_mode = 'pan'
      else:
        self.mouse_drag_mode = 'orbit'

    if state == 1:
      self.mouse_last_drag_pos = None
      self.mouse_drag_mode = None
コード例 #5
0
ファイル: glviewer.py プロジェクト: schnorr/tupan
 def keyboard_s(self, key, x, y):
     mkey = glut.glutGetModifiers()
     if mkey == glut.GLUT_ACTIVE_CTRL:
         pass
     elif mkey == glut.GLUT_ACTIVE_ALT:
         pass
     else:
         if key == glut.GLUT_KEY_UP:
             self.rotate["x"] += 1
         elif key == glut.GLUT_KEY_DOWN:
             self.rotate["x"] -= 1
         elif key == glut.GLUT_KEY_LEFT:
             self.rotate["y"] -= 1
         elif key == glut.GLUT_KEY_RIGHT:
             self.rotate["y"] += 1
     glut.glutSetWindow(self.window_handle)
     glut.glutPostRedisplay()
コード例 #6
0
ファイル: backend_osxglut.py プロジェクト: rougier/unity
 def _special_up(self, code, x, y):
     modifiers = glut.glutGetModifiers()
     self.dispatch_event("on_key_release", self._keyboard_translate(code), self._modifiers_translate(modifiers))
コード例 #7
0
ファイル: backend_osxglut.py プロジェクト: rougier/unity
 def _keyboard(self, code, x, y):
     symbol = self._keyboard_translate(code)
     modifiers = glut.glutGetModifiers()
     modifiers = self._modifiers_translate(modifiers)
     self.dispatch_event("on_key_press", symbol, modifiers)
コード例 #8
0
ファイル: backend_freeglut.py プロジェクト: jk34/glumpy
 def _special( self, code, x, y ):
     modifiers = glut.glutGetModifiers()
     self.dispatch_event('on_key_press',
                         self._keyboard_translate(code),
                         self._modifiers_translate(modifiers))
コード例 #9
0
ファイル: backend_osxglut.py プロジェクト: wzunknown/glumpy
 def _keyboard_up(self, code, x, y):
     modifiers = glut.glutGetModifiers()
     self.dispatch_event('on_key_release', self._keyboard_translate(code),
                         self._modifiers_translate(modifiers))
コード例 #10
0
ファイル: backend_osxglut.py プロジェクト: wzunknown/glumpy
 def _keyboard(self, code, x, y):
     symbol = self._keyboard_translate(code)
     modifiers = glut.glutGetModifiers()
     modifiers = self._modifiers_translate(modifiers)
     self.dispatch_event('on_key_press', symbol, modifiers)
コード例 #11
0
ファイル: backend_osxglut.py プロジェクト: wangvei/glumpy
 def _special(self, code, x, y):
     modifiers = glut.glutGetModifiers()
     self.dispatch_event('on_key_press', self._keyboard_translate(code),
                         self._modifiers_translate(modifiers))