Back to index

freevial  1.2
globals.py
Go to the documentation of this file.
00001 # -*- coding: utf-8 -*-
00002 
00003 #
00004 # Freevial
00005 # Global Data used all over Freevial
00006 #
00007 # Copyright (C) 2007, 2008 The Freevial Team
00008 #
00009 # By Carles Oriol i Margarit <carles@kumbaworld.com>
00010 # By Siegfried-Angel Gevatter Pujals <siggi.gevatter@gmail.com>
00011 #
00012 # This program is free software: you can redistribute it and/or modify
00013 # it under the terms of the GNU General Public License as published by
00014 # the Free Software Foundation, either version 3 of the License, or
00015 # (at your option) any later version.
00016 #
00017 # This program is distributed in the hope that it will be useful,
00018 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 # GNU General Public License for more details.
00021 #
00022 # You should have received a copy of the GNU General Public License
00023 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
00024 #
00025 
00026 import os.path
00027 import random
00028 import pygame
00029 import gettext
00030 
00031 gettext.install('freevial', '/usr/share/locale', unicode=1)
00032 
00033 class GlobalVar:
00034        
00035        def __repr__( self ):
00036               
00037               return str(vars(self))
00038        
00039        
00040        def __str__( self ):
00041               
00042               return self.__repr__()
00043 
00044 
00045 Global = GlobalVar()
00046 
00047 Global.DEBUG_MODE = False
00048 Global.SOUND_MUTE = False
00049 Global.MUSIC_MUTE = False
00050 Global.DISPLAY_FPS = False
00051 Global.LOCKED_MODE = False
00052 Global.FS_MODE = False      # Fullscreen Mode
00053 
00054 Global.screen_x = 1024
00055 Global.screen_y = 768
00056 Global.fps_limit = 40
00057 
00058 Global.basefolder = '../data'
00059 Global.database = '../databases'
00060 
00061 Global.folders = {
00062               'images': os.path.join(Global.basefolder, 'images'),
00063               'sounds': os.path.join(Global.basefolder, 'sounds'),
00064               'fonts': os.path.join(Global.basefolder, 'fonts'),
00065               'help': os.path.join(Global.basefolder, 'help'),
00066        }
00067 
00068 
00069 def mute( sound = None, music = None ):
00070        """ Mute sound or music. """
00071        
00072        global SOUND_MUTE, MUSIC_MUTE
00073        
00074        if sound: SOUND_MUTE = sound
00075        if music: MUSIC_MUTE = music
00076        
00077        return {
00078                      'sound': SOUND_MUTE,
00079                      'music': MUSIC_MUTE,
00080               }