Simple UI, autogenerated from your classes.
Mutated Properties - a simple HTML5 property-configuration UI, autogenerated from your classes.
It’s great if you need a quick’n’dirty UI with minimal effort and without changing much of the existing codebase. Mutaprops also thrive on headless systems when usual UI solutions like tkinter doesn’t make sense.
However, the customization possibilities are limited, so if you are looking for some framework for building a full-fledged attractive GUI, better look elsewhere.
- Generate a self-documented web UI directly from your objects with simple decorators
- UI state automatically updated with object state changes (through websockets)
- Supports multiple UI sessions on the same object, synchronized through websockets
- Supports clustering of UI’s from multiple machines
- UI look and feel can be customized with your own stylesheet
- Add any widget you like with direct HTML support
- HTML5 log console capturing all your Python logging
- Asyncio support (and also a requirement ;))
The simplest example
Imagine a normal Python class:
class Hoovercraft: MAX_EELS = 40 def __init__(self, number_of_eels=20, speed=0, direction='North'): self._eel_count = number_of_eels self._speed = speed self._direction = direction self._engine_running = False self._steering_locked = True @property def eels(self): return self._eel_count @eels.setter def eels(self, value): self._eel_count = value if self._eel_count >= self.MAX_EELS: logger.warning("The hoovercraft is full of eels!") def drop_all_eels(self): self.eels = 0 logger.info("Eels are goooone!")
Now, to turn this into an UI, one just has to decorate it like this:
from mutaprops import * @mutaprop_class("Hoovercraft UI") class Hoovercraft: MAX_EELS = 40 def __init__(self, number_of_eels=20, speed=0, direction='North'): self._eel_count = number_of_eels self._speed = speed self._direction = direction self._engine_running = False self._steering_locked = True @mutaproperty("Number of eels", MutaTypes.INT, min_val=0, max_val=MAX_EELS) def eels(self): return self._eel_count @eels.setter def eels(self, value): self._eel_count = value if self._eel_count >= self.MAX_EELS: logger.warning("The hoovercraft is full of eels!") @mutaprop_action("Drop all eels!") def drop_all_eels(self): self.eels = 0 logger.info("Eels are goooone!")
And then run it like this:
if __name__ == '__main__': test = Hoovercraft() test.muta_init("Hoovercraft instance #1") man = HttpMutaManager("Hoovercraft manager", proxy_log=logger) man.add_object(test) man.run(port=9000)
Et voila, here’s the UI:
The examples/ folder contains several other examples:
The complete documentation is available at https://mutaprops.readthedocs.io
Using the UI
Simple explanation how to use the UI is here.
The default logo created with the Chlorinar font.
The widgets and styling are based on Bootstrap 3.
The toggle widget is the Bootstrap toggle.
Hoovercraft logo used in advanced_example.py was created by Theresa Stoodley from the Noun Project. Licensed under Creative Commons 3.0 license.
- Added compatibility with newer versions of AioHttp (4.0.0dev) and Python (3.8)
- Fixed (OMG) yet another log message placeholder escaping bug !!!
- Fixed another log message placeholder escaping bug !!
- Fixed log message placeholder escaping bug.
- Fixed master controller connection bug.
- Fixed log timestamp bug.
- Updated sockjs dependency.
- Updated dependencies. (Still not newest, as it is required for Mutaprops to run on Python 3.4)
- Fixed chardet dependency.
- Fixed bug with step setting.
- Added css separation
- Added documentation
- Minor bug fixes
Added the forgoten JS build…
Fixed various UI bugs (read-only settings, responsive design, title). Actions now can have read-only setting.
Fixed incompatibility with Python 3.4.2.
Fixed debug print of properties.
Fixed bug with log messages formatting on the Web UI.
Fixed bug with Bool-type props help panels not uncollapsing.
Fixed error message when object was not selected in an one-object list.
- Large internal rework - introduced update-dependencies for values and selected meta-values (selects, minimums, maximums, steps etc).
- Added MutaSources as non-UI MutaProps for supporting internal dependencies
- Added HTML type of value (read-only)
- JS client now works with single state-store (Vuex)
- MutaSelects removed - this functionality is now replaced by more general update-dependencies through MutaSources. This breaks compatibility with 0.4.x
- Fixed bug with displaying first prop in hierarchy panel.
- One level hierarchy (panels) and experimental support of toggle buttons instead of checkboxes.
- Allowed HTML in help blocks
- Allowed local files/local dir
- Fixed path problem on linux
- Added ALPS logo
- HTTP manager chaining.
- UI bugfixes.
- First (internal) release.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size mutaprops-0.7.4.tar.gz (541.8 kB)||File type Source||Python version None||Upload date||Hashes View|