scripts/modules.d/500-LIRC-MceUSB2-Intercept.py

00001     #***
00002   #*********************************************************************
00003 #*************************************************************************
00004 #*** 
00005 #*** GizmoDaemon Config Script
00006 #***    LIRCMceUSB2 Intercept config
00007 #***
00008 #*****************************************
00009   #*****************************************
00010     #***
00011 
00012 """
00013 
00014   Copyright (c) 2007, Gizmo Daemon Team
00015   Licensed under the Apache License, Version 2.0 (the "License");
00016   you may not use this file except in compliance with the License.
00017   You may obtain a copy of the License at 
00018 
00019         http://www.apache.org/licenses/LICENSE-2.0
00020 
00021   Unless required by applicable law or agreed to in writing, software
00022   distributed under the License is distributed on an "AS IS" BASIS,
00023   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00024   See the License for the specific language governing permissions and 
00025   limitations under the License. 
00026   
00027 """
00028 
00029 ############################
00030 # Imports
00031 ##########################
00032 
00033 from GizmoDaemon import *
00034 from GizmoScriptDefault import *
00035 from GizmoScriptAltTabber import *
00036 import subprocess
00037 
00038 ENABLED = True
00039 VERSION_NEEDED = 3.3
00040 INTERESTED_CLASSES = [GizmoEventClass.LIRC]
00041 USES_LIRC_REMOTES = ["mceusb", "mceusb2"]
00042 
00043 ############################
00044 # LIRCMceUSB2Intercept Class definition
00045 ##########################
00046 
00047 class LIRCMceUSB2Intercept(GizmoScriptDefault):
00048         """
00049         Intercept LIRC Event Mapping for the MceUSB2 remote
00050         """
00051         
00052         ############################
00053         # Public Functions
00054         ##########################
00055                         
00056         def onDeviceEvent(self, Event, Gizmo = None):
00057                 """
00058                 Called from Base Class' onEvent method.
00059                 See GizmodDispatcher.onEvent documention for an explanation of this function.
00060                 """
00061 
00062                 # if the event isn't from the remote we're interested in don't handle it
00063                 if Event.Remote not in USES_LIRC_REMOTES:
00064                         return False
00065 
00066                 # process the key
00067                 if Event.Button == "Home" and self.AltTabber.isAltTabbing():
00068                         self.AltTabber.doAltTab()
00069                         return True
00070                 else:
00071                         # unmatched event, keep processing
00072                         return False                            
00073         
00074         ############################
00075         # Private Functions
00076         ##########################
00077 
00078         def __init__(self):
00079                 """ 
00080                 Default Constructor
00081                 """
00082                 
00083                 GizmoScriptDefault.__init__(self, ENABLED, VERSION_NEEDED, INTERESTED_CLASSES)
00084                 self.AltTabber = GizmoScriptAltTabber()
00085 
00086 ############################
00087 # LIRCMceUSB2Intercept class end
00088 ##########################
00089 
00090 # register the user script
00091 LIRCMceUSB2Intercept()

Generated on Wed Nov 7 10:04:16 2007 for gizmod by  doxygen 1.5.3