prett6


Nameprett6 JSON
Version 1.0.0 PyPI version JSON
download
home_pagehttps://github.com/KD-Group/prett
SummaryA Pretty Project Framework
upload_time2024-05-15 03:40:44
maintainerNone
docs_urlNone
authorSF-Zhou
requires_python>=3.8
licenseMIT
keywords qt ui
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            prett: A Pretty Project Framework
==================================

.. image:: https://travis-ci.com/KD-Group/prett.svg?branch=master
    :target: https://travis-ci.com/KD-Group/prett

A pretty project framework for Python3 & PySide6.

I hope it is useful for you, too. :D

============
Dict Storage
============

All the project items' values are stored in the **project.value** dict. The key is the item name.
Generally this dict can be serialized and stored in the file if the dict can be pickled directly.

.. code-block:: python

    import prett


    class ItemDemo(prett.IntProjectItem):
        pass

    class ProjectDemo(prett.AbstractProject):
        def __init__(self):
            self.width = ItemDemo(self)
            self.height = ItemDemo(self)

    p = ProjectDemo()
    p.width.int.value = 16
    p.height.int.value = 20
    print(p.value)  # {'width': '16', 'height': '20'}


===============
Type Conversion
===============

In prett, there are default type conversion in string-int and string-float.
When the item is inherited from StringIntItem, the item value is stored in string type, and its int property will automatically convert to or from string type.

.. code-block:: python

    import prett


    class ItemDemo(prett.IntProjectItem):
        pass

    class ProjectDemo(prett.AbstractProject):
        def __init__(self):
            self.length = ItemDemo(self)

    p = ProjectDemo()
    p.length.string.value = '200'
    print(p.length.int.value)  # 200, type is int

==============
Changed Signal
==============

When the value of property change, the changed signals of project, item, and properties will be emitted.

.. code-block:: python

    import prett


    class ItemDemo(prett.IntProjectItem):
        pass

    class ProjectDemo(prett.AbstractProject):
        def __init__(self):
            self.width = ItemDemo(self)
            self.height = ItemDemo(self)

    p = ProjectDemo()
    p.width.int.value = 16  # p.changed signal emitted, p.width.changed emitted
                            # then p.width.string.changed emitted, p.width.int.changed emitted

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/KD-Group/prett",
    "name": "prett6",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "qt ui",
    "author": "SF-Zhou",
    "author_email": "sfzhou.scut@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/4f/77/6af01a23a0922e47752cb976a551f0bc69900c5c77618625fb45f04a4b74/prett6-1.0.0.tar.gz",
    "platform": null,
    "description": "prett: A Pretty Project Framework\n==================================\n\n.. image:: https://travis-ci.com/KD-Group/prett.svg?branch=master\n    :target: https://travis-ci.com/KD-Group/prett\n\nA pretty project framework for Python3 & PySide6.\n\nI hope it is useful for you, too. :D\n\n============\nDict Storage\n============\n\nAll the project items' values are stored in the **project.value** dict. The key is the item name.\nGenerally this dict can be serialized and stored in the file if the dict can be pickled directly.\n\n.. code-block:: python\n\n    import prett\n\n\n    class ItemDemo(prett.IntProjectItem):\n        pass\n\n    class ProjectDemo(prett.AbstractProject):\n        def __init__(self):\n            self.width = ItemDemo(self)\n            self.height = ItemDemo(self)\n\n    p = ProjectDemo()\n    p.width.int.value = 16\n    p.height.int.value = 20\n    print(p.value)  # {'width': '16', 'height': '20'}\n\n\n===============\nType Conversion\n===============\n\nIn prett, there are default type conversion in string-int and string-float.\nWhen the item is inherited from StringIntItem, the item value is stored in string type, and its int property will automatically convert to or from string type.\n\n.. code-block:: python\n\n    import prett\n\n\n    class ItemDemo(prett.IntProjectItem):\n        pass\n\n    class ProjectDemo(prett.AbstractProject):\n        def __init__(self):\n            self.length = ItemDemo(self)\n\n    p = ProjectDemo()\n    p.length.string.value = '200'\n    print(p.length.int.value)  # 200, type is int\n\n==============\nChanged Signal\n==============\n\nWhen the value of property change, the changed signals of project, item, and properties will be emitted.\n\n.. code-block:: python\n\n    import prett\n\n\n    class ItemDemo(prett.IntProjectItem):\n        pass\n\n    class ProjectDemo(prett.AbstractProject):\n        def __init__(self):\n            self.width = ItemDemo(self)\n            self.height = ItemDemo(self)\n\n    p = ProjectDemo()\n    p.width.int.value = 16  # p.changed signal emitted, p.width.changed emitted\n                            # then p.width.string.changed emitted, p.width.int.changed emitted\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A Pretty Project Framework",
    "version": "1.0.0",
    "project_urls": {
        "Homepage": "https://github.com/KD-Group/prett"
    },
    "split_keywords": [
        "qt",
        "ui"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ceb80b3e6c7947f619d103f507deeba16a5b4e89746b66153322d43cf6dbb18f",
                "md5": "d4273aaf7d128b4dd532448d353dcedd",
                "sha256": "4ed44277d81b222301a24ea08f59f8d0c7d512a58ebbdc3c3ba62065c7a14826"
            },
            "downloads": -1,
            "filename": "prett6-1.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d4273aaf7d128b4dd532448d353dcedd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 13978,
            "upload_time": "2024-05-15T03:40:42",
            "upload_time_iso_8601": "2024-05-15T03:40:42.604046Z",
            "url": "https://files.pythonhosted.org/packages/ce/b8/0b3e6c7947f619d103f507deeba16a5b4e89746b66153322d43cf6dbb18f/prett6-1.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "4f776af01a23a0922e47752cb976a551f0bc69900c5c77618625fb45f04a4b74",
                "md5": "49de0e554587fbacabc347b19caca1ac",
                "sha256": "7f6c2e1eeeaf775fc8cb333e7386f95abbbd4906f3443a688eb4a34736a111c9"
            },
            "downloads": -1,
            "filename": "prett6-1.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "49de0e554587fbacabc347b19caca1ac",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 10306,
            "upload_time": "2024-05-15T03:40:44",
            "upload_time_iso_8601": "2024-05-15T03:40:44.800691Z",
            "url": "https://files.pythonhosted.org/packages/4f/77/6af01a23a0922e47752cb976a551f0bc69900c5c77618625fb45f04a4b74/prett6-1.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-15 03:40:44",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "KD-Group",
    "github_project": "prett",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "lcname": "prett6"
}
        
Elapsed time: 0.22446s