Machine registry improvements (#10150)

* Add wrapper function for machine registry

* Decorate entrypoint functions

* Docstrings

* Fix for boolean setting

* Add playwright tests

* Use proper entrypoints

* Ensure settings are fetched correctly

* Prevent recursion of machine registry decorator

* Fix machine status display

* Enhanced warning msg

* Add simple machine sample printer

* Adds playwright tests for machine UI

* re-throw exception

* Define 'machine' plugin mixin class

* Adjust machine discovery

* Use plugin mixins for registering machine types and drivers

* Adjust unit test

* Remove plugin static files when deactivating

* Force machine reload when plugin registry changes

* Add plugins specific to testing framework

* Add test for plugin loading sequence

* Add session caching

- Significantly reduce DB hits

* Enhanced unit testing and test plugins

* Refactor unit tests

* Further unit test fixes

* Adjust instance rendering

* Display table of available drivers

* Cleanup

* ADjust unit test

* Tweak unit test

* Add docs on new mixin type

* Tweak machine overview docs

* Tweak playwright tests

* Additional unit test

* Add unit test for calling machine func

* Enhanced playwright tests

* Account for database not being ready
This commit is contained in:
Oliver
2025-08-20 23:00:39 +10:00
committed by GitHub
parent ed31503d3b
commit bd9c52eeaf
40 changed files with 1095 additions and 425 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
title: Barcode Mixin
---
## Barcode Plugins
## BarcodeMixin
InvenTree supports decoding of arbitrary barcode data and generation of internal barcode formats via a **Barcode Plugin** interface. Barcode data POSTed to the `/api/barcode/` endpoint will be supplied to all loaded barcode plugins, and the first plugin to successfully interpret the barcode data will return a response to the client.
+53
View File
@@ -0,0 +1,53 @@
---
title: Machine Mixin
---
## MachineDriverMixin
The `MachineDriverMixin` class is used to implement custom machine drivers (or machine types) in InvenTree.
InvenTree supports integration with [external machines](../machines/overview.md), through the use of plugin-supplied device drivers.
### get_machine_drivers
To register custom machine driver(s), the `get_machine_drivers` method must be implemented. This method should return a list of machine driver classes that the plugin supports.
::: plugin.base.integration.MachineMixin.MachineDriverMixin.get_machine_drivers
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
summary: False
members: []
extra:
show_source: True
The default implementation returns an empty list, meaning no custom machine drivers are registered.
### get_machine_types
To register custom machine type(s), the `get_machine_types` method must be implemented. This method should return a list of machine type classes that the plugin supports.
::: plugin.base.integration.MachineMixin.MachineDriverMixin.get_machine_types
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
summary: False
members: []
extra:
show_source: True
The default implementation returns an empty list, meaning no custom machine types are registered.
## Sample Plugin
A sample plugin is provided which implements a simple [label printing](../machines/label_printer.md) machine driver:
::: plugin.samples.machines.sample_printer.SamplePrinterMachine
options:
show_bases: False
show_root_heading: False
show_root_toc_entry: False
show_source: True
members: []
+1 -1
View File
@@ -4,7 +4,7 @@ title: Mail Mixin
## MailMixin
The MailMixin class provides basic functionality for processing in- and outgoing mails.
The `MailMixin` class provides basic functionality for processing in- and outgoing mails.
### Sample Plugin
+1 -1
View File
@@ -16,7 +16,7 @@ The ScheduleMixin class provides a plugin with the ability to call functions at
{{ image("plugin/enable_schedule.png", "Enable schedule integration") }}
### SamplePlugin
### Sample Plugin
An example of a plugin which supports scheduled tasks:
+1 -1
View File
@@ -2,7 +2,7 @@
title: User Interface Mixin
---
## User Interface Mixin
## UserInterfaceMixin
The `UserInterfaceMixin` class provides a set of methods to implement custom functionality for the InvenTree web interface.