From 53371d58c7d13194ad4909b478618d3b9db07e49 Mon Sep 17 00:00:00 2001 From: Nicholas Hydock Date: Fri, 22 Feb 2013 19:07:37 -0500 Subject: [PATCH] move isTrue checking into constants Last thing we need is for a boolean check like this to start floating around everywhere without being cleanly contained in a proper location --- src/Shader.py | 4 +++- src/Theme.py | 3 --- src/constants.py | 5 +++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/Shader.py b/src/Shader.py index 775f84cc0..7de6358a7 100644 --- a/src/Shader.py +++ b/src/Shader.py @@ -38,6 +38,8 @@ from OpenGL.GL.ARB.multitexture import * from OpenGL.GL.EXT.texture3D import * +from constants import isTrue + class ShaderCompilationError(Exception): pass @@ -489,7 +491,7 @@ def checkIfEnabled(self): value = Config.get("video","shader_"+i) if value != "None": if value == "theme": - if Config.get("theme","shader_"+i).lower() in ["1", "true", "yes", "on"]: + if isTrue(Config.get("theme","shader_"+i).lower()): value = i else: continue diff --git a/src/Theme.py b/src/Theme.py index 2507b96bd..2202d1cab 100644 --- a/src/Theme.py +++ b/src/Theme.py @@ -70,9 +70,6 @@ def valign(value, default='middle'): Log.warn('Invalid vertical alignment value - defaulting to %s' % default) return valign(default) -def isTrue(value): - return value in ["1", "true", "yes", "on"] - class Theme(Task): def __getattr__(self, attr): diff --git a/src/constants.py b/src/constants.py index acc00a41d..8189b94d4 100644 --- a/src/constants.py +++ b/src/constants.py @@ -37,3 +37,8 @@ # Screen sizing scalers SCREEN_WIDTH = 640.0 SCREEN_HEIGHT = 480.0 + +#set of values that define as true when loading string values from a file +def isTrue(value): + return value in ["1", "true", "yes", "on"] +