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


Python wizard.Wizard类代码示例

本文整理汇总了Python中wizard.Wizard的典型用法代码示例。如果您正苦于以下问题:Python Wizard类的具体用法?Python Wizard怎么用?Python Wizard使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: wizard_view

def wizard_view(request, step):
    wizard = Wizard(
        'wizard',
        wizard_steps
    )
    wizard.set_step_init_args(request)
    return wizard.handle_request(request, step)
开发者ID:42cc,项目名称:django-wizard,代码行数:7,代码来源:views.py

示例2: WvmSpritesList

class WvmSpritesList():
    """A class listing all the Sprites of the game."""

    def __init__(self, config, screen):
        """Initialize the sprite list."""
        self.config = config
        self.screen = screen

        #initialize the sprites
        self.wiz = Wizard(config, self)
        self.monsters = Group()
        self.missiles = Group()

    def update_all(self):
        """Update the positions of all sprites."""
        self.update_missiles()
        self.wiz.update()
        self.monsters.update()

    def update_missiles(self):
        """update magic missiles positions"""
        self.missiles.update()
        # remove the missiles that have left the screen
        for mi in self.missiles.copy():
            if mi.rect.left >= self.screen.get_rect().right:
                self.missiles.remove(mi)

    def draw(self):
        self.screen.fill(self.config.bg_color)
        for mi in self.missiles:
            mi.draw_missile()
        self.wiz.blitme()
        for mo in self.monsters:
            mo.blitme()

    def fire_missile(self):
        """Fire a missile if limit not reached yet."""
        if len(self.missiles) < self.wiz.magic_missile_allowed:
            self.missiles.add(MagicMissile(self.config, self))

    def create_monster(self):
        """Create a new monster and place it randomly at the right."""
        monster=Monster(self.config, self)
        #TODO move the monster
        self.monsters.add(monster)
开发者ID:BenObiWan,项目名称:wizard_vs_monster,代码行数:45,代码来源:wvm_sprites_list.py

示例3: __init__

    def __init__(self, config, screen):
        """Initialize the sprite list."""
        self.config = config
        self.screen = screen

        #initialize the sprites
        self.wiz = Wizard(config, self)
        self.monsters = Group()
        self.missiles = Group()
开发者ID:BenObiWan,项目名称:wizard_vs_monster,代码行数:9,代码来源:wvm_sprites_list.py

示例4: __init__

    def __init__(self, endpoint, destination = None, limit = 0, strategy = 'curl', avoid_small_files = False):
        self.endpoint    = endpoint
        self.destination = destination
        self.success     = False
        self.limit       = limit
        self.wizard      = Wizard(self.endpoint)
        self.strategy    = strategy
        self.avoid_small = avoid_small_files

        self.init_callbacks()
开发者ID:Djlosm1166,项目名称:ss-plex.bundle,代码行数:10,代码来源:downloader.py

示例5: __init__

    def __init__(self, endpoint, environment = environment.default, destination = None, limit = 0):
        super(Downloader, self).__init__()
        self.endpoint    = endpoint
        self.destination = destination
        self.success     = False
        self.limit       = limit
        self.environment = environment
        self.wizard      = Wizard(self.endpoint, environment = self.environment)

        self.init_callbacks()
开发者ID:mindcracker,项目名称:ss-plex.bundle,代码行数:10,代码来源:downloader.py

示例6: initAgents

    def initAgents(self, world):
        self.agentlayer = world.map.getLayer('TechdemoMapGroundObjectLayer')
        world.agentlayer = self.agentlayer
        self.boy = Boy(TDS, world, 'PC:boy', self.agentlayer)
        self.game.instance_to_agent[self.boy.agent.getFifeId()] = self.boy
        self.boy.start()
        self.agent_list.append(self.boy)

        self.girl = Girl(TDS, world, 'PC:girl', self.agentlayer, self)
        self.game.instance_to_agent[self.girl.agent.getFifeId()] = self.girl
        self.girl.start()
        self.agent_list.append(self.girl)

        self.wizard = Wizard(TDS, world, 'PC:wizard', self.agentlayer, self)
        self.game.instance_to_agent[self.wizard.agent.getFifeId()] = self.wizard
        self.wizard.start()
        self.agent_list.append(self.wizard)

        self.beekeepers = create_anonymous_agents(TDS, world, 'beekeeper', self.agentlayer, Beekeeper)
        for beekeeper in self.beekeepers:
            self.game.instance_to_agent[beekeeper.agent.getFifeId()] = beekeeper
            beekeeper.start()
            self.agent_list.append(beekeeper)

        self.cage = Cage(TDS, world, 'sword_crate', self.agentlayer)
        self.game.instance_to_agent[self.cage.agent.getFifeId()] = self.cage
        self.cage.start()
        self.agent_list.append(self.cage)

        self.bees = []
        for i in range(1, 8):
            bee = code.agents.bee.Bee(TDS, world, 'NPC:bee:0{}'.format(i), self.agentlayer, self)
            self.bees.append(bee)
            self.game.instance_to_agent[bee.agent.getFifeId()] = bee
            bee.start()
            self.agent_list.append(bee)

        self.warrior = Warrior(TDS, world, 'PC:warrior', self.agentlayer)
        self.game.instance_to_agent[self.warrior.agent.getFifeId()] = self.warrior
        self.warrior.start()
        self.agent_list.append(self.warrior)

        self.chemist = Chemist(TDS, world, 'NPC:chemist', self.agentlayer)
        self.game.instance_to_agent[self.chemist.agent.getFifeId()] = self.chemist
        self.chemist.start()
        self.agent_list.append(self.chemist)

        self.playableAgent = []
        self.reset()
开发者ID:drolando,项目名称:SoftDev,代码行数:49,代码来源:agent_manager.py

示例7: test_strike_no_manna

 def test_strike_no_manna(self):
     wizard = Wizard('Merlin',100,10,0)
     opponent = Wizard('Gandalf',100,10,20)
     wizard.strike(opponent)
     self.assertEqual(wizard.manna,0)
     self.assertEqual(opponent.hp,97)
开发者ID:greenfox-academy,项目名称:gyurka00,代码行数:6,代码来源:wizard_test.py

示例8: main

def main(argv):

    path = None
    first_arg = None
    second_arg = None
    config = None
    apath = None
    print("QT VERSION %s" % QT_VERSION_STR )

    try:
        first_arg = argv[1]
        second_arg = argv[2]
    except IndexError:
        pass

    if first_arg is not None:
        if first_arg == "-c":
            config = True 
            if second_arg is not None:
                path = second_arg
        else:
            path = first_arg
        
    try:
        #app = QApplication(argv)
        app = MyApp(argv)

        QCoreApplication.setOrganizationDomain('www.trickplay.com');
        QCoreApplication.setOrganizationName('Trickplay');
        QCoreApplication.setApplicationName('Trickplay Debugger');
        QCoreApplication.setApplicationVersion('0.0.1');
            
        s = QProcessEnvironment.systemEnvironment().toStringList()
        for item in s:
            k , v = str( item ).split( "=" , 1 )
            if k == 'PWD':
                apath = v

        apath = os.path.join(apath, os.path.dirname(str(argv[0])))
        main = MainWindow(app, apath)
        main.config = config

        main.show()
        main.raise_()
        wizard = Wizard()
        app.main = main

        path = wizard.start(path)
        if path:
            settings = QSettings()
            settings.setValue('path', path)

            app.setActiveWindow(main)
            main.start(path, wizard.filesToOpen())
            main.show()

        sys.exit(app.exec_())

    # TODO, better way of doing this for 'clean' exit...
    except KeyboardInterrupt:
		exit("Exited")
开发者ID:,项目名称:,代码行数:61,代码来源:

示例9: test_strike_without_manna

 def test_strike_without_manna(self):
     wizard = Wizard('Merlin', 40, 9, 0)
     opponent = Wizard('Other', 30, 5, 10)
     wizard.strike(opponent)
     self.assertEqual(opponent.hp, 27)
开发者ID:Wushaowei001,项目名称:frankedus,代码行数:5,代码来源:wizard_test.py

示例10: Downloader

class Downloader(object):
    def __init__(self, endpoint, destination = None, limit = 0, strategy = 'curl', avoid_small_files = False):
        self.endpoint    = endpoint
        self.destination = destination
        self.success     = False
        self.limit       = limit
        self.wizard      = Wizard(self.endpoint)
        self.strategy    = strategy
        self.avoid_small = avoid_small_files

        self.init_callbacks()

    @property
    def file_name(self):
        hinted = self.wizard.file_hint.encode()
        consumed = self.consumer.file_name.encode()
        ext = consumed.split('.')[-1]
        merged = '%s.%s' % (hinted, ext)

        return sanitize_file(merged)

    @property
    def status_file(self):
        return status_file_for(self.endpoint)

    @property
    def local_partfile(self):
        return self.local_file + '.part'

    @property
    def local_file(self):
        import os.path
        return os.path.join(self.destination, self.file_name)

    def add_callback(self, group, cb): self.callbacks[group].append(cb)
    def on_start(self, cb):    self.add_callback('start',    cb)
    def on_success(self,  cb): self.add_callback('success',  cb)
    def on_error(self, cb):    self.add_callback('error',    cb)

    def run_start_callbacks(self):
        log.debug('Running start callbacks')
        self.run_callbacks('_start')
        self.run_callbacks('start')

    def run_success_callbacks(self):
        log.debug('Running success callbacks')
        self.run_callbacks('_success')
        self.run_callbacks('success')

    def run_error_callbacks(self):
        log.debug('Running error callbacks')
        self.run_callbacks('_error')
        self.run_callbacks('error')

    def run_callbacks(self, group):
        for cb in self.callbacks[group]:
            cb(self)

    def init_callbacks(self):
        groups = ( 'start', 'success', 'error' )
        self.callbacks = {}

        for g in groups:
            self.callbacks[g]       = []
            self.callbacks['_' + g] = []

        def rename_partfile(dl):
            try:
                import os
                os.rename( dl.local_partfile, dl.local_file )
            except: pass

        def cleanup_status_file(dl):
            dl.cleanup_status_file()

        self.add_callback('_success', rename_partfile)
        self.add_callback('_success', cleanup_status_file)

    def download(self):
        def perform_download(consumer):
            self.consumer = consumer
            self.success  = self.really_download()

        self.wizard.sources(perform_download)

        if self.success:
            self.run_success_callbacks()
            log.info('Finished downloading %s' % self.wizard.file_hint)
        else:
            self.run_error_callbacks()

    def download_command(self):
        return globals()[self.strategy + '_strategy_command'](self)

    def really_download(self):
        from signal import SIGTERM
        import subprocess

        command  = self.download_command()
        piped    = subprocess.Popen(command)
#.........这里部分代码省略.........
开发者ID:Djlosm1166,项目名称:ss-plex.bundle,代码行数:101,代码来源:downloader.py

示例11: test_without_manna

 def test_without_manna(self):
     wizard = Wizard("Merlin", 40, 10, 20)
     opponent = Wizard("Other",30, 5, 20)
     wizard.strike(opponent)
     self.assertEqual(opponent.manna, 15)
开发者ID:greenfox-academy,项目名称:bauerjudit,代码行数:5,代码来源:wizard_test.py

示例12: test_strike_wo_mana

	def test_strike_wo_mana(self):
		wizard = Wizard('GHAARRiYYY', 50, 30, 0)
		opponent = Wizard('VOLDERMORT', 100, 70, 20)
		wizard.strike(opponent)
		self.assertEqual(opponent.hp, 90)
开发者ID:greenfox-academy,项目名称:kristoftombacz,代码行数:5,代码来源:wizard_test.py

示例13: test_strike_with_manna

 def test_strike_with_manna(self):
     wizard = Wizard('Merlin', 40, 10, 20)
     opponent = Wizard('Other', 30, 5, 10)
     wizard.strike(opponent)
     self.assertEqual(wizard.manna, 15)
开发者ID:Wushaowei001,项目名称:frankedus,代码行数:5,代码来源:wizard_test.py

示例14: test_strike_five_manna

 def test_strike_five_manna(self):
     wizard = Wizard("Merlin", 40, 10, 20)
     opponent = Wizard("opi", 40, 10, 20)
     wizard.strike(opponent)
     self.assertEqual(wizard.manna, 15)
     self.assertEqual(opponent.hp, 10)
开发者ID:greenfox-academy,项目名称:purple-flower,代码行数:6,代码来源:wizard_test.py

示例15: test_strike_less_than_five_manna

 def test_strike_less_than_five_manna(self):
     wizard = Wizard("Merlin", 40, 9, 4)
     opponent = Wizard("opi", 40, 10, 20)
     wizard.strike(opponent)
     self.assertEqual(wizard.manna, 4)
     self.assertEqual(opponent.hp, 37)
开发者ID:greenfox-academy,项目名称:purple-flower,代码行数:6,代码来源:wizard_test.py


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