StreamDeckLayoutManager


NameStreamDeckLayoutManager JSON
Version 1.0.2 PyPI version JSON
download
home_pageNone
SummaryA higher-level Python API for ElGato's Stream Deck.
upload_time2023-11-17 09:10:25
maintainerNone
docs_urlNone
authorNone
requires_python>=3.8
licenseNone
keywords elgato streamdeck
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # StreamDeckLayoutManager

[![MIT License](https://img.shields.io/badge/license-MIT-orange)](https://spdx.org/licenses/MIT.html) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/StreamDeckLayoutManager.svg)](https://python.org) [![PyPI - Version](https://img.shields.io/pypi/v/StreamDeckLayoutManager.svg)](https://pypi.org/project/StreamDeckLayoutManager)

A higher-level **Python** API for ElGato's [Stream Deck](https://www.elgato.com/en/stream-deck-mk2).

This module is based off and uses [streamdeck-elgato-python](https://github.com/abcminiuser/python-elgato-streamdeck) from [Dean Camera](https://github.com/abcminiuser).

### Installation

**StreamDeckLayoutManager** is a pure Python project. It requires at least [Python](https://python.org) 3.8.

You can install **StreamDeckLayoutManager** by typing the following in a terminal window:

```console
pip install StreamDeckLayoutManager
```

### Usage

You can use **StreamDeckLayoutManager** in your own **Python** scripts like this:

```
import StreamDeckLayoutManager

streamdeck_manager = StreamDeckLayoutManager.Manager('StreamDeckConfig.toml')
streamdeck_manager.displayPage('MyPageName')
```

In order to receive key press/release information, you need to hook up at least one callback:

```
streamdeck_manager.setCallback('MyCallbackName', callback_method)
```

Callback method will receive a `List` of arguments, as provided by the key configuration, minus the callback name:

```
def streamdeckCallback(arguments):
    # -- If the key's action is [ 'MyCallbackName', 'test', 42 ]
    # -- then arguments in this case will be [ 'test', 42 ]
    ...
```

### Config file format

Config files are regular [`toml`](https://toml.io/en/) files. They have a general section named `config`:

```
[config]
Brightness = 90
AssetFolder = 'assets'
Font = 'Roboto-Regular.ttf'
FontSize = 11
```

`AssetFolder` is relative to the folder where the config file is found.

They also have entries for each page:

```
[MyPageName]
Key13Image = 'MyIcon.png'
Key13Label = 'My Label'
Key13PressedAction = [ 'MyCallbackName', 'test', 42 ]
Key13ReleasedAction = [ 'MyCallbackName', 'other_test' ]
...
```

The page contains numbered entries for each key from `Key0` to `Key14` (if you are using an original stream deck). Each entry lists the image to use, the text to display underneath the image and the callback to call when the key is pressed or when it is released.

Image path is relative to the asset folder provided in the `config` section.

Callback names such as `push_page`, `pop_page` and `display_page` are reserved and can be used to moved between pages, including creating folders

```
Key14Image = 'folder.png'
Key14Label = 'MyFolder'
Key14PressedAction = [ 'push_page', 'SamplePage1' ]
```

This callback will push the current page onto a stack and display the page `SamplePage1`.

```
Key14Image = 'back.png'
Key14Label = 'Go Back'
Key14PressedAction = [ 'pop_page' ]
```

This callback will pop the previous page from a stack and display it again.

```
Key9Image = 'other.png'
Key9Label = 'NextPage'
Key9PressedAction = [ 'display_page', 'SamplePage2' ]
```

This callback will simply display it the page `SamplePage2`. The page stack is unaffected and only the current page is modified.

### StreamDeckLayoutManager.Manager class

##### `Manager(config_file_path: str, deck_index: int = 0)`

Initialize a new manager for stream deck at index `deck_index` using the config file at `config_file_path`.

##### `Manager.shutdown()`

Shuts down the manager.

##### `Manager.displayPage(page_name: str)`

Display page named `page_name`.

##### `Manager.pushPage(self, page_name: str)`

Push current page onto the stack and display page named `page_name`.

##### `Manager.popPage()`

Pop the previous page off the stack and display it.

##### `Manager.setKey(self, page_name: str, key_index: int, image_file: str, label: str, pressed_callback, released_callback=None)`

Set the key in page named `page_name` at index `key_index` to display image at `image_file` with label `label`. When key is pressed then `pressed_callback` is called, when the key is released then `released_callback` is called.

Image path is relative to the asset folder provided in the `config` section.

This can be used to set keys dynamically, as opposed to statically in the config file.

For example:

```
streamdeck_manager.setKey('MainPage', 12, 'MyImage.png', 'My Label',
                          ['MyCallbackName', 'test_argument', 2])
```

##### `Manager.setCallback(self, callback_name: str, callback)`

Set the callback method for callback `callback_name` to the method `callback`.

##### `Manager.numberOfStreamDecks(self) -> int`

Return the number of stream decks found.

##### `Manager.printDeckInfo(self, index: int)`

Prints diagnostic information about the stream deck at index `index`.

### License

**StreamDeckLayoutManager** is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "StreamDeckLayoutManager",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "elgato,streamdeck",
    "author": null,
    "author_email": "Didier Malenfant <coding@malenfant.net>",
    "download_url": "https://files.pythonhosted.org/packages/a5/7e/340dd0ce1fd2c55cc4945170912a77f950f7202cde6fed115fc328f85677/streamdecklayoutmanager-1.0.2.tar.gz",
    "platform": null,
    "description": "# StreamDeckLayoutManager\n\n[![MIT License](https://img.shields.io/badge/license-MIT-orange)](https://spdx.org/licenses/MIT.html) [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/StreamDeckLayoutManager.svg)](https://python.org) [![PyPI - Version](https://img.shields.io/pypi/v/StreamDeckLayoutManager.svg)](https://pypi.org/project/StreamDeckLayoutManager)\n\nA higher-level **Python** API for ElGato's [Stream Deck](https://www.elgato.com/en/stream-deck-mk2).\n\nThis module is based off and uses [streamdeck-elgato-python](https://github.com/abcminiuser/python-elgato-streamdeck) from [Dean Camera](https://github.com/abcminiuser).\n\n### Installation\n\n**StreamDeckLayoutManager** is a pure Python project. It requires at least [Python](https://python.org) 3.8.\n\nYou can install **StreamDeckLayoutManager** by typing the following in a terminal window:\n\n```console\npip install StreamDeckLayoutManager\n```\n\n### Usage\n\nYou can use **StreamDeckLayoutManager** in your own **Python** scripts like this:\n\n```\nimport StreamDeckLayoutManager\n\nstreamdeck_manager = StreamDeckLayoutManager.Manager('StreamDeckConfig.toml')\nstreamdeck_manager.displayPage('MyPageName')\n```\n\nIn order to receive key press/release information, you need to hook up at least one callback:\n\n```\nstreamdeck_manager.setCallback('MyCallbackName', callback_method)\n```\n\nCallback method will receive a `List` of arguments, as provided by the key configuration, minus the callback name:\n\n```\ndef streamdeckCallback(arguments):\n    # -- If the key's action is [ 'MyCallbackName', 'test', 42 ]\n    # -- then arguments in this case will be [ 'test', 42 ]\n    ...\n```\n\n### Config file format\n\nConfig files are regular [`toml`](https://toml.io/en/) files. They have a general section named `config`:\n\n```\n[config]\nBrightness = 90\nAssetFolder = 'assets'\nFont = 'Roboto-Regular.ttf'\nFontSize = 11\n```\n\n`AssetFolder` is relative to the folder where the config file is found.\n\nThey also have entries for each page:\n\n```\n[MyPageName]\nKey13Image = 'MyIcon.png'\nKey13Label = 'My Label'\nKey13PressedAction = [ 'MyCallbackName', 'test', 42 ]\nKey13ReleasedAction = [ 'MyCallbackName', 'other_test' ]\n...\n```\n\nThe page contains numbered entries for each key from `Key0` to `Key14` (if you are using an original stream deck). Each entry lists the image to use, the text to display underneath the image and the callback to call when the key is pressed or when it is released.\n\nImage path is relative to the asset folder provided in the `config` section.\n\nCallback names such as `push_page`, `pop_page` and `display_page` are reserved and can be used to moved between pages, including creating folders\n\n```\nKey14Image = 'folder.png'\nKey14Label = 'MyFolder'\nKey14PressedAction = [ 'push_page', 'SamplePage1' ]\n```\n\nThis callback will push the current page onto a stack and display the page `SamplePage1`.\n\n```\nKey14Image = 'back.png'\nKey14Label = 'Go Back'\nKey14PressedAction = [ 'pop_page' ]\n```\n\nThis callback will pop the previous page from a stack and display it again.\n\n```\nKey9Image = 'other.png'\nKey9Label = 'NextPage'\nKey9PressedAction = [ 'display_page', 'SamplePage2' ]\n```\n\nThis callback will simply display it the page `SamplePage2`. The page stack is unaffected and only the current page is modified.\n\n### StreamDeckLayoutManager.Manager class\n\n##### `Manager(config_file_path: str, deck_index: int = 0)`\n\nInitialize a new manager for stream deck at index `deck_index` using the config file at `config_file_path`.\n\n##### `Manager.shutdown()`\n\nShuts down the manager.\n\n##### `Manager.displayPage(page_name: str)`\n\nDisplay page named `page_name`.\n\n##### `Manager.pushPage(self, page_name: str)`\n\nPush current page onto the stack and display page named `page_name`.\n\n##### `Manager.popPage()`\n\nPop the previous page off the stack and display it.\n\n##### `Manager.setKey(self, page_name: str, key_index: int, image_file: str, label: str, pressed_callback, released_callback=None)`\n\nSet the key in page named `page_name` at index `key_index` to display image at `image_file` with label `label`. When key is pressed then `pressed_callback` is called, when the key is released then `released_callback` is called.\n\nImage path is relative to the asset folder provided in the `config` section.\n\nThis can be used to set keys dynamically, as opposed to statically in the config file.\n\nFor example:\n\n```\nstreamdeck_manager.setKey('MainPage', 12, 'MyImage.png', 'My Label',\n                          ['MyCallbackName', 'test_argument', 2])\n```\n\n##### `Manager.setCallback(self, callback_name: str, callback)`\n\nSet the callback method for callback `callback_name` to the method `callback`.\n\n##### `Manager.numberOfStreamDecks(self) -> int`\n\nReturn the number of stream decks found.\n\n##### `Manager.printDeckInfo(self, index: int)`\n\nPrints diagnostic information about the stream deck at index `index`.\n\n### License\n\n**StreamDeckLayoutManager** is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "A higher-level Python API for ElGato's Stream Deck.",
    "version": "1.0.2",
    "project_urls": {
        "Homepage": "https://codeberg.org/DidierMalenfant/StreamDeckLayoutManager"
    },
    "split_keywords": [
        "elgato",
        "streamdeck"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "017deb88a6e21da06d7b112966d4b71a6bf1be35033022dcb988291cc27ed4c4",
                "md5": "e3701d17df35e9df767f7e996060d2d3",
                "sha256": "be780d6293e80a1be668c80c76ec37464431f51048058b38f03cdab98a1a5820"
            },
            "downloads": -1,
            "filename": "streamdecklayoutmanager-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e3701d17df35e9df767f7e996060d2d3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 7713,
            "upload_time": "2023-11-17T09:10:23",
            "upload_time_iso_8601": "2023-11-17T09:10:23.460817Z",
            "url": "https://files.pythonhosted.org/packages/01/7d/eb88a6e21da06d7b112966d4b71a6bf1be35033022dcb988291cc27ed4c4/streamdecklayoutmanager-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "a57e340dd0ce1fd2c55cc4945170912a77f950f7202cde6fed115fc328f85677",
                "md5": "5b57e935ffbc954a2e66131a59eb8ac2",
                "sha256": "fe1a5244eb79b2fede4fe35a54cd2075f890c922049131d9628955f56466f9c9"
            },
            "downloads": -1,
            "filename": "streamdecklayoutmanager-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "5b57e935ffbc954a2e66131a59eb8ac2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 6324,
            "upload_time": "2023-11-17T09:10:25",
            "upload_time_iso_8601": "2023-11-17T09:10:25.297027Z",
            "url": "https://files.pythonhosted.org/packages/a5/7e/340dd0ce1fd2c55cc4945170912a77f950f7202cde6fed115fc328f85677/streamdecklayoutmanager-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-11-17 09:10:25",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": true,
    "codeberg_user": "DidierMalenfant",
    "codeberg_project": "StreamDeckLayoutManager",
    "lcname": "streamdecklayoutmanager"
}
        
Elapsed time: 0.13847s