# Visiongraph UI
User interface library for visiongraph projects. The idea behind this project is to create a structure for computer vision applications. The idea is to have a **configuration**, **app** and **graph**. And if needed a **window**.
### Example
#### Configuration
```python
class DemoConfig:
def __init__(self):
container = ContainerHelper(self)
# non-ui bound settings
with container.section("Test"):
self.enable_input = DataField(False) | ui.Boolean("Enable") | Argument(help="Enable input.")
```
#### Application
```python
class DemoApp(VisiongraphApp[vg.VisionGraph, DemoConfig]):
def __init__(self, config: DemoConfig):
super().__init__(config)
def create_graph(self) -> vg.Visiongraph:
graph = DemoGraph().create_graph(vg.VideoCaptureInput())
graph.multi_threaded = True
return graph
```
#### Graph
```python
class DemoGraph:
def __init__(self):
self.on_frame_ready: Event[np.ndarray] = Event()
self.graph: Optional[vg.VisionGraph] = None
def _on_frame_ready(self, frame: np.ndarray) -> np.ndarray:
self.on_frame_ready(frame)
return frame
def create_graph(self, input_device: vg.BaseInput) -> vg.VisionGraph:
self.graph = (
vg.create_graph(name="Demo Graph", input_node=input_device, multi_threaded=True)
.then(vg.custom(self._on_frame_ready))
.build()
)
return self.graph
```
#### Window
```python
class DemoWindow(VisiongraphUserInterface[DemoApp, DemoConfig]):
def __init__(self, app: DemoApp):
super().__init__(app)
```
#### Usage
```python
def main():
config = DemoConfig()
app = DemoApp(config)
with UIContext():
window = DemoWindow(app)
```
### About
This is a first draft of the library and the api will change in future release.
Raw data
{
"_id": null,
"home_page": "https://github.com/cansik/visiongraph-ui",
"name": "visiongraph-ui",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "",
"author": "Florian Bruggisser",
"author_email": "github@broox.ch",
"download_url": "",
"platform": null,
"description": "# Visiongraph UI\n\nUser interface library for visiongraph projects. The idea behind this project is to create a structure for computer vision applications. The idea is to have a **configuration**, **app** and **graph**. And if needed a **window**.\n\n### Example\n\n#### Configuration\n\n```python\nclass DemoConfig:\n def __init__(self):\n container = ContainerHelper(self)\n\n # non-ui bound settings\n with container.section(\"Test\"):\n self.enable_input = DataField(False) | ui.Boolean(\"Enable\") | Argument(help=\"Enable input.\")\n```\n\n#### Application\n\n```python\nclass DemoApp(VisiongraphApp[vg.VisionGraph, DemoConfig]):\n def __init__(self, config: DemoConfig):\n super().__init__(config)\n\n def create_graph(self) -> vg.Visiongraph:\n graph = DemoGraph().create_graph(vg.VideoCaptureInput())\n graph.multi_threaded = True\n return graph\n```\n\n#### Graph\n\n```python\nclass DemoGraph:\n def __init__(self):\n self.on_frame_ready: Event[np.ndarray] = Event()\n self.graph: Optional[vg.VisionGraph] = None\n\n def _on_frame_ready(self, frame: np.ndarray) -> np.ndarray:\n self.on_frame_ready(frame)\n return frame\n\n def create_graph(self, input_device: vg.BaseInput) -> vg.VisionGraph:\n self.graph = (\n vg.create_graph(name=\"Demo Graph\", input_node=input_device, multi_threaded=True)\n .then(vg.custom(self._on_frame_ready))\n .build()\n )\n return self.graph\n```\n\n#### Window\n\n```python\nclass DemoWindow(VisiongraphUserInterface[DemoApp, DemoConfig]):\n def __init__(self, app: DemoApp):\n super().__init__(app)\n```\n\n#### Usage\n\n```python\ndef main():\n config = DemoConfig()\n app = DemoApp(config)\n\n with UIContext():\n window = DemoWindow(app)\n```\n\n### About\n\nThis is a first draft of the library and the api will change in future release.\n\n\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "User interface library for visiongraph projects.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/cansik/visiongraph-ui"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "43b332cce60d72dca7500106beabc60b5177e660d7d0664bb8616a8f6c15a572",
"md5": "fea76cd78dc162bb9a459816ee0ed4f1",
"sha256": "5ce9e0d77d4d09e07359089f70d7fbdc21d8e5353b6ec32b0c0354f516080d85"
},
"downloads": -1,
"filename": "visiongraph_ui-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "fea76cd78dc162bb9a459816ee0ed4f1",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 10921,
"upload_time": "2023-08-09T14:53:48",
"upload_time_iso_8601": "2023-08-09T14:53:48.211190Z",
"url": "https://files.pythonhosted.org/packages/43/b3/32cce60d72dca7500106beabc60b5177e660d7d0664bb8616a8f6c15a572/visiongraph_ui-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-08-09 14:53:48",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cansik",
"github_project": "visiongraph-ui",
"github_not_found": true,
"lcname": "visiongraph-ui"
}