code: def create_context_menu_actions(self):
          
          actions = []
          fnames = self.get_selected_filenames()
          new_actions = self.create_file_new_actions(fnames)
          if len(new_actions) > 1:
              # Creating a submenu only if there is more than one entry
              new_act_menu = QMenu(_('New'), self)
              add_actions(new_act_menu, new_actions)
              actions.append(new_act_menu)
          else:
              actions += new_actions
          import_actions = self.create_file_import_actions(fnames)
          if len(import_actions) > 1:
              # Creating a submenu only if there is more than one entry
              import_act_menu = QMenu(_('Import'), self)
              add_actions(import_act_menu, import_actions)
              actions.append(import_act_menu)
          else:
              actions += import_actions
          if actions:
              actions.append(None)
          if fnames:
              actions += self.create_file_manage_actions(fnames)
          if actions:
              actions.append(None)
          if fnames and all([osp.isdir(_fn) for _fn in fnames]):
              actions += self.create_folder_manage_actions(fnames)
          return actions
docs: Create context menu actions