Пример #1
0
def finish_callback(cmd):
    session = Kernel.session()
    
    # remove command from active commands set
    sc_utils.removeFromSet(session, cmds[cmd], keynodes.ui.active_base_user_cmd)
    # append command into finished command set
    sc_utils.appendIntoSet(session, Kernel.segment(), cmds[cmd], 
                           keynodes.ui.finish_base_user_cmd,
                           sc_core.pm.SC_CONST | sc_core.pm.SC_POS)
   
    cmds.pop(cmd)
    cmd.delete()
Пример #2
0
def finish_callback(cmd):
    session = Kernel.session()

    # remove command from active commands set
    sc_utils.removeFromSet(session, cmds[cmd],
                           keynodes.ui.active_base_user_cmd)
    # append command into finished command set
    sc_utils.appendIntoSet(session, Kernel.segment(), cmds[cmd],
                           keynodes.ui.finish_base_user_cmd,
                           sc_core.pm.SC_CONST | sc_core.pm.SC_POS)

    cmds.pop(cmd)
    cmd.delete()
Пример #3
0
def cmd_finished(_params, _segment):

    session = Kernel.session()

    # getting command node
    command = session.search_one_shot(
        session.sc_constraint_new(sc_core.constants.CONSTR_5_f_a_a_a_f,
                                  keynodes.ui.finish_base_user_cmd,
                                  sc_core.pm.SC_A_CONST, sc_core.pm.SC_N_CONST,
                                  sc_core.pm.SC_A_CONST, _params), True, 5)
    if not command:
        return

    # remove finished state (that need to replay it in future)
    session.erase_el(command[1])

    command = command[2]

    # trying to find next command
    res = sc_utils.searchOneShotFullBinPairsAttrFromNode(
        session, command, keynodes.common.nrel_base_order, sc_core.pm.SC_CONST)

    if res is None:
        return

    next_command = res[2]

    # check if command isn't active
    if sc_utils.checkIncToSets(session, next_command,
                               [keynodes.ui.active_base_user_cmd],
                               sc_core.pm.SC_CONST):
        raise RuntimeWarning("Command %s is active" % str(next_command))

    # if next command included into finished commands set, then we need to remove it from that set
    if sc_utils.checkIncToSets(session, next_command,
                               [keynodes.ui.finish_base_user_cmd],
                               sc_core.pm.SC_CONST):
        sc_utils.removeFromSet(session, next_command,
                               keynodes.ui.finish_base_user_cmd)

    # append command into set of initialized commands
    sc_utils.appendIntoSet(session, Kernel.segment(), next_command,
                           keynodes.ui.init_base_user_cmd, sc_core.pm.SC_CONST)
Пример #4
0
def cmd_finished(_params, _segment):
    
    session = Kernel.session()
    
    # getting command node
    command = session.search_one_shot(session.sc_constraint_new(sc_core.constants.CONSTR_5_f_a_a_a_f,
                                                                     keynodes.ui.finish_base_user_cmd,
                                                                     sc_core.pm.SC_A_CONST,
                                                                     sc_core.pm.SC_N_CONST,
                                                                     sc_core.pm.SC_A_CONST,
                                                                     _params), True, 5)
    if not command:
        return
    
    # remove finished state (that need to replay it in future)
    session.erase_el(command[1])
    
    command = command[2] 
    
    # trying to find next command
    res = sc_utils.searchOneShotFullBinPairsAttrFromNode(session, command, keynodes.common.nrel_base_order, sc_core.pm.SC_CONST)
    
    if res is None:
        return
    
    next_command = res[2]
    
    # check if command isn't active
    if sc_utils.checkIncToSets(session, next_command, [keynodes.ui.active_base_user_cmd], sc_core.pm.SC_CONST):
        raise RuntimeWarning("Command %s is active" % str(next_command))
    
    # if next command included into finished commands set, then we need to remove it from that set
    if sc_utils.checkIncToSets(session, next_command, [keynodes.ui.finish_base_user_cmd], sc_core.pm.SC_CONST):
        sc_utils.removeFromSet(session, next_command, keynodes.ui.finish_base_user_cmd)
    
    # append command into set of initialized commands
    sc_utils.appendIntoSet(session, Kernel.segment(), next_command, keynodes.ui.init_base_user_cmd, sc_core.pm.SC_CONST)