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 GizmoScriptDefault import *
00035 import subprocess
00036
00037
00038
00039
00040
00041 class GizmoScriptActiveApplication(GizmoScriptDefault):
00042 """
00043 Event Mapping Base Class for the ActiveApplication Mappings
00044
00045 Inherit from this class if you want to define a per application event mapping
00046 where the application has to be the currently focused app
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 GizmoScriptDefault.checkEvent(self, Event, Gizmo):
00060 return False
00061
00062
00063 if [i for i in self.InterestedWindows if Gizmod.CurrentFocus.WindowName.lower().find(i) > -1]:
00064
00065 return self.onDeviceEvent(Event, Gizmo)
00066 else:
00067
00068 return False
00069
00070
00071
00072
00073
00074 def __init__(self, Enabled, VersionNeeded, InterestedClasses, InterestedWindows):
00075 """
00076 Default Constructor
00077 """
00078
00079
00080 GizmoScriptDefault.__init__(self, Enabled, VersionNeeded, InterestedClasses)
00081
00082
00083 self.InterestedWindows = InterestedWindows
00084
00085
00086
00087