wolfhece.PyConfig ================= .. py:module:: wolfhece.PyConfig .. autoapi-nested-parse:: Author: HECE - University of Liege, Pierre Archambeau Date: 2024 Copyright (c) 2024 University of Liege. All rights reserved. This script and its content are protected by copyright law. Unauthorized copying or distribution of this file, via any medium, is strictly prohibited. Module Contents --------------- .. py:function:: _default_plugins_directory() -> pathlib.Path Return the built-in plugins directory and make sure it exists. .. py:class:: ConfigurationKeys(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece.PyConfig.ConfigurationKeys :parts: 1 :private-bases: Using enumerated keys make sure we can check value names at code write time (i.e. we don't use string which are brittle) .. py:attribute:: VERSION :value: 'Version' .. py:attribute:: PLAY_WELCOME_SOUND :value: 'PlayWelcomeSound' .. py:attribute:: TICKS_SIZE :value: 'TicksSize' .. py:attribute:: TICKS_BOUNDS :value: 'TicksBounds' .. py:attribute:: TICKS_XROTATION :value: 'TicksXRotation' .. py:attribute:: TICKS_FONTSIZE :value: 'TicksFontSize' .. py:attribute:: OVERLAY_XY_FONT_NAME :value: 'OverlayXYFontName' .. py:attribute:: OVERLAY_XY_FONT_SIZE :value: 'OverlayXYFontSize' .. py:attribute:: TOOLBAR_TOOLTIP_FONT_SIZE :value: 'ToolbarTooltipFontSize' .. py:attribute:: COLOR_BACKGROUND :value: 'ColorBackground' .. py:attribute:: ACTIVE_ARRAY_PALETTE_FOR_IMAGE :value: 'Use active array palette for image' .. py:attribute:: ACTIVE_RES2D_PALETTE_FOR_IMAGE :value: 'Use active result palette for image' .. py:attribute:: ASSEMBLY_IMAGES :value: 'AssemblyImages' .. py:attribute:: DIRECTORY_DEM :value: 'Default DEM directory' .. py:attribute:: DIRECTORY_DTM :value: 'Default DTM directory' .. py:attribute:: DIRECTORY_LAZ :value: 'Default LAZ directory' .. py:attribute:: ACTIVE_VECTOR_COLOR :value: 'Active vector color' .. py:attribute:: ACTIVE_VECTOR_SIZE_SQUARE :value: 'Active vector square size' .. py:attribute:: XLSX_HECE_DATABASE :value: 'Hece Database XLSX file' .. py:attribute:: EPSG_CODE :value: 'Default EPSG code' .. py:attribute:: SNAP_GRID_UNIT :value: 'Snap grid base unit' .. py:attribute:: SNAP_GRID_ROUND_BASE :value: 'Snap grid origin round base' .. py:attribute:: OVERLAY_BG_COLOR :value: 'OverlayBgColor' .. py:attribute:: PLUGINS_DIRECTORY :value: 'PluginsDirectory' .. py:attribute:: PLUGINS_DISABLED :value: 'PluginsDisabled' .. py:class:: WolfConfiguration(path=None) Holds the PyWolf configuration .. py:property:: path :type: pathlib.Path Where the configuration is read/saved. .. py:method:: set_default_config() .. py:method:: _check_config() .. py:method:: load() .. py:method:: save() .. py:class:: GlobalOptionsDialog(*args, **kw) Bases: :py:obj:`wx.Dialog` .. autoapi-inheritance-diagram:: wolfhece.PyConfig.GlobalOptionsDialog :parts: 1 :private-bases: A dialog to set global options for a WolfMapViewer. .. py:method:: push_configuration(configuration) .. py:method:: pull_configuration(configuration) .. py:method:: InitUI() .. py:method:: _init_tab_general(notebook) .. py:method:: _init_tab_display(notebook) .. py:method:: _init_tab_directories(notebook) .. py:method:: _init_tab_vectors(notebook) .. py:method:: _init_tab_plugins(notebook) Create the *Plugins* tab in the options notebook. .. py:method:: _populate_plugins_list(plugins_dir: str, disabled: list) -> None Refresh the plugins check-list (built-in first, then user plugins). .. py:method:: _collect_disabled_plugins() -> list Return the list of plugin names (strings) that are *unchecked*. .. py:method:: _OnPluginChecked(event) -> None Ask for approval when the user enables an unknown/changed external plugin. .. py:method:: _OnNewPlugin(event) Open the 'New plugin from template' dialog and scaffold the files. .. py:method:: _OnChoosePluginsDir(event) Browse for a custom plugins directory. .. py:method:: OnChooseDem(e) Choose a directory for DEM files .. py:method:: OnChooseDtm(e) Choose a directory for DTM files .. py:method:: OnChooseLaz(e) Choose a directory for LAZ files .. py:method:: OnChooseXLSX(e) Choose a XLSX file for HECE database .. py:method:: OnOk(e) .. py:method:: OnClose(e) .. py:function:: _plugin_menu_badge(info) -> str Return ``'☰ '``, ``'⚡ '``, or ``''`` based on whether *info* has a menu. .. py:function:: _plugin_badges(info, trust_store) -> str Return a combined trust + menu badge prefix for *info*. Format: ``' '`` (e.g. ``'★ ☰ '``, ``'✓ ⚡ '``, ``'? ☰ '``) .. py:function:: _slug_to_class_name(slug: str) -> str Convert a slug like ``my_feature`` to a class name ``MyFeatureCompanion``. .. py:function:: _create_plugin_from_template(slug: str, display_name: str, author: str, description: str, target_dir) -> pathlib.Path Copy the template directory to *target_dir*/ with substituted values. :raises FileExistsError: if the target directory already exists. :raises FileNotFoundError: if the template directory is missing. :return: Path to the created plugin directory. .. py:class:: _NewPluginDialog(parent, target_dir) Bases: :py:obj:`wx.Dialog` .. autoapi-inheritance-diagram:: wolfhece.PyConfig._NewPluginDialog :parts: 1 :private-bases: Small form to collect metadata for a new plugin. .. py:attribute:: _target_dir .. py:property:: slug :type: str .. py:property:: display_name :type: str .. py:property:: author :type: str .. py:property:: description :type: str .. py:method:: _build_ui() .. py:method:: _on_ok(event) .. py:function:: handle_configuration_dialog(wxparent, configuration) .. py:data:: cfg