(self, items: list = None, path: str = None)
Used to create the menu. Recursively iterates through each element in the top level menu.
Used to create the menu. Recursively iterates through each element in the top level menu.
Used to create the menu . Recursively iterates through each element in the top level menu .
def compile(self, items: list = None, path: str = None):
        '''
        Used to create the menu. Recursively iterates through each element in the top level menu.
        '''
        if items == None:
            # run_admin()
            items = self.sub_items
            path = self.create_menu(self.name, self.path)

        for item in items:
            if item.isMenu:
                # if the item is a menu
                submenu_path = self.create_menu(item.name, path)
                self.compile(items=item.sub_items, path=submenu_path)
            else:
                # Otherwise the item is  a command
                if item.command == None:
                    # If a Python function is defined
                    func_name, func_file_name, func_dir_path = item.get_method_info()
                    new_command = None
                    if self.type in ['DIRECTORY_BACKGROUND', 'DESKTOP_BACKGROUND']:
                        # If it requires a background command
                        new_command = create_directory_background_command(
                            func_name, func_file_name, func_dir_path, item.params)
                    else:
                        # If it requires a file command
                        new_command = create_file_select_command(
                            func_name, func_file_name, func_dir_path, item.params)
                    self.create_command(item.name, path, new_command)
                elif item.command_vars != None:
                    # If the item has to be ran from os.system

                    new_command = create_shell_command(item.command, item.command_vars)
                    self.create_command(item.name, path, new_command)
                else:
                    # The item is just a plain old command
                    self.create_command(item.name, path, item.command)
def compile ( self , items : list = None , path : str = None ) : if items == None : # run_admin() items = self . sub_items path = self . create_menu ( self . name , self . path ) for item in items : if item . isMenu : # if the item is a menu submenu_path = self . create_menu ( item . name , path ) self . compile ( items = item . sub_items , path = submenu_path ) else : # Otherwise the item is  a command if item . command == None : # If a Python function is defined func_name , func_file_name , func_dir_path = item . get_method_info ( ) new_command = None if self . type in [ 'DIRECTORY_BACKGROUND' , 'DESKTOP_BACKGROUND' ] : # If it requires a background command new_command = create_directory_background_command ( func_name , func_file_name , func_dir_path , item . params ) else : # If it requires a file command new_command = create_file_select_command ( func_name , func_file_name , func_dir_path , item . params ) self . create_command ( item . name , path , new_command ) elif item . command_vars != None : # If the item has to be ran from os.system new_command = create_shell_command ( item . command , item . command_vars ) self . create_command ( item . name , path , new_command ) else : # The item is just a plain old command self . create_command ( item . name , path , item . command )