Magic-class

Latest version: v0.7.14

Safety actively analyzes 723217 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 8 of 11

0.5.11

New Features
---------------
- `bind_key` can bind private methods to keyboard shortcuts now.
- `MagicTemplate` can check undesired override when subclassed.

Changes
----------
- Macro recording functions are now dependent on [macro-kit](https://github.com/hanjinliu/macro-kit).
- Try/except block in method-to-widget conversion, because some callable objects is not compatible with magic class construction.
- The `myname="ui"` argument in `create_macro` method is deleted because this change can simplify the code a lot.
- Block macro recording if it is caused by another function that causes macro recording.

Bug Fixes
-----------
- Tooltips was disabled by magic-class `wraps` methods (docstrings were not inherited correctly).
- Magic classes inserted into parent magic class did not update `__magicclass_parent__` attribute.
- Bug fix in container generated by `widget_type="list"`.

0.5.10

New Features
---------------
- Custom key-binding is working! Decorate method with `bind_key("Ctrl-A")` and that's it.
- New container `GroupBoxContainer` with option `magicclass(widget_type="groupbox")`
- `to_clipboard` helper function.

Changes
---------
- `show_messagebox` are moved to `magicclass.utils`

0.5.9

New Features
---------------
- Add traceback of widget creation history and error causing method definition when magic class construction failed.
- `DictWidget` similar to `ListWidget` is available.
- `ProgressWidget` is partly working in parallel.
- `show_url` function for opening a URL in the default web browser.
- Any widgets can now be added to menu bar via `QWidgetAction`.
- `NapariCanvas` is available now, which is useful for building simple `napari`-like widget.
- `MagicTemplate` is available, which is useful to make magic class specific attributes discoverable from IDE and console.
- New container variation based on `QMdiArea` (`widget_type="subwindows"`).

Changes
----------
- `wraps` system was completely re-implemented. Now it actually calls parent method. No API changes.
- `magicclass` in `magicmenu` will actually be docked into the menu bar for integrity of API.

Bug Fix
--------
- Compatibility of `Bound` and fields.
- Make `QtConsole` compatible to current implementation.

0.5.8

New Features
---------------
- All the push buttons have `running` attribute now. This attribute is True only when the function is running in `magicgui` side, that is, executed from GUI. It is useful when a function need to know how it is called (e.g. don't use thread worker when function is called from script).
- `MagicValueField` and `vfield` can make a field that is more similar to Python `property`. See the document for details.
- `record` option in `field` function. Use `field(..., record=False)` to avoid recording value changes in macro.
- `"bind"` option supports `MagicField` now. See the document for details.
- `Bound` function for annotation with `"bind"` options.
- Traceback of widget creation will be printed when an error occurred during magic-class construction.

Important Changes
---------------------
- `MagicField` is now always referred via `__get__`. There is not change in API, but fields became immutable.
- `FrozenContainer` is no longer used because it doesn't have to be a container. `FreeWidget` is now used instead. Therefore, `Containter`'s methods are no longer supported.
- Many methods of `ListWidget` are renamed because it is no longer a `Container`. It is much more similar to Python `list` now.
- `add_item` → `append`
- `insert_item` → `insert`
- `pop_item` → `pop`

Bug fixes
----------
- The disgusting spaces in separators are removed.
- `Annotated` type works well in magic-class.

0.5.7

Changes
----------
- `QtPlotCanvas.layers` and `QtImageCanvas.layers` now return `LayerList` object, which acts much more similar to `napari`'s layer list.
- `show_messagebox` function for popping up a message box dialog.

Bug Fixes
----------
- `error_mode="stderr"` bug fix.
- The image layer of `QtImageCanvas` was off by 0.5 pixel compared to `napari` and `matplotlib`.

0.5.6

Bug Fixes
-----------
- `MagicField` did not deal with not installed module correctly
- `QtImageCanvas.image` property raised error when image was not set.

Page 8 of 11

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.