{ "info": { "author": "troido", "author_email": "troido@protonmail.com", "bugtrack_url": null, "classifiers": [ "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "# RATUIL\n\nResponsive Ansicode Terminal User Interface Library\n\nRatuil a a Terminal UI library that was made for games that have the screen divided in multiple sections, and should support different (and changing) terminal sizes.\nAnother important feature is that the layout of the UI is generated from an XML file.\n\nRatuil was originally created with [Asciifarm](https://github.com/jmdejong/asciifarm) in mind.\n\n\n\n## Example\n\nThis is an example layout:\n\n \n \n \n \n \n \n \n milk\n eggs\n bread\n \n \n \n \n cotton underwear\n cotton shirt\n jeans\n friendship bracelet\n \n \n \n \n \n This is a great place to show some information.\n Textbox lines can be wrapped!\n \n \n \n \n @\n \n \n \n >\n \n \n \n Welcome to [game]\n \n \n \n \n \n hello world\n \n \n \n \n \n\nOn a 80x20 screen it will show this output (but then with colours):\n\n +---------------------------------------------------------+@++++++++++++++++----\n | |@####################\n | +-----------+ |@#*cotton underwear #\n | |hello world| |@# cotton shirt #\n | +-----------+ |@# jeans #\n | |@# friendship bracel#\n | |@# #\n | |@# #\n | |@# #\n | |@# #\n | |@####################\n | |@ \n | |@ This is a great \n | |@ place to show some \n | |@ information. \n +---------------------------------------------------------+@ Textbox lines can \n @ be wrapped! \n @ \n Welcome to [game] @ \n > @ \n\nThe values of several elements can be changed from code.\n\n## Global Attributes\n\nAs seen in the text, the elements can have several attributes.\nSome of these are global.\n\n- id: An identifier string to get this element. In the code you can get access to this element using Layout.get(id). This is the only way to access an element from code. If an element has an id this id should be unique.\n- key: This is also an identifier, but is only needed to distinguish elements from their siblings. Currently this is only used for children of switchbox or overlay elements.\n- offset-x, offset-y, width, height, align: These are the style attributes. They are used to position elements withing the parent attributes. Currently this is only used for children of hbox, vbox and overlay elements\n - width and height: the width and height of the element. If no width or height is given the element will cover the total available space.\n - min-width, min-height, max-width, max-height: minimum and maximum values for the sizes.\n - align: whether to align to left, right, top or bottom. Since top-left alignment is the default, only \"right\" and \"bottom\" will actually do something. The string can be a combination, for example \"right;bottom\".\n I will probably change the way this works a bit, and split it into align-hor and align-vert or something like that.\n - offset-x and offset-y: The values between the side of this element and the end of the available size. This is currently only used by children of overlay.\n If alignment is topleft (the default) these sizes are the distance between the start of the available area and the beginning of the element. If the alignment is bottom right these sizes are the distance between the end of the element and the end of the available area.\n If no offset is given it will be 0.\n\n The values for width, height, offset-x and offset-y can be absolute values, relative values or very relative values:\n - Absolute: The number of characters. This is just an integer without any suffix. Examples: \"10\", \"0\", \"3\"\n - Relative: The size relative to the size of the parent. This can be denoted by a real number followed by a \"/\" or \"%\". If the \"%\" sign is used the value is multiplied by 100 before multiplying by the size. Examples: \"0.5/\", \"25%\", \"1/\", \"33.3%\", \"0.22/\", \"22%\". The strings \"0.22/\" and \"22%\" denote the same value.\n - Very relative: The size relative to the available size after the previous siblings have taken their cut. This is the real available size. This is only used in children of hbox and vbox, otherwise this is treated as a regular relative size. This is denoted by having \"//\" or \"%%\" at the end. For the rest it works the same as relative. Examples: \"0.5//\", \"100%%\", \"0.6//\", \"60%%\". The strings \"0.6//\" and \"60%%\" denote the same value.\n- hidden: The element and its children will not be drawn. Their update method will never be invoked.\n\n## Elements\n\n### charbox\n\n\n\n### textbox\n\nThe most basic element for showing text.\nIt will show its given text (either in the xml or with the `set_text(text)` method) in the area that it has.\n\nThe 'wrap' attribute deals how overflow is handled.\nBy default, or if the value is \"crop\" the overflow is cropped.\nIf the value is \"words\" then the overflow is wrapped on whitespace (using `textwrap.wrap`).\n\n\n### hbox\n\nDraw its children horizontally next to each other. The order of the children is the order of priority. If the earlier children take up all much space the later children may not be draw\n\n### vbox\n\nSimilar to hbox but vertically.\n\n### switchbox\n\nOnly draws one of its children at a time. It is possible to pick from code which child is drawn using the `select(identifier)` method. Children can be selected by their index (starting at 0) or by their key if they have one.\n\n### listing\n\nA list of several strings (one on each line) of a certain item can be selected. If the list is longer than the available height, it will center on the selected item.\n\n### border\n\nDraw a border around its child. Can only have one child\n\n### fill\n\nFill all available area with a pattern (or a single character).\nThis could also be used to make a separator line within an hbox or vbox.\n\n### etc...\n\n## Installing\n\n git clone https://github.com/jmdejong/ratuil.git\n pip3 install -e ratuil/ --user\n\n## Usage\n\n\n\tfrom ratuil.layout import Layout\n\tfrom ratuil.bufferedscreen import BufferedScreen\n\n\tscreen = BufferedScreen() // Make the screen. BufferedScreen is recommended, but other DrawTargets can be used too.\n\tscreen.clear()\n\n\tlayout = Layout.from_xml_file(\"layout.xml\") // Load the layout from xml. This assumes that there is the file \"layout.xml\" in the current directory\n\n\tlayout.set_target(screen) // Tell the layout that the screen is its target\n\tlayout.update() // Draw the layout to the buffered screen\n\tscreen.update() // Draw the buffer to the terminal\n\n\n\t// change something:\n\tlog = layout.get(\"messages\") // get the element with id \"messages\". For this example this is a log element.\n\tlog.add_message(\"hello world\") // add a new message to the log\n\n\n\t// draw again\n\tlayout.update()\n\tscreen.update()\n\n## Considerations\n\nCurrently an element has the attributes for both the styling relative to its parent, and for its own parameters.\nIt might be better to separate it.\nOptions are including an in-between element for these styling things (which makes it more verbose) or putting the syling into a single attribute (just like css).\nI don't like either solution.\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/jmdejong/ratuil", "keywords": "", "license": "", "maintainer": "", "maintainer_email": "", "name": "ratuil", "package_url": "https://pypi.org/project/ratuil/", "platform": "", "project_url": "https://pypi.org/project/ratuil/", "project_urls": { "Homepage": "https://github.com/jmdejong/ratuil" }, "release_url": "https://pypi.org/project/ratuil/0.0.2/", "requires_dist": null, "requires_python": ">=3.6", "summary": "A terminal UI library for games", "version": "0.0.2" }, "last_serial": 5895843, "releases": { "0.0.1": [ { "comment_text": "", "digests": { "md5": "36308ae4a2a63e284cebf2eeb5ddebfd", "sha256": "6415ce1f662a4023fbc6001c41101b2c70cf7a047c0a663a710871e4e7cafa79" }, "downloads": -1, "filename": "ratuil-0.0.1-py3-none-any.whl", "has_sig": false, "md5_digest": "36308ae4a2a63e284cebf2eeb5ddebfd", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5127, "upload_time": "2019-09-27T11:54:00", "url": "https://files.pythonhosted.org/packages/32/54/bf47d51177bc124cd50c9d09e4cc3378b2239485b268c9b341c74332b475/ratuil-0.0.1-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "f20f02b2b17cccae6f9563010e530aa4", "sha256": "e8fe0bd87da6d10eacc589329a9af05166ff25c0b117601ee517d4e06fa3fa02" }, "downloads": -1, "filename": "ratuil-0.0.1.tar.gz", "has_sig": false, "md5_digest": "f20f02b2b17cccae6f9563010e530aa4", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4912, "upload_time": "2019-09-27T11:54:03", "url": "https://files.pythonhosted.org/packages/b0/c6/cd9592d89ece7459c3296a2d492717e7799b3d8080e10582b6e50f77457c/ratuil-0.0.1.tar.gz" } ], "0.0.2": [ { "comment_text": "", "digests": { "md5": "aa99683e7e3d3b3637ed40aa8cfe3379", "sha256": "a84c33e2ad5e480c2ad3f67712ed3f3c31d8a8c553d3412019bceab56a7d8396" }, "downloads": -1, "filename": "ratuil-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "aa99683e7e3d3b3637ed40aa8cfe3379", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5151, "upload_time": "2019-09-27T12:34:04", "url": "https://files.pythonhosted.org/packages/46/70/2524722c2cc6a918de5e8daacbcbcecc3d176fb4ffae10215e53503cf61b/ratuil-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06d2d94e94395ab4a06d5ca23eda82e5", "sha256": "ae1e060a71430950a045d55cd0220a638b66e75f5da6bc6403b6b7f245ebec55" }, "downloads": -1, "filename": "ratuil-0.0.2.tar.gz", "has_sig": false, "md5_digest": "06d2d94e94395ab4a06d5ca23eda82e5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4927, "upload_time": "2019-09-27T12:34:07", "url": "https://files.pythonhosted.org/packages/ea/c2/48e9e3aa36ec415ef5ae9eaf04e396d3098af207cf7dc919368af4b7d3a5/ratuil-0.0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "aa99683e7e3d3b3637ed40aa8cfe3379", "sha256": "a84c33e2ad5e480c2ad3f67712ed3f3c31d8a8c553d3412019bceab56a7d8396" }, "downloads": -1, "filename": "ratuil-0.0.2-py3-none-any.whl", "has_sig": false, "md5_digest": "aa99683e7e3d3b3637ed40aa8cfe3379", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": ">=3.6", "size": 5151, "upload_time": "2019-09-27T12:34:04", "url": "https://files.pythonhosted.org/packages/46/70/2524722c2cc6a918de5e8daacbcbcecc3d176fb4ffae10215e53503cf61b/ratuil-0.0.2-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "06d2d94e94395ab4a06d5ca23eda82e5", "sha256": "ae1e060a71430950a045d55cd0220a638b66e75f5da6bc6403b6b7f245ebec55" }, "downloads": -1, "filename": "ratuil-0.0.2.tar.gz", "has_sig": false, "md5_digest": "06d2d94e94395ab4a06d5ca23eda82e5", "packagetype": "sdist", "python_version": "source", "requires_python": ">=3.6", "size": 4927, "upload_time": "2019-09-27T12:34:07", "url": "https://files.pythonhosted.org/packages/ea/c2/48e9e3aa36ec415ef5ae9eaf04e396d3098af207cf7dc919368af4b7d3a5/ratuil-0.0.2.tar.gz" } ] }