Example #1
0
    def __init__(self, overlayId, app):
        Overlay.__init__(self, OVERLAY_APP, overlayId)
        EventHandler.__init__(self)
        self.app = app   # which app is this overlay tied to
        self.bounds.setAll(app.left, app.right, app.top, app.bottom)
        self.displayId = app.getDisplayId()
        self.aspectRatio = self.bounds.getWidth() / float(self.bounds.getHeight())
        self.minAppSize = 300   # min app size in either direction
        self.z = self.app.getZvalue()
        self.__resetOverlay()
        self.capturedCorner = APP
        self.lastClickPos = (0,0)
        self.lastClickDeviceId = None
        self.overCorner = APP
                
        # register for the events that are fired when an app changes
        self.registerForEvent(EVT_APP_INFO, self.__onAppChanged)
        self.registerForEvent(EVT_Z_CHANGE, self.__onZChanged)

        # register for the events that are fired by devices
        self.registerForEvent(EVT_MOVE, self.__onOver)
        self.registerForEvent(EVT_CLICK, self.__onClick)
        self.registerForEvent(EVT_DRAG, self.__onDrag)
        self.registerForEvent(EVT_ROTATE, self.__onRotate)
        self.registerForEvent(EVT_ZOOM, self.__onZoom)
        self.registerForEvent(EVT_ARROW, self.__onArrow)
        self.registerForEvent(EVT_LEFT_WINDOW, self.__onLeftWindow)

        # register for the events from the special devices
        self.registerForEvent(EVT_MOVE_SPECIAL, self.__onSpecialMove)
        self.registerForEvent(EVT_ENTERED_WINDOW_SPECIAL, self.__onEnteredWindowSpecial)
        self.registerForEvent(EVT_LEFT_WINDOW_SPECIAL, self.__onLeftWindowSpecial)
Example #2
0
    def __init__(self, app=None):
        Overlay.__init__(self, OVERLAY_BUTTON)
        EventHandler.__init__(self, app)
        
        # register for the events that are fired by devices
        self.registerForEvent(EVT_CLICK, self._onClick)
        self.registerForEvent(EVT_MOVE, self._onMove)
        self.registerForEvent(EVT_LEFT_WINDOW, self._onLeftWindow)
        self.registerForEvent(EVT_ENTERED_WINDOW, self._onEnteredWindow)

        # paths to images drawn for different button states
        self.__upImage = "images/default_button_up.png"
        self.__downImage = ""
        self.__overImage = ""

        self.__doPlaySound = True

        # button can be a toggle
        self._isToggle = False
        self.__radioFunc = True
        self.__clicked = False
        self._manual = False
        self._radio = False

        # current state of the button
        self.__state = UP_STATE
        
        # callbacks you can register
        self.__onDown = None
        self.__onUp = None
        self._lastDevice = None
        
        self.__minTimeBetweenClicks = 0.5  # by default, allow rapid successive clicks
        self.__lastUp = 0.0
        self.__lastDown = 0.0
Example #3
0
    def __init__(self, app=None, direction=VERTICAL):
        Overlay.__init__(self, OVERLAY_SPLITTER)
        EventHandler.__init__(self, app)

        self.direction = direction
        self.__enlarged = False
        self.__scaleMultiplier = 4.0
        self._canScale = False
        self.mouseOverScale = 1.0
        self.setTransparency(255)
        self.z = BOTTOM_Z - 10
        self.relPos = 0.5  # relative to the section it splits
        self._preCollapsedPos = self.relPos
        self.__buffer = int(20 * getGlobalScale())
        self._collapsed = False

        self.registerForEvent(EVT_DRAG, self.__onDrag)
        self.registerForEvent(EVT_CLICK, self.__onClick)
        self.registerForEvent(EVT_MOVE, self.__onMove)
        self.registerForEvent(EVT_LEFT_WINDOW, self._onLeftWindow)
        self.registerForEvent(EVT_ENTERED_WINDOW, self._onEnteredWindow)

        if direction == VERTICAL:
            self.__image = opj("images", "vertical_divider.png")
        else:
            self.__image = opj("images", "horizontal_divider.png")
Example #4
0
 def __init__(self, displayId):
     EventHandler.__init__(self)
     self.displayId = displayId
     #self.registerForEvent(EVT_MOVE, self.__onMove)
     self.registerForEvent(EVT_DISPLAY_INFO, self.__onDispInfo)
     self.registerForEvent(EVT_ENTERED_WINDOW, self.__onEnteredWindow)
     self.registerForEvent(EVT_LEFT_WINDOW, self.__onLeftWindow)
     self.z = BOTTOM_Z
Example #5
0
 def __init__(self, app=None, label="", fontSize=NORMAL):
     """ If you pass in None for app, the widget will reside on the top layer
         above all apps but below pointers.
     """
     Overlay.__init__(self, OVERLAY_LABEL)
     EventHandler.__init__(self, app)
     self.setLabel(label, fontSize)
     self.__drawBackground = True
Example #6
0
    def __init__(self, app):
        Overlay.__init__(self, OVERLAY_APP)
        EventHandler.__init__(self, app)
        
        # must set size and pos first
        self._canScale = False
        self.setSize(1.0, 1.0)   # same size as the app
        self.setPos(0.0, 0.0)    # right over the app
        self._zOffset = APP_OVERLAY_Z
        self._allowSelection = True

        # some initial params
        self.minAppSize = 250   # min app size in either direction
        self.capturedCorner = APP
        self.lastClickPos = (0,0)
        self.lastClickDeviceId = None
        self.overCorner = APP
        self.bounds = self.getBounds()  # from EventHandler base class
        self._clickDownTime = 0.0
        self.__startedDrag = False  # for accidental touches...

        # if less than X seconds has passed between two double clicks,
        # maximize to the whole display, otherwise, just within the section
        self._lastDoubleClick = 0.0
        self.__maximizeThreshold = 1.3  # seconds between two double clicks...

        # for closing apps
        self.__multiTouchStartTime = -1

        self.org = getLayoutOrganization()

        # get the filename from appLauncher
        if "imageviewer" in app.getName().lower() or \
            "mplayer" in app.getName().lower() or \
            "stereo3d" in app.getName().lower() or \
            "pdf" in app.getName().lower():
            # get the config info from the right appLauncher
            if app.getLauncherId() != "none":
                appLauncher = xmlrpclib.ServerProxy("http://" + app.getLauncherId())
                try:
                    res = appLauncher.getAppConfigInfo( app.getAppId() )
                except:
                    print "\nUnable to connect to appLauncher on", app.getLauncherId(), "so not saving this app: ", app.getName() 
                else:
                    print "appLauncher.getAppConfigInfo : ", res
                    if res != -1:
                        configName, optionalArgs = res
                        if "imageviewer" in app.getName().lower():
                            # filename at the beginning of the command line for images
                            self.fullpathname = optionalArgs.split()[0].strip('"')
                            self.filename     = os.path.basename( self.fullpathname )
                        else:
                            # filename at the end of the command line for movies
                            self.fullpathname = optionalArgs.split()[-1].strip('"')
                            self.filename = os.path.basename( self.fullpathname )
                        if getShowWindowTitleBar():
                            self.setTooltip(self.filename, LARGER)
Example #7
0
 def __init__(self, app=None, direction=HORIZONTAL):
     """ If you pass in None for app, the widget will reside on the top layer
         above all apps but below pointers.
     """
     Overlay.__init__(self, OVERLAY_SIZER)
     EventHandler.__init__(self, app)
     self.__direction = direction
     
     # let the events pass through since we are transparent
     self._eventTransparent = True  
Example #8
0
    def __init__(self, app=None):
        """ If you pass in None for app, the widget will reside on the top layer
            above all apps but below pointers.
        """
        Overlay.__init__(self, OVERLAY_PANEL)
        EventHandler.__init__(self, app)

        self.registerForEvent(EVT_DRAG, self.__onDrag)
        self.registerForEvent(EVT_CLICK, self._onClick)

        self._allowDrag = False  # ONLY USE WITH ABSOLUTE POSITION!!! (wont work when aligned)
        
        self.__fitInWidth = True
        self.__fitInHeight = True

        self.__borderWidth = 0

        self._zOffset -= 0.01  # just below the other widgets

        self.px = self.py = 0
Example #9
0
    def __init__(self, x=0, y=0):
        Overlay.__init__(self, OVERLAY_POINTER)
        EventHandler.__init__(self)

        self.setSize(50,75)
        self.setPos(x,y)
        self.setDrawOrder(POST_DRAW)

        self.state = RESET
        self.lastOrientation = 0
        self.inApp = False
        self.__savedState = [self.state, self.lastOrientation, self.inApp]

        # some devices only produce one analog event so set it here if so
        # (e.g. a zoom-only puck)
        # this is used when the device enters an application in order to show
        # the correct pointer shape describing what the device can do
        self.onlyAnalogEvent = None   
        self._eventTransparent = True  # so that we dont receive our own clicks...

        self.__image = ""