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 GizmoScriptRunningApplication import *
00035 import subprocess
00036
00037 ENABLED = True
00038 VERSION_NEEDED = 3.2
00039 INTERESTED_CLASSES = [GizmoEventClass.ATIX10]
00040 INTERESTED_APPLICATION = "amarokapp"
00041
00042
00043
00044
00045
00046 class ATIX10Amarok(GizmoScriptRunningApplication):
00047 """
00048 Amarok 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_PAUSE:
00067 subprocess.Popen(["amarok", "--play-pause"])
00068 return True
00069 elif Event.Code == GizmoKey.KEY_PLAY:
00070 subprocess.Popen(["amarok", "--play-pause"])
00071 return True
00072 elif Event.Code == GizmoKey.KEY_STOP:
00073 subprocess.Popen(["amarok", "--stop"])
00074 return True
00075 elif Event.Code == GizmoKey.KEY_LEFT:
00076 subprocess.Popen(["amarok", "--previous"])
00077 return True
00078 elif Event.Code == GizmoKey.KEY_REWIND:
00079 subprocess.Popen(["amarok", "--previous"])
00080 return True
00081 elif Event.Code == GizmoKey.KEY_RIGHT:
00082 subprocess.Popen(["amarok", "--next"])
00083 return True
00084 elif Event.Code == GizmoKey.KEY_FORWARD:
00085 subprocess.Popen(["amarok", "--next"])
00086 return True
00087 else:
00088
00089 return False
00090
00091
00092
00093
00094
00095 def __init__(self):
00096 """
00097 Default Constructor
00098 """
00099
00100 GizmoScriptRunningApplication.__init__(self, ENABLED, VERSION_NEEDED, INTERESTED_CLASSES, INTERESTED_APPLICATION)
00101
00102
00103
00104
00105
00106
00107 ATIX10Amarok()