# Brython.Dragdrop
A library for your Brython apps to implement drag-and-drop UX (User Experience),
without needing to deal with low level drag or drop event callbacks.
## Usage
Here comes some high level description.
1. You create a board game's board using html tags, such as TABLE's TD.
2. You create individual pieces by using normal html tags,
and then you combine them with `brython_dragdrop.DraggableMixin`. For example:
```python
class Card(brython_dragdrop.DraggableMixin, html.SPAN):
pass
```
Then create as many cards as you like, and make them visible in your UI.
3. You declare some area to be droppable, by defining rules. For example:
```python
brython_dragdrop.make_droppable(BOARD, rules={
(Card, Card): brython_dragdrop.swap,
(Card, html.TD): brython_dragdrop.occupy,
})
```
Predefined rules include:
* `swap` which will swap two draggable pieces
* `join` which will append dragged piece into the landing area,
so that the landing area may contain more and more dragged pieces.
* `occupy` which will swap the existing piece (if any) with dragged piece,
or place dragged piece into the empty landing area.
So that the landing area will contain up to one draggable piece.
Sample: todo.
## Roadmap
* More sophisticated API to support on-the-spot logic calculation before drop.
Raw data
{
"_id": null,
"home_page": "https://github.com/rayluo/brython.dragdrop",
"name": "brython-dragdrop",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "brython,drag,drop",
"author": "Ray Luo",
"author_email": "rayluo.mba@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/36/aa/32dd63567562ea0dc30fb08a7ce49ec7dd5022e6d779c719ad0ddd445f9f/brython-dragdrop-0.1.0.tar.gz",
"platform": null,
"description": "# Brython.Dragdrop\n\nA library for your Brython apps to implement drag-and-drop UX (User Experience),\nwithout needing to deal with low level drag or drop event callbacks.\n\n\n## Usage\n\nHere comes some high level description.\n\n1. You create a board game's board using html tags, such as TABLE's TD.\n\n2. You create individual pieces by using normal html tags,\n and then you combine them with `brython_dragdrop.DraggableMixin`. For example:\n\n ```python\n class Card(brython_dragdrop.DraggableMixin, html.SPAN):\n pass\n ```\n Then create as many cards as you like, and make them visible in your UI.\n\n3. You declare some area to be droppable, by defining rules. For example:\n\n ```python\n brython_dragdrop.make_droppable(BOARD, rules={\n (Card, Card): brython_dragdrop.swap,\n (Card, html.TD): brython_dragdrop.occupy,\n })\n ```\n Predefined rules include:\n\n * `swap` which will swap two draggable pieces\n * `join` which will append dragged piece into the landing area,\n so that the landing area may contain more and more dragged pieces.\n * `occupy` which will swap the existing piece (if any) with dragged piece,\n or place dragged piece into the empty landing area.\n So that the landing area will contain up to one draggable piece.\n\nSample: todo.\n\n\n## Roadmap\n\n* More sophisticated API to support on-the-spot logic calculation before drop.\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "My package description",
"version": "0.1.0",
"project_urls": {
"Changelog": "https://github.com/rayluo/brython.dragdrop/releases",
"Homepage": "https://github.com/rayluo/brython.dragdrop"
},
"split_keywords": [
"brython",
"drag",
"drop"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "9358300224b65c1d11337cebe54c91e1400fda4927a0a264cd66ed47569a892a",
"md5": "dd1798edb9df739b349a9a3bd98bd642",
"sha256": "25a704b2b487f2f590f412ab741434a03f01e1321e01f763c1f139a4d903defb"
},
"downloads": -1,
"filename": "brython_dragdrop-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "dd1798edb9df739b349a9a3bd98bd642",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 4991,
"upload_time": "2023-12-31T09:08:39",
"upload_time_iso_8601": "2023-12-31T09:08:39.572017Z",
"url": "https://files.pythonhosted.org/packages/93/58/300224b65c1d11337cebe54c91e1400fda4927a0a264cd66ed47569a892a/brython_dragdrop-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "36aa32dd63567562ea0dc30fb08a7ce49ec7dd5022e6d779c719ad0ddd445f9f",
"md5": "5719b37e767ca1daa59180be7eb5424f",
"sha256": "185c3210ccb2bc00ce1c1719e3c64feeb11765a43644bd9cf7dca13e612a354d"
},
"downloads": -1,
"filename": "brython-dragdrop-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "5719b37e767ca1daa59180be7eb5424f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4750,
"upload_time": "2023-12-31T09:08:40",
"upload_time_iso_8601": "2023-12-31T09:08:40.998628Z",
"url": "https://files.pythonhosted.org/packages/36/aa/32dd63567562ea0dc30fb08a7ce49ec7dd5022e6d779c719ad0ddd445f9f/brython-dragdrop-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-12-31 09:08:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rayluo",
"github_project": "brython.dragdrop",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [],
"lcname": "brython-dragdrop"
}