{ "info": { "author": "Blair Bonnett", "author_email": "blair.bonnett@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Programming Language :: Python" ], "description": "===========\npython-rofi\n===========\n\nA Python module to make simple GUIs using Rofi.\n\n\nWhat is Rofi?\n=============\n\nRofi_ is a popup window switcher with minimal dependencies. Its basic operation\nis to display a list of options and let the user pick one. The following\nscreenshot is shamelessly hotlinked from the Rofi website (which you should\nprobably visit if you want actual details about Rofi!) and shows it being used\nby the teiler_ screenshot application.\n\n.. image:: https://davedavenport.github.io/rofi/images/rofi/dmenu-replacement.png\n :alt: A screenshot of the teiler application using Rofi.\n\n.. _Rofi: https://davedavenport.github.io/rofi/\n\n.. _teiler: https://carnager.github.io/teiler/\n\n\nWhat is this module?\n====================\n\nIt simplifies making simple GUIs using Rofi. It provides a class with a number\nof methods for various GUI actions (show messages, pick one of these options,\nenter some text / a number). These are translated to the appropriate Rofi\ncommand line options, and then the standard subprocess_ module is used to run\nRofi. Any output is then processed and returned to you to do whatever you like\nwith.\n\n.. _subprocess: https://docs.python.org/3/library/subprocess.html\n\n\nExamples\n--------\n\nData entry\n~~~~~~~~~~\n\nThe simplest example is to create a Rofi instance and prompt the user to enter\na piece of text::\n\n from rofi import Rofi\n r = Rofi()\n name = r.text_entry('What is your name? ')\n\nThere are also entry methods for integers, floating-point numbers, and decimal\nnumbers::\n\n age = r.integer_entry('How old are you? ')\n height = r.float_entry('How tall are you? ')\n price = r.decimal_entry('How much are you willing to spend? ')\n\nAll of these return the corresponding Python type. Dates and times can also be\nrequested::\n\n dob = r.date_entry('What is your date of birth? ')\n start = r.time_entry('When do you start work? ')\n reminder = r.datetime_entry('When do you want to be alerted? ')\n\nAgain, these return the corresponding Python type. By default, they expect the\nuser to enter something in the appropriate format for the current locale. You\ncan override this by providing a list of format specifiers to any of these\nfunctions. The available specifiers are detailed in the Python documentation\nfor the datetime_ module. For example::\n\n start = r.time_entry('When do you start work? ', formats=['%H:%M'])\n\nAll of these entry methods are specialisations of the ``generic_entry()``\nmethod. You can use this to create your own entry types. All you need to do is\ncreate a validator function which takes the text entered by the user, and\nreturns either the Python object or an error message. For example, to enforce a\nminimum length on an entered piece of text::\n\n validator = lambda s: (s, None) if len(s) > 6 else (None, \"Too short!\")\n r.generic_entry('Enter a 7-character or longer string: ', validator)\n\nNote that all of these methods return ``None`` if the dialog is cancelled.\n\n.. _datetime: https://docs.python.org/3/library/datetime.html\n\nErrors\n~~~~~~\n\nTo show an error message to the user::\n\n r.error('I cannot let you do that.')\n r.exit_with_error('I cannot let you do that.')\n\nThe latter shows the error message and then exits.\n\nSelections\n~~~~~~~~~~\n\nTo give the user a list of things to select from, and return the index of the\noption they chose::\n\n options = ['Red', 'Green', 'Blue', 'White', 'Silver', 'Black', 'Other']\n index, key = r.select('What colour car do you drive?', options)\n\nThe returned ``key`` value tells you what key the user pressed. For Enter, the\nvalue is 0, while -1 indicates they cancelled the dialog. You can also specify\ncustom key bindings::\n\n index, key = r.select('What colour car do you drive?', options, key5=('Alt+n', \"I don't drive\"))\n\nIn this case, the returned ``key`` will be 5 if they press Alt+n.\n\nStatus\n~~~~~~\n\nTo display a status message to the user::\n\n r.status(\"I'm working on that...\")\n\nThis is the only non-blocking method (all the others wait for the user to\nfinish before returning control to your script). To close the status message::\n\n r.close()\n\nCalling a display or entry method will also close any status message currently\ndisplayed.\n\nMessages\n~~~~~~~~\n\nAny of the entry methods and the select method have an optional argument\n``message``. This is a string which is displayed below the prompt. The string\ncan contain Pango_ markup::\n\n r.text_entry('What are your goals for this year? ', message='Be bold!')\n\nIf you need to escape a string to avoid it being mistaken for markup, use the\n``Rofi.escape()`` class method::\n\n msg = Rofi.escape('Format: ')\n r.text_entry('Enter your name: ', message=msg)\n\n.. _Pango: https://developer.gnome.org/pango/stable/PangoMarkupFormat.html\n\nCustomisation\n~~~~~~~~~~~~~\n\nThere are a number of options available to customise the display. These can be\nset in the initialiser to apply to every dialog displayed, or you can pass them\nto any of the display methods to change just that dialog. See the Rofi\ndocumentation for full details of these parameters.\n\n* ``lines``: The maximum number of lines to show before scrolling.\n\n* ``fixed_lines``: Keep a fixed number of lines visible.\n\n* ``width``: If positive but not more than 100, this is the percentage of the\n screen's width the window takes up. If greater than 100, it is the width in\n pixels. If negative, it estimates the width required for the corresponding\n number of characters, i.e., -30 would set the width so approximately 30\n characters per row would show.\n\n* ``fullscreen``: If True, use the full height and width of the screen.\n\n* ``location``: The position of the window on the screen.\n\n\nRequirements\n============\n\nYou need to have the ``rofi`` executable available on the system path (i.e.,\ninstall Rofi!). Everything else that python-rofi needs is provided by the\nPython standard libraries.\n\n\nWhat Python versions are supported?\n===================================\n\nIt *should* work with any version of Python from 2.7 onwards. It may work with\nolder versions, though no specific support for them will be added. It is\ndeveloped on Python 2.7 and Python 3.6 -- the latest versions of the Python 2\nand 3 branches respectively.\n\n\nWhat license does it use?\n=========================\n\nThe MIT license, the same as Rofi itself.\n\n\nBug reports\n===========\n\nThe project is developed on GitHub_. Please file any bug reports or feature\nrequests on the Issues_ page there.\n\n.. _GitHub: https://github.com/bcbnz/python-rofi\n.. _Issues: https://github.com/bcbnz/python-rofi/issues\n\n\n", "description_content_type": null, "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/bcbnz/python-rofi", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "python-rofi", "package_url": "https://pypi.org/project/python-rofi/", "platform": "", "project_url": "https://pypi.org/project/python-rofi/", "project_urls": { "Homepage": "https://github.com/bcbnz/python-rofi" }, "release_url": "https://pypi.org/project/python-rofi/1.0.1/", "requires_dist": null, "requires_python": "", "summary": "Create simple GUIs using the Rofi application", "version": "1.0.1" }, "last_serial": 4640368, "releases": { "1.0.1": [ { "comment_text": "", "digests": { "md5": "f92e93d2750d7b26bd150bcb35c0483b", "sha256": "6acf69ce1480b81e929119acc85e6e1d62c975beb82d14c62152c9690f44f251" }, "downloads": -1, "filename": "python_rofi-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f92e93d2750d7b26bd150bcb35c0483b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15527, "upload_time": "2017-01-15T00:24:07", "url": "https://files.pythonhosted.org/packages/d1/82/7d412565933fb60481fc33d5f042c78a546dbaaf6c3beee78c33b8ede022/python_rofi-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dbffabf52cb710a04324ee17f78cd496", "sha256": "f2d6b8c7a1fcd1807b19cf27329d9a7f6c839cc9e8877396a819337cfa797a61" }, "downloads": -1, "filename": "python-rofi-1.0.1.tar.gz", "has_sig": true, "md5_digest": "dbffabf52cb710a04324ee17f78cd496", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11388, "upload_time": "2017-01-15T00:26:04", "url": "https://files.pythonhosted.org/packages/9b/01/dd1cfcdc4ddd4929958a38bee3ee9f8eb8b37594090b18cfaa4612901c08/python-rofi-1.0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f92e93d2750d7b26bd150bcb35c0483b", "sha256": "6acf69ce1480b81e929119acc85e6e1d62c975beb82d14c62152c9690f44f251" }, "downloads": -1, "filename": "python_rofi-1.0.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "f92e93d2750d7b26bd150bcb35c0483b", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 15527, "upload_time": "2017-01-15T00:24:07", "url": "https://files.pythonhosted.org/packages/d1/82/7d412565933fb60481fc33d5f042c78a546dbaaf6c3beee78c33b8ede022/python_rofi-1.0.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "dbffabf52cb710a04324ee17f78cd496", "sha256": "f2d6b8c7a1fcd1807b19cf27329d9a7f6c839cc9e8877396a819337cfa797a61" }, "downloads": -1, "filename": "python-rofi-1.0.1.tar.gz", "has_sig": true, "md5_digest": "dbffabf52cb710a04324ee17f78cd496", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11388, "upload_time": "2017-01-15T00:26:04", "url": "https://files.pythonhosted.org/packages/9b/01/dd1cfcdc4ddd4929958a38bee3ee9f8eb8b37594090b18cfaa4612901c08/python-rofi-1.0.1.tar.gz" } ] }