[GRASS-git] [OSGeo/grass] 552e00: gui(nviz): Type hinting to the nviz library wrappe...

Edouard Choinière noreply at github.com
Mon Jan 27 16:50:14 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 552e00b8978ede232f134a4303124bc99a06d4da
      https://github.com/OSGeo/grass/commit/552e00b8978ede232f134a4303124bc99a06d4da
  Author: Edouard Choinière <27212526+echoix at users.noreply.github.com>
  Date:   2025-01-27 (Mon, 27 Jan 2025)

  Changed paths:
    M gui/wxpython/core/gcmd.py
    M gui/wxpython/core/utils.py
    M gui/wxpython/gui_core/wrap.py
    M gui/wxpython/mapdisp/frame.py
    M gui/wxpython/mapswipe/mapwindow.py
    M gui/wxpython/nviz/mapwindow.py
    M gui/wxpython/nviz/wxnviz.py

  Log Message:
  -----------
  gui(nviz): Type hinting to the nviz library wrapper and various related improvements (#4899)

* gui.wxpython.nviz: numpy import can safely be below

* gui.wxpython.nviz: Move ctypes and grass.lib imports below normal imports

There is no reason (dependency of imports) apparent here that would prevent it from working.

Works locally in a Ubuntu 22.04 WSL on Windows

* gui.wxpython.nviz: Sort remaining imports

grass.script was already below gui imports in 2023

* gui.wxpython.nviz: Set render flags dicts as a TypedDict

This allows static analysis of self.render dict, that contains 4 keys and all boolean values

* gui.wxpython.nviz.mapwindow: Light typing annotations

* gui.wxpython.nviz.mapwindow: GetContentScaleFactor() typing annotations

* gui.wxpython.nviz: Make GLWindow.ZoomToMap()'s layer argument optional

* gui.wxpython.core.utils: PIL.Image and wx.Image type annotations

* gui.wxpython.gui_core.wrap: wx.Image and wx.Bitmap type annotations

* gui.wxpython.gui_core.wrap: wx.Rect and other type annotations

* gui.wxpython.core.gcmd: Add typing and overloads for EncodeString and DecodeString

* gui: isort mapswipe.mapwindow imports

* gui.wxpython.mapswipe.mapwindow: Add type hints related to wx.Size

* gui.wxpython.nviz.wxnviz: Add type hints for OGSF/Nviz wrappers

Includes using different aliases for different type of ids, to be able to check for usage mismatches

* gui.wxpython.nviz.wxnviz: Add type hints for QueryMap with TypedDict

gui.wxpython.nviz.wxnviz: Add some type hints for Texture and ImageTexture

* gui.wxpython.nviz.wxnviz: Add typing to functions that return empty vectors, considered tuples

* gui.wxpython.nviz.wxnviz: Address type checking warnings in QueryMap

When results of GetPointOnSurface() is None, ensure that we return None, and the other branch is assured to contain floats

* gui.wxpython.nviz.wxnviz: Remove unused import

* gui.wxpython.nviz.mapwindow: Sort imports with an isort split group

* gui.wxpython.nviz.mapwindow: Add some type hints

* gui.wxpython.mapdisp.frame: Sort imports with an isort split group

* gui.wxpython.nviz.mapwindow: Handle some cases where self._display is None or other variables are missing



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list