{ "info": { "author": "asrp", "author_email": "asrp@email.com", "bugtrack_url": null, "classifiers": [], "description": "Undoable\n========\n\nA simple Python list (``observed_list``) and dict (``observed_dict``)\nwith callbacks when they are changed and undo/redo using these\ncallbacks.\n\nAlso includes ``observed_tree``, a labelled tree with ordered children\nimplemented as Python list with parent pointers and a bit of consistency\ncheck.\n\nImplementation\n--------------\n\nImplemented using the `command\npattern `__. See `my blog\npost discussing this `__.\n\nExample\n-------\n\n::\n\n pip install undoable\n\nCallbacks\n~~~~~~~~~\n\n::\n\n >>> from undoable import observed_dict, observed_list\n >>> def printargs(*args):\n ... print args\n ... \n >>> l = observed_list([1, 2, 3])\n >>> l.callbacks.append(printargs)\n >>> l.append(4)\n ([1, 2, 3, 4], 'append', 4)\n >>> l.extend([5, 6, 7])\n ([1, 2, 3, 4, 5, 6, 7], 'extend', [5, 6, 7])\n >>> d = observed_dict({1: \"one\", 2: \"two\"})\n >>> d.callbacks.append(printargs)\n >>> d[3] = \"three\"\n ({1: 'one', 2: 'two', 3: 'three'}, '__setitem__', 3, 'three')\n >>> d2 = observed_dict()\n >>> d2.undocallbacks.append(printargs)\n >>> d2[1] = \"one\"\n ({1: 'one'}, ('__delitem__', 1), ('__setitem__', 1, 'one'))\n\nUndo/redo\n~~~~~~~~~\n\n::\n\n >>> from undoable import UndoLog, observed_dict, observed_list\n >>> u = UndoLog()\n >>> d = observed_dict({1: \"one\", 2: \"two\"})\n >>> l = observed_list([1, 2, 3])\n >>> u.add(d)\n >>> u.add(l)\n >>> l.append(1)\n >>> d[3] = \"Hello\"\n >>> l\n [1, 2, 3, 1]\n >>> d\n {1: 'one', 2: 'two', 3: 'Hello'}\n >>> u.undo()\n >>> d\n {1: 'one', 2: 'two'}\n >>> u.undo()\n >>> l\n [1, 2, 3]\n >>> u.redo()\n >>> u.redo()\n >>> l\n [1, 2, 3, 1]\n >>> d\n {1: 'one', 2: 'two', 3: 'Hello'}\n >>> u.start_group(\"foo\")\n True\n >>> d[53] = \"user\"\n >>> del d[1]\n >>> u.end_group(\"foo\")\n >>> d\n {2: 'two', 3: 'Hello', 53: 'user'}\n >>> u.undo()\n >>> d\n {1: 'one', 2: 'two', 3: 'Hello'}", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/asrp/undoable", "keywords": "callbacks undo observer", "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "undoable", "package_url": "https://pypi.org/project/undoable/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/undoable/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/asrp/undoable" }, "release_url": "https://pypi.org/project/undoable/0.3.1/", "requires_dist": null, "requires_python": null, "summary": "Simple Python list and dict with undo/redo", "version": "0.3.1" }, "last_serial": 2672632, "releases": { "0.3": [ { "comment_text": "", "digests": { "md5": "fc869b95b9da23c0e64b7a7e9e975391", "sha256": "efd6fbe465f220388ffa5db67b2576a027afb11114966f972143aff59e9db25b" }, "downloads": -1, "filename": "undoable-0.3.tar.gz", "has_sig": false, "md5_digest": "fc869b95b9da23c0e64b7a7e9e975391", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4818, "upload_time": "2017-02-28T08:34:20", "url": "https://files.pythonhosted.org/packages/ea/96/f9fbbdebcc17ccc66f88b4794c2781bc96d4a51bb12001a05bc2786a36f8/undoable-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "8e97dfb7408f615867abd3b85dd53606", "sha256": "57db8770cf5f27fb816784b7bbd03a1dfcd54730807a724dfe2ea4e452e09988" }, "downloads": -1, "filename": "undoable-0.3.1.tar.gz", "has_sig": false, "md5_digest": "8e97dfb7408f615867abd3b85dd53606", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4809, "upload_time": "2017-02-28T08:39:39", "url": "https://files.pythonhosted.org/packages/54/47/939631e14bec61f1cc44c7084b92f0555381d9b2930f15528709822879c7/undoable-0.3.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8e97dfb7408f615867abd3b85dd53606", "sha256": "57db8770cf5f27fb816784b7bbd03a1dfcd54730807a724dfe2ea4e452e09988" }, "downloads": -1, "filename": "undoable-0.3.1.tar.gz", "has_sig": false, "md5_digest": "8e97dfb7408f615867abd3b85dd53606", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4809, "upload_time": "2017-02-28T08:39:39", "url": "https://files.pythonhosted.org/packages/54/47/939631e14bec61f1cc44c7084b92f0555381d9b2930f15528709822879c7/undoable-0.3.1.tar.gz" } ] }