How do I change material render preview? by using Python

enter image description here

I want to change the render material preview by removing the floor in the preview and replacing all the lighting and environment in it with an hdri image, and setting an image as a background, so that the render preview changes from this:

enter image description here

To this:

enter image description here

I also want the material shown in the preview to look the same in Blender’s file browser when I use append, like this:


So how do I do all this?
I do not mind using programming with Python if there is no other than this solution.
I have no problem creating a new ui panel in the region of properties editor as a new material preview panel (not a thumbnail images list)

I guess that is not possible only with python, you have to code it in the core, i would suggest to ask the question here:

I want to to create a new panel using Python that contains a small window consisting of two layers of images:
1- A fixed image layer that does not change (the background that will appear behind the material ball)
2- An image layer for the material sphere (or any other shape) that changes according to the material properties change, with a transparent background so that the first layer appears behind the material sphere.
I think that the second layer will not change directly nor the properties of the material associated with the model, but rather the properties of the material must be specified first, then pressing a button that performs the submit function to replace the second layer of the image of the material with the old properties with image of the material with the new properties and apply the new properties to the material associated with the object, as it will appear on the surface of the material sphere reflection of light, or HDRI (reflection of the illumination of the surrounding “world”).
I am trying to adjust the settings and the user interface in Blender, for