def end_test(self, name, attrs):
        my_variables = BuiltIn().get_variables()
        current_output_dir = os.path.abspath(my_variables['${OUTPUTDIR}'])
        fullname = my_variables['${SUITE_NAME}'] + '.' + my_variables['${TEST_NAME}'] + '-MOBILE'
        fullname = re.sub(r'\s+', '_', fullname)

        test_output_dir = os.path.join(current_output_dir, 'gif', fullname)
        gif_name = fullname + '.gif'
        gif_path = os.path.join(current_output_dir, gif_name)

        myPicList = self.GetDirImageList(os.path.abspath(my_variables['${OUTPUTDIR}']), False)
        # human sort png list eg: [1,11,2] -- > [1,2,11]
        myPicList = self.sort_nicely(myPicList)

        if myPicList:
            self.GetGifAnimationFromImages(gif_path, myPicList, 2)
            if os.path.isdir(test_output_dir):
                shutil.rmtree(test_output_dir)
            os.makedirs(test_output_dir)

        for item in os.listdir(current_output_dir):
            # if re.search(r'mobile-gif.*png|.*gif',item):
            if re.search(r'(^mobile-gif-.*png)|(.*MOBILE\.gif$)', item):
                shutil.move(os.path.join(current_output_dir, item), os.path.join(test_output_dir, item))

        event.dispatch('scope_end', attrs['longname'])
Ejemplo n.º 2
0
    def end_test(self, name, attrs):
        my_variables = BuiltIn().get_variables()
        current_output_dir = os.path.abspath(my_variables['${OUTPUTDIR}'])
        fullname = my_variables['${SUITE_NAME}'] + '.' + my_variables[
            '${TEST_NAME}'] + '-MOBILE'
        fullname = re.sub(r'\s+', '_', fullname)

        test_output_dir = os.path.join(current_output_dir, 'gif', fullname)
        gif_name = fullname + '.gif'
        gif_path = os.path.join(current_output_dir, gif_name)

        myPicList = self.GetDirImageList(
            os.path.abspath(my_variables['${OUTPUTDIR}']), False)
        # human sort png list eg: [1,11,2] -- > [1,2,11]
        myPicList = self.sort_nicely(myPicList)

        if myPicList:
            self.GetGifAnimationFromImages(gif_path, myPicList, 2)
            if os.path.isdir(test_output_dir):
                shutil.rmtree(test_output_dir)
            os.makedirs(test_output_dir)

        for item in os.listdir(current_output_dir):
            # if re.search(r'mobile-gif.*png|.*gif',item):
            if re.search(r'(^mobile-gif-.*png)|(.*MOBILE\.gif$)', item):
                shutil.move(os.path.join(current_output_dir, item),
                            os.path.join(test_output_dir, item))

        event.dispatch('scope_end', attrs['longname'])
Ejemplo n.º 3
0
    def attack(self):
        wielder = self.get_wielder()

        e = entity.get_entity_type("Projectile")()

        e.controlled_by = wielder.controlled_by
        e.position = wielder.position.copy()
        e.duration = self.proj_life
        e.rotation = wielder.rotation
        e.move_dir = euclid.Vector2(*util.rot_to_vec(e.rotation))
        game.spawn(e)
        
        if game.is_controlled(e):
            events.dispatch("on_attack", self.get_wielder(), self, e)
Ejemplo n.º 4
0
    def attack(self):
        real_wielder = self.get_wielder() # The real entity (not the eid)
        e = entity.get_entity_type("MeleeWeaponEntity")()
        e.attached_to = self.wielder
        e.wielder = self.wielder
        e.controlled_by = real_wielder.controlled_by
        e.position = real_wielder.position.copy()
        e.duration = self.duration
        e.duration_left = e.duration
        e.offset = self.offset
        e.arc = self.arc
        e.rotation_off = -self.arc/2
        game.spawn(e)


        if game.is_controlled(e):
            events.dispatch("on_attack", self.get_wielder(), self, e)
Ejemplo n.º 5
0
    def attack(self):
        real_wielder = self.get_wielder()

        e = entity.get_entity_type("Projectile")()

        e.damage = 20
        e.friendly = real_wielder.friendly
        e.controlled_by = real_wielder.controlled_by
        e.position = real_wielder.position.copy()
        e.duration = self.proj_life
        e.rotation = real_wielder.rotation
        e.move_dir = util.rot_to_vec(e.rotation)

        game.Game.spawn(e)

        #e.body.linearVelocity = util.rot_to_vec(e.rotation) * self.proj_speed  # TODO: This should be set in the projectille itself (currently cant because of physics body being created after the instance)

        if game.Game.is_controlled(e):
            events.dispatch("on_attack", self.get_wielder(), self, e)
Ejemplo n.º 6
0
    def attack(self):
        real_wielder = self.get_wielder()  # The real entity (not the eid)
        e = entity.get_entity_type("MeleeWeaponEntity")()
        e.damage = self.damage
        e.friendly = real_wielder.friendly
        e.attached_to = self.wielder
        e.wielder = self.wielder
        e.controlled_by = real_wielder.controlled_by
        e.position = real_wielder.position.copy()
        e.duration = self.p_duration
        e.duration_left = e.duration
        e.offset = self.offset
        e.arc = self.arc
        e.size = self.size
        e.rotation_off = -self.arc / 2
        e.swing_speed = self.p_swing_speed
        e.width = self.p_width
        e.length = self.p_length
        game.Game.spawn(e)

        if game.Game.is_controlled(e):
            events.dispatch("on_attack", self.get_wielder(), self, e)
Ejemplo n.º 7
0
events.register_callback(xproto.MappingNotifyEvent,
                         root.cb_MappingNotifyEvent, state.root)
events.register_callback(xproto.MapRequestEvent,
                         client.cb_MapRequestEvent, state.root)
events.register_callback(xproto.FocusInEvent,
                         client.cb_FocusInEvent, state.root)
events.register_callback(xproto.FocusOutEvent,
                         client.cb_FocusOutEvent, state.root)
events.register_callback(xproto.ConfigureRequestEvent,
                         window.cb_ConfigureRequestEvent, state.root)
events.register_callback(xproto.MotionNotifyEvent, grab.drag_do,
                         state.pyndow, None, None, None)
events.register_callback(xproto.ButtonReleaseEvent, grab.drag_end,
                         state.pyndow, None, None, None)

state.root_focus()

while True:
    event.read(state.conn, block=True)
    for e in event.queue():
        events.dispatch(e)

    events.run_latent()

    state.conn.flush()

    if state.die:
        break

misc.spawn('killall Xephyr')
Ejemplo n.º 8
0
 def start_suite(self, name, attrs):
     event.dispatch( 'scope_start', attrs['longname'] )
Ejemplo n.º 9
0
 def end_test(self, name, attrs):
     event.dispatch( 'scope_end', attrs['longname'] )