-
Notifications
You must be signed in to change notification settings - Fork 287
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
Introducing wxPython type stubs #801
Conversation
…nit instead of outside
excluded listctrl from ruff Fixed ruff errors in canvas_renderer
…on state of object
changed font to graphics font to avoid type conflict
I'm not against the using Pyright instead of Mypy. It is faster and is already used as LSP (VSCode uses Pylance, but Pylance uses Pyright). |
Then I will study the options and decide later. Until then I will be satisfying both type checkers. |
Can you please inform me of the types of both |
Both are a list of objects that implements the method |
Hi @tfmoraes ! Can I get confirmation that the points are OK to be |
On a side note, shouldn't |
You can use tuple of float for every position in this file. |
You mean an |
Looks like handling all errors properly in this module ( |
Ok. I think that is better. |
commit 020cd60 Author: Thiago Franco de Moraes <[email protected]> Date: Mon Aug 5 10:41:11 2024 -0300 Removed eval from dicom.py (invesalius#820) commit d1d62f7 Author: Paulo Henrique Junqueira Amorim <[email protected]> Date: Wed Jul 31 09:52:34 2024 -0300 Bundle win64 (invesalius#817) commit 0f2071c Author: Paulo Henrique Junqueira Amorim <[email protected]> Date: Wed Jul 31 09:40:10 2024 -0300 Date and commit hash updated in about when generating the executable (invesalius#816) commit b66217b Author: Hafsa Shoaib <[email protected]> Date: Tue Jul 30 23:32:52 2024 +0500 Update "Getting Started" link to the new user manual commit 9400fda Author: Paulo Henrique Junqueira Amorim <[email protected]> Date: Tue Jul 30 11:38:48 2024 -0300 Github action for automatic generation of nightly releases (invesalius#814) * Added bundle files to generate .exe * Added icons to windows install wizard * First version to automatically add to nightly release * Temporarily removed plugins * Test to nightly release - to try fix setup * Fix plugin path after installation commit 1d49c5d Author: Thiago Franco de Moraes <[email protected]> Date: Mon Jul 29 10:40:20 2024 -0300 Fix launch new instance of InVesalius (invesalius#812) commit 3d88ea4 Author: Omar Abdelgawad <[email protected]> Date: Sat Jul 27 04:29:10 2024 +0300 removed slots and numpy.floating (invesalius#810) commit 79a7775 Author: Renan Matsuda <[email protected]> Date: Thu Jul 25 11:33:57 2024 -0300 FIX: ruff format commit 3a79ea7 Author: Renan Matsuda <[email protected]> Date: Thu Jul 25 11:33:05 2024 -0300 ADD: robot messages in neuronavigation_api commit dde0e54 Author: Thiago Franco de Moraes <[email protected]> Date: Thu Jul 18 10:21:29 2024 -0300 Formatted source code with ruff (invesalius#806) commit 817e6fe Author: Omar Abdelgawad <[email protected]> Date: Thu Jul 18 16:20:35 2024 +0300 Introducing wxPython type stubs (invesalius#801) * formatted and fixed linting of clut_raycasting * changed wl_px initialization to None to make it compatible with Tuple type * Removed default values of Node attributes had initialization inside init instead of outside * Added type annotations to function signatures * Formatted and fixed linting of clut_imagedata * Added typings directory for stubs * fixed some annotations after addings stubs * Annotated rest of widgets * Added more type defs excluded listctrl from ruff Fixed ruff errors in canvas_renderer * removed python2 weakrefmethod compatibility * changed draw_text function to take value as input instead of relying on state of object * Added extra parameter to _move_node * Added typings/utils for useful protocols * Changed Button API to take bitmap img on construction * Changed Node to a dataclass using slots changed font to graphics font to avoid type conflict * Removed wx.dataview * Changed return None to exception * type hinted missing signatures * Formatted constants.py * resolved review comments * Fixed | to Union and turned types imported at typechecking only to str * Annotated draw_list * Changed CanvasHandlerBase to ABC * Changed ColourType to accept str * Added generic annotation for mypy * fixed second review errors * Fixed Merge conflict commit 58058e9 Merge: 6594434 35579b6 Author: Victor Hugo Souza <[email protected]> Date: Mon Jul 15 09:36:11 2024 +0200 Merge pull request invesalius#735 from Abo-Omar-74/Feature-Add-Progress-Bar-for-Open-Project-Functionality Add Progress bar for File/Save Project functionality , replacing busy cursor commit 35579b6 Author: Victor Souza <[email protected]> Date: Mon Jul 15 10:32:48 2024 +0300 FIX: Formatting of control.py with ruff commit fb95a88 Author: Victor Souza <[email protected]> Date: Mon Jul 15 10:23:47 2024 +0300 ENH: Create bind_events for subscribe in progress bar commit 3b35e46 Author: Victor Souza <[email protected]> Date: Mon Jul 15 10:19:00 2024 +0300 FIX: dialogs formatting with ruff commit 9a3a122 Author: Mohamed Abo-Omar <[email protected]> Date: Mon Jun 10 23:38:26 2024 +0300 Renaming was_cancelled function commit 6ae2d80 Author: Mohamed Abo-Omar <[email protected]> Date: Mon Jun 10 23:29:38 2024 +0300 Disabling Cancel button commit 51647f6 Author: Mohamed Abo-Omar <[email protected]> Date: Mon Apr 1 16:35:28 2024 +0200 Add Progress bar for File/Save Project functionality , replacing busy cursor commit 6594434 Merge: c18da9f 1d9dcb0 Author: Victor Hugo Souza <[email protected]> Date: Sun Jul 14 09:34:55 2024 +0200 Merge pull request invesalius#800 from invesalius/minors-visualization-nav Minors visualization navigation commit 1d9dcb0 Author: Victor Souza <[email protected]> Date: Sun Jul 14 10:34:02 2024 +0300 FIX: Formatting of task_navigator commit 297a6c6 Merge: a3a4136 c18da9f Author: Victor Hugo Souza <[email protected]> Date: Sun Jul 14 09:22:44 2024 +0200 Merge branch 'master' into minors-visualization-nav commit c18da9f Merge: adafa00 46c0d3c Author: Victor Hugo Souza <[email protected]> Date: Sat Jul 13 21:11:24 2024 +0200 Merge pull request invesalius#786 from Rakhesis/fiducial-buttons Improved object and tracker fiducial registration UI commit adafa00 Merge: 5848aa4 473496a Author: Renan <[email protected]> Date: Wed Jul 10 10:35:44 2024 -0300 Merge pull request invesalius#803 from lukatolo/fix-typo Fix app-breaking typo introduced in commit 8a62bac commit 473496a Author: Tolonen Luka <[email protected]> Date: Wed Jul 10 16:01:21 2024 +0300 Fix app-breaking typo introduced in commit 8a62bac commit 5848aa4 Author: Victor Hugo Souza <[email protected]> Date: Mon Jul 8 15:41:30 2024 +0200 UPD: Update conda and pip packages for Python 3.11 (invesalius#798) * UPD: Update conda and pip packages for Python 3.11 * BMP: Bump numpy to 1.26.4 commit a3a4136 Author: Renan Matsuda <[email protected]> Date: Mon Jul 8 09:38:53 2024 -0300 FIX: Set target mode button off when track obj is disabled commit f7198cf Author: Renan Matsuda <[email protected]> Date: Mon Jul 8 09:25:12 2024 -0300 FIX: show pointer in 3D scene when track object is off and reformating viewer_volume and navigation and commit 208e152 Author: Omar Abdelgawad <[email protected]> Date: Fri Jul 5 22:01:41 2024 +0300 Added Action for running pre-commit on pull requests (invesalius#802) commit 46c0d3c Author: Victor Souza <[email protected]> Date: Fri Jul 5 09:54:17 2024 +0300 FIX: Button colors were not updated in MacOS commit 095f9a9 Merge: fc22c72 5d86d8d Author: Victor Souza <[email protected]> Date: Fri Jul 5 08:17:20 2024 +0300 FIX: Merge conflicts at task_navigator commit 5d86d8d Merge: 8a62bac 35d6551 Author: Renan <[email protected]> Date: Thu Jul 4 16:51:27 2024 -0300 Merge pull request invesalius#793 from henrikkauppi/context-menu-improvements Context menu improvements commit 0646990 Author: Rakhesis <[email protected]> Date: Thu Jul 4 17:40:26 2024 +0300 ENH: Cross tool can be disabled when it was enabled for image registration Using the cross tool toggle button will automatically disable image registration. This will prevent the cross tool from getting stuck turned on. commit 9128311 Author: Rakhesis <[email protected]> Date: Thu Jul 4 17:33:38 2024 +0300 MOD: Stop image registration when all fiducials have been set commit 35d6551 Merge: 600cc97 8a62bac Author: Henrik Kauppi <[email protected]> Date: Wed Jul 3 14:35:49 2024 +0300 Merge branch 'invesalius:master' into context-menu-improvements commit 600cc97 Author: Henrik Kauppi <[email protected]> Date: Wed Jul 3 12:45:25 2024 +0300 FIX: cancel color dialog bug and KeyError when trying to change color of a mask after deleting the previous mask commit 8a62bac Author: rishabh-ranjan1 <[email protected]> Date: Tue Jul 2 19:41:11 2024 +0530 Request to look into my branch and 'pull' if it is reasonable (invesalius#780) * Added page for Logging in Preferences * ... * updated session.py * ... * updated frame.py * ... * '...' * constants.py file updated for proper saving of options chosen * removed debug print statements * added logfilr name text field * Log file name: choosing a default name, saving, loading options rectified * Changed the logging interface * Changed the logging interface * Logging file selection completed. * Moved logging option types as constants * Changed RadioButton to Choices window for logging level selection to reduce window width * Begun log.py file for logging options * ... * ... * some changes for logging. not done yet ... * some changes for logging. not done yet ... * ... * ... * ... * ... * ... * ... * ... * Adding an error catching decorator * refactoring log preference interface * Changes to have interface for console and file logging. testing due * ... * ... * Rool Logger setLevel needs to be called after adding all handlers * moved __set_default_logfile__ from session.py to log.py * Beginnng to work of directing console log into a wx Text window * Console logging messages in a separate window - WIP * Separate window for console stream log. Still WIP. * Messages still not coming, but no issue with consle window * Window interface for console logging. Almost there * some cleaning * Need to figure log level settings at different levels for console, file, general * sill WIP * sill WIP * bugs in console log window removed, but still work in progress * Commented out the /close button. Goof fo r now. * Removed recursive buggy call. * default log file name option added * cleanup a bit * ... * some clean up * Replaced calling new logger with invLogger * Replaced calling new logger with log.invLogger * Replaced calling new logger with log.invLogger * Decorators modified/added * Logging format added as a parameter; bug removed when presribed logfile name does not exist while calling os.path.samefile * log.py moved from data folder to gui folder * log.py moved from data folder to gui folder * Modification in Logging tab going on. Work in progress ... * Logging interface udate. Still work in progress ... * Logging interface size seems under control now * ... * changed function names * code cleanup * bug removed: console logging now stopping when deselected, and starting back when reselected * Addressing the FileNotFoundError * flush method added to class ConsoleRedirectText * New version of Error correction decorator added. * Some more exploratory code for error handling added for testing. WIP. * Some more exploratory code for error handling added for testing. WIP. * Error handling - WIP --------- Co-authored-by: Rishabh Ranjan <[email protected]> commit fc22c72 Author: Renan Matsuda <[email protected]> Date: Fri Jun 28 16:36:23 2024 -0300 FIX: marker_type checks track_obj flag commit c71d487 Author: Renan Matsuda <[email protected]> Date: Fri Jun 28 16:35:22 2024 -0300 REM: keeps torus when hide coil button is pressed commit aeeb3f2 Merge: 6608ed7 870e968 Author: Renan <[email protected]> Date: Fri Jun 28 08:49:58 2024 -0300 Merge pull request invesalius#799 from vhosouza/fix-gui-refine-call FIX: Refine called non-existing UpdateGUI commit 870e968 Author: Victor Souza <[email protected]> Date: Fri Jun 28 12:16:18 2024 +0300 FIX: Refine called non-existing UpdateGUI commit dd3fd7b Author: Rakhesis <[email protected]> Date: Thu Jun 27 20:30:48 2024 +0300 MOD: ObjectCalibrationDialog fiducial actors color to match buttons OrderedFiducialButtons now colors the fiducial ball and text actors to match the buttons. Use colorblind-friendly colors for ball and text actors. commit f7dc061 Author: Rakhesis <[email protected]> Date: Thu Jun 27 20:27:21 2024 +0300 ENH: Fixed coordinate collection "Fixed fiducial" for coil registration now collected automatically after collecting the anterior fiducial for certain trackers. Added list of trackers with which to collect the fixed coordinate separately to constants.py. Fixed coordinate hidden from GUI when not needed. Hiding the Fastrak sensor port and the dynamic reference combobox now use the same condition. commit fa13e08 Author: Rakhesis <[email protected]> Date: Thu Jun 27 18:20:32 2024 +0300 ADD: Reset button to ObjectCalibrationDialog commit 44e93e4 Author: Rakhesis <[email protected]> Date: Thu Jun 27 18:10:56 2024 +0300 FIX: Preferences page shows "None" when a configuration has been previously loaded commit 78dce8a Author: Rakhesis <[email protected]> Date: Thu Jun 27 18:05:57 2024 +0300 CLN: CoregistrationPanel comments commit 58807b1 Author: Rakhesis <[email protected]> Date: Thu Jun 27 18:02:14 2024 +0300 ENH: Registration GUI text Changed labels in GUI: Stimulator -> TMS Coil Tracker Registration -> Patient Registration Enhanced tooltips. commit 9f2b411 Author: Rakhesis <[email protected]> Date: Thu Jun 27 17:59:02 2024 +0300 ENH: Reset tracker fiducials on starting registration commit c1daba6 Author: Henrik Kauppi <[email protected]> Date: Thu Jun 27 17:08:13 2024 +0300 FIX: Update the color in the surface properties UI after deleting a surface commit a49f010 Author: Victor Souza <[email protected]> Date: Thu Jun 27 15:07:56 2024 +0300 ENH: Improve surface transparency dialog control commit 0768e26 Author: Victor Souza <[email protected]> Date: Thu Jun 27 14:57:27 2024 +0300 ENH: Improve surface transparency update commit d3461f8 Author: Henrik Kauppi <[email protected]> Date: Thu Jun 27 14:51:24 2024 +0300 CLN: Remove unnecessary if statement commit 81e9f15 Author: Victor Souza <[email protected]> Date: Thu Jun 27 11:00:29 2024 +0300 FIX: Change label dialog in MacOS parameter error commit 7a64b2c Author: Henrik Kauppi <[email protected]> Date: Thu Jun 27 13:09:16 2024 +0300 FIX: Moving the transparency slider now updates surface transparency in volume viewer in real time commit a57fe83 Author: Henrik Kauppi <[email protected]> Date: Wed Jun 26 15:54:59 2024 +0300 MOD: make function names more descriptive commit 858ce21 Author: Henrik Kauppi <[email protected]> Date: Wed Jun 26 15:36:44 2024 +0300 MOD: simplify context menu item names commit 7d0133c Author: Henrik Kauppi <[email protected]> Date: Wed Jun 26 15:32:14 2024 +0300 ADD: Confirmation dialog window when deleting masks or surfaces commit f58a1e6 Merge: 2243d30 6608ed7 Author: Henrik Kauppi <[email protected]> Date: Wed Jun 26 15:23:48 2024 +0300 Merge branch 'invesalius:master' into context-menu-improvements commit 2243d30 Author: Henrik Kauppi <[email protected]> Date: Wed Jun 26 15:20:57 2024 +0300 ADD: option to change surface transparency in the surface list context menu commit 3166197 Author: Henrik Kauppi <[email protected]> Date: Wed Jun 26 11:31:32 2024 +0300 ADD: Context menu with change color, duplicate, and delete options to the list of surfaces commit 6608ed7 Merge: 25f94c7 c520bb8 Author: Renan <[email protected]> Date: Tue Jun 25 17:14:15 2024 -0300 Merge pull request invesalius#792 from vhosouza/select_nifti_volume FIX: Fail to import NIfTI with multiple volumes commit c520bb8 Author: Victor Souza <[email protected]> Date: Tue Jun 25 22:54:27 2024 +0300 ENH: Allow user to decide rescaling nifti pixel intensity commit e4e2a4d Author: Victor Souza <[email protected]> Date: Tue Jun 25 17:29:42 2024 +0300 FIX: Fail to import NIfTI with multiple volumes commit eeff860 Merge: 4b33a19 25f94c7 Author: Henrik Kauppi <[email protected]> Date: Tue Jun 25 09:17:21 2024 +0300 Merge branch 'invesalius:master' into context-menu-improvements commit 4b33a19 Author: Henrik Kauppi <[email protected]> Date: Thu Jun 20 16:44:12 2024 +0300 ADD: Context menu to masks list with options to edit, duplicate and delete masks commit 25f94c7 Author: Omar Abdelgawad <[email protected]> Date: Wed Jun 19 16:53:51 2024 +0300 Type info Added to gradient.py and inv_spinctrl.py (invesalius#787) * Formmatted and fixed linting error with ruff. Also marked get_physical_memory and predict_memory as deprecated since they were not used anywhere. * Added Exception after except to avoid handling base Exceptions such as ctrl-C * type hinted utils.py * added Tuple, and List for py38 compatibility formatted and removed python2's import ordereddict statement in slice_menu.py * Added type info to slice_menu.py * fixed ruff linting errors * Removed unused import removed old super() arguments * commented unused variables * removed old wx version line * Annotated ranges as ints * Type hinted function parameters and return types of inv_spinctrl.py * type hinted function signatures in gradient.py * removed ChangeMinValue and ChangeMaxValue deprecated functions * Added annotations for colourtype Changed GradientDisp and GradientNoSlide api * Annotated unknown Events as Any * Added SpinEvent and FocusEvent types commit 81764b7 Author: Henrik Kauppi <[email protected]> Date: Thu Jun 13 16:02:56 2024 +0300 ADD: Delete option to the marker list context menu commit e644f1a Author: Rakhesis <[email protected]> Date: Mon Jun 10 16:09:40 2024 +0300 ENH: Tracker fiducial registration Use OrderedFiducialButtons class for tracker fiducials. Changed fiducial registration order from LE, RE, NA to LE, NA, RE. Fiducial registration order can now be changed more easily through constants.py. Can click on fiducial buttons to record fiducials out of default order. commit d490dd7 Author: Rakhesis <[email protected]> Date: Mon Jun 10 15:24:51 2024 +0300 ENH: Object fiducial registration Implement object registration using OrderedFiducialButtons. Fiducial buttons now colored like with tracker fiducials for improved clarity. Less clicking required to record fiducials. commit 14fa2c3 Author: Rakhesis <[email protected]> Date: Mon Jun 10 13:51:45 2024 +0300 ADD: Class for creating fiducial buttons New class OrderedFiducialButtons for creating fiducial buttons and keeping track of which button to set next. commit ed080de Author: Rakhesis <[email protected]> Date: Mon Jun 10 13:47:27 2024 +0300 ENH: PedalConnector code clarity
📢 Describe your changes
invesalius/gui/widgets/
with few errors remaining for only two files.typings/wx
where I would be improving it little by little across the project. (Most of the pyi file Now is still untyped).typings/utils
__init__
instead of assigningNone
to it, changing a name of a variable inside a function to avoid clash with a different type, etc. All changes are minor and local to methods. The API exported from all modules are still the same.__eq__
method.🧪 How to test this Pull Request
ruff check invesalius/gui/widgets/
🗒️ Notes for future improvements
invesalius/gui/widgets/*.py
files were fixed in this PR.