[4] | 1 | ############################################################################ |
---|
| 2 | # |
---|
| 3 | # DIM - A Direct Interaction Manager for SAGE |
---|
| 4 | # Copyright (C) 2007 Electronic Visualization Laboratory, |
---|
| 5 | # University of Illinois at Chicago |
---|
| 6 | # |
---|
| 7 | # All rights reserved. |
---|
| 8 | # |
---|
| 9 | # Redistribution and use in source and binary forms, with or without |
---|
| 10 | # modification, are permitted provided that the following conditions are met: |
---|
| 11 | # |
---|
| 12 | # * Redistributions of source code must retain the above copyright |
---|
| 13 | # notice, this list of conditions and the following disclaimer. |
---|
| 14 | # * Redistributions in binary form must reproduce the above |
---|
| 15 | # copyright notice, this list of conditions and the following disclaimer |
---|
| 16 | # in the documentation and/or other materials provided with the distribution. |
---|
| 17 | # * Neither the name of the University of Illinois at Chicago nor |
---|
| 18 | # the names of its contributors may be used to endorse or promote |
---|
| 19 | # products derived from this software without specific prior written permission. |
---|
| 20 | # |
---|
| 21 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
---|
| 22 | # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
---|
| 23 | # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
---|
| 24 | # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
---|
| 25 | # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
---|
| 26 | # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
---|
| 27 | # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
---|
| 28 | # PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
---|
| 29 | # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
---|
| 30 | # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
---|
| 31 | # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
---|
| 32 | # |
---|
| 33 | # Direct questions, comments etc about SAGE UI to www.evl.uic.edu/cavern/forum |
---|
| 34 | # |
---|
| 35 | # Author: Ratko Jagodic |
---|
| 36 | # |
---|
| 37 | ############################################################################ |
---|
| 38 | |
---|
| 39 | |
---|
| 40 | |
---|
| 41 | |
---|
| 42 | from eventHandler import EventHandler |
---|
| 43 | from overlay import Overlay |
---|
| 44 | from globals import * |
---|
| 45 | |
---|
| 46 | WALL_RESOLUTION = 0; |
---|
| 47 | |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | def makeNew(overlayId): |
---|
| 51 | """ this is how we instantiate the object from |
---|
| 52 | the main program that loads this plugin """ |
---|
| 53 | return Wall(overlayId) |
---|
| 54 | |
---|
| 55 | |
---|
| 56 | |
---|
| 57 | class Wall(EventHandler, Overlay): |
---|
| 58 | |
---|
| 59 | def __init__(self, overlayId): |
---|
| 60 | Overlay.__init__(self, OVERLAY_WALL, overlayId) |
---|
| 61 | EventHandler.__init__(self) |
---|
| 62 | # self.displayId = displayId |
---|
| 63 | #self.registerForEvent(EVT_MOVE, self.__onMove) |
---|
| 64 | self.registerForEvent(EVT_DISPLAY_INFO, self.__onDispInfo) |
---|
| 65 | self.registerForEvent(EVT_OBJECT_INFO, self.__onObjectInfo) |
---|
| 66 | self.registerForEvent(EVT_ENTERED_WINDOW, self.__onEnteredWindow) |
---|
| 67 | self.registerForEvent(EVT_LEFT_WINDOW, self.__onLeftWindow) |
---|
| 68 | self.z = BOTTOM_Z |
---|
| 69 | |
---|
| 70 | ## def __onMove(self, event): |
---|
| 71 | ## """ just resets the pointer for now """ |
---|
| 72 | ## device = event.device |
---|
| 73 | ## if device.pointer: |
---|
| 74 | ## device.pointer.resetPointer() |
---|
| 75 | ## device.pointer.showOutApp() |
---|
| 76 | |
---|
| 77 | def __onLeftWindow(self, event): |
---|
| 78 | pass |
---|
| 79 | |
---|
| 80 | |
---|
| 81 | def __onEnteredWindow(self, event): |
---|
| 82 | pointer = event.device.pointer |
---|
| 83 | if pointer: |
---|
| 84 | event.device.pointer.resetPointer() |
---|
| 85 | event.device.pointer.showOutApp() |
---|
| 86 | |
---|
| 87 | |
---|
| 88 | def __onDispInfo(self, event): |
---|
| 89 | di = event.displayInfo |
---|
| 90 | display = di.getDisplay(self.displayId) |
---|
| 91 | self.bounds.setAll(0, display.sageW, display.sageH, 0) |
---|
| 92 | |
---|
| 93 | def __onObjectInfo(self, event): |
---|
| 94 | width = (getSageData().getDisplayInfo().sageW) |
---|
| 95 | height = (getSageData().getDisplayInfo().sageH) |
---|
| 96 | |
---|
| 97 | #!!!Dirty hack for installation in WestPoint!!! |
---|
| 98 | width = 8*width/9 |
---|
| 99 | |
---|
| 100 | self.sendOverlayMessage(WALL_RESOLUTION,width,height) |
---|