scripts/modules.d/bases/GizmoScriptEnableChecker.py

00001     #***
00002   #*********************************************************************
00003 #*************************************************************************
00004 #*** 
00005 #*** GizmoDaemon Config Script
00006 #***    GizmoScript EnableChecker 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 import subprocess
00035 
00036 ############################
00037 # GizmoScriptEnableChecker Class definition
00038 ##########################
00039 
00040 class GizmoScriptEnableChecker:
00041         """
00042         Base Class that checks whether or not a script should be enabled
00043         """
00044         
00045         ############################
00046         # Public Functions
00047         ##########################
00048         
00049         ############################
00050         # Private Functions
00051         ##########################
00052 
00053         def __init__(self, Enabled, VersionNeeded):
00054                 """ 
00055                 EnableChecker Constructor
00056                 """
00057                 
00058                 self.Enabled = Enabled
00059                 self.VersionNeeded = VersionNeeded
00060                 
00061                 if self.Enabled:
00062                         if not Gizmod.checkVersion(self.VersionNeeded, False):
00063                                 Gizmod.printNiceScriptInit(1, " * " + self.__class__.__name__, "NOT LOADED", "Version Needed: " + str(self.VersionNeeded))
00064                         else:
00065                                 Gizmod.printNiceScriptInit(1, self.__class__.__name__, self.__class__.__doc__, "")
00066                                 Gizmod.Dispatcher.userScripts.append(self)
00067                 else:
00068                         Gizmod.printNiceScriptInit(1, " * " + self.__class__.__name__, "NOT LOADED", "Disabled")
00069 
00070 ############################
00071 # GizmoScriptEnableChecker class end
00072 ##########################

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