wolfhece.PyConfig

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

wolfhece.PyConfig._default_plugins_directory() pathlib.Path[source]

Return the built-in plugins directory and make sure it exists.

class wolfhece.PyConfig.ConfigurationKeys(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece.PyConfig.ConfigurationKeys

Using enumerated keys make sure we can check value names at code write time (i.e. we don’t use string which are brittle)

VERSION = 'Version'[source]
PLAY_WELCOME_SOUND = 'PlayWelcomeSound'[source]
TICKS_SIZE = 'TicksSize'[source]
TICKS_BOUNDS = 'TicksBounds'[source]
TICKS_XROTATION = 'TicksXRotation'[source]
TICKS_FONTSIZE = 'TicksFontSize'[source]
OVERLAY_XY_FONT_NAME = 'OverlayXYFontName'[source]
OVERLAY_XY_FONT_SIZE = 'OverlayXYFontSize'[source]
TOOLBAR_TOOLTIP_FONT_SIZE = 'ToolbarTooltipFontSize'[source]
COLOR_BACKGROUND = 'ColorBackground'[source]
ACTIVE_ARRAY_PALETTE_FOR_IMAGE = 'Use active array palette for image'[source]
ACTIVE_RES2D_PALETTE_FOR_IMAGE = 'Use active result palette for image'[source]
ASSEMBLY_IMAGES = 'AssemblyImages'[source]
DIRECTORY_DEM = 'Default DEM directory'[source]
DIRECTORY_DTM = 'Default DTM directory'[source]
DIRECTORY_LAZ = 'Default LAZ directory'[source]
ACTIVE_VECTOR_COLOR = 'Active vector color'[source]
ACTIVE_VECTOR_SIZE_SQUARE = 'Active vector square size'[source]
XLSX_HECE_DATABASE = 'Hece Database XLSX file'[source]
EPSG_CODE = 'Default EPSG code'[source]
SNAP_GRID_UNIT = 'Snap grid base unit'[source]
SNAP_GRID_ROUND_BASE = 'Snap grid origin round base'[source]
OVERLAY_BG_COLOR = 'OverlayBgColor'[source]
PLUGINS_DIRECTORY = 'PluginsDirectory'[source]
PLUGINS_DISABLED = 'PluginsDisabled'[source]
class wolfhece.PyConfig.WolfConfiguration(path=None)[source]

Holds the PyWolf configuration

property path: pathlib.Path[source]

Where the configuration is read/saved.

set_default_config()[source]
_check_config()[source]
load()[source]
save()[source]
class wolfhece.PyConfig.GlobalOptionsDialog(*args, **kw)[source]

Bases: wx.Dialog

Inheritance diagram of wolfhece.PyConfig.GlobalOptionsDialog

A dialog to set global options for a WolfMapViewer.

push_configuration(configuration)[source]
pull_configuration(configuration)[source]
InitUI()[source]
_init_tab_general(notebook)[source]
_init_tab_display(notebook)[source]
_init_tab_directories(notebook)[source]
_init_tab_vectors(notebook)[source]
_init_tab_plugins(notebook)[source]

Create the Plugins tab in the options notebook.

_populate_plugins_list(plugins_dir: str, disabled: list) None[source]

Refresh the plugins check-list (built-in first, then user plugins).

_collect_disabled_plugins() list[source]

Return the list of plugin names (strings) that are unchecked.

_OnPluginChecked(event) None[source]

Ask for approval when the user enables an unknown/changed external plugin.

_OnNewPlugin(event)[source]

Open the ‘New plugin from template’ dialog and scaffold the files.

_OnChoosePluginsDir(event)[source]

Browse for a custom plugins directory.

OnChooseDem(e)[source]

Choose a directory for DEM files

OnChooseDtm(e)[source]

Choose a directory for DTM files

OnChooseLaz(e)[source]

Choose a directory for LAZ files

OnChooseXLSX(e)[source]

Choose a XLSX file for HECE database

OnOk(e)[source]
OnClose(e)[source]
wolfhece.PyConfig._plugin_menu_badge(info) str[source]

Return '☰ ', '⚡ ', or '' based on whether info has a menu.

wolfhece.PyConfig._plugin_badges(info, trust_store) str[source]

Return a combined trust + menu badge prefix for info.

Format: '<trust> <menu> ' (e.g. '★ ', '✓ ', '? ')

wolfhece.PyConfig._slug_to_class_name(slug: str) str[source]

Convert a slug like my_feature to a class name MyFeatureCompanion.

wolfhece.PyConfig._create_plugin_from_template(slug: str, display_name: str, author: str, description: str, target_dir) pathlib.Path[source]

Copy the template directory to target_dir/<slug> with substituted values.

Raises:
  • FileExistsError – if the target directory already exists.

  • FileNotFoundError – if the template directory is missing.

Returns:

Path to the created plugin directory.

class wolfhece.PyConfig._NewPluginDialog(parent, target_dir)[source]

Bases: wx.Dialog

Inheritance diagram of wolfhece.PyConfig._NewPluginDialog

Small form to collect metadata for a new plugin.

_target_dir[source]
property slug: str[source]
property display_name: str[source]
property author: str[source]
property description: str[source]
_build_ui()[source]
_on_ok(event)[source]
wolfhece.PyConfig.handle_configuration_dialog(wxparent, configuration)[source]
wolfhece.PyConfig.cfg[source]