scripts/modules.d/bases/GizmoScriptDefault.py

00001     #***
00002   #*********************************************************************
00003 #*************************************************************************
00004 #*** 
00005 #*** GizmoDaemon Config Script
00006 #***    GizmoScript Default 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 GizmoScriptEnableChecker import *
00035 import subprocess
00036 
00037 ############################
00038 # GizmoScriptDefault Class definition
00039 ##########################
00040 
00041 class GizmoScriptDefault(GizmoScriptEnableChecker):
00042         """
00043         Event Mapping Base Class for the Default Mappings
00044 
00045         Inherit from this class if you want a default device event mapping
00046         """
00047         
00048         ############################
00049         # Public Functions
00050         ##########################
00051         
00052         def checkEvent(self, Event, Gizmo = None):
00053                 """
00054                 Test if an event should go through or not
00055                 """
00056                         
00057                 # if the event class is in INTERESTED_CLASSES and the active window is
00058                 # one of INTERESTED_WINDOWS and there is a keyboard and mouse attached 
00059                 # then process the event
00060                 if Event.Class in self.InterestedClasses and len(Gizmod.Mice) and len(Gizmod.Keyboards):
00061                         # process the key
00062                         return True
00063                 else:
00064                         # unmatched event, keep processing
00065                         return False
00066                         
00067         def onEvent(self, Event, Gizmo = None):
00068                 """
00069                 See GizmodDispatcher.onEvent documention for an explanation of this function
00070                 """
00071                 
00072                 if self.checkEvent(Event, Gizmo):
00073                         return self.onDeviceEvent(Event, Gizmo)
00074                 else:
00075                         return False
00076                 
00077         ############################
00078         # Private Functions
00079         ##########################
00080 
00081         def __init__(self, Enabled, VersionNeeded, InterestedClasses):
00082                 """ 
00083                 Default Constructor
00084                 """
00085                 
00086                 self.InterestedClasses = InterestedClasses
00087                 GizmoScriptEnableChecker.__init__(self, Enabled, VersionNeeded)         
00088 
00089 ############################
00090 # GizmoScriptDefault class end
00091 ##########################

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