wolfhece._pydraw_utils ====================== .. py:module:: wolfhece._pydraw_utils .. autoapi-nested-parse:: 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 --------------- .. py:class:: 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) Bases: :py:obj:`wolfhece.matplotlib_fig.Matplotlib_Figure` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.MplFigViewer :parts: 1 :private-bases: Matplotlib Figure with wx Frame .. py:attribute:: _mapviewer :value: None .. py:attribute:: _idx :value: '' .. py:method:: OnClose(event) Close the window .. py:property:: mapviewer .. py:property:: idx .. py:class:: Memory_View(screen_width, screen_height, xmin, xmax, ymin, ymax) Memory view .. py:attribute:: screen_width .. py:attribute:: screen_height .. py:attribute:: xmin .. py:attribute:: xmax .. py:attribute:: ymin .. py:attribute:: ymax .. py:property:: width Width of the view .. py:property:: height Height of the view .. py:method:: serialize() Serialize the view .. py:method:: deserialize(data: dict) :staticmethod: Deserialize the view .. py:class:: Memory_View_encoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None) Bases: :py:obj:`json.JSONEncoder` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.Memory_View_encoder :parts: 1 :private-bases: Memory view encoder .. py:method:: default(o) Default method .. py:class:: Memory_View_decoder(*args, **kwargs) Bases: :py:obj:`json.JSONDecoder` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.Memory_View_decoder :parts: 1 :private-bases: Memory view decoder .. py:method:: object_hook(obj) Decode the object .. py:class:: Memory_Views Memory views .. py:attribute:: views :type: dict[str, Memory_View] .. py:method:: add_view(name: str, screen_width: int, screen_height: int, xmin: float, xmax: float, ymin: float, ymax: float) Add a new view to the memory views .. py:method:: remove_view(name: str) Remove a view from the memory views .. py:method:: reset() Reset the memory views .. py:method:: zoom_on(name: str, mapviewer: wolfhece.PyDraw.WolfMapViewer) Zoom on a view .. py:method:: save(filename: str) Save the memory views .. py:method:: load(filename: str) Load the memory views .. py:class:: Memory_Views_GUI(parent, title, memory_views: Memory_Views, mapviewer: wolfhece.PyDraw.WolfMapViewer) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.Memory_Views_GUI :parts: 1 :private-bases: Memory views GUI .. py:attribute:: mapviewer .. py:attribute:: _memory_views .. py:attribute:: _views .. py:attribute:: _cmdZoom .. py:attribute:: _cmdAdd .. py:attribute:: _cmdDelete .. py:attribute:: _cmdReset .. py:attribute:: _label_xmin .. py:attribute:: _xmin .. py:attribute:: _label_xmax .. py:attribute:: _xmax .. py:attribute:: _label_ymin .. py:attribute:: _ymin .. py:attribute:: _label_ymax .. py:attribute:: _ymax .. py:attribute:: _label_canvas_height .. py:attribute:: _canvas_height .. py:attribute:: _cmdGet .. py:attribute:: _cmdApply .. py:attribute:: _cmdSave .. py:attribute:: _cmdLoad .. py:method:: OnSave(event) Save the memory views .. py:method:: OnLoad(event) Load the memory views .. py:method:: OnClose(event) Close the memory views GUI .. py:method:: OnSelectView(event) Select a view .. py:method:: OnZoom(event) Zoom on the current view .. py:method:: OnAdd(event) Add a view .. py:method:: OnDelete(event) Delete a view .. py:method:: OnReset(event) Reset the views .. py:method:: OnApply(event) Apply the changes .. py:method:: OnGet(event) Get the values .. py:class:: draw_type(*args, **kwds) Bases: :py:obj:`enum.Enum` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.draw_type :parts: 1 :private-bases: 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 - value lookup: >>> Color(1) - name lookup: >>> Color['RED'] Enumerations can be iterated over, and know how many members they have: >>> len(Color) 3 >>> list(Color) [, , ] Methods can be added to enumerations, and members can have their own attributes -- see the documentation for details. .. py:attribute:: ARRAYS :value: 'arrays' .. py:attribute:: BRIDGES :value: 'bridges' .. py:attribute:: WEIRS :value: 'weirs' .. py:attribute:: VECTORS :value: 'vectors' .. py:attribute:: CLOUD :value: 'clouds' .. py:attribute:: TRIANGULATION :value: 'triangulations' .. py:attribute:: PARTICLE_SYSTEM :value: 'particle systems' .. py:attribute:: CROSS_SECTIONS :value: 'cross_sections' .. py:attribute:: OTHER :value: 'others' .. py:attribute:: VIEWS :value: 'views' .. py:attribute:: RES2D :value: 'wolf2d' .. py:attribute:: WMSBACK :value: 'wms-background' .. py:attribute:: WMSFORE :value: 'wms-foreground' .. py:attribute:: TILES :value: 'tiles' .. py:attribute:: IMAGESTILES :value: 'imagestiles' .. py:attribute:: LAZ :value: 'laz' .. py:attribute:: DROWNING :value: 'drowning' .. py:attribute:: DIKE :value: 'dike' .. py:attribute:: PICTURECOLLECTION :value: 'picture_collection' .. py:attribute:: INJECTOR :value: 'injector' .. py:class:: Colors_1to9(parent) Bases: :py:obj:`wx.Frame` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.Colors_1to9 :parts: 1 :private-bases: .. py:attribute:: _parent .. py:attribute:: colors1to9 :value: [(0, 0, 255, 255), (0, 255, 0, 255), (0, 128, 255, 255), (255, 255, 0, 255), (255, 165, 0, 255),... .. py:property:: directory .. py:property:: file .. py:method:: change_colors(e) .. py:method:: Apply() .. py:method:: OnOK(event) .. py:method:: OnCancel(event) .. py:method:: OnSetDefault(event) .. py:method:: OnSave(event) .. py:method:: OnLoad(event) .. py:class:: DragdropFileTarget(window: wolfhece.PyDraw.WolfMapViewer) Bases: :py:obj:`wx.FileDropTarget` .. autoapi-inheritance-diagram:: wolfhece._pydraw_utils.DragdropFileTarget :parts: 1 :private-bases: .. py:attribute:: window .. py:method:: OnDropFiles(x, y, filenames)