Пример #1
0
class Application:
    def __init__( self, args ):
        self.__board = Board( IdleManager() )

        if len( args ) > 1:
            fileName = args[ 1 ]
            if os.path.exists( fileName ):
                if fileName.endswith( ".c4plan" ):
                    self.__board.load( fileName )
                else:
                    self.__board.resetFromScenario( fileName )

        self.__window = None
        self.__createWindow( "en" )

    def run( self ):
        gtk.main()

    def __createWindow( self, lang ):
        Internationalization.initialize( lang )
        if self.__window is not None:
            self.__window.hide()
        self.__window = MainWindow( self.__board, self.__createWindow )
        self.__window.connect( "destroy", lambda w: gtk.main_quit() )