Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 22 commits into from
Jan 28, 2025
Merged
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
286a32f
gui.wxpython.nviz: numpy import can safely be below
echoix Dec 23, 2024
7cbb713
gui.wxpython.nviz: Move ctypes and grass.lib imports below normal imp…
echoix Dec 23, 2024
7759b78
gui.wxpython.nviz: Sort remaining imports
echoix Dec 23, 2024
e09f4cf
gui.wxpython.nviz: Set render flags dicts as a TypedDict
echoix Dec 23, 2024
8ed3f41
gui.wxpython.nviz.mapwindow: Light typing annotations
echoix Dec 23, 2024
0444061
gui.wxpython.nviz.mapwindow: GetContentScaleFactor() typing annotations
echoix Dec 23, 2024
543e09d
gui.wxpython.nviz: Make GLWindow.ZoomToMap()'s layer argument optional
echoix Dec 24, 2024
0b7da47
gui.wxpython.core.utils: PIL.Image and wx.Image type annotations
echoix Dec 24, 2024
dc7bdf1
gui.wxpython.gui_core.wrap: wx.Image and wx.Bitmap type annotations
echoix Dec 24, 2024
2f577e5
gui.wxpython.gui_core.wrap: wx.Rect and other type annotations
echoix Dec 24, 2024
318ffeb
gui.wxpython.core.gcmd: Add typing and overloads for EncodeString and…
echoix Dec 24, 2024
d38c9fa
gui: isort mapswipe.mapwindow imports
echoix Dec 24, 2024
ba1d9d3
gui.wxpython.mapswipe.mapwindow: Add type hints related to wx.Size
echoix Dec 24, 2024
581cf77
gui.wxpython.nviz.wxnviz: Add type hints for OGSF/Nviz wrappers
echoix Dec 25, 2024
a4b781a
gui.wxpython.nviz.wxnviz: Add type hints for QueryMap with TypedDict
echoix Dec 25, 2024
4150039
gui.wxpython.nviz.wxnviz: Add typing to functions that return empty v…
echoix Dec 25, 2024
c47d892
gui.wxpython.nviz.wxnviz: Address type checking warnings in QueryMap
echoix Dec 25, 2024
43a383a
gui.wxpython.nviz.wxnviz: Remove unused import
echoix Dec 25, 2024
1b6d041
gui.wxpython.nviz.mapwindow: Sort imports with an isort split group
echoix Dec 25, 2024
d8e84fc
gui.wxpython.nviz.mapwindow: Add some type hints
echoix Dec 25, 2024
3263de2
gui.wxpython.mapdisp.frame: Sort imports with an isort split group
echoix Dec 25, 2024
8b576c7
gui.wxpython.nviz.mapwindow: Handle some cases where self._display is…
echoix Dec 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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
echoix committed Dec 31, 2024
commit e09f4cfeae76f7e8bb394422d60b25b33f5414e0
14 changes: 12 additions & 2 deletions gui/wxpython/nviz/mapwindow.py
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@
import sys
import time
from threading import Thread
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, TypedDict

import wx
from wx.lib.newevent import NewEvent
@@ -57,6 +57,16 @@
wxUpdateCPlane, EVT_UPDATE_CPLANE = NewEvent()


class RenderTypedDict(TypedDict):
"""Typed dictionary to store the render flags for GLWindow.
At runtime, it is a plain dict."""

quick: bool
vlines: bool
vpoints: bool
overlays: bool


class NvizThread(Thread):
def __init__(self, log, progressbar, window):
Thread.__init__(self)
@@ -139,7 +149,7 @@ def __init__(
self.context = glcanvas.GLContext(self)

# render mode
self.render = {
self.render: RenderTypedDict = {
"quick": False,
# do not render vector lines in quick mode
"vlines": False,