Skip to content

Commit

Permalink
move isTrue checking into constants
Browse files Browse the repository at this point in the history
Last thing we need is for a boolean check like this to start floating around everywhere without being cleanly contained in a proper location
  • Loading branch information
erodozer committed Feb 23, 2013
1 parent ed52a89 commit 53371d5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
4 changes: 3 additions & 1 deletion src/Shader.py
Expand Up @@ -38,6 +38,8 @@
from OpenGL.GL.ARB.multitexture import *
from OpenGL.GL.EXT.texture3D import *

from constants import isTrue

class ShaderCompilationError(Exception):
pass

Expand Down Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions src/Theme.py
Expand Up @@ -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):
Expand Down
5 changes: 5 additions & 0 deletions src/constants.py
Expand Up @@ -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"]

0 comments on commit 53371d5

Please sign in to comment.