当前位置: 首页>>代码示例>>Python>>正文


Python Engine.run方法代码示例

本文整理汇总了Python中engine.Engine.run方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.run方法的具体用法?Python Engine.run怎么用?Python Engine.run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在engine.Engine的用法示例。


在下文中一共展示了Engine.run方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start_engine

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def start_engine(args):
    if not (args.name and args.engine_cfg):
        LOG.error('Need name and engine cfg')
        return
    utils.create_files([engine_cfg])
    if args.purge:
        utils.purge_disabled(engine_cfg)
    if utils.check_exists_and_enabled(args.name, engine_cfg):
        LOG.error("An engine of the same name %s is already "
                  "registered and running", args.name)
        return
    if utils.check_exists_and_disabled(args.name, engine_cfg):
        LOG.error("And engine of the same name %s is already "
                  "registered, but disabled. Run with purge?", args.name)
        return
    try:
        cfg_data = dict(utils.load_yaml(args.engine_cfg))[args.name]
        cfg = {
            args.name: {
                'cfg': os.path.join(os.getcwd(), args.engine_cfg),
                'pid': os.getpid(),
                'backend': cfg_data['backend'],
                'enabled': True
            }
        }
        utils.write_yaml(cfg, engine_cfg)
        LOG.info('Added %s to engine cfg', args.name)
        entropy_engine = Engine(args.name, **cfg_data)
        entropy_engine.run()
    except Exception:
        LOG.exception("Could not start engine %s", args.name)
        return
开发者ID:openstack,项目名称:entropy,代码行数:34,代码来源:__main__.py

示例2: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
	os.environ["SDL_VIDEO_CENTERED"] = "1"
	pygame.init()

	game_data = {
		TITLE: "Crazy Ant",
		SIZE: (640, 480),
		FONT: Font(None, 32),
		LEVELS: [
			"level1",
			"level2",
			"level3",
		],
		LEVEL_DATA: {
			"level1": {
				FILE: "level1.lvl",
			},
			"level2": {
				FILE: "level2.lvl",
			},
			"level3": {
				FILE: "level3.lvl",
			},
		},
		CONTROLS: {
			LEFT: K_a,
			RIGHT: K_d,
			JUMP: K_s
		},
	}

	engine = Engine(game_data)
	engine.run()
开发者ID:luciferous,项目名称:CrazyAnt,代码行数:35,代码来源:main.py

示例3: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    parser = ArgumentParser()
    parser.add_argument('name', help='name of language configuration')
    parser.add_argument(
        '-v', '--verbose', action='store_true',
        help='show intermediate sound changes'
    )
    parser.add_argument(
        '-r', '--repeat', type=int, default=1,
        help='generate multiple words'
    )
    parser.add_argument(
        '-p', '--phonetic', action='store_true',
        help='show phonetic transcriptions'
    )
    parser.add_argument(
        '-R', '--raw', action='store_true',
        help='show raw state machine output'
    )
    parser.add_argument(
        '-w', '--words', nargs='+',
        help='use given words instead of state machine output'
    )
    engine = Engine(parser)
    engine.run()
开发者ID:chheisler,项目名称:Conlang,代码行数:27,代码来源:app.py

示例4: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    fn = sys.argv[1]
    # TODO : use getopt?
    db_print ('user folder is :',fn)
    if os.path.exists(fn):
        db_print (os.path.basename(fn),'exists')  # file exists
        parse_folder(fn)
        e = Engine(actors=Actor.registry)
        e.run()
开发者ID:msarch,项目名称:py,代码行数:11,代码来源:__main__.py

示例5: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    pygame.init()

    game_data = {
        SIZE: (640, 480),
        FONT: Font(None, 32)
    }

    engine = Engine(game_data)
    engine.run()
开发者ID:dvadas,项目名称:CrazyAnt,代码行数:12,代码来源:main.py

示例6: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    options={ 'DEBUG' : 1,
            'END_TIME' : 3, # EXPORT MODE : duration (seconds) of the anim
            'PREVIEW_SIZE' : (800,600),
            'BGCOLOR' : (0.95, 0.95, 0.95, 0),# background
            'FPS' : 60, # display max framerate
            'PicPS' : 25,  # EXPORT MODE FRAMERATE : images per second for movie export
            'MODE' : 'PREVIEW', # options are : 'FULL'; 'PREVIEW'; 'EXPORT'
            'OBJ' : obj
            }
    engine=Engine(**options)
    engine.run()
开发者ID:msarch,项目名称:py,代码行数:14,代码来源:main.py

示例7: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    options={ 'DEBUG' : 1,
            'PREVIEW_SIZE' : (800,600),
            'BGCOLOR' : (0.95, 0.95, 0.95, 0),# background
            'FPS' : 60, # display max framerate
            'PicPS' : 25,  # EXPORT MODE FRAMERATE : images per second for movie export
            'MODE' : 'PREVIEW', # options are : 'FULL'; 'PREVIEW'; 'EXPORT'
            }
    engine=Engine(**options)
    scene1=Scene(folder='scene1', duration=3)
    scene1.configure()
    engine.run(scene1)
开发者ID:msarch,项目名称:py,代码行数:14,代码来源:run.py

示例8: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    opts = None  # 命令行参数
    conf = None  # 全局的配置
    eng = None  # 主线程核心引擎对象

    # 加载命令行参数
    try:
        opts = parse_opts()
    except OptParseError:
        return

    # 加载系统运行配置
    try:
        conf = parse_conf(opts)
    except Exception:
        print '>> yaml syntax error'
        traceback.print_exc()
        return

    # 加载日志配置
    parse_logger(conf)

    # 开始日志记录
    log = logging.getLogger('robber')
    log.debug('logging modules init ok.')

    # 暂时不支持多个任务 只有默认配置中的root任务
    assert(conf['root'])
    root_conf = conf['root']
    try:
        eng = Engine(root_conf)
        log.debug('Engine modules init ok.')
    except Exception:
        traceback.print_exc()
        log.critical('Engine modules init fatal.')
        return

    try:
        eng.run()
        log.info('all job done exit.')
        sys.exit(0)
    except KeyboardInterrupt:
        log.warning('rev KeyboardInterrupt exit.')
        print '<< KeyboardInterrupt'
        os._exit(-1)  # 警告: 危险的快速退出
    except Exception:
        log.critical('engine object run fatal.')
        traceback.print_exc()
开发者ID:cj1324,项目名称:hanchenproject,代码行数:50,代码来源:steal.py

示例9: EnigmaX

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
class EnigmaX():
    def __init__(self):
        self.builder = Gtk.Builder()
        self.builder.add_from_file(gtk_builder_file)
        self.engine = Engine()
        self.window = self.builder.get_object('windowMain')
        self.textBox = self.builder.get_object('entry')
        self.label = self.builder.get_object('label')
        self.label2 = self.builder.get_object('enigma')
        self.engineToString()

        self.textBox.connect('activate', self.signal_text_activate)
        self.textBox.connect('changed', self.signal_text_changed)
        self.window.connect('destroy', self.signal_window_destroy)

        self.ciphertext = ''

        self.window.show_all()
    
    def signal_window_destroy(self, _):
        self.window.destroy()
        Gtk.main_quit()

    def signal_text_activate(self, *args):
        self.label.set_text(self.engine.run(self.textBox.get_text()))
        self.engineToString()
    
    def signal_text_changed(self, *args):
        newChar = self.textBox.get_text()[-1] if len(self.textBox.get_text()) else ''
        self.ciphertext += self.engine.translate(newChar.upper())
        self.label.set_text(self.ciphertext)
        self.engineToString()
    
    def engineToString(self):
        self.label2.set_text(self.engine.toString())
开发者ID:jacobj10,项目名称:PyEnigma,代码行数:37,代码来源:enigmaX.py

示例10: Engine

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
#!/usr/bin/python
# create, initialize, and run the 381 engine

from engine import Engine

try:
    engine = Engine()
    engine.init()
    engine.run()

except Exception, e:
    # prevent system from losing buffered keys on program crash
    try:
        if engine.inputMgr is not None:
            engine.inputMgr.stop()
            
    except:
        pass

    raise e
开发者ID:JakubBerlinski,项目名称:cs381,代码行数:22,代码来源:main.py

示例11: Game

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
class Game(object):

    def __init__(self):

        self.engine = None
        self.main_room = None
        self.maze_room = None
        self.fib_room = None

    def start(self):

        self.engine = Engine(1200, 700)

        self.engine.game = self

        screen = pygame.display.set_mode((1200, 700), pygame.HWSURFACE, 32)
        title_screen = pygame.image.load("assets/images/gui/title_screen.png").convert()

        x = 1200/2 - title_screen.get_width()/2
        y = 700/2 - title_screen.get_height()/2

        # show title screen
        exit_title_screen = False
        while not exit_title_screen:

            for event in pygame.event.get():
                if event.type == QUIT:
                    Engine.clean_up()

                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_RETURN:
                        exit_title_screen = True

            screen.fill((0, 0, 0))
            screen.blit(title_screen, (x, y))

            pygame.display.update()

        self.main_room = PlatformWorld()
        self.maze_room = Maze()
        self.fib_room = FibWorld()

        self.engine.worlds.append(self.main_room)
        self.engine.worlds.append(self.maze_room)
        self.engine.worlds.append(self.fib_room)

        self.engine.set_world(self.main_room)
        self.engine.run()

    def go_to_maze(self):
        self.engine.set_world(self.maze_room)

    def go_to_fib(self):
        self.engine.set_world(self.fib_room)

    def go_to_main(self):
        self.engine.set_world(self.main_room)

    def go_to_end(self):
        screen = pygame.display.set_mode((1200, 700), pygame.HWSURFACE, 32)
        title_screen = pygame.image.load("assets/images/gui/end_screen.png").convert()

        x = 1200/2 - title_screen.get_width()/2
        y = 700/2 - title_screen.get_height()/2

        # show title screen
        exit_title_screen = False
        while not exit_title_screen:

            for event in pygame.event.get():
                if event.type == QUIT:
                    Engine.clean_up()

                if event.type == pygame.KEYDOWN:
                    if event.key == pygame.K_RETURN:
                        exit_title_screen = True

            screen.fill((0, 0, 0))
            screen.blit(title_screen, (x, y))

            pygame.display.update()
        self.start()
开发者ID:Unit978,项目名称:luminescence_standalone,代码行数:84,代码来源:main.py

示例12: Engine

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
from engine import Engine

if __name__ == '__main__':
    e = Engine()
    e.run()
开发者ID:WendyHanzer,项目名称:7c,代码行数:7,代码来源:main.py

示例13: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    engine = Engine()
    engine.run()
开发者ID:madlinux,项目名称:ironpython,代码行数:5,代码来源:run.py

示例14: main

# 需要导入模块: from engine import Engine [as 别名]
# 或者: from engine.Engine import run [as 别名]
def main():
    app = Engine(SplashState(), fullscreen=True)
    app.run()
开发者ID:pycoder01,项目名称:pw5-murmel,代码行数:5,代码来源:main.py


注:本文中的engine.Engine.run方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。