comparison pyntnclick/main.py @ 782:6a3440c8be8d pyntnclick

The title needs to be lazily translated. It's evaluated before we set up gettext
author Stefano Rivera <stefano@rivera.za.net>
date Sat, 26 Jan 2013 19:13:07 +0200
parents c91c613ae6d0
children 29c5badeef98
comparison
equal deleted inserted replaced
781:5fb962434159 782:6a3440c8be8d
9 from optparse import OptionParser 9 from optparse import OptionParser
10 10
11 import pygame 11 import pygame
12 from pygame.locals import SWSURFACE 12 from pygame.locals import SWSURFACE
13 13
14 from pyntnclick.i18n import _
14 from pyntnclick.engine import Engine 15 from pyntnclick.engine import Engine
15 from pyntnclick.gamescreen import DefMenuScreen, DefEndScreen, GameScreen 16 from pyntnclick.gamescreen import DefMenuScreen, DefEndScreen, GameScreen
16 from pyntnclick.constants import GameConstants, DEBUG_ENVVAR 17 from pyntnclick.constants import GameConstants, DEBUG_ENVVAR
17 from pyntnclick.resources import Resources 18 from pyntnclick.resources import Resources
18 from pyntnclick.sound import Sound 19 from pyntnclick.sound import Sound
126 # This is a bit hack'ish, but works 127 # This is a bit hack'ish, but works
127 if not self.constants.debug: 128 if not self.constants.debug:
128 for option in self.debug_options: 129 for option in self.debug_options:
129 if option in sys.argv: 130 if option in sys.argv:
130 self.warn_debug(option) 131 self.warn_debug(option)
131 opts, _ = parser.parse_args(sys.argv) 132 opts, args = parser.parse_args(sys.argv)
132 pygame.display.init() 133 pygame.display.init()
133 pygame.font.init() 134 pygame.font.init()
134 if opts.sound: 135 if opts.sound:
135 self.sound.enable_sound(self.constants) 136 self.sound.enable_sound(self.constants)
136 else: 137 else:
157 pygame.display.set_mode(self.constants.screen, SWSURFACE) 158 pygame.display.set_mode(self.constants.screen, SWSURFACE)
158 if self.constants.icon: 159 if self.constants.icon:
159 pygame.display.set_icon(self.resource.get_image( 160 pygame.display.set_icon(self.resource.get_image(
160 self.constants.icon, basedir='icons')) 161 self.constants.icon, basedir='icons'))
161 if self.constants.title: 162 if self.constants.title:
162 pygame.display.set_caption(self.constants.title) 163 title = _(self.constants.title).encode('utf-8')
164 pygame.display.set_caption(title)
163 165
164 self.engine = Engine(self) 166 self.engine = Engine(self)
165 # Initialize the special screens in the engine 167 # Initialize the special screens in the engine
166 for name, cls in self._screens.iteritems(): 168 for name, cls in self._screens.iteritems():
167 screen = cls(self) 169 screen = cls(self)