ovos-mark1-utils


Nameovos-mark1-utils JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttps://github.com/OpenVoiceOS/ovos-mark1-utils
SummaryNone
upload_time2024-09-09 22:51:29
maintainerNone
docs_urlNone
authorJarbas
requires_pythonNone
licenseApache-2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # OVOS Mark1 Client

small library to interact with a [Mycroft Mark1 faceplate via the messagebus](https://openvoiceos.github.io/message_spec/phal_mk1/)

gives you full control of the faceplate and eyes pixel by pixel

![](./demo/86788719_10157996735085818_3139665318654246912_n.jpg)

## Usage

drawing in python

```python
from ovos_mark1.faceplate import BlackScreen

class MusicIcon(BlackScreen):
    str_grid = """
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX     XXXXXXXXXXXXX
XXXXXXXXXXXXXX     XXXXXXXXXXXXX
XXXXXXXXXXXXXX XXX XXXXXXXXXXXXX
XXXXXXXXXXXXXX XXX XXXXXXXXXXXXX
XXXXXXXXXXXXX  XX  XXXXXXXXXXXXX
XXXXXXXXXXXX   X   XXXXXXXXXXXXX
XXXXXXXXXXXXX XXX XXXXXXXXXXXXXX
"""

icon = MusicIcon()
icon.print()  # show in terminal
icon.display()  # show in mark1
```

Animate the eyes

```python
from ovos_mark1.eyes import Eyes
from ovos_bus_client.util import get_mycroft_bus

bus = get_mycroft_bus("0.0.0.0")

eyes = Eyes(bus)
eyes.hue_spin()
```

Animation helpers

```python

# it's snowing !
class FallingDots(FacePlateAnimation):
    def __init__(self, n=10, bus=None):
        super().__init__(bus=bus)
        self._create = True
        assert 0 < n < 32
        self.n = n

    @property
    def n_dots(self):
        n = 0
        for y in range(self.height):
            for x in range(self.width):
                if self.grid[y][x]:
                    n += 1
        return n

    def animate(self):
        self.move_down()
        if self._create:
            if random.choice([True, False]):
                self._create = False
                x = random.randint(0, self.width - 1)
                self.grid[0][x] = 1
        if self.n_dots < self.n:
            self._create = True
```

Pre made animations

```python
from ovos_mark1.faceplate.animations import ParticleBox
from ovos_utils.messagebus import get_mycroft_bus
from time import sleep

bus = get_mycroft_bus("0.0.0.0")

for faceplate in ParticleBox(bus=bus):
    faceplate.display(invert=False)
    sleep(0.5)


from ovos_mark1.faceplate.cellular_automaton import Rule110

a = Rule110(bus=bus)

for grid in a:
    grid.print()  # animate in terminal
    grid.display(invert=False)
    sleep(0.5)
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/OpenVoiceOS/ovos-mark1-utils",
    "name": "ovos-mark1-utils",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": null,
    "author": "Jarbas",
    "author_email": "jarbas@openvoiceos.com",
    "download_url": null,
    "platform": null,
    "description": "# OVOS Mark1 Client\n\nsmall library to interact with a [Mycroft Mark1 faceplate via the messagebus](https://openvoiceos.github.io/message_spec/phal_mk1/)\n\ngives you full control of the faceplate and eyes pixel by pixel\n\n![](./demo/86788719_10157996735085818_3139665318654246912_n.jpg)\n\n## Usage\n\ndrawing in python\n\n```python\nfrom ovos_mark1.faceplate import BlackScreen\n\nclass MusicIcon(BlackScreen):\n    str_grid = \"\"\"\nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX\nXXXXXXXXXXXXXX     XXXXXXXXXXXXX\nXXXXXXXXXXXXXX     XXXXXXXXXXXXX\nXXXXXXXXXXXXXX XXX XXXXXXXXXXXXX\nXXXXXXXXXXXXXX XXX XXXXXXXXXXXXX\nXXXXXXXXXXXXX  XX  XXXXXXXXXXXXX\nXXXXXXXXXXXX   X   XXXXXXXXXXXXX\nXXXXXXXXXXXXX XXX XXXXXXXXXXXXXX\n\"\"\"\n\nicon = MusicIcon()\nicon.print()  # show in terminal\nicon.display()  # show in mark1\n```\n\nAnimate the eyes\n\n```python\nfrom ovos_mark1.eyes import Eyes\nfrom ovos_bus_client.util import get_mycroft_bus\n\nbus = get_mycroft_bus(\"0.0.0.0\")\n\neyes = Eyes(bus)\neyes.hue_spin()\n```\n\nAnimation helpers\n\n```python\n\n# it's snowing !\nclass FallingDots(FacePlateAnimation):\n    def __init__(self, n=10, bus=None):\n        super().__init__(bus=bus)\n        self._create = True\n        assert 0 < n < 32\n        self.n = n\n\n    @property\n    def n_dots(self):\n        n = 0\n        for y in range(self.height):\n            for x in range(self.width):\n                if self.grid[y][x]:\n                    n += 1\n        return n\n\n    def animate(self):\n        self.move_down()\n        if self._create:\n            if random.choice([True, False]):\n                self._create = False\n                x = random.randint(0, self.width - 1)\n                self.grid[0][x] = 1\n        if self.n_dots < self.n:\n            self._create = True\n```\n\nPre made animations\n\n```python\nfrom ovos_mark1.faceplate.animations import ParticleBox\nfrom ovos_utils.messagebus import get_mycroft_bus\nfrom time import sleep\n\nbus = get_mycroft_bus(\"0.0.0.0\")\n\nfor faceplate in ParticleBox(bus=bus):\n    faceplate.display(invert=False)\n    sleep(0.5)\n\n\nfrom ovos_mark1.faceplate.cellular_automaton import Rule110\n\na = Rule110(bus=bus)\n\nfor grid in a:\n    grid.print()  # animate in terminal\n    grid.display(invert=False)\n    sleep(0.5)\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": null,
    "version": "0.0.1",
    "project_urls": {
        "Homepage": "https://github.com/OpenVoiceOS/ovos-mark1-utils"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7aee6eff60f7e5f1e182147c2596c4470da5312f129a3dc14cf606d760baf466",
                "md5": "2bf5fc65571ba55403701e18766e3893",
                "sha256": "5cf8a613e6161bfb133819510dc8e95456a78609c7c6fddbde6f912a82716ed0"
            },
            "downloads": -1,
            "filename": "ovos_mark1_utils-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "2bf5fc65571ba55403701e18766e3893",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19675,
            "upload_time": "2024-09-09T22:51:29",
            "upload_time_iso_8601": "2024-09-09T22:51:29.553207Z",
            "url": "https://files.pythonhosted.org/packages/7a/ee/6eff60f7e5f1e182147c2596c4470da5312f129a3dc14cf606d760baf466/ovos_mark1_utils-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-09 22:51:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "OpenVoiceOS",
    "github_project": "ovos-mark1-utils",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ovos-mark1-utils"
}
        
Elapsed time: 0.40127s