Skip to content

Commit

Permalink
Type hinted all of invesalius/data/bases.py, invesalius/data/converte…
Browse files Browse the repository at this point in the history
…rs.py, invesalius/data/poly_data_utils.py, invesalius/data/vtk_utils.py, invesalius/data/watershed_process.py, invesalius/session.py, invesalius/pubsub/pub.py, and invesalius/gui/dialogs.py and cython stubs

* Added type annotations to function signatures

* Annotated rest of widgets

* Added more type defs

excluded listctrl from ruff

Fixed ruff errors in canvas_renderer

* Added typings/utils for useful protocols

* Changed Node to a dataclass using slots

changed font to graphics font to avoid type conflict

* Removed wx.dataview

* resolved review comments

* Type hinted session and inv_paths

* Added stubs for cython

* Type hinted root modules

* Type hinted dialogs.py

* Added event types

* mv typings/wx/ typings/wx-stubs

* mv invesalius_cy/*.pyi typings/invesalius_cy-stubs/

* ruff format invesalius/gui

* Fix review comments

* removed _FireSpin{Min,Max}{Change,Changed}

* deleted unused modules

* Fixing some mypy errors

* Added cy_mesh.pyi and floodfill.pyi
  • Loading branch information
omar-abdelgawad authored Aug 13, 2024
1 parent 740843f commit 1f59027
Show file tree
Hide file tree
Showing 47 changed files with 3,897 additions and 4,388 deletions.
2 changes: 1 addition & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def __init__(self):
# except on win64, due to wxWidgets bug
try:
ok = dialog.ShowModal() == wx.ID_OK
except wx._core.PyAssertionError:
except wx.PyAssertionError:
ok = True
finally:
if ok:
Expand Down
6 changes: 3 additions & 3 deletions invesalius/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import itertools
import sys
from typing import Dict, Optional, Tuple, Union
from typing import Dict, List, Optional, Tuple, Union

import psutil
import wx
Expand Down Expand Up @@ -290,7 +290,7 @@
MASK_NAME_PATTERN = _("Mask %d")
MASK_OPACITY = 0.40
# MASK_OPACITY = 0.35
MASK_COLOUR = [
MASK_COLOUR: List[List[float]] = [
[0.33, 1, 0.33],
[1, 1, 0.33],
[0.33, 0.91, 1],
Expand All @@ -312,7 +312,7 @@

MEASURE_COLOUR = itertools.cycle([[1, 0, 0], [1, 0.4, 0], [0, 0, 1], [1, 0, 1], [0, 0.6, 0]])

SURFACE_COLOUR = [
SURFACE_COLOUR: List[Tuple[float, float, float]] = [
(0.33, 1, 0.33),
(1, 1, 0.33),
(0.33, 0.91, 1),
Expand Down
Loading

0 comments on commit 1f59027

Please sign in to comment.