(self, name: str, items: list)
Builds the body commands of the script.
Builds the body commands of the script.
Builds the body commands of the script .
def build_script_body(self, name: str, items: list):
        '''
        Builds the body commands of the script.
        '''
        top_item = self.generate_item(name)
        top_menu = self.generate_menu()
        submenu_com = self.set_submenu(top_item.name, top_menu.name)
        self.commands.append(top_item.code)
        self.commands.append(top_menu.code)
        self.commands.append(submenu_com)

        for item in items:
            if item.isMenu:
                subsubmenu_con = self.append_item(
                    top_menu.name, self.get_next_item())
                self.build_script_body(item.name, item.sub_items)
                self.commands.append(subsubmenu_con)
            else:
                # if the item is a command
                formatted_command = self.generate_item(item.name)
                self.commands.append(formatted_command.code)

                connected_func = None

                if item.python != None:
                    # if there is a python function
                    item_info = item.get_method_info()
                    connected_func = self.generate_python_func(
                        item_info[1], item_info[0], item.params)
                    self.script_dirs.append(item_info[2])
                    self.imports.append(item_info[1])
                elif item.command_vars != None:
                    # if the command requries parameters
                    connected_func = self.generate_mod_command_func(item.command, item.command_vars)
                else:
                    # if the command is simply normal
                    connected_func = self.generate_command_func(item.command)
                    # connected_func = self.generate_func('os', 'system')

                self.funcs.append(connected_func.code)

                connected_command = self.connect(
                    formatted_command.name, connected_func.name)
                self.commands.append(connected_command)

                formatted_command = self.append_item(
                    top_menu.name, formatted_command.name)
                self.commands.append(formatted_command)
def build_script_body ( self , name : str , items : list ) : top_item = self . generate_item ( name ) top_menu = self . generate_menu ( ) submenu_com = self . set_submenu ( top_item . name , top_menu . name ) self . commands . append ( top_item . code ) self . commands . append ( top_menu . code ) self . commands . append ( submenu_com ) for item in items : if item . isMenu : subsubmenu_con = self . append_item ( top_menu . name , self . get_next_item ( ) ) self . build_script_body ( item . name , item . sub_items ) self . commands . append ( subsubmenu_con ) else : # if the item is a command formatted_command = self . generate_item ( item . name ) self . commands . append ( formatted_command . code ) connected_func = None if item . python != None : # if there is a python function item_info = item . get_method_info ( ) connected_func = self . generate_python_func ( item_info [ 1 ] , item_info [ 0 ] , item . params ) self . script_dirs . append ( item_info [ 2 ] ) self . imports . append ( item_info [ 1 ] ) elif item . command_vars != None : # if the command requries parameters connected_func = self . generate_mod_command_func ( item . command , item . command_vars ) else : # if the command is simply normal connected_func = self . generate_command_func ( item . command ) # connected_func = self.generate_func('os', 'system') self . funcs . append ( connected_func . code ) connected_command = self . connect ( formatted_command . name , connected_func . name ) self . commands . append ( connected_command ) formatted_command = self . append_item ( top_menu . name , formatted_command . name ) self . commands . append ( formatted_command )