GUI
This section describe the objects used to launch a GUI explorer.
- class fractalshades.gui.guimodel.Fractal_GUI(func)[source]
- __init__(func)[source]
- Parameters:
- funccallable with signature (
fs.Fractal
,**kwargs
). The function definition shall provide ‘type hints’ that will be used by the the GUI to select / customize the appropriate editor. Each parameter will be displayed interactively and will be editable. The editor might be a simple text box, or for more complex objects a full pop-up or a dockable window.
The first parameter shall be a
fractalshades.Fractal
object, and its name shall be “fractal”. It is also partially editable: the parameters from the __init__ method will be user-tunable (it is not possible to change the fractal type or the base directory during a GUI interactive session)
- funccallable with signature (
Notes
Theses notes give further details regarding the definition of the
func
parameterNote
Regarding
Type hints
in Python, for a full specification, please see PEP_484. For a simplified introduction to type hints, see PEP_483. Fractalshades only support a subset of these, details below.Note
- Currently the following parameters types are supported :
float
int
bool
mpmath.mpf
(arbitrary precision floating point)fs.colors.Color=(0., 0., 1.)
(RGB color)fs.colors.Color=(0., 0., 1., 0)
(RGBA color)fs.numpy_utils.Numpy_expr
(defines a numpy function from string)fs.Fractal
subclassesfs.colors.Fractal_colormap
fs.colors.Blinn_lighting
fs.gui.separator
(used to group a set of parameters under a title)fs.gui.collapsible_separator
(same as above, collapsible)
A parameter that the user will chose among a list of discrete values can be represented by a
typing.Literal
:listed: typing.Literal["a", "b", "c", 1, None]="c"
Also,
typing.Union
ortyping.Optional
derived of supported base types are supported (in this case a combo box to chose one type among those authorized be available):typing.Union[int, float, str] typing.Optional[float]
Note
An example of a valid
func
parameter signature is show below:import typing import fractalshades.models as fsm def func( fractal: fsm.Perturbation_mandelbrot=fractal, calc_name: str=calc_name, _1: fsgui.separator="Zoom parameters", x: mpmath.mpf=x, y: mpmath.mpf=y, dx: mpmath.mpf=dx, xy_ratio: float=xy_ratio, dps: int= dps, _2: fsgui.collapsible_separator="Calculation parameters", max_iter: int=max_iter, optional_float: typing.Optional[float]=3.14159, choices_str: typing.Literal["a", "b", "c"]="c", nx: int=nx, interior_detect: bool=interior_detect, interior_color: QtGui.QColor=(0., 0., 1.), transparent_color: QtGui.QColor=(0., 0., 1., 0.), probes_zmax: float=probes_zmax, epsilon_stationnary: float=epsilon_stationnary, colormap: fs.colors.Fractal_colormap=colormap func: fs.numpy_utils.Numpy_expr = ( fs.numpy_utils.Numpy_expr("x", "np.log(x)") ), ):
- connect_image(image_param='calc_name')[source]
Associate a image file with the GUI main diplay
- Parameters:
- image_param: str
Name of the image file to display. This image file shall be created by the function
func
in the same directory as the main script.
- connect_mouse(x='x', y='y', dx='dx', nx='nx', xy_ratio='xy_ratio', theta_deg='theta_deg', dps='dps', **kwargs)[source]
Binds some parameters of the
func
passed to thefractalshades.gui.Fractal_GUI
constructor with GUI mouse events.- Parameters:
- x: str
Name of the parameter for the x-axis center of the image
- y: str
Name of the parameter for the y-axis center of the image
- dx: str
Name of the parameter for the x-axis width of the image
- nx: str
Name of the parameter for the x-axis width of the image
- xy_ratio: str
Name of the parameter for the ratio width / height of the image
- dps: str | None
Name of the parameter for the precision in base-10 digits (mpmath arbitrary precision). If not using arbitrary precision, it is NEEDED to pass None.
- theta_deg: str
Name of the parameter for the image rotation angle in degree.
- other_parameters: dict
Pairs of (key, value) for additionnal parameters (skew, …)
- class fractalshades.gui.guitemplates.std_zooming(fractal)[source]
- __init__(fractal)[source]
A generic zooming function to explore standard or perturbation Fractals, intended for use with a GUI
fs.gui.guimodel.Fractal_GUI
Compatible with :
holomorphic or non-holomorphic (Burning-ship & al) variants
optional fieldlines
optional shading
optional interior plots based on cycle attractivity & order
optional deepzoom implementation
- Parameters:
- fractal: `fs.Fractal`
The fractal object to explore
Notes
Note
A typical use case is show below (see also the interactive examples from the Gallery section):
fractal = fsm.Perturbation_mandelbrot(plot_dir) zooming = fs.gui.guitemplates.std_zooming(fractal) gui = fs.gui.guimodel.Fractal_GUI(zooming) gui.show()