00001
00002
00003
00004
00005
00006
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
00031
00032
00033 from GizmoDaemon import *
00034 from GizmoScriptEnableChecker import *
00035 import sys
00036
00037 ENABLED = True
00038 VERSION_NEEDED = 3.2
00039
00040
00041
00042
00043
00044 class CatchAllDebug(GizmoScriptEnableChecker):
00045 """
00046 CatchAll Event Mapping for Testing
00047 """
00048
00049
00050
00051
00052
00053 def onEvent(self, Event, Gizmo = None):
00054 """
00055 See GizmodDispatcher.onEvent documention for an explanation of this function
00056 """
00057
00058
00059 if not Gizmod.DebugEnabled:
00060 return False
00061
00062
00063 if Event.Remote:
00064 sys.stdout.write("[R] ")
00065
00066
00067 if Event.Class == GizmoEventClass.WindowFocus:
00068 print "onEvent: " + str(Event.Class) + " [" + str(Event.WindowEventType) + "] -- <WindowTitle:" + Event.WindowName + "> <FormalName:" + Event.WindowNameFormal + "> <Class:" + Event.WindowClass + ">"
00069 elif Event.Class == GizmoEventClass.LIRC:
00070 print "onEvent: " + str(Event.Class) + " -- " + Gizmo.FileName + " | [" + Event.Code + "] " + Event.Button + " <" + Event.Remote + "> Repeat: " + str(Event.Repeat)
00071 elif Event.Class == GizmoEventClass.SoundCard:
00072 if Event.Mixer:
00073 sys.stdout.write("onEvent: " + str(Event.Class) + " -- " + str(Event.Type) + " [" + str(Event.SoundCard.CardName) + "] <" + str(Event.Mixer.Name) + ">")
00074 if Event.VolumePlaybackChanged:
00075 sys.stdout.write(" Vol: " + str(Event.Mixer.VolumePlaybackPercent))
00076 if Event.SwitchPlaybackChanged:
00077 if Event.Mixer.SwitchPlayback:
00078 sys.stdout.write(" Unmute")
00079 else:
00080 sys.stdout.write(" Mute")
00081 sys.stdout.write("\n")
00082 else:
00083 print "onEvent: " + str(Event.Class) + " -- " + str(Event.Type) + " [" + str(Event.SoundCard.CardName) + "]"
00084 elif Event.Class == GizmoEventClass.CPUUsage:
00085
00086
00087 pass
00088 elif Event.Class == GizmoEventClass.Powermate and Event.Type == GizmoEventType.EV_MSC:
00089
00090 pass
00091 elif Event.Class == GizmoEventClass.SoundVisualization:
00092
00093 pass
00094 else:
00095 if Event.Type == GizmoEventType.EV_KEY:
00096 if Event.Class == GizmoEventClass.Powermate and Event.Value == 0:
00097 print "onEvent: " + str(Event.Class) + " -- " + Gizmo.FileName + " | [" + str(Event.Type) + "] <" + str(Event.Code) + "> c: " + str(hex(Event.RawCode)) + " v: " + str(hex(Event.Value)) + " Duration: " + str(Event.ClickTime)
00098 else:
00099 print "onEvent: " + str(Event.Class) + " -- " + Gizmo.FileName + " | [" + str(Event.Type) + "] <" + str(Event.Code) + "> c: " + str(hex(Event.RawCode)) + " v: " + str(hex(Event.Value))
00100 else:
00101 print "onEvent: " + str(Event.Class) + " -- " + Gizmo.FileName + " | [" + str(Event.Type) + "] c: " + str(hex(Event.RawCode)) + " Val: " + str(hex(Event.Value))
00102
00103
00104 return False
00105
00106
00107
00108
00109
00110 def __init__(self):
00111 """
00112 Default Constructor
00113 """
00114
00115 GizmoScriptEnableChecker.__init__(self, ENABLED, VERSION_NEEDED)
00116
00117
00118
00119
00120
00121
00122 CatchAllDebug()