wolfhece._pydraw_utils

Small utility classes extracted from PyDraw.py.

Includes MplFigViewer, Memory_View helpers, draw_type enum, Colors_1to9 panel, and DragdropFileTarget.

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

class wolfhece._pydraw_utils.MplFigViewer(layout=None, idx: str = '', mapviewer: wolfhece.PyDraw.WolfMapViewer = None, caption: str = '', size: tuple = (800, 600), style: int = wx.DEFAULT_FRAME_STYLE ^ wx.RESIZE_BORDER)[source]

Bases: wolfhece.matplotlib_fig.Matplotlib_Figure

Inheritance diagram of wolfhece._pydraw_utils.MplFigViewer

Matplotlib Figure with wx Frame

_mapviewer = None[source]
_idx = ''[source]
OnClose(event)[source]

Close the window

property mapviewer[source]
property idx[source]
class wolfhece._pydraw_utils.Memory_View(screen_width, screen_height, xmin, xmax, ymin, ymax)[source]

Memory view

screen_width[source]
screen_height[source]
xmin[source]
xmax[source]
ymin[source]
ymax[source]
property width[source]

Width of the view

property height[source]

Height of the view

serialize()[source]

Serialize the view

static deserialize(data: dict)[source]

Deserialize the view

class wolfhece._pydraw_utils.Memory_View_encoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

Bases: json.JSONEncoder

Inheritance diagram of wolfhece._pydraw_utils.Memory_View_encoder

Memory view encoder

default(o)[source]

Default method

class wolfhece._pydraw_utils.Memory_View_decoder(*args, **kwargs)[source]

Bases: json.JSONDecoder

Inheritance diagram of wolfhece._pydraw_utils.Memory_View_decoder

Memory view decoder

object_hook(obj)[source]

Decode the object

class wolfhece._pydraw_utils.Memory_Views[source]

Memory views

views: dict[str, Memory_View][source]
add_view(name: str, screen_width: int, screen_height: int, xmin: float, xmax: float, ymin: float, ymax: float)[source]

Add a new view to the memory views

remove_view(name: str)[source]

Remove a view from the memory views

reset()[source]

Reset the memory views

zoom_on(name: str, mapviewer: wolfhece.PyDraw.WolfMapViewer)[source]

Zoom on a view

save(filename: str)[source]

Save the memory views

load(filename: str)[source]

Load the memory views

class wolfhece._pydraw_utils.Memory_Views_GUI(parent, title, memory_views: Memory_Views, mapviewer: wolfhece.PyDraw.WolfMapViewer)[source]

Bases: wx.Frame

Inheritance diagram of wolfhece._pydraw_utils.Memory_Views_GUI

Memory views GUI

mapviewer[source]
_memory_views[source]
_views[source]
_cmdZoom[source]
_cmdAdd[source]
_cmdDelete[source]
_cmdReset[source]
_label_xmin[source]
_xmin[source]
_label_xmax[source]
_xmax[source]
_label_ymin[source]
_ymin[source]
_label_ymax[source]
_ymax[source]
_label_canvas_height[source]
_canvas_height[source]
_cmdGet[source]
_cmdApply[source]
_cmdSave[source]
_cmdLoad[source]
OnSave(event)[source]

Save the memory views

OnLoad(event)[source]

Load the memory views

OnClose(event)[source]

Close the memory views GUI

OnSelectView(event)[source]

Select a view

OnZoom(event)[source]

Zoom on the current view

OnAdd(event)[source]

Add a view

OnDelete(event)[source]

Delete a view

OnReset(event)[source]

Reset the views

OnApply(event)[source]

Apply the changes

OnGet(event)[source]

Get the values

class wolfhece._pydraw_utils.draw_type(*args, **kwds)[source]

Bases: enum.Enum

Inheritance diagram of wolfhece._pydraw_utils.draw_type

Create a collection of name/value pairs.

Example enumeration:

>>> class Color(Enum):
...     RED = 1
...     BLUE = 2
...     GREEN = 3

Access them by:

  • attribute access:

>>> Color.RED
<Color.RED: 1>
  • value lookup:

>>> Color(1)
<Color.RED: 1>
  • name lookup:

>>> Color['RED']
<Color.RED: 1>

Enumerations can be iterated over, and know how many members they have:

>>> len(Color)
3
>>> list(Color)
[<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]

Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.

ARRAYS = 'arrays'[source]
BRIDGES = 'bridges'[source]
WEIRS = 'weirs'[source]
VECTORS = 'vectors'[source]
CLOUD = 'clouds'[source]
TRIANGULATION = 'triangulations'[source]
PARTICLE_SYSTEM = 'particle systems'[source]
CROSS_SECTIONS = 'cross_sections'[source]
OTHER = 'others'[source]
VIEWS = 'views'[source]
RES2D = 'wolf2d'[source]
WMSBACK = 'wms-background'[source]
WMSFORE = 'wms-foreground'[source]
TILES = 'tiles'[source]
IMAGESTILES = 'imagestiles'[source]
LAZ = 'laz'[source]
DROWNING = 'drowning'[source]
DIKE = 'dike'[source]
PICTURECOLLECTION = 'picture_collection'[source]
INJECTOR = 'injector'[source]
class wolfhece._pydraw_utils.Colors_1to9(parent)[source]

Bases: wx.Frame

Inheritance diagram of wolfhece._pydraw_utils.Colors_1to9
_parent[source]
colors1to9 = [(0, 0, 255, 255), (0, 255, 0, 255), (0, 128, 255, 255), (255, 255, 0, 255), (255, 165, 0, 255),...[source]
property directory[source]
property file[source]
change_colors(e)[source]
Apply()[source]
OnOK(event)[source]
OnCancel(event)[source]
OnSetDefault(event)[source]
OnSave(event)[source]
OnLoad(event)[source]
class wolfhece._pydraw_utils.DragdropFileTarget(window: wolfhece.PyDraw.WolfMapViewer)[source]

Bases: wx.FileDropTarget

Inheritance diagram of wolfhece._pydraw_utils.DragdropFileTarget
window[source]
OnDropFiles(x, y, filenames)[source]