{ "info": { "author": "Simon Kaeser", "author_email": "skaeser@gmail.com", "bugtrack_url": null, "classifiers": [ "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Introduction\n============\n\n``horae.groupselect`` provides a grouped ``Dropdown`` widget for\n`zope.formlib `_ using\nthe default ``optgroup`` elements provided by HTML.\n\nUsage\n=====\n\nTo use a grouped dropdown widget the previously used ``Choice`` field\nof the schema has to be replaced by a ``GroupedChoice`` field provided\nin ``horae.groupedselect.field``. A ``GroupedChoice`` field takes the\nexactly same parameters as the stock ``Choice`` field but additionally\nan instance of a groups provider (implementing\n``horae.groupedselect.interfaces.IGroups``) has to be provided over the\nparameter ``groups``. The mentioned groups provider converts the\nvocabulary of the field into a list of groups.\n\nImagine field to select a country and you would like to group them by\nregion::\n\n from zope import interface, implements\n from zope.schema import vocabulary\n \n from horae.groupedselect import field, interfaces\n \n class Country(object):\n def __init__(self, region, country):\n self.region = region\n self.country = country\n \n class CountryGroups(object):\n implements(interfaces.IGroups)\n \n def groups(self, vocabulary):\n \"\"\"\n Converts the given vocabulary into a list of groups:\n \n return (('Group 1', (term1, term2, term3)),\n ('Group 2', (term6, term5, term6)),)\n \"\"\"\n groups = {}\n for term in vocabulary:\n if not term.value.region in groups:\n groups[term.value.region] = ()\n groups[term.value.region] = groups[term.value.region] + \\\n (term,)\n return groups.items()\n \n class ICountrySelection(interface.Interface):\n \n country = field.GroupedChoice(\n title = u'Country',\n vocabulary = vocabulary.SimpleVocabulary((\n # ...\n vocabulary.SimpleTerm(\n Country(u'Europe', u'Switzerland'),\n 'ch',\n u'Switzerland'\n ),\n vocabulary.SimpleTerm(\n Country(u'Europe', u'Germany'),\n 'de',\n u'Germany'\n ),\n vocabulary.SimpleTerm(\n Country(u'Europe', u'Austria'),\n 'at',\n u'Austria'\n ),\n vocabulary.SimpleTerm(\n Country(u'Europe', u'France'),\n 'fr',\n u'France'\n ),\n # ...\n vocabulary.SimpleTerm(\n Country(u'North America', u'USA'),\n 'us',\n u'USA'\n ),\n vocabulary.SimpleTerm(\n Country(u'Europe', u'Canada'),\n 'ca',\n u'Canada'\n ),\n # ...\n )),\n groups = CountryGroups()\n )\n\nDependencies\n============\n\n* `zope.schema `_\n* `zope.formlib `_\n\nChangelog\n=========\n\n1.0a1 (2012-01-16)\n------------------\n\n* Initial release", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "UNKNOWN", "keywords": "", "license": "GPL", "maintainer": null, "maintainer_email": null, "name": "horae.groupselect", "package_url": "https://pypi.org/project/horae.groupselect/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/horae.groupselect/", "project_urls": { "Download": "UNKNOWN", "Homepage": "UNKNOWN" }, "release_url": "https://pypi.org/project/horae.groupselect/1.0a1/", "requires_dist": null, "requires_python": null, "summary": "Provides a grouped Dropdown widget for zope.formlib", "version": "1.0a1" }, "last_serial": 792991, "releases": { "1.0a1": [ { "comment_text": "", "digests": { "md5": "ae73bd524abb15ba9cc97ae932dcea1e", "sha256": "6f7285b54b9b9c5fbf8b17e1d1c804eda67d29cb3fd8b654b4dfed0dd004cf4d" }, "downloads": -1, "filename": "horae.groupselect-1.0a1.tar.gz", "has_sig": false, "md5_digest": "ae73bd524abb15ba9cc97ae932dcea1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4010, "upload_time": "2012-01-16T12:02:06", "url": "https://files.pythonhosted.org/packages/ab/68/77a81f53f8db60a187a7dac1682e82b47abe485a2255a942330030a5b334/horae.groupselect-1.0a1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ae73bd524abb15ba9cc97ae932dcea1e", "sha256": "6f7285b54b9b9c5fbf8b17e1d1c804eda67d29cb3fd8b654b4dfed0dd004cf4d" }, "downloads": -1, "filename": "horae.groupselect-1.0a1.tar.gz", "has_sig": false, "md5_digest": "ae73bd524abb15ba9cc97ae932dcea1e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4010, "upload_time": "2012-01-16T12:02:06", "url": "https://files.pythonhosted.org/packages/ab/68/77a81f53f8db60a187a7dac1682e82b47abe485a2255a942330030a5b334/horae.groupselect-1.0a1.tar.gz" } ] }