{ "info": { "author": "Hans-Peter Jansen", "author_email": "hpj@urpla.net", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Environment :: Console", "Environment :: MacOS X", "Environment :: Win32 (MS Windows)", "Environment :: X11 Applications :: Qt", "Framework :: Setuptools Plugin", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: POSIX", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development", "Topic :: Software Development :: Build Tools", "Topic :: Software Development :: Internationalization", "Topic :: Software Development :: Localization", "Topic :: Software Development :: User Interfaces", "Topic :: System :: Software Distribution" ], "description": "distutils_ui\n============\n\nA distutils build extension for PyQt{4,5} applications\n------------------------------------------------------\n\nBuild UI specific elements in tree, controlled by configuration variables in\nsetup.cfg. Running the tool chain is delegated to a couple of internal build\ncommands.\n\nFollowing layout is assumed::\n\n project/\n i18n/ # keep all translation specific files here\n i18n/project.pro # translation project file (generated, optionally)\n ui/ # all designer forms, may contain sub folders\n project.qrc # project resource definition (generated)\n project_rc.py # project resources (generated)\n setup.py # distutils/setuptools module for the project\n setup.cfg # setup configuration\n ...\n\n\nTranslations\n------------\nProper translation is subject of fetching the translatable strings from\nall forms and source modules, translate them (with ``linguist``), and convert\nthe textual representation (``.ts``) into binary form (``.qm``), palatable for\n``QTranslator`` instances.\n\nThere are two ways to accomplish this task: using an intermediate project\nfile (``.pro``), that can be generated with the built-in command ``gentrpro``,\nor feeding globbing args to the tools ``pylupdate`` and ``lrelease`` directly.\nUnfortunately, the latter way is hampered by some bugs. Hence, the preferred way\nis using the ``.pro`` file.\n\nBecause the translation source files (``.ts``) references forms and sources with\nrelative paths, and the tools ``pylupdate`` and ``lrelease`` operate relative\nto the ``.pro`` file location, and *we* *want* to keep all translation specific\nfiles in one place, we run the translation tool chain relative to ``i18n/``.\n\nA new language\n~~~~~~~~~~~~~~\n* create an appropriately named file in ``i18n/``\n e.g. ``touch i18n/project_lang.ts``\n* build initial translation source with ``setup.py build_ui``\n* set up language parameter with linguist once\n e.g. ``linguist i18n/project_lang.ts``\n\nTranslation relies on tr() and translate() used properly in the source.\n\n\nForms\n-----\n\n``ui/`` and sub folders contain all designer forms. You shouldn't mix source\ncode and forms in one folder, because forms are translated to *Python* source\nfiles, that you want to handle differently (e.g. exclude from translation,\nbecause the translation source is generated from the forms already.\n\nThe ``
.ui`` file is translated to ``ui_.py``. Usually, it contains\na single form, where the toplevel object is the camel cased name of the\nmodule. E.g.: ``form.ui`` contains a widget ``Form``, that is imported from\ntoplevel modules with::\n\n from ui.ui_form import Ui_Form\n\nTypically, this form is subclassed with multiple inheritance::\n\n class Form(QWidget, Ui_Form):\n def __init__(self, parent = None):\n super(Form, self).__init__(parent)\n self.setupUi(self)\n\n\nResources\n---------\nResource collection files (``.qrc``) defines resources, that are included within\na single module. Typically, this includes images, translation files (``.qm``),\nand other static data. These resources are accessed with::\n\n app.setWindowIcon(QIcon(\":/images/icon.png\"))\n\nNote the \":\" prefix. The resource file is typically included early in the\nmain module::\n\n import project_rc # __IGNORE_WARNING__ (this is not referenced any further)\n\nand the included resources are available in all modules.\n\n**distutils_ui** contains a built-in command ``genqrc``, that generates ``.qrc``\nfiles from globbing patterns. ``genqrc`` supports two specific options: ``prefix``\nand ``strip``. Prefix allows to place all resources under a custom prefix, while\nstrip removes the path from objects. Strip requires, that all files are uniquely\nnamed, otherwise some objects are not accessible. The command ``pyrcc``\ngenerates the resource module ``project_rc.py`` from ``project.qrc``.\n\n\nCommands\n--------\nThe ``gentrpro`` and ``genqrc`` commands are built-in, therefore they don't\ndefine their own command, rather than process input and output files directly.\nAll other commands call external tools, that must be available and specified\nwith a ``command`` parameter in ``setup.cfg``.\n\nCommand parameter use ``{macro}`` expressions, that references other parameters\nin the same section, such as ``{infiles}`` and ``{outfiles}``, as well as\nmetadata parameter, like ``{name}`` and ``{version}``. These parameters can\nbe mixed with file globbing patterns.\n\n``infiles`` and ``outfiles`` parameter define input files and targets.\n\nAn ``exclude`` parameter removes matching elements from ``infiles``.\n\nThe ``chdir`` parameter allow to change the execution path of that command,\nalso subject to metadata macro expansion.\n\nA special command mode is provided: ``singlefile``. It is used to call the\ncommand *one* by *one* for *every* input file. In this mode, additional macros\nare available, that can be used to further control the output file: ``{path}``,\n``{filename}``, and ``{fileext}``. Check the template for ``pyuic`` and\n``pyrcc`` commands for examples.\n\nIf you only want to work with a command subset: just define ``commands`` in\n``[build_ui]`` section accordingly.\n\n\n\nsetup.py::\n\n from distutils.command.build import build\n from build_ui import build_ui\n\n [...]\n\n cmdclass = {\n 'build_ui': build_ui,\n }\n\n # Optional: inject ui specific build into standard build process\n build.sub_commands.insert(0, ('build_ui', None))\n\n [...]\n\n setup(\n name = name,\n version = version,\n [...]\n cmdclass = cmdclass\n )\n\n\nsetup.cfg of build_ui template for PyQt5::\n\n [build_ui]\n # control the tool chain (default: run all commands)\n #commands = gentrpro, pylupdate, lrelease, pyuic, genqrc, pyrcc\n\n [gentrpro]\n # pro files are processed relative to their location, cope with it:\n # generate pro file with relative paths from i18n, and call\n # pylupdate and lrelease from within i18n\n chdir = {name}/i18n\n infiles = ../ui/*.ui ../*.py *.ts\n outfiles = {name}.pro\n exclude = ../{name}_rc.py\n\n [pylupdate]\n # update translation source files (*.ts) from forms and source files\n # -noobsolete will remove all outdated translations\n chdir = {name}/i18n\n command = pylupdate5 -verbose {infiles}\n infiles = {name}.pro\n outfiles = {name}_*.ts\n\n [lrelease]\n # convert translation source files into binary representation (*.qm)\n chdir = {name}/i18n\n command = lrelease-qt5 {infiles}\n infiles = {name}.pro\n outfiles = {name}_*.qm\n\n [pyuic]\n # generate python source files from UI definitions (*.ui)\n command = pyuic5 -x -o {outfiles} {infiles}\n infiles = {name}/ui/*.ui\n outfiles = {name}/ui/ui_{filename}.py\n singlefile = true\n\n [genqrc]\n # generate a resource description file (*.qrc)\n chdir = {name}\n infiles = images/*.png i18n/*.qm\n outfiles = {name}.qrc\n # these are specific for genqrc\n strip = false\n prefix =\n\n [pyrcc]\n # generate a resource module from qrc file\n command = pyrcc5 -o {outfiles} {infiles}\n infiles = {name}/{name}.qrc\n outfiles = {name}/{name}_rc.py\n singlefile = true\n\n\nThe plain UI build is triggered with::\n\n python3 setup.py build_ui [-f|--force]\n\nA cleanup of the generated files can be done in a similar fashion::\n\n python3 setup.py build_ui [-C|--clean]\n\nNotes:\n\n* avoid spaces in filenames\n* '.pro' file approach results in spurious builds\n\nDebug::\n\n python3 setup.py -v build_ui\n\nAuthor:\n\n (c) 2016 Hans-Peter Jansen \n\nLicense:\n\n MIT, Copyright (c) 2016, Hans-Peter Jansen, see LICENSE.txt\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/frispete/distutils_ui", "keywords": "distutils setuptools generate translate build resources", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "distutils_ui", "package_url": "https://pypi.org/project/distutils_ui/", "platform": "", "project_url": "https://pypi.org/project/distutils_ui/", "project_urls": { "Homepage": "https://github.com/frispete/distutils_ui" }, "release_url": "https://pypi.org/project/distutils_ui/0.1.2/", "requires_dist": null, "requires_python": "", "summary": "A distutils build extension for PyQt{4,5} applications", "version": "0.1.2" }, "last_serial": 2828869, "releases": { "0.1.0": [ { "comment_text": "", "digests": { "md5": "e5f5411fdc4a3dbadf39ea0c9cad8a58", "sha256": "8e4f7f33c317e9058907d6c85185c1427584e60f1b4db7fb38ce762be849a92a" }, "downloads": -1, "filename": "distutils_ui-0.1.0.tar.gz", "has_sig": false, "md5_digest": "e5f5411fdc4a3dbadf39ea0c9cad8a58", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19305, "upload_time": "2016-12-03T21:27:35", "url": "https://files.pythonhosted.org/packages/cd/22/2176e7c43e094b299cc57e32fdc7e648f8cfc08fa045d11c4923d2ab1c13/distutils_ui-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "06e7e03be1856188b4defc71640ee685", "sha256": "09a01a063329e154c87d3eecc4eeabaab6069b16e9148a7e16275bbcbc2d6051" }, "downloads": -1, "filename": "distutils_ui-0.1.1.tar.gz", "has_sig": false, "md5_digest": "06e7e03be1856188b4defc71640ee685", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19286, "upload_time": "2016-12-03T22:05:56", "url": "https://files.pythonhosted.org/packages/82/56/57c8cf1d0d371f358d62cf85e62359b04060b84c160ceb14ceead20d2676/distutils_ui-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2aab2d0301d5c9e0dabaa5f4b46e8d1a", "sha256": "b1fc945012d2201b48d6eb45ab1fdfbb2bc19f8b5b03c906082ae4aa1c55a605" }, "downloads": -1, "filename": "distutils_ui-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2aab2d0301d5c9e0dabaa5f4b46e8d1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19375, "upload_time": "2017-04-25T13:39:49", "url": "https://files.pythonhosted.org/packages/2d/3a/a6542d50d650bcb7dfe614aef89bba31403301103fb961e329501261b292/distutils_ui-0.1.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2aab2d0301d5c9e0dabaa5f4b46e8d1a", "sha256": "b1fc945012d2201b48d6eb45ab1fdfbb2bc19f8b5b03c906082ae4aa1c55a605" }, "downloads": -1, "filename": "distutils_ui-0.1.2.tar.gz", "has_sig": false, "md5_digest": "2aab2d0301d5c9e0dabaa5f4b46e8d1a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 19375, "upload_time": "2017-04-25T13:39:49", "url": "https://files.pythonhosted.org/packages/2d/3a/a6542d50d650bcb7dfe614aef89bba31403301103fb961e329501261b292/distutils_ui-0.1.2.tar.gz" } ] }