{ "info": { "author": "Ross Anderson", "author_email": "ross.anderson@ualberta.ca", "bugtrack_url": null, "classifiers": [], "description": "undoredo\n--------\n\nundo/redo functionality for arbitrary python classes\n\nSupports Python 3. Might work in Python 2.\n\n> Author: Ross Anderson ([rosshamish](https://github.com/rosshamish))\n\n### Installation\n\n```\npip install undoredo\n```\n\n### Usage \n\nAny class can gain undo/redo functionality by doing the following:\n\n- keep around an instance of UndoManager\n- annotate undoable methods with the @undoable decorator\n- implement do(), undo(), and redo() methods as shown in the following example\n- implement copy(), and restore(obj) methods\n - where copy() returns a copy of the object (probably a deep copy)\n - where restore(obj) restores the calling object to the state of the passed object\n\n### Example\n\n```\nimport undoredo\n\nclass Counter(object):\n def __init__(self, value=0):\n self.undo_mgr = undoredo.UndoManager()\n self.value = value\n\n @undoredo.undoable\n def increment(self):\n self.value += 1\n\n @undoredo.undoable\n def decrement(self):\n self.value -= 1\n\n def do(self, command):\n return self.undo_mgr.do(command)\n\n def undo(self):\n return self.undo_mgr.undo()\n\n def redo(self):\n return self.undo_mgr.redo()\n\n def copy(self):\n return Counter(self.value)\n\n def restore(self, counter):\n self.value = counter.value\n\nc = Counter(0) # 0\nc.increment() # 1\nc.increment() # 2\nc.undo() # 1\nc.redo() # 2\n```\n\n### License\n\nGPLv3", "description_content_type": null, "docs_url": null, "download_url": "https://github.com/rosshamish/undoredo/tarball/0.1.4", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/rosshamish/undoredo/", "keywords": null, "license": "GPLv3", "maintainer": null, "maintainer_email": null, "name": "undoredo", "package_url": "https://pypi.org/project/undoredo/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/undoredo/", "project_urls": { "Download": "https://github.com/rosshamish/undoredo/tarball/0.1.4", "Homepage": "https://github.com/rosshamish/undoredo/" }, "release_url": "https://pypi.org/project/undoredo/0.1.4/", "requires_dist": null, "requires_python": null, "summary": "undo/redo functionality for arbitrary python classes", "version": "0.1.4" }, "last_serial": 1905651, "releases": { "0.1.4": [ { "comment_text": "", "digests": { "md5": "162fef737c3f448a13c442ef767ad99f", "sha256": "abc1839ebf3aab3cdd5353595ad87875fd98d3f520843326720241f022fd07f9" }, "downloads": -1, "filename": "undoredo-0.1.4.tar.gz", "has_sig": false, "md5_digest": "162fef737c3f448a13c442ef767ad99f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2451, "upload_time": "2016-01-15T06:44:32", "url": "https://files.pythonhosted.org/packages/13/d2/5522e7e9ef97b4673633f960f147b1630ec50e7a88a7dbfcda8a759db68a/undoredo-0.1.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "162fef737c3f448a13c442ef767ad99f", "sha256": "abc1839ebf3aab3cdd5353595ad87875fd98d3f520843326720241f022fd07f9" }, "downloads": -1, "filename": "undoredo-0.1.4.tar.gz", "has_sig": false, "md5_digest": "162fef737c3f448a13c442ef767ad99f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 2451, "upload_time": "2016-01-15T06:44:32", "url": "https://files.pythonhosted.org/packages/13/d2/5522e7e9ef97b4673633f960f147b1630ec50e7a88a7dbfcda8a759db68a/undoredo-0.1.4.tar.gz" } ] }