vedo.settings

  1#!/usr/bin/env python3
  2# -*- coding: utf-8 -*-
  3import os
  4
  5__docformat__ = "google"
  6
  7class Settings:
  8    """
  9    General settings to modify the global behavior
 10
 11    Usage Example:
 12        ```python
 13        from vedo import settings, Cube
 14        settings.use_parallel_projection = True
 15        Cube().color('g').show().close()
 16        ```
 17
 18    List of available properties:
 19
 20    ```python
 21    # Set a default for the font to be used for axes, comments etc.
 22    default_font = 'Normografo' # check font options in shapes.Text
 23
 24    # Palette number when using an integer to choose a color
 25    palette = 0
 26
 27    # Scale magnification of the screenshot (must be an integer)
 28    screeshot_scale = 1
 29    screenshot_transparent_background = False
 30    screeshot_large_image = False # Sometimes setting this to True gives better results
 31
 32    # [DISABLED] Allow to continuously interact with scene during interactive() execution
 33    allow_interaction = True
 34
 35    # enable tracking pipeline functionality: 
 36    #  allows to show a graph with the pipeline of action which let to a final object
 37    #  this is achieved by calling "myobj.pipeline.show()" (a new window will pop up)
 38    self.enable_pipeline = True
 39
 40    # Set up default mouse and keyboard functionalities
 41    enable_default_mouse_callbacks = True
 42    enable_default_keyboard_callbacks = True
 43
 44    # If False, when multiple renderers are present do not render each one for separate
 45    #  but do it just once at the end (when interactive() is called)
 46    immediate_rendering = True
 47
 48    # Show a gray frame margin in multirendering windows
 49    renderer_frame_color = None
 50    renderer_frame_alpha = 0.5
 51    renderer_frame_width = 0.5
 52    renderer_frame_padding = 0.0001
 53
 54    # In multirendering mode set the position of the horizontal of vertical splitting [0,1]
 55    window_splitting_position = None
 56
 57    # Enable / disable color printing by printc()
 58    enable_print_color = True
 59
 60    # Wrap lines in tubes
 61    render_lines_as_tubes = False
 62
 63    # Smoothing options
 64    point_smoothing = False
 65    line_smoothing = False
 66    polygon_smoothing = False
 67
 68    # Remove hidden lines when in wireframe mode
 69    hidden_line_removal = False
 70
 71    # Turn on/off the automatic repositioning of lights as the camera moves.
 72    light_follows_camera = False
 73    two_sided_lighting = True
 74
 75    # Turn on/off rendering of translucent material with depth peeling technique.
 76    use_depth_peeling = False
 77    alpha_bit_planes  = True   # options only active if useDepthPeeling=True
 78    multi_samples     = 8      # force to not pick a framebuffer with a multisample buffer
 79    max_number_of_peels= 4     # maximum number of rendering passes
 80    occlusion_ratio   = 0.0    # occlusion ratio, 0 = exact image.
 81
 82    # Turn on/off nvidia FXAA post-process anti-aliasing, if supported.
 83    use_fxaa = False           # either True or False
 84
 85    # By default, the depth buffer is reset for each renderer.
 86    #  If True, use the existing depth buffer
 87    preserve_depth_buffer = False
 88
 89    # Use a polygon/edges offset to possibly resolve conflicts in rendering
 90    use_polygon_offset    = False
 91    polygon_offset_factor = 0.1
 92    polygon_offset_units  = 0.1
 93
 94    # Interpolate scalars to render them smoothly
 95    interpolate_scalars_before_mapping = True
 96
 97    # Set parallel projection On or Off (place camera to infinity, no perspective effects)
 98    use_parallel_projection = False
 99
100    # Set orientation type when reading TIFF files (volumes):
101    # TOPLEFT  1 (row 0 top, col 0 lhs)    TOPRIGHT 2 (row 0 top, col 0 rhs)
102    # BOTRIGHT 3 (row 0 bottom, col 0 rhs) BOTLEFT  4 (row 0 bottom, col 0 lhs)
103    # LEFTTOP  5 (row 0 lhs, col 0 top)    RIGHTTOP 6 (row 0 rhs, col 0 top)
104    # RIGHTBOT 7 (row 0 rhs, col 0 bottom) LEFTBOT  8 (row 0 lhs, col 0 bottom)
105    tiff_orientation_type = 1
106
107    # Annotated cube axis type nr. 5 options:
108    annotated_cube_color      = (0.75, 0.75, 0.75)
109    annotated_cube_text_color = None # use default, otherwise specify a single color
110    annotated_cube_text_scale = 0.2
111    annotated_cube_texts      = ["right","left ", "front","back ", " top ", "bttom"]
112
113    # Automatically close the Plotter instance after show() in jupyter sessions
114    # setting it to False will keep the current Plotter instance active
115    backend_autoclose = True
116
117    # k3d settings for jupyter notebooks
118    k3d_menu_visibility = True
119    k3d_plot_height = 512
120    k3d_antialias   = True
121    k3d_lighting    = 1.2
122    k3d_camera_autofit = True
123    k3d_grid_autofit= True
124    k3d_axes_helper = True    # size of the small triad of axes on the bottom right
125    k3d_point_shader= "mesh"  # others are '3d', '3dSpecular', 'dot', 'flat'
126    k3d_line_shader = "thick" # others are 'flat', 'mesh'
127    ```
128    """
129
130    # Restrict the attributes so accidental typos will generate an AttributeError exception
131    __slots__ = [
132        "_level",
133        "default_font",
134        "default_backend",
135        "palette",
136        "remember_last_figure_format",
137        "screeshot_scale",
138        "screenshot_transparent_background",
139        "screeshot_large_image",
140        "allow_interaction",
141        "hack_call_screen_size",
142        "enable_default_mouse_callbacks",
143        "enable_default_keyboard_callbacks",
144        "enable_pipeline",
145        "immediate_rendering",
146        "renderer_frame_color",
147        "renderer_frame_alpha",
148        "renderer_frame_width",
149        "renderer_frame_padding",
150        "render_lines_as_tubes",
151        "hidden_line_removal",
152        "point_smoothing",
153        "line_smoothing",
154        "polygon_smoothing",
155        "visible_grid_edges",
156        "light_follows_camera",
157        "two_sided_lighting",
158        "use_depth_peeling",
159        "multi_samples",
160        "alpha_bit_planes",
161        "max_number_of_peels",
162        "occlusion_ratio",
163        "use_fxaa",
164        "preserve_depth_buffer",
165        "use_polygon_offset",
166        "polygon_offset_factor",
167        "polygon_offset_units",
168        "interpolate_scalars_before_mapping",
169        "use_parallel_projection",
170        "window_splitting_position",
171        "tiff_orientation_type",
172        "annotated_cube_color",
173        "annotated_cube_text_color",
174        "annotated_cube_text_scale",
175        "annotated_cube_texts",
176        "enable_print_color",
177        "backend_autoclose",
178        "k3d_menu_visibility",
179        "k3d_plot_height",
180        "k3d_antialias",
181        "k3d_lighting",
182        "k3d_camera_autofit",
183        "k3d_grid_autofit",
184        "k3d_axes_helper",
185        "k3d_point_shader",
186        "k3d_line_shader",
187        "font_parameters",
188    ]
189
190    def __init__(self, level=0):
191        """Contructor."""
192
193        self._level = level
194
195        # Default font
196        self.default_font = "Normografo"
197
198        # Default backend engine in jupyter notebooks
199        self.default_backend = "vtk"
200
201        # enable tracking pipeline functionality
202        self.enable_pipeline = True
203
204        if any(["SPYDER" in name for name in os.environ]):
205            self.default_backend = "vtk"
206        else:
207            try:
208                get_ipython()
209                self.default_backend = "2d"
210            except NameError:
211                pass
212
213        # Palette number when using an integer to choose a color
214        self.palette = 0
215
216        self.remember_last_figure_format = False
217
218        # Scale magnification of the screenshot (must be an integer)
219        self.screeshot_scale = 1
220        self.screenshot_transparent_background = False
221        self.screeshot_large_image = False
222
223        # [DISABLED] Allow to continuously interact with scene during interactor.Start() execution
224        self.allow_interaction = True
225
226        # BUG in vtk9.0 (if true close works but sometimes vtk crashes, if false doesnt crash but cannot close)
227        # see plotter.py line 555
228        self.hack_call_screen_size = True
229
230        # Set up default mouse and keyboard functionalities
231        self.enable_default_mouse_callbacks = True
232        self.enable_default_keyboard_callbacks = True
233
234        # When multiple renderers are present do not render each one for separate.
235        # but do it just once at the end (when interactive() is called)
236        self.immediate_rendering = True
237
238        # Show a gray frame margin in multirendering windows
239        self.renderer_frame_color = None
240        self.renderer_frame_alpha = 0.5
241        self.renderer_frame_width = 0.5
242        self.renderer_frame_padding = 0.0001
243
244        # Wrap lines in tubes
245        self.render_lines_as_tubes = False
246
247        # Remove hidden lines when in wireframe mode
248        self.hidden_line_removal = False
249
250        # Smoothing options
251        self.point_smoothing = False
252        self.line_smoothing = False
253        self.polygon_smoothing = False
254
255        # For Structured and RectilinearGrid: show internal edges not only outline
256        self.visible_grid_edges = False
257
258        # Turn on/off the automatic repositioning of lights as the camera moves.
259        self.light_follows_camera = False
260        self.two_sided_lighting = True
261
262        # Turn on/off rendering of translucent material with depth peeling technique.
263        self.use_depth_peeling = False
264        self.multi_samples = 8
265        self.alpha_bit_planes = 1
266        self.max_number_of_peels = 4
267        self.occlusion_ratio = 0.1
268
269        # Turn on/off nvidia FXAA anti-aliasing, if supported.
270        self.use_fxaa = False  # either True or False
271
272        # By default, the depth buffer is reset for each renderer. If true, use the existing depth buffer
273        self.preserve_depth_buffer = False
274
275        # Use a polygon/edges offset to possibly resolve conflicts in rendering
276        self.use_polygon_offset = True
277        self.polygon_offset_factor = 0.1
278        self.polygon_offset_units  = 0.1
279
280        # Interpolate scalars to render them smoothly
281        self.interpolate_scalars_before_mapping = True
282
283        # Set parallel projection On or Off (place camera to infinity, no perspective effects)
284        self.use_parallel_projection = False
285
286        # In multirendering mode set the position of the horizontal of vertical splitting [0,1]
287        self.window_splitting_position = None
288
289        # Set orientation type when reading TIFF files (volumes):
290        # TOPLEFT  1 (row 0 top, col 0 lhs)    TOPRIGHT 2 (row 0 top, col 0 rhs)
291        # BOTRIGHT 3 (row 0 bottom, col 0 rhs) BOTLEFT  4 (row 0 bottom, col 0 lhs)
292        # LEFTTOP  5 (row 0 lhs, col 0 top)    RIGHTTOP 6 (row 0 rhs, col 0 top)
293        # RIGHTBOT 7 (row 0 rhs, col 0 bottom) LEFTBOT  8 (row 0 lhs, col 0 bottom)
294        self.tiff_orientation_type = 1
295
296        # AnnotatedCube axis (type 5) customization:
297        self.annotated_cube_color = (0.75, 0.75, 0.75)
298        self.annotated_cube_text_color = None # use default, otherwise specify a single color
299        self.annotated_cube_text_scale = 0.2
300        self.annotated_cube_texts = ["right","left ", "front","back ", " top ", "bttom"]
301
302        # enable / disable color printing
303        self.enable_print_color = True
304
305        ####################################################################################
306        # Automatically close the Plotter instance after show() in jupyter sessions,
307        #  setting it to False will keep the current Plotter instance active
308        self.backend_autoclose = True
309
310        # k3d settings for jupyter notebooks
311        self.k3d_menu_visibility = True
312        self.k3d_plot_height = 512
313        self.k3d_antialias  = True
314        self.k3d_lighting   = 1.2
315        self.k3d_camera_autofit = True
316        self.k3d_grid_autofit= True
317        self.k3d_axes_helper = True    # size of the small triad of axes on the bottom right
318        self.k3d_point_shader= "mesh"  # others are '3d', '3dSpecular', 'dot', 'flat'
319        self.k3d_line_shader = "thick" # others are 'flat', 'mesh'
320
321        ####################################################################################
322        ####################################################################################
323        # mono       # means that all letters occupy the same space slot horizontally
324        # hspacing   # an horizontal stretching factor (affects both letters and words)
325        # lspacing   # horizontal spacing inbetween letters (not words)
326        # islocal    # is locally stored in /fonts, otherwise it's on vedo.embl.es/fonts
327        #
328        self.font_parameters = dict(
329            Normografo=dict(
330                mono=False,
331                fscale=0.75,
332                hspacing=1,
333                lspacing=0.2,
334                dotsep="~·",
335                islocal=True,
336            ),
337            Bongas=dict(
338                mono=False,
339                fscale=0.875,
340                hspacing=0.52,
341                lspacing=0.25,
342                dotsep="·",
343                islocal=True,
344            ),
345            Calco=dict(
346                mono=True,
347                fscale=0.8,
348                hspacing=1,
349                lspacing=0.1,
350                dotsep="·",
351                islocal=True,
352            ),
353            Comae=dict(
354                mono=False,
355                fscale=0.75,
356                lspacing=0.2,
357                hspacing=1,
358                dotsep="~·",
359                islocal=True,
360            ),
361            ComicMono=dict(
362                mono=True,
363                fscale=0.8,
364                hspacing=1,
365                lspacing=0.1,
366                dotsep="·",
367                islocal=False,
368            ),
369            Edo=dict(
370                mono=False,
371                fscale=0.75,
372                hspacing=1,
373                lspacing=0.2,
374                dotsep="·~~",
375                islocal=False,
376            ),
377            FiraMonoMedium=dict(
378                mono=True,
379                fscale=0.8,
380                hspacing=1,
381                lspacing=0.1,
382                dotsep="·",
383                islocal=False,
384            ),
385            FiraMonoBold=dict(
386                mono=True,
387                fscale=0.8,
388                hspacing=1,
389                lspacing=0.1,
390                dotsep="·",
391                islocal=False,
392            ),
393            Glasgo=dict(
394                mono=True,
395                fscale=0.75,
396                lspacing=0.1,
397                hspacing=1,
398                dotsep="·",
399                islocal=True,
400            ),
401            Kanopus=dict(
402                mono=False,
403                fscale=0.75,
404                lspacing=0.15,
405                hspacing=0.75,
406                dotsep="~·",
407                islocal=True,
408            ),
409            LogoType=dict(
410                mono=False,
411                fscale=0.75,
412                hspacing=1,
413                lspacing=0.2,
414                dotsep="·~~",
415                islocal=False,
416            ),
417            Quikhand=dict(
418                mono=False,
419                fscale=0.8,
420                hspacing=0.6,
421                lspacing=0.15,
422                dotsep="~~·~",
423                islocal=True,
424            ),
425            SmartCouric=dict(
426                mono=True,
427                fscale=0.8,
428                hspacing=1.05,
429                lspacing=0.1,
430                dotsep="·",
431                islocal=True,
432            ),
433            Spears=dict(
434                mono=False,
435                fscale=0.8,
436                hspacing=0.5,
437                lspacing=0.2,
438                dotsep="·",
439                islocal=False,
440            ),
441            Theemim=dict(
442                mono=False,
443                fscale=0.825,
444                hspacing=0.52,
445                lspacing=0.3,
446                dotsep="~·",
447                islocal=True,
448            ),
449            VictorMono=dict(
450                mono=True,
451                fscale=0.725,
452                hspacing=1,
453                lspacing=0.1,
454                dotsep="·",
455                islocal=True,
456            ),
457            Justino1=dict(
458                mono=True,
459                fscale=0.725,
460                hspacing=1,
461                lspacing=0.1,
462                dotsep="·",
463                islocal=False,
464            ),
465            Justino2=dict(
466                mono=True,
467                fscale=0.725,
468                hspacing=1,
469                lspacing=0.1,
470                dotsep="·",
471                islocal=False,
472            ),
473            Justino3=dict(
474                mono=True,
475                fscale=0.725,
476                hspacing=1,
477                lspacing=0.1,
478                dotsep="·",
479                islocal=False,
480            ),
481            Calibri=dict(
482                mono=False,
483                fscale=0.75,
484                hspacing=1,
485                lspacing=0.2,
486                dotsep="~·",
487                islocal=False,
488            ),
489            Capsmall=dict(
490                mono=False,
491                fscale=0.8,
492                hspacing=0.75,
493                lspacing=0.15,
494                dotsep="·",
495                islocal=False,
496            ),
497            Cartoons123=dict(
498                mono=False,
499                fscale=0.8,
500                hspacing=0.75,
501                lspacing=0.15,
502                dotsep="·",
503                islocal=False,
504            ),
505            Vega=dict(
506                mono=False,
507                fscale=0.8,
508                hspacing=0.75,
509                lspacing=0.15,
510                dotsep="·",
511                islocal=False,
512            ),
513            Meson=dict(
514                mono=False,
515                fscale=0.8,
516                hspacing=0.9,
517                lspacing=0.225,
518                dotsep="~^.~ ",
519                islocal=False,
520            ),
521            Komika=dict(
522                mono=False,
523                fscale=0.7,
524                hspacing=0.75,
525                lspacing=0.225,
526                dotsep="~^.~ ",
527                islocal=False,
528            ),
529            Vogue=dict(
530                mono=False,
531                fscale=0.7,
532                hspacing=0.75,
533                lspacing=0.225,
534                dotsep="~^.~ ",
535                islocal=False,
536            ),
537            Brachium=dict(
538                mono=True,
539                fscale=0.8,
540                hspacing=1,
541                lspacing=0.1,
542                dotsep="·",
543                islocal=False,
544            ),
545            Dalim=dict(
546                mono=False,
547                fscale=0.75,
548                lspacing=0.2,
549                hspacing=1,
550                dotsep="~·",
551                islocal=False,
552            ),
553            Miro=dict(
554                mono=False,
555                fscale=0.75,
556                lspacing=0.2,
557                hspacing=1,
558                dotsep="~·",
559                islocal=False,
560            ),
561            Ubuntu=dict(
562                mono=False,
563                fscale=0.75,
564                lspacing=0.2,
565                hspacing=1,
566                dotsep="~·",
567                islocal=False,
568            ),
569            Mizar=dict(
570                mono=False,
571                fscale=0.75,
572                lspacing=0.2,
573                hspacing=0.75,
574                dotsep="~·",
575                islocal=False,
576            ),
577            LiberationSans=dict(
578                mono=False,
579                fscale=0.75,
580                lspacing=0.2,
581                hspacing=1,
582                dotsep="~·",
583                islocal=False,
584            ),
585            DejavuSansMono=dict(
586                mono=True,
587                fscale=0.725,
588                hspacing=1,
589                lspacing=0.1,
590                dotsep="·",
591                islocal=False,
592            ),
593            SunflowerHighway=dict(
594                mono=False,
595                fscale=0.75,
596                lspacing=0.2,
597                hspacing=1,
598                dotsep="~·",
599                islocal=False,
600            ),
601            Swansea=dict(
602                mono=False,
603                fscale=0.75,
604                lspacing=0.2,
605                hspacing=1,
606                dotsep="~·",
607                islocal=False,
608            ),
609            Housekeeper=dict(  # support chinese glyphs
610                mono=False,
611                fscale=0.75,
612                hspacing=1,
613                lspacing=0.2,
614                dotsep="~·",
615                islocal=False,
616            ),
617            Wananti=dict(  # support chinese glyphs
618                mono=False,
619                fscale=0.75,
620                hspacing=1,
621                lspacing=0.2,
622                dotsep="~·",
623                islocal=False,
624            ),
625            AnimeAce=dict(
626                mono=False,
627                fscale=0.75,
628                hspacing=1,
629                lspacing=0.2,
630                dotsep="~·",
631                islocal=False,
632            ),
633            AnimeAceBold=dict(
634                mono=False,
635                fscale=0.75,
636                hspacing=1,
637                lspacing=0.2,
638                dotsep="~·",
639                islocal=False,
640            ),
641        )
642
643    ####################################################################################
644    def reset(self):
645        """Reset all settings to their default status."""
646        self.__init__()
647
648    def print(self):
649        """Print function."""
650        print(' ' + '-'*80)
651        s = Settings.__doc__.replace('   ','')
652        s = s.replace(".. code-block:: python\n","")
653        try:
654            from pygments import highlight
655            from pygments.lexers import Python3Lexer
656            from pygments.formatters import Terminal256Formatter
657            s = highlight(s, Python3Lexer(), Terminal256Formatter(style='zenburn'))
658            print(s, end='')
659
660        except ModuleNotFoundError:
661            print("\x1b[33;1m" + s + "\x1b[0m")
662
663
664    def _warn(self, key):
665        if self._level == 0:
666            print(f'\x1b[1m\x1b[33;20m Warning! Please use "settings.{key}" instead!\x1b[0m')
667
668    def __getitem__(self, key):
669        """Make the class work like a dictionary too"""
670        return getattr(self, key)
671
672    def __setitem__(self, key, value):
673        """Make the class work like a dictionary too"""
674        setattr(self, key, value)
675
676
677    ####################################################################################
678    # Deprecations
679    ####################################################################################
680    @property
681    def defaultFont(self):
682        self._warn("default_font")
683        return self.default_font
684    @defaultFont.setter
685    def defaultFont(self, value):
686        self._warn("default_font")
687        self.default_font = value
688    ##################################
689    @property
690    def screeshotScale(self):
691        self._warn("screeshot_scale")
692        return self.screeshot_scale
693    @screeshotScale.setter
694    def screeshotScale(self, value):
695        self._warn("screeshot_scale")
696        self.screeshot_scale = value
697    ##################################
698    @property
699    def screenshotTransparentBackground(self):
700        self._warn("screenshot_transparent_background")
701        return self.NAME_SNAKE
702    @screenshotTransparentBackground.setter
703    def screenshotTransparentBackground(self, value):
704        self._warn("screenshot_transparent_background")
705        self.screenshot_transparent_background = value
706    ##################################
707    @property
708    def screeshotLargeImage(self):
709        self._warn("screeshot_large_image")
710        return self.screeshot_large_image
711    @screeshotLargeImage.setter
712    def screeshotLargeImage(self, value):
713        self._warn("screeshot_large_image")
714        self.screeshot_large_image = value
715    ##################################
716    @property
717    def allowInteraction(self):
718        self._warn("allow_interaction")
719        return self.allow_interaction
720    @allowInteraction.setter
721    def allowInteraction(self, value):
722        self._warn("allow_interaction")
723        self.allow_interaction = value
724    ##################################
725    @property
726    def enableDefaultMouseCallbacks(self):
727        self._warn("enable_default_mouse_callbacks")
728        return self.enable_default_mouse_callbacks
729    @enableDefaultMouseCallbacks.setter
730    def enableDefaultMouseCallbacks(self, value):
731        self._warn("enable_default_mouse_callbacks")
732        self.enable_default_mouse_callbacks = value
733    ##################################
734    @property
735    def enableDefaultKeyboardCallbacks(self):
736        self._warn("enable_default_keyboard_callbacks")
737        return self.enable_default_keyboard_callbacks
738    @enableDefaultKeyboardCallbacks.setter
739    def enableDefaultKeyboardCallbacks(self, value):
740        self._warn("enable_default_keyboard_callbacks")
741        self.enable_default_keyboard_callbacks = value
742    ##################################
743    @property
744    def immediateRendering(self):
745        self._warn("immediate_rendering")
746        return self.immediate_rendering
747    @immediateRendering.setter
748    def immediateRendering(self, value):
749        self._warn("immediate_rendering")
750        self.immediate_rendering = value
751    ##################################
752    @property
753    def renderLinesAsTubes(self):
754        self._warn("render_lines_as_tubes")
755        return self.render_lines_as_tubes
756    @renderLinesAsTubes.setter
757    def renderLinesAsTubes(self, value):
758        self._warn("render_lines_as_tubes")
759        self.render_lines_as_tubes = value
760    ##################################
761    @property
762    def hiddenLineRemoval(self):
763        self._warn("hidden_line_removal")
764        return self.hidden_line_removal
765    @hiddenLineRemoval.setter
766    def hiddenLineRemoval(self, value):
767        self._warn("hidden_line_removal")
768        self.hidden_line_removal = value
769    ##################################
770    @property
771    def pointSmoothing(self):
772        self._warn("point_smoothing")
773        return self.point_smoothing
774    @pointSmoothing.setter
775    def pointSmoothing(self, value):
776        self._warn("point_smoothing")
777        self.point_smoothing = value
778    ##################################
779    @property
780    def lightFollowsCamera(self):
781        self._warn("light_follows_camera")
782        return self.light_follows_camera
783    @lightFollowsCamera.setter
784    def lightFollowsCamera(self, value):
785        self._warn("light_follows_camera")
786        self.light_follows_camera = value
787    ##################################
788    @property
789    def twoSidedLighting(self):
790        self._warn("two_sided_lighting")
791        return self.two_sided_lighting
792    @twoSidedLighting.setter
793    def twoSidedLighting(self, value):
794        self._warn("two_sided_lighting")
795        self.two_sided_lighting = value
796    ##################################
797    @property
798    def useDepthPeeling(self):
799        self._warn("use_depth_peeling")
800        return self.use_depth_peeling
801    @useDepthPeeling.setter
802    def useDepthPeeling(self, value):
803        self._warn("use_depth_peeling")
804        self.use_depth_peeling = value
805    ##################################
806    @property
807    def multiSamples(self):
808        self._warn("multi_samples")
809        return self.multi_samples
810    @multiSamples.setter
811    def multiSamples(self, value):
812        self._warn("multi_samples")
813        self.multi_samples = value
814    ##################################
815    @property
816    def alphaBitPlanes(self):
817        self._warn("alpha_bit_planes")
818        return self.alpha_bit_planes
819    @alphaBitPlanes.setter
820    def alphaBitPlanes(self, value):
821        self._warn("alpha_bit_planes")
822        self.alpha_bit_planes = value
823    ##################################
824    @property
825    def maxNumberOfPeels(self):
826        self._warn("max_number_of_peels")
827        return self.max_number_of_peels
828    @maxNumberOfPeels.setter
829    def maxNumberOfPeels(self, value):
830        self._warn("max_number_of_peels")
831        self.max_number_of_peels = value
832    ##################################
833    @property
834    def occlusionRatio(self):
835        self._warn("occlusion_ratio")
836        return self.occlusion_ratio
837    @occlusionRatio.setter
838    def occlusionRatio(self, value):
839        self._warn("occlusion_ratio")
840        self.occlusion_ratio = value
841    ##################################
842    @property
843    def useFXAA(self):
844        self._warn("use_fxaa")
845        return self.use_fxaa
846    @useFXAA.setter
847    def useFXAA(self, value):
848        self._warn("use_fxaa")
849        self.use_fxaa = value
850    ##################################
851    @property
852    def preserveDepthBuffer(self):
853        self._warn("preserve_depth_buffer")
854        return self.preserve_depth_buffer
855    @preserveDepthBuffer.setter
856    def preserveDepthBuffer(self, value):
857        self._warn("preserve_depth_buffer")
858        self.preserve_depth_buffer = value
859    ##################################
860    @property
861    def usePolygonOffset(self):
862        self._warn("use_polygon_offset")
863        return self.use_polygon_offset
864    @usePolygonOffset.setter
865    def usePolygonOffset(self, value):
866        self._warn("use_polygon_offset")
867        self.use_polygon_offset = value
868    ##################################
869    @property
870    def polygonOffsetFactor(self):
871        self._warn("polygon_offset_factor")
872        return self.polygon_offset_factor
873    @polygonOffsetFactor.setter
874    def polygonOffsetFactor(self, value):
875        self._warn("polygon_offset_factor")
876        self.polygon_offset_factor = value
877    ##################################
878    @property
879    def polygonOffsetUnits(self):
880        self._warn("polygon_offset_units")
881        return self.polygon_offset_units
882    @polygonOffsetUnits.setter
883    def polygonOffsetUnits(self, value):
884        self._warn("polygon_offset_units")
885        self.polygon_offset_units = value
886    ##################################
887    @property
888    def interpolateScalarsBeforeMapping(self):
889        self._warn("interpolate_scalars_before_mapping")
890        return self.interpolate_scalars_before_mapping
891    @interpolateScalarsBeforeMapping.setter
892    def interpolateScalarsBeforeMapping(self, value):
893        self._warn("interpolate_scalars_before_mapping")
894        self.interpolate_scalars_before_mapping = value
895    ##################################
896    @property
897    def useParallelProjection(self):
898        self._warn("use_parallel_projection")
899        return self.use_parallel_projection
900    @useParallelProjection.setter
901    def useParallelProjection(self, value):
902        self._warn("use_parallel_projection")
903        self.use_parallel_projection = value
904    ##################################
905    @property
906    def windowSplittingPosition(self):
907        self._warn("window_splitting_position")
908        return self.window_splitting_position
909    @windowSplittingPosition.setter
910    def windowSplittingPosition(self, value):
911        self._warn("window_splitting_position")
912        self.window_splitting_position = value
913    ##################################
914    @property
915    def tiffOrientationType(self):
916        self._warn("tiff_orientation_type")
917        return self.tiff_orientation_type
918    @tiffOrientationType.setter
919    def tiffOrientationType(self, value):
920        self._warn("tiff_orientation_type")
921        self.tiff_orientation_type = value
922    ##################################
923    @property
924    def enablePrintColor(self):
925        self._warn("enable_print_color")
926        return self.enable_print_color
927    @enablePrintColor.setter
928    def enablePrintColor(self, value):
929        self._warn("enable_print_color")
930        self.enable_print_color = value
class Settings:
  8class Settings:
  9    """
 10    General settings to modify the global behavior
 11
 12    Usage Example:
 13        ```python
 14        from vedo import settings, Cube
 15        settings.use_parallel_projection = True
 16        Cube().color('g').show().close()
 17        ```
 18
 19    List of available properties:
 20
 21    ```python
 22    # Set a default for the font to be used for axes, comments etc.
 23    default_font = 'Normografo' # check font options in shapes.Text
 24
 25    # Palette number when using an integer to choose a color
 26    palette = 0
 27
 28    # Scale magnification of the screenshot (must be an integer)
 29    screeshot_scale = 1
 30    screenshot_transparent_background = False
 31    screeshot_large_image = False # Sometimes setting this to True gives better results
 32
 33    # [DISABLED] Allow to continuously interact with scene during interactive() execution
 34    allow_interaction = True
 35
 36    # enable tracking pipeline functionality: 
 37    #  allows to show a graph with the pipeline of action which let to a final object
 38    #  this is achieved by calling "myobj.pipeline.show()" (a new window will pop up)
 39    self.enable_pipeline = True
 40
 41    # Set up default mouse and keyboard functionalities
 42    enable_default_mouse_callbacks = True
 43    enable_default_keyboard_callbacks = True
 44
 45    # If False, when multiple renderers are present do not render each one for separate
 46    #  but do it just once at the end (when interactive() is called)
 47    immediate_rendering = True
 48
 49    # Show a gray frame margin in multirendering windows
 50    renderer_frame_color = None
 51    renderer_frame_alpha = 0.5
 52    renderer_frame_width = 0.5
 53    renderer_frame_padding = 0.0001
 54
 55    # In multirendering mode set the position of the horizontal of vertical splitting [0,1]
 56    window_splitting_position = None
 57
 58    # Enable / disable color printing by printc()
 59    enable_print_color = True
 60
 61    # Wrap lines in tubes
 62    render_lines_as_tubes = False
 63
 64    # Smoothing options
 65    point_smoothing = False
 66    line_smoothing = False
 67    polygon_smoothing = False
 68
 69    # Remove hidden lines when in wireframe mode
 70    hidden_line_removal = False
 71
 72    # Turn on/off the automatic repositioning of lights as the camera moves.
 73    light_follows_camera = False
 74    two_sided_lighting = True
 75
 76    # Turn on/off rendering of translucent material with depth peeling technique.
 77    use_depth_peeling = False
 78    alpha_bit_planes  = True   # options only active if useDepthPeeling=True
 79    multi_samples     = 8      # force to not pick a framebuffer with a multisample buffer
 80    max_number_of_peels= 4     # maximum number of rendering passes
 81    occlusion_ratio   = 0.0    # occlusion ratio, 0 = exact image.
 82
 83    # Turn on/off nvidia FXAA post-process anti-aliasing, if supported.
 84    use_fxaa = False           # either True or False
 85
 86    # By default, the depth buffer is reset for each renderer.
 87    #  If True, use the existing depth buffer
 88    preserve_depth_buffer = False
 89
 90    # Use a polygon/edges offset to possibly resolve conflicts in rendering
 91    use_polygon_offset    = False
 92    polygon_offset_factor = 0.1
 93    polygon_offset_units  = 0.1
 94
 95    # Interpolate scalars to render them smoothly
 96    interpolate_scalars_before_mapping = True
 97
 98    # Set parallel projection On or Off (place camera to infinity, no perspective effects)
 99    use_parallel_projection = False
100
101    # Set orientation type when reading TIFF files (volumes):
102    # TOPLEFT  1 (row 0 top, col 0 lhs)    TOPRIGHT 2 (row 0 top, col 0 rhs)
103    # BOTRIGHT 3 (row 0 bottom, col 0 rhs) BOTLEFT  4 (row 0 bottom, col 0 lhs)
104    # LEFTTOP  5 (row 0 lhs, col 0 top)    RIGHTTOP 6 (row 0 rhs, col 0 top)
105    # RIGHTBOT 7 (row 0 rhs, col 0 bottom) LEFTBOT  8 (row 0 lhs, col 0 bottom)
106    tiff_orientation_type = 1
107
108    # Annotated cube axis type nr. 5 options:
109    annotated_cube_color      = (0.75, 0.75, 0.75)
110    annotated_cube_text_color = None # use default, otherwise specify a single color
111    annotated_cube_text_scale = 0.2
112    annotated_cube_texts      = ["right","left ", "front","back ", " top ", "bttom"]
113
114    # Automatically close the Plotter instance after show() in jupyter sessions
115    # setting it to False will keep the current Plotter instance active
116    backend_autoclose = True
117
118    # k3d settings for jupyter notebooks
119    k3d_menu_visibility = True
120    k3d_plot_height = 512
121    k3d_antialias   = True
122    k3d_lighting    = 1.2
123    k3d_camera_autofit = True
124    k3d_grid_autofit= True
125    k3d_axes_helper = True    # size of the small triad of axes on the bottom right
126    k3d_point_shader= "mesh"  # others are '3d', '3dSpecular', 'dot', 'flat'
127    k3d_line_shader = "thick" # others are 'flat', 'mesh'
128    ```
129    """
130
131    # Restrict the attributes so accidental typos will generate an AttributeError exception
132    __slots__ = [
133        "_level",
134        "default_font",
135        "default_backend",
136        "palette",
137        "remember_last_figure_format",
138        "screeshot_scale",
139        "screenshot_transparent_background",
140        "screeshot_large_image",
141        "allow_interaction",
142        "hack_call_screen_size",
143        "enable_default_mouse_callbacks",
144        "enable_default_keyboard_callbacks",
145        "enable_pipeline",
146        "immediate_rendering",
147        "renderer_frame_color",
148        "renderer_frame_alpha",
149        "renderer_frame_width",
150        "renderer_frame_padding",
151        "render_lines_as_tubes",
152        "hidden_line_removal",
153        "point_smoothing",
154        "line_smoothing",
155        "polygon_smoothing",
156        "visible_grid_edges",
157        "light_follows_camera",
158        "two_sided_lighting",
159        "use_depth_peeling",
160        "multi_samples",
161        "alpha_bit_planes",
162        "max_number_of_peels",
163        "occlusion_ratio",
164        "use_fxaa",
165        "preserve_depth_buffer",
166        "use_polygon_offset",
167        "polygon_offset_factor",
168        "polygon_offset_units",
169        "interpolate_scalars_before_mapping",
170        "use_parallel_projection",
171        "window_splitting_position",
172        "tiff_orientation_type",
173        "annotated_cube_color",
174        "annotated_cube_text_color",
175        "annotated_cube_text_scale",
176        "annotated_cube_texts",
177        "enable_print_color",
178        "backend_autoclose",
179        "k3d_menu_visibility",
180        "k3d_plot_height",
181        "k3d_antialias",
182        "k3d_lighting",
183        "k3d_camera_autofit",
184        "k3d_grid_autofit",
185        "k3d_axes_helper",
186        "k3d_point_shader",
187        "k3d_line_shader",
188        "font_parameters",
189    ]
190
191    def __init__(self, level=0):
192        """Contructor."""
193
194        self._level = level
195
196        # Default font
197        self.default_font = "Normografo"
198
199        # Default backend engine in jupyter notebooks
200        self.default_backend = "vtk"
201
202        # enable tracking pipeline functionality
203        self.enable_pipeline = True
204
205        if any(["SPYDER" in name for name in os.environ]):
206            self.default_backend = "vtk"
207        else:
208            try:
209                get_ipython()
210                self.default_backend = "2d"
211            except NameError:
212                pass
213
214        # Palette number when using an integer to choose a color
215        self.palette = 0
216
217        self.remember_last_figure_format = False
218
219        # Scale magnification of the screenshot (must be an integer)
220        self.screeshot_scale = 1
221        self.screenshot_transparent_background = False
222        self.screeshot_large_image = False
223
224        # [DISABLED] Allow to continuously interact with scene during interactor.Start() execution
225        self.allow_interaction = True
226
227        # BUG in vtk9.0 (if true close works but sometimes vtk crashes, if false doesnt crash but cannot close)
228        # see plotter.py line 555
229        self.hack_call_screen_size = True
230
231        # Set up default mouse and keyboard functionalities
232        self.enable_default_mouse_callbacks = True
233        self.enable_default_keyboard_callbacks = True
234
235        # When multiple renderers are present do not render each one for separate.
236        # but do it just once at the end (when interactive() is called)
237        self.immediate_rendering = True
238
239        # Show a gray frame margin in multirendering windows
240        self.renderer_frame_color = None
241        self.renderer_frame_alpha = 0.5
242        self.renderer_frame_width = 0.5
243        self.renderer_frame_padding = 0.0001
244
245        # Wrap lines in tubes
246        self.render_lines_as_tubes = False
247
248        # Remove hidden lines when in wireframe mode
249        self.hidden_line_removal = False
250
251        # Smoothing options
252        self.point_smoothing = False
253        self.line_smoothing = False
254        self.polygon_smoothing = False
255
256        # For Structured and RectilinearGrid: show internal edges not only outline
257        self.visible_grid_edges = False
258
259        # Turn on/off the automatic repositioning of lights as the camera moves.
260        self.light_follows_camera = False
261        self.two_sided_lighting = True
262
263        # Turn on/off rendering of translucent material with depth peeling technique.
264        self.use_depth_peeling = False
265        self.multi_samples = 8
266        self.alpha_bit_planes = 1
267        self.max_number_of_peels = 4
268        self.occlusion_ratio = 0.1
269
270        # Turn on/off nvidia FXAA anti-aliasing, if supported.
271        self.use_fxaa = False  # either True or False
272
273        # By default, the depth buffer is reset for each renderer. If true, use the existing depth buffer
274        self.preserve_depth_buffer = False
275
276        # Use a polygon/edges offset to possibly resolve conflicts in rendering
277        self.use_polygon_offset = True
278        self.polygon_offset_factor = 0.1
279        self.polygon_offset_units  = 0.1
280
281        # Interpolate scalars to render them smoothly
282        self.interpolate_scalars_before_mapping = True
283
284        # Set parallel projection On or Off (place camera to infinity, no perspective effects)
285        self.use_parallel_projection = False
286
287        # In multirendering mode set the position of the horizontal of vertical splitting [0,1]
288        self.window_splitting_position = None
289
290        # Set orientation type when reading TIFF files (volumes):
291        # TOPLEFT  1 (row 0 top, col 0 lhs)    TOPRIGHT 2 (row 0 top, col 0 rhs)
292        # BOTRIGHT 3 (row 0 bottom, col 0 rhs) BOTLEFT  4 (row 0 bottom, col 0 lhs)
293        # LEFTTOP  5 (row 0 lhs, col 0 top)    RIGHTTOP 6 (row 0 rhs, col 0 top)
294        # RIGHTBOT 7 (row 0 rhs, col 0 bottom) LEFTBOT  8 (row 0 lhs, col 0 bottom)
295        self.tiff_orientation_type = 1
296
297        # AnnotatedCube axis (type 5) customization:
298        self.annotated_cube_color = (0.75, 0.75, 0.75)
299        self.annotated_cube_text_color = None # use default, otherwise specify a single color
300        self.annotated_cube_text_scale = 0.2
301        self.annotated_cube_texts = ["right","left ", "front","back ", " top ", "bttom"]
302
303        # enable / disable color printing
304        self.enable_print_color = True
305
306        ####################################################################################
307        # Automatically close the Plotter instance after show() in jupyter sessions,
308        #  setting it to False will keep the current Plotter instance active
309        self.backend_autoclose = True
310
311        # k3d settings for jupyter notebooks
312        self.k3d_menu_visibility = True
313        self.k3d_plot_height = 512
314        self.k3d_antialias  = True
315        self.k3d_lighting   = 1.2
316        self.k3d_camera_autofit = True
317        self.k3d_grid_autofit= True
318        self.k3d_axes_helper = True    # size of the small triad of axes on the bottom right
319        self.k3d_point_shader= "mesh"  # others are '3d', '3dSpecular', 'dot', 'flat'
320        self.k3d_line_shader = "thick" # others are 'flat', 'mesh'
321
322        ####################################################################################
323        ####################################################################################
324        # mono       # means that all letters occupy the same space slot horizontally
325        # hspacing   # an horizontal stretching factor (affects both letters and words)
326        # lspacing   # horizontal spacing inbetween letters (not words)
327        # islocal    # is locally stored in /fonts, otherwise it's on vedo.embl.es/fonts
328        #
329        self.font_parameters = dict(
330            Normografo=dict(
331                mono=False,
332                fscale=0.75,
333                hspacing=1,
334                lspacing=0.2,
335                dotsep="~·",
336                islocal=True,
337            ),
338            Bongas=dict(
339                mono=False,
340                fscale=0.875,
341                hspacing=0.52,
342                lspacing=0.25,
343                dotsep="·",
344                islocal=True,
345            ),
346            Calco=dict(
347                mono=True,
348                fscale=0.8,
349                hspacing=1,
350                lspacing=0.1,
351                dotsep="·",
352                islocal=True,
353            ),
354            Comae=dict(
355                mono=False,
356                fscale=0.75,
357                lspacing=0.2,
358                hspacing=1,
359                dotsep="~·",
360                islocal=True,
361            ),
362            ComicMono=dict(
363                mono=True,
364                fscale=0.8,
365                hspacing=1,
366                lspacing=0.1,
367                dotsep="·",
368                islocal=False,
369            ),
370            Edo=dict(
371                mono=False,
372                fscale=0.75,
373                hspacing=1,
374                lspacing=0.2,
375                dotsep="·~~",
376                islocal=False,
377            ),
378            FiraMonoMedium=dict(
379                mono=True,
380                fscale=0.8,
381                hspacing=1,
382                lspacing=0.1,
383                dotsep="·",
384                islocal=False,
385            ),
386            FiraMonoBold=dict(
387                mono=True,
388                fscale=0.8,
389                hspacing=1,
390                lspacing=0.1,
391                dotsep="·",
392                islocal=False,
393            ),
394            Glasgo=dict(
395                mono=True,
396                fscale=0.75,
397                lspacing=0.1,
398                hspacing=1,
399                dotsep="·",
400                islocal=True,
401            ),
402            Kanopus=dict(
403                mono=False,
404                fscale=0.75,
405                lspacing=0.15,
406                hspacing=0.75,
407                dotsep="~·",
408                islocal=True,
409            ),
410            LogoType=dict(
411                mono=False,
412                fscale=0.75,
413                hspacing=1,
414                lspacing=0.2,
415                dotsep="·~~",
416                islocal=False,
417            ),
418            Quikhand=dict(
419                mono=False,
420                fscale=0.8,
421                hspacing=0.6,
422                lspacing=0.15,
423                dotsep="~~·~",
424                islocal=True,
425            ),
426            SmartCouric=dict(
427                mono=True,
428                fscale=0.8,
429                hspacing=1.05,
430                lspacing=0.1,
431                dotsep="·",
432                islocal=True,
433            ),
434            Spears=dict(
435                mono=False,
436                fscale=0.8,
437                hspacing=0.5,
438                lspacing=0.2,
439                dotsep="·",
440                islocal=False,
441            ),
442            Theemim=dict(
443                mono=False,
444                fscale=0.825,
445                hspacing=0.52,
446                lspacing=0.3,
447                dotsep="~·",
448                islocal=True,
449            ),
450            VictorMono=dict(
451                mono=True,
452                fscale=0.725,
453                hspacing=1,
454                lspacing=0.1,
455                dotsep="·",
456                islocal=True,
457            ),
458            Justino1=dict(
459                mono=True,
460                fscale=0.725,
461                hspacing=1,
462                lspacing=0.1,
463                dotsep="·",
464                islocal=False,
465            ),
466            Justino2=dict(
467                mono=True,
468                fscale=0.725,
469                hspacing=1,
470                lspacing=0.1,
471                dotsep="·",
472                islocal=False,
473            ),
474            Justino3=dict(
475                mono=True,
476                fscale=0.725,
477                hspacing=1,
478                lspacing=0.1,
479                dotsep="·",
480                islocal=False,
481            ),
482            Calibri=dict(
483                mono=False,
484                fscale=0.75,
485                hspacing=1,
486                lspacing=0.2,
487                dotsep="~·",
488                islocal=False,
489            ),
490            Capsmall=dict(
491                mono=False,
492                fscale=0.8,
493                hspacing=0.75,
494                lspacing=0.15,
495                dotsep="·",
496                islocal=False,
497            ),
498            Cartoons123=dict(
499                mono=False,
500                fscale=0.8,
501                hspacing=0.75,
502                lspacing=0.15,
503                dotsep="·",
504                islocal=False,
505            ),
506            Vega=dict(
507                mono=False,
508                fscale=0.8,
509                hspacing=0.75,
510                lspacing=0.15,
511                dotsep="·",
512                islocal=False,
513            ),
514            Meson=dict(
515                mono=False,
516                fscale=0.8,
517                hspacing=0.9,
518                lspacing=0.225,
519                dotsep="~^.~ ",
520                islocal=False,
521            ),
522            Komika=dict(
523                mono=False,
524                fscale=0.7,
525                hspacing=0.75,
526                lspacing=0.225,
527                dotsep="~^.~ ",
528                islocal=False,
529            ),
530            Vogue=dict(
531                mono=False,
532                fscale=0.7,
533                hspacing=0.75,
534                lspacing=0.225,
535                dotsep="~^.~ ",
536                islocal=False,
537            ),
538            Brachium=dict(
539                mono=True,
540                fscale=0.8,
541                hspacing=1,
542                lspacing=0.1,
543                dotsep="·",
544                islocal=False,
545            ),
546            Dalim=dict(
547                mono=False,
548                fscale=0.75,
549                lspacing=0.2,
550                hspacing=1,
551                dotsep="~·",
552                islocal=False,
553            ),
554            Miro=dict(
555                mono=False,
556                fscale=0.75,
557                lspacing=0.2,
558                hspacing=1,
559                dotsep="~·",
560                islocal=False,
561            ),
562            Ubuntu=dict(
563                mono=False,
564                fscale=0.75,
565                lspacing=0.2,
566                hspacing=1,
567                dotsep="~·",
568                islocal=False,
569            ),
570            Mizar=dict(
571                mono=False,
572                fscale=0.75,
573                lspacing=0.2,
574                hspacing=0.75,
575                dotsep="~·",
576                islocal=False,
577            ),
578            LiberationSans=dict(
579                mono=False,
580                fscale=0.75,
581                lspacing=0.2,
582                hspacing=1,
583                dotsep="~·",
584                islocal=False,
585            ),
586            DejavuSansMono=dict(
587                mono=True,
588                fscale=0.725,
589                hspacing=1,
590                lspacing=0.1,
591                dotsep="·",
592                islocal=False,
593            ),
594            SunflowerHighway=dict(
595                mono=False,
596                fscale=0.75,
597                lspacing=0.2,
598                hspacing=1,
599                dotsep="~·",
600                islocal=False,
601            ),
602            Swansea=dict(
603                mono=False,
604                fscale=0.75,
605                lspacing=0.2,
606                hspacing=1,
607                dotsep="~·",
608                islocal=False,
609            ),
610            Housekeeper=dict(  # support chinese glyphs
611                mono=False,
612                fscale=0.75,
613                hspacing=1,
614                lspacing=0.2,
615                dotsep="~·",
616                islocal=False,
617            ),
618            Wananti=dict(  # support chinese glyphs
619                mono=False,
620                fscale=0.75,
621                hspacing=1,
622                lspacing=0.2,
623                dotsep="~·",
624                islocal=False,
625            ),
626            AnimeAce=dict(
627                mono=False,
628                fscale=0.75,
629                hspacing=1,
630                lspacing=0.2,
631                dotsep="~·",
632                islocal=False,
633            ),
634            AnimeAceBold=dict(
635                mono=False,
636                fscale=0.75,
637                hspacing=1,
638                lspacing=0.2,
639                dotsep="~·",
640                islocal=False,
641            ),
642        )
643
644    ####################################################################################
645    def reset(self):
646        """Reset all settings to their default status."""
647        self.__init__()
648
649    def print(self):
650        """Print function."""
651        print(' ' + '-'*80)
652        s = Settings.__doc__.replace('   ','')
653        s = s.replace(".. code-block:: python\n","")
654        try:
655            from pygments import highlight
656            from pygments.lexers import Python3Lexer
657            from pygments.formatters import Terminal256Formatter
658            s = highlight(s, Python3Lexer(), Terminal256Formatter(style='zenburn'))
659            print(s, end='')
660
661        except ModuleNotFoundError:
662            print("\x1b[33;1m" + s + "\x1b[0m")
663
664
665    def _warn(self, key):
666        if self._level == 0:
667            print(f'\x1b[1m\x1b[33;20m Warning! Please use "settings.{key}" instead!\x1b[0m')
668
669    def __getitem__(self, key):
670        """Make the class work like a dictionary too"""
671        return getattr(self, key)
672
673    def __setitem__(self, key, value):
674        """Make the class work like a dictionary too"""
675        setattr(self, key, value)
676
677
678    ####################################################################################
679    # Deprecations
680    ####################################################################################
681    @property
682    def defaultFont(self):
683        self._warn("default_font")
684        return self.default_font
685    @defaultFont.setter
686    def defaultFont(self, value):
687        self._warn("default_font")
688        self.default_font = value
689    ##################################
690    @property
691    def screeshotScale(self):
692        self._warn("screeshot_scale")
693        return self.screeshot_scale
694    @screeshotScale.setter
695    def screeshotScale(self, value):
696        self._warn("screeshot_scale")
697        self.screeshot_scale = value
698    ##################################
699    @property
700    def screenshotTransparentBackground(self):
701        self._warn("screenshot_transparent_background")
702        return self.NAME_SNAKE
703    @screenshotTransparentBackground.setter
704    def screenshotTransparentBackground(self, value):
705        self._warn("screenshot_transparent_background")
706        self.screenshot_transparent_background = value
707    ##################################
708    @property
709    def screeshotLargeImage(self):
710        self._warn("screeshot_large_image")
711        return self.screeshot_large_image
712    @screeshotLargeImage.setter
713    def screeshotLargeImage(self, value):
714        self._warn("screeshot_large_image")
715        self.screeshot_large_image = value
716    ##################################
717    @property
718    def allowInteraction(self):
719        self._warn("allow_interaction")
720        return self.allow_interaction
721    @allowInteraction.setter
722    def allowInteraction(self, value):
723        self._warn("allow_interaction")
724        self.allow_interaction = value
725    ##################################
726    @property
727    def enableDefaultMouseCallbacks(self):
728        self._warn("enable_default_mouse_callbacks")
729        return self.enable_default_mouse_callbacks
730    @enableDefaultMouseCallbacks.setter
731    def enableDefaultMouseCallbacks(self, value):
732        self._warn("enable_default_mouse_callbacks")
733        self.enable_default_mouse_callbacks = value
734    ##################################
735    @property
736    def enableDefaultKeyboardCallbacks(self):
737        self._warn("enable_default_keyboard_callbacks")
738        return self.enable_default_keyboard_callbacks
739    @enableDefaultKeyboardCallbacks.setter
740    def enableDefaultKeyboardCallbacks(self, value):
741        self._warn("enable_default_keyboard_callbacks")
742        self.enable_default_keyboard_callbacks = value
743    ##################################
744    @property
745    def immediateRendering(self):
746        self._warn("immediate_rendering")
747        return self.immediate_rendering
748    @immediateRendering.setter
749    def immediateRendering(self, value):
750        self._warn("immediate_rendering")
751        self.immediate_rendering = value
752    ##################################
753    @property
754    def renderLinesAsTubes(self):
755        self._warn("render_lines_as_tubes")
756        return self.render_lines_as_tubes
757    @renderLinesAsTubes.setter
758    def renderLinesAsTubes(self, value):
759        self._warn("render_lines_as_tubes")
760        self.render_lines_as_tubes = value
761    ##################################
762    @property
763    def hiddenLineRemoval(self):
764        self._warn("hidden_line_removal")
765        return self.hidden_line_removal
766    @hiddenLineRemoval.setter
767    def hiddenLineRemoval(self, value):
768        self._warn("hidden_line_removal")
769        self.hidden_line_removal = value
770    ##################################
771    @property
772    def pointSmoothing(self):
773        self._warn("point_smoothing")
774        return self.point_smoothing
775    @pointSmoothing.setter
776    def pointSmoothing(self, value):
777        self._warn("point_smoothing")
778        self.point_smoothing = value
779    ##################################
780    @property
781    def lightFollowsCamera(self):
782        self._warn("light_follows_camera")
783        return self.light_follows_camera
784    @lightFollowsCamera.setter
785    def lightFollowsCamera(self, value):
786        self._warn("light_follows_camera")
787        self.light_follows_camera = value
788    ##################################
789    @property
790    def twoSidedLighting(self):
791        self._warn("two_sided_lighting")
792        return self.two_sided_lighting
793    @twoSidedLighting.setter
794    def twoSidedLighting(self, value):
795        self._warn("two_sided_lighting")
796        self.two_sided_lighting = value
797    ##################################
798    @property
799    def useDepthPeeling(self):
800        self._warn("use_depth_peeling")
801        return self.use_depth_peeling
802    @useDepthPeeling.setter
803    def useDepthPeeling(self, value):
804        self._warn("use_depth_peeling")
805        self.use_depth_peeling = value
806    ##################################
807    @property
808    def multiSamples(self):
809        self._warn("multi_samples")
810        return self.multi_samples
811    @multiSamples.setter
812    def multiSamples(self, value):
813        self._warn("multi_samples")
814        self.multi_samples = value
815    ##################################
816    @property
817    def alphaBitPlanes(self):
818        self._warn("alpha_bit_planes")
819        return self.alpha_bit_planes
820    @alphaBitPlanes.setter
821    def alphaBitPlanes(self, value):
822        self._warn("alpha_bit_planes")
823        self.alpha_bit_planes = value
824    ##################################
825    @property
826    def maxNumberOfPeels(self):
827        self._warn("max_number_of_peels")
828        return self.max_number_of_peels
829    @maxNumberOfPeels.setter
830    def maxNumberOfPeels(self, value):
831        self._warn("max_number_of_peels")
832        self.max_number_of_peels = value
833    ##################################
834    @property
835    def occlusionRatio(self):
836        self._warn("occlusion_ratio")
837        return self.occlusion_ratio
838    @occlusionRatio.setter
839    def occlusionRatio(self, value):
840        self._warn("occlusion_ratio")
841        self.occlusion_ratio = value
842    ##################################
843    @property
844    def useFXAA(self):
845        self._warn("use_fxaa")
846        return self.use_fxaa
847    @useFXAA.setter
848    def useFXAA(self, value):
849        self._warn("use_fxaa")
850        self.use_fxaa = value
851    ##################################
852    @property
853    def preserveDepthBuffer(self):
854        self._warn("preserve_depth_buffer")
855        return self.preserve_depth_buffer
856    @preserveDepthBuffer.setter
857    def preserveDepthBuffer(self, value):
858        self._warn("preserve_depth_buffer")
859        self.preserve_depth_buffer = value
860    ##################################
861    @property
862    def usePolygonOffset(self):
863        self._warn("use_polygon_offset")
864        return self.use_polygon_offset
865    @usePolygonOffset.setter
866    def usePolygonOffset(self, value):
867        self._warn("use_polygon_offset")
868        self.use_polygon_offset = value
869    ##################################
870    @property
871    def polygonOffsetFactor(self):
872        self._warn("polygon_offset_factor")
873        return self.polygon_offset_factor
874    @polygonOffsetFactor.setter
875    def polygonOffsetFactor(self, value):
876        self._warn("polygon_offset_factor")
877        self.polygon_offset_factor = value
878    ##################################
879    @property
880    def polygonOffsetUnits(self):
881        self._warn("polygon_offset_units")
882        return self.polygon_offset_units
883    @polygonOffsetUnits.setter
884    def polygonOffsetUnits(self, value):
885        self._warn("polygon_offset_units")
886        self.polygon_offset_units = value
887    ##################################
888    @property
889    def interpolateScalarsBeforeMapping(self):
890        self._warn("interpolate_scalars_before_mapping")
891        return self.interpolate_scalars_before_mapping
892    @interpolateScalarsBeforeMapping.setter
893    def interpolateScalarsBeforeMapping(self, value):
894        self._warn("interpolate_scalars_before_mapping")
895        self.interpolate_scalars_before_mapping = value
896    ##################################
897    @property
898    def useParallelProjection(self):
899        self._warn("use_parallel_projection")
900        return self.use_parallel_projection
901    @useParallelProjection.setter
902    def useParallelProjection(self, value):
903        self._warn("use_parallel_projection")
904        self.use_parallel_projection = value
905    ##################################
906    @property
907    def windowSplittingPosition(self):
908        self._warn("window_splitting_position")
909        return self.window_splitting_position
910    @windowSplittingPosition.setter
911    def windowSplittingPosition(self, value):
912        self._warn("window_splitting_position")
913        self.window_splitting_position = value
914    ##################################
915    @property
916    def tiffOrientationType(self):
917        self._warn("tiff_orientation_type")
918        return self.tiff_orientation_type
919    @tiffOrientationType.setter
920    def tiffOrientationType(self, value):
921        self._warn("tiff_orientation_type")
922        self.tiff_orientation_type = value
923    ##################################
924    @property
925    def enablePrintColor(self):
926        self._warn("enable_print_color")
927        return self.enable_print_color
928    @enablePrintColor.setter
929    def enablePrintColor(self, value):
930        self._warn("enable_print_color")
931        self.enable_print_color = value

General settings to modify the global behavior

Usage Example:
from vedo import settings, Cube
settings.use_parallel_projection = True
Cube().color('g').show().close()

List of available properties:

# Set a default for the font to be used for axes, comments etc.
default_font = 'Normografo' # check font options in shapes.Text

# Palette number when using an integer to choose a color
palette = 0

# Scale magnification of the screenshot (must be an integer)
screeshot_scale = 1
screenshot_transparent_background = False
screeshot_large_image = False # Sometimes setting this to True gives better results

# [DISABLED] Allow to continuously interact with scene during interactive() execution
allow_interaction = True

# enable tracking pipeline functionality: 
#  allows to show a graph with the pipeline of action which let to a final object
#  this is achieved by calling "myobj.pipeline.show()" (a new window will pop up)
self.enable_pipeline = True

# Set up default mouse and keyboard functionalities
enable_default_mouse_callbacks = True
enable_default_keyboard_callbacks = True

# If False, when multiple renderers are present do not render each one for separate
#  but do it just once at the end (when interactive() is called)
immediate_rendering = True

# Show a gray frame margin in multirendering windows
renderer_frame_color = None
renderer_frame_alpha = 0.5
renderer_frame_width = 0.5
renderer_frame_padding = 0.0001

# In multirendering mode set the position of the horizontal of vertical splitting [0,1]
window_splitting_position = None

# Enable / disable color printing by printc()
enable_print_color = True

# Wrap lines in tubes
render_lines_as_tubes = False

# Smoothing options
point_smoothing = False
line_smoothing = False
polygon_smoothing = False

# Remove hidden lines when in wireframe mode
hidden_line_removal = False

# Turn on/off the automatic repositioning of lights as the camera moves.
light_follows_camera = False
two_sided_lighting = True

# Turn on/off rendering of translucent material with depth peeling technique.
use_depth_peeling = False
alpha_bit_planes  = True   # options only active if useDepthPeeling=True
multi_samples     = 8      # force to not pick a framebuffer with a multisample buffer
max_number_of_peels= 4     # maximum number of rendering passes
occlusion_ratio   = 0.0    # occlusion ratio, 0 = exact image.

# Turn on/off nvidia FXAA post-process anti-aliasing, if supported.
use_fxaa = False           # either True or False

# By default, the depth buffer is reset for each renderer.
#  If True, use the existing depth buffer
preserve_depth_buffer = False

# Use a polygon/edges offset to possibly resolve conflicts in rendering
use_polygon_offset    = False
polygon_offset_factor = 0.1
polygon_offset_units  = 0.1

# Interpolate scalars to render them smoothly
interpolate_scalars_before_mapping = True

# Set parallel projection On or Off (place camera to infinity, no perspective effects)
use_parallel_projection = False

# Set orientation type when reading TIFF files (volumes):
# TOPLEFT  1 (row 0 top, col 0 lhs)    TOPRIGHT 2 (row 0 top, col 0 rhs)
# BOTRIGHT 3 (row 0 bottom, col 0 rhs) BOTLEFT  4 (row 0 bottom, col 0 lhs)
# LEFTTOP  5 (row 0 lhs, col 0 top)    RIGHTTOP 6 (row 0 rhs, col 0 top)
# RIGHTBOT 7 (row 0 rhs, col 0 bottom) LEFTBOT  8 (row 0 lhs, col 0 bottom)
tiff_orientation_type = 1

# Annotated cube axis type nr. 5 options:
annotated_cube_color      = (0.75, 0.75, 0.75)
annotated_cube_text_color = None # use default, otherwise specify a single color
annotated_cube_text_scale = 0.2
annotated_cube_texts      = ["right","left ", "front","back ", " top ", "bttom"]

# Automatically close the Plotter instance after show() in jupyter sessions
# setting it to False will keep the current Plotter instance active
backend_autoclose = True

# k3d settings for jupyter notebooks
k3d_menu_visibility = True
k3d_plot_height = 512
k3d_antialias   = True
k3d_lighting    = 1.2
k3d_camera_autofit = True
k3d_grid_autofit= True
k3d_axes_helper = True    # size of the small triad of axes on the bottom right
k3d_point_shader= "mesh"  # others are '3d', '3dSpecular', 'dot', 'flat'
k3d_line_shader = "thick" # others are 'flat', 'mesh'
Settings(level=0)
191    def __init__(self, level=0):
192        """Contructor."""
193
194        self._level = level
195
196        # Default font
197        self.default_font = "Normografo"
198
199        # Default backend engine in jupyter notebooks
200        self.default_backend = "vtk"
201
202        # enable tracking pipeline functionality
203        self.enable_pipeline = True
204
205        if any(["SPYDER" in name for name in os.environ]):
206            self.default_backend = "vtk"
207        else:
208            try:
209                get_ipython()
210                self.default_backend = "2d"
211            except NameError:
212                pass
213
214        # Palette number when using an integer to choose a color
215        self.palette = 0
216
217        self.remember_last_figure_format = False
218
219        # Scale magnification of the screenshot (must be an integer)
220        self.screeshot_scale = 1
221        self.screenshot_transparent_background = False
222        self.screeshot_large_image = False
223
224        # [DISABLED] Allow to continuously interact with scene during interactor.Start() execution
225        self.allow_interaction = True
226
227        # BUG in vtk9.0 (if true close works but sometimes vtk crashes, if false doesnt crash but cannot close)
228        # see plotter.py line 555
229        self.hack_call_screen_size = True
230
231        # Set up default mouse and keyboard functionalities
232        self.enable_default_mouse_callbacks = True
233        self.enable_default_keyboard_callbacks = True
234
235        # When multiple renderers are present do not render each one for separate.
236        # but do it just once at the end (when interactive() is called)
237        self.immediate_rendering = True
238
239        # Show a gray frame margin in multirendering windows
240        self.renderer_frame_color = None
241        self.renderer_frame_alpha = 0.5
242        self.renderer_frame_width = 0.5
243        self.renderer_frame_padding = 0.0001
244
245        # Wrap lines in tubes
246        self.render_lines_as_tubes = False
247
248        # Remove hidden lines when in wireframe mode
249        self.hidden_line_removal = False
250
251        # Smoothing options
252        self.point_smoothing = False
253        self.line_smoothing = False
254        self.polygon_smoothing = False
255
256        # For Structured and RectilinearGrid: show internal edges not only outline
257        self.visible_grid_edges = False
258
259        # Turn on/off the automatic repositioning of lights as the camera moves.
260        self.light_follows_camera = False
261        self.two_sided_lighting = True
262
263        # Turn on/off rendering of translucent material with depth peeling technique.
264        self.use_depth_peeling = False
265        self.multi_samples = 8
266        self.alpha_bit_planes = 1
267        self.max_number_of_peels = 4
268        self.occlusion_ratio = 0.1
269
270        # Turn on/off nvidia FXAA anti-aliasing, if supported.
271        self.use_fxaa = False  # either True or False
272
273        # By default, the depth buffer is reset for each renderer. If true, use the existing depth buffer
274        self.preserve_depth_buffer = False
275
276        # Use a polygon/edges offset to possibly resolve conflicts in rendering
277        self.use_polygon_offset = True
278        self.polygon_offset_factor = 0.1
279        self.polygon_offset_units  = 0.1
280
281        # Interpolate scalars to render them smoothly
282        self.interpolate_scalars_before_mapping = True
283
284        # Set parallel projection On or Off (place camera to infinity, no perspective effects)
285        self.use_parallel_projection = False
286
287        # In multirendering mode set the position of the horizontal of vertical splitting [0,1]
288        self.window_splitting_position = None
289
290        # Set orientation type when reading TIFF files (volumes):
291        # TOPLEFT  1 (row 0 top, col 0 lhs)    TOPRIGHT 2 (row 0 top, col 0 rhs)
292        # BOTRIGHT 3 (row 0 bottom, col 0 rhs) BOTLEFT  4 (row 0 bottom, col 0 lhs)
293        # LEFTTOP  5 (row 0 lhs, col 0 top)    RIGHTTOP 6 (row 0 rhs, col 0 top)
294        # RIGHTBOT 7 (row 0 rhs, col 0 bottom) LEFTBOT  8 (row 0 lhs, col 0 bottom)
295        self.tiff_orientation_type = 1
296
297        # AnnotatedCube axis (type 5) customization:
298        self.annotated_cube_color = (0.75, 0.75, 0.75)
299        self.annotated_cube_text_color = None # use default, otherwise specify a single color
300        self.annotated_cube_text_scale = 0.2
301        self.annotated_cube_texts = ["right","left ", "front","back ", " top ", "bttom"]
302
303        # enable / disable color printing
304        self.enable_print_color = True
305
306        ####################################################################################
307        # Automatically close the Plotter instance after show() in jupyter sessions,
308        #  setting it to False will keep the current Plotter instance active
309        self.backend_autoclose = True
310
311        # k3d settings for jupyter notebooks
312        self.k3d_menu_visibility = True
313        self.k3d_plot_height = 512
314        self.k3d_antialias  = True
315        self.k3d_lighting   = 1.2
316        self.k3d_camera_autofit = True
317        self.k3d_grid_autofit= True
318        self.k3d_axes_helper = True    # size of the small triad of axes on the bottom right
319        self.k3d_point_shader= "mesh"  # others are '3d', '3dSpecular', 'dot', 'flat'
320        self.k3d_line_shader = "thick" # others are 'flat', 'mesh'
321
322        ####################################################################################
323        ####################################################################################
324        # mono       # means that all letters occupy the same space slot horizontally
325        # hspacing   # an horizontal stretching factor (affects both letters and words)
326        # lspacing   # horizontal spacing inbetween letters (not words)
327        # islocal    # is locally stored in /fonts, otherwise it's on vedo.embl.es/fonts
328        #
329        self.font_parameters = dict(
330            Normografo=dict(
331                mono=False,
332                fscale=0.75,
333                hspacing=1,
334                lspacing=0.2,
335                dotsep="~·",
336                islocal=True,
337            ),
338            Bongas=dict(
339                mono=False,
340                fscale=0.875,
341                hspacing=0.52,
342                lspacing=0.25,
343                dotsep="·",
344                islocal=True,
345            ),
346            Calco=dict(
347                mono=True,
348                fscale=0.8,
349                hspacing=1,
350                lspacing=0.1,
351                dotsep="·",
352                islocal=True,
353            ),
354            Comae=dict(
355                mono=False,
356                fscale=0.75,
357                lspacing=0.2,
358                hspacing=1,
359                dotsep="~·",
360                islocal=True,
361            ),
362            ComicMono=dict(
363                mono=True,
364                fscale=0.8,
365                hspacing=1,
366                lspacing=0.1,
367                dotsep="·",
368                islocal=False,
369            ),
370            Edo=dict(
371                mono=False,
372                fscale=0.75,
373                hspacing=1,
374                lspacing=0.2,
375                dotsep="·~~",
376                islocal=False,
377            ),
378            FiraMonoMedium=dict(
379                mono=True,
380                fscale=0.8,
381                hspacing=1,
382                lspacing=0.1,
383                dotsep="·",
384                islocal=False,
385            ),
386            FiraMonoBold=dict(
387                mono=True,
388                fscale=0.8,
389                hspacing=1,
390                lspacing=0.1,
391                dotsep="·",
392                islocal=False,
393            ),
394            Glasgo=dict(
395                mono=True,
396                fscale=0.75,
397                lspacing=0.1,
398                hspacing=1,
399                dotsep="·",
400                islocal=True,
401            ),
402            Kanopus=dict(
403                mono=False,
404                fscale=0.75,
405                lspacing=0.15,
406                hspacing=0.75,
407                dotsep="~·",
408                islocal=True,
409            ),
410            LogoType=dict(
411                mono=False,
412                fscale=0.75,
413                hspacing=1,
414                lspacing=0.2,
415                dotsep="·~~",
416                islocal=False,
417            ),
418            Quikhand=dict(
419                mono=False,
420                fscale=0.8,
421                hspacing=0.6,
422                lspacing=0.15,
423                dotsep="~~·~",
424                islocal=True,
425            ),
426            SmartCouric=dict(
427                mono=True,
428                fscale=0.8,
429                hspacing=1.05,
430                lspacing=0.1,
431                dotsep="·",
432                islocal=True,
433            ),
434            Spears=dict(
435                mono=False,
436                fscale=0.8,
437                hspacing=0.5,
438                lspacing=0.2,
439                dotsep="·",
440                islocal=False,
441            ),
442            Theemim=dict(
443                mono=False,
444                fscale=0.825,
445                hspacing=0.52,
446                lspacing=0.3,
447                dotsep="~·",
448                islocal=True,
449            ),
450            VictorMono=dict(
451                mono=True,
452                fscale=0.725,
453                hspacing=1,
454                lspacing=0.1,
455                dotsep="·",
456                islocal=True,
457            ),
458            Justino1=dict(
459                mono=True,
460                fscale=0.725,
461                hspacing=1,
462                lspacing=0.1,
463                dotsep="·",
464                islocal=False,
465            ),
466            Justino2=dict(
467                mono=True,
468                fscale=0.725,
469                hspacing=1,
470                lspacing=0.1,
471                dotsep="·",
472                islocal=False,
473            ),
474            Justino3=dict(
475                mono=True,
476                fscale=0.725,
477                hspacing=1,
478                lspacing=0.1,
479                dotsep="·",
480                islocal=False,
481            ),
482            Calibri=dict(
483                mono=False,
484                fscale=0.75,
485                hspacing=1,
486                lspacing=0.2,
487                dotsep="~·",
488                islocal=False,
489            ),
490            Capsmall=dict(
491                mono=False,
492                fscale=0.8,
493                hspacing=0.75,
494                lspacing=0.15,
495                dotsep="·",
496                islocal=False,
497            ),
498            Cartoons123=dict(
499                mono=False,
500                fscale=0.8,
501                hspacing=0.75,
502                lspacing=0.15,
503                dotsep="·",
504                islocal=False,
505            ),
506            Vega=dict(
507                mono=False,
508                fscale=0.8,
509                hspacing=0.75,
510                lspacing=0.15,
511                dotsep="·",
512                islocal=False,
513            ),
514            Meson=dict(
515                mono=False,
516                fscale=0.8,
517                hspacing=0.9,
518                lspacing=0.225,
519                dotsep="~^.~ ",
520                islocal=False,
521            ),
522            Komika=dict(
523                mono=False,
524                fscale=0.7,
525                hspacing=0.75,
526                lspacing=0.225,
527                dotsep="~^.~ ",
528                islocal=False,
529            ),
530            Vogue=dict(
531                mono=False,
532                fscale=0.7,
533                hspacing=0.75,
534                lspacing=0.225,
535                dotsep="~^.~ ",
536                islocal=False,
537            ),
538            Brachium=dict(
539                mono=True,
540                fscale=0.8,
541                hspacing=1,
542                lspacing=0.1,
543                dotsep="·",
544                islocal=False,
545            ),
546            Dalim=dict(
547                mono=False,
548                fscale=0.75,
549                lspacing=0.2,
550                hspacing=1,
551                dotsep="~·",
552                islocal=False,
553            ),
554            Miro=dict(
555                mono=False,
556                fscale=0.75,
557                lspacing=0.2,
558                hspacing=1,
559                dotsep="~·",
560                islocal=False,
561            ),
562            Ubuntu=dict(
563                mono=False,
564                fscale=0.75,
565                lspacing=0.2,
566                hspacing=1,
567                dotsep="~·",
568                islocal=False,
569            ),
570            Mizar=dict(
571                mono=False,
572                fscale=0.75,
573                lspacing=0.2,
574                hspacing=0.75,
575                dotsep="~·",
576                islocal=False,
577            ),
578            LiberationSans=dict(
579                mono=False,
580                fscale=0.75,
581                lspacing=0.2,
582                hspacing=1,
583                dotsep="~·",
584                islocal=False,
585            ),
586            DejavuSansMono=dict(
587                mono=True,
588                fscale=0.725,
589                hspacing=1,
590                lspacing=0.1,
591                dotsep="·",
592                islocal=False,
593            ),
594            SunflowerHighway=dict(
595                mono=False,
596                fscale=0.75,
597                lspacing=0.2,
598                hspacing=1,
599                dotsep="~·",
600                islocal=False,
601            ),
602            Swansea=dict(
603                mono=False,
604                fscale=0.75,
605                lspacing=0.2,
606                hspacing=1,
607                dotsep="~·",
608                islocal=False,
609            ),
610            Housekeeper=dict(  # support chinese glyphs
611                mono=False,
612                fscale=0.75,
613                hspacing=1,
614                lspacing=0.2,
615                dotsep="~·",
616                islocal=False,
617            ),
618            Wananti=dict(  # support chinese glyphs
619                mono=False,
620                fscale=0.75,
621                hspacing=1,
622                lspacing=0.2,
623                dotsep="~·",
624                islocal=False,
625            ),
626            AnimeAce=dict(
627                mono=False,
628                fscale=0.75,
629                hspacing=1,
630                lspacing=0.2,
631                dotsep="~·",
632                islocal=False,
633            ),
634            AnimeAceBold=dict(
635                mono=False,
636                fscale=0.75,
637                hspacing=1,
638                lspacing=0.2,
639                dotsep="~·",
640                islocal=False,
641            ),
642        )

Contructor.

def reset(self):
645    def reset(self):
646        """Reset all settings to their default status."""
647        self.__init__()

Reset all settings to their default status.

def print(self):
649    def print(self):
650        """Print function."""
651        print(' ' + '-'*80)
652        s = Settings.__doc__.replace('   ','')
653        s = s.replace(".. code-block:: python\n","")
654        try:
655            from pygments import highlight
656            from pygments.lexers import Python3Lexer
657            from pygments.formatters import Terminal256Formatter
658            s = highlight(s, Python3Lexer(), Terminal256Formatter(style='zenburn'))
659            print(s, end='')
660
661        except ModuleNotFoundError:
662            print("\x1b[33;1m" + s + "\x1b[0m")

Print function.