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 GizmoScriptActiveApplication import *
00035 import subprocess
00036
00037 ENABLED = True
00038 VERSION_NEEDED = 3.2
00039 INTERESTED_CLASSES = [GizmoEventClass.ATIX10]
00040 INTERESTED_WINDOWS = ["mplayer"]
00041
00042
00043
00044
00045
00046 class ATIX10MPlayer(GizmoScriptActiveApplication):
00047 """
00048 MPlayer ATIX10 Event Mapping
00049 """
00050
00051
00052
00053
00054
00055 def onDeviceEvent(self, Event, Gizmo = None):
00056 """
00057 Called from Base Class' onEvent method.
00058 See GizmodDispatcher.onEvent documention for an explanation of this function
00059 """
00060
00061
00062 if Event.Value == 0:
00063 return False
00064
00065
00066 if Event.Code == GizmoKey.KEY_POWER:
00067 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_ESC)
00068 return True
00069 elif Event.Code == GizmoKey.KEY_PAUSE:
00070 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_SPACE)
00071 return True
00072 elif Event.Code == GizmoKey.KEY_PLAY:
00073 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_SPACE)
00074 return True
00075 elif Event.Code == GizmoKey.KEY_STOP:
00076 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_SPACE)
00077 return True
00078 elif Event.Code == GizmoKey.KEY_BOOKMARKS:
00079 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_V)
00080 return True
00081 elif Event.Code == GizmoKey.KEY_EDIT:
00082 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_O)
00083 return True
00084 elif Event.Code == GizmoKey.KEY_REWIND:
00085 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_PAGEDOWN)
00086 return True
00087 elif Event.Code == GizmoKey.KEY_FORWARD:
00088 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_PAGEUP)
00089 return True
00090 elif Event.Code == GizmoKey.KEY_COFFEE:
00091 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_Q)
00092 return True
00093 elif Event.Code == GizmoKey.KEY_C:
00094 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_MINUS)
00095 return True
00096 elif Event.Code == GizmoKey.KEY_D:
00097 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_EQUAL, [GizmoKey.KEY_RIGHTSHIFT])
00098 return True
00099 elif Event.Code == GizmoKey.KEY_E:
00100 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_E)
00101 return True
00102 elif Event.Code == GizmoKey.KEY_F:
00103 Gizmod.Keyboards[0].createEvent(GizmoEventType.EV_KEY, GizmoKey.KEY_F)
00104 return True
00105 else:
00106
00107 return False
00108
00109
00110
00111
00112
00113 def __init__(self):
00114 """
00115 Default Constructor
00116 """
00117
00118 GizmoScriptActiveApplication.__init__(self, ENABLED, VERSION_NEEDED, INTERESTED_CLASSES, INTERESTED_WINDOWS)
00119
00120
00121
00122
00123
00124
00125 ATIX10MPlayer()