Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 4 # libavg - Media Playback Engine. 5 # Copyright (C) 2003-2008 Ulrich von Zadow 6 # 7 # This library is free software; you can redistribute it and/or 8 # modify it under the terms of the GNU Lesser General Public 9 # License as published by the Free Software Foundation; either 10 # version 2 of the License, or (at your option) any later version. 11 # 12 # This library is distributed in the hope that it will be useful, 13 # but WITHOUT ANY WARRANTY; without even the implied warranty of 14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 # Lesser General Public License for more details. 16 # 17 # You should have received a copy of the GNU Lesser General Public 18 # License along with this library; if not, write to the Free Software 19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 # 21 # Current versions can be found at www.libavg.de 22 # 23 24 avg = None 25 g_Player = None 26 27 try: 28 from . import avg 29 except ValueError: 30 pass 31 32105 106 11035 global g_Player 36 g_Player = avg.Player.get() 37 self.__node = node 38 self.__onDragStart = onDragStart 39 self.__onDragEnd = onDragEnd 40 self.__onDragMove = onDragMove 41 self.__isDragging = False42 4547 if self.__isDragging: 48 self.__stop() 49 self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, None) 50 self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE | avg.TOUCH, None) 51 self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, None)52 55 5860 self.__cursorID = event.cursorid 61 self.__isDragging = True 62 groupsNode = self.__node.getParent() 63 groupsNode.reorderChild(groupsNode.indexOf(self.__node), 64 groupsNode.getNumChildren()-1) 65 self.__node.setEventCapture(event.cursorid) 66 self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, None) 67 self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE | avg.TOUCH, self.__onMove) 68 self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, self.__onStop) 69 stopBubble = False 70 if self.__onDragStart: 71 stopBubble = self.__onDragStart(event) 72 if stopBubble == None: 73 stopBubble = False 74 self.__startDragPos = self.__node.pos 75 return stopBubble7678 if event.cursorid == self.__cursorID: 79 self.__node.x = self.__startDragPos[0]+event.x-event.lastdownpos[0] 80 self.__node.y = self.__startDragPos[1]+event.y-event.lastdownpos[1] 81 stopBubble = False 82 if self.__onDragMove: 83 stopBubble = self.__onDragMove(event) 84 if stopBubble == None: 85 stopBubble = False 86 return stopBubble8789 if event.cursorid == self.__cursorID: 90 self.__onMove(event) 91 self.__stop() 92 stopBubble = False 93 if self.__onDragEnd: 94 stopBubble = self.__onDragEnd(event) 95 if stopBubble == None: 96 stopBubble = False 97 return stopBubble98100 self.__isDragging = False 101 self.__node.setEventHandler(avg.CURSORDOWN, avg.MOUSE | avg.TOUCH, self.__onStart) 102 self.__node.setEventHandler(avg.CURSORMOTION, avg.MOUSE | avg.TOUCH, None) 103 self.__node.setEventHandler(avg.CURSORUP, avg.MOUSE | avg.TOUCH, None) 104 self.__node.releaseEventCapture(self.__cursorID)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jan 8 16:09:02 2010 | http://epydoc.sourceforge.net |