Comel


NameComel JSON
Version 0.2.4 PyPI version JSON
download
home_pageNone
SummaryOpinionated PySide6 Light/Dark Theme Toggler.
upload_time2024-04-19 09:28:32
maintainerNone
docs_urlNone
authorNone
requires_python>=3.7
licenseMIT License Copyright (c) 2022 Huey Yeng Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords python library qt widgets development
VCS
bugtrack_url
requirements darkdetect PySide6
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Comel

Opinionated PySide6 Light/Dark Theme Toggler. Oh wait yet another ~~Qt for Python~~ PySide6 light/dark theme package?
Yes it is!

![](docs/images/comel_takusan.gif)

> **ATTENTION:** This package is designed with writing/deploying standalone PySide6 application in mind.

## Features

1. Custom QMainWindow widget with built-in light/dark mode toggler. Connect the `toggle_theme` function to QtWidgets
   callback function and you're done.
2. Very simple package (for now). Not bloated from trying to cater various Qt for Python packages.

## Getting Started

Last tested with **Python 3.10+** but any Python version that PySide6 supports. Highly recommend using virtual
environment when testing/implementing this.

### Install using pip

```shell
pip install Comel
```

### Cloning this repo

Clone this repo and copy the `comel` package into your project. Ensure both `darkdetect` and `PySide6` is installed in
your Python environment.

## Usage

Import `ComelMainWindowWrapper` class and connect `toggle_theme` to a widget action. That's it!

Refer to examples directory for `barebone_app.py` for boilerplate code or `takusan_app.py` for a typical PySide app
written from scratch without using Qt Designer.

### Custom Widgets

There is **CCheckBox** and **CRadioButton** which uses custom icons and size override. Using the regular **QCheckBox**
and
**QRadioButton** will result in bigger than usual size as it displays the 32x32 size icon image.

## Examples

```shell
# Barebone app
python examples/barebone_app.py

# Takusan app
python examples/takusan_app.py

# Run this for normal and disabled state comparison 
python examples/check_disabled_state_app.py
```

## Customizing Qt Style Sheets (QSS)

> Refer to https://doc.qt.io/qt-6/stylesheet-examples.html for examples on the correct CSS selectors. Search on Stack
> Overflow/Qt Forum/etc if you cannot find the specific CSS selectors.

1. Edit `base.qss` and `presets.py` with the relevant variable and color.
2. Run `generate_qss.py` to generate `light.qss` and `dark.qss` located in `qss/themes` and `comel/themes` folder.

## Known Issues

1. The default Qt arrow icons does not play nicely when using Qt Style Sheets. While there is a way to bundle custom
   icons, I'm not fancy with the extra steps needed to compile Qt `.qrc` into Python file. I might create wrapper class
   for the affected widgets in future updates.
2. This library does not cover every single widget styles. Create an issue if you encounter a widget that is missing
   either light or dark styling.
3. **QMdiArea** and **QMdiSubWindow** is missing the window resize handle after applying Comel stylesheets. Suspecting
   one of the selector override to be the root cause.

## Why Comel?

![](examples/icons/icons8-fat-cat-96.png)

Qt is pronounced as "cute". Comel means **cute** in Bahasa Melayu aka Malay language. Also, the name of my childhood
cat.

## Credits

- Uses [darkdetect](https://github.com/albertosottile/darkdetect) for detecting the operating system dark mode.
- Uses icons from [Icons8](https://icons8.com).
- Special thanks to [izzthedude](https://github.com/izzthedude) for experimenting with this idea.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "Comel",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Huey Yeng <huey.yeng.mmu@gmail.com>",
    "keywords": "python, library, qt, widgets, development",
    "author": null,
    "author_email": "Huey Yeng <huey.yeng.mmu@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/7e/1f/02763cec2b14f3b506ba2b369ddd3fad115dc1b162201f507a348b5f7bd2/comel-0.2.4.tar.gz",
    "platform": null,
    "description": "# Comel\r\n\r\nOpinionated PySide6 Light/Dark Theme Toggler. Oh wait yet another ~~Qt for Python~~ PySide6 light/dark theme package?\r\nYes it is!\r\n\r\n![](docs/images/comel_takusan.gif)\r\n\r\n> **ATTENTION:** This package is designed with writing/deploying standalone PySide6 application in mind.\r\n\r\n## Features\r\n\r\n1. Custom QMainWindow widget with built-in light/dark mode toggler. Connect the `toggle_theme` function to QtWidgets\r\n   callback function and you're done.\r\n2. Very simple package (for now). Not bloated from trying to cater various Qt for Python packages.\r\n\r\n## Getting Started\r\n\r\nLast tested with **Python 3.10+** but any Python version that PySide6 supports. Highly recommend using virtual\r\nenvironment when testing/implementing this.\r\n\r\n### Install using pip\r\n\r\n```shell\r\npip install Comel\r\n```\r\n\r\n### Cloning this repo\r\n\r\nClone this repo and copy the `comel` package into your project. Ensure both `darkdetect` and `PySide6` is installed in\r\nyour Python environment.\r\n\r\n## Usage\r\n\r\nImport `ComelMainWindowWrapper` class and connect `toggle_theme` to a widget action. That's it!\r\n\r\nRefer to examples directory for `barebone_app.py` for boilerplate code or `takusan_app.py` for a typical PySide app\r\nwritten from scratch without using Qt Designer.\r\n\r\n### Custom Widgets\r\n\r\nThere is **CCheckBox** and **CRadioButton** which uses custom icons and size override. Using the regular **QCheckBox**\r\nand\r\n**QRadioButton** will result in bigger than usual size as it displays the 32x32 size icon image.\r\n\r\n## Examples\r\n\r\n```shell\r\n# Barebone app\r\npython examples/barebone_app.py\r\n\r\n# Takusan app\r\npython examples/takusan_app.py\r\n\r\n# Run this for normal and disabled state comparison \r\npython examples/check_disabled_state_app.py\r\n```\r\n\r\n## Customizing Qt Style Sheets (QSS)\r\n\r\n> Refer to https://doc.qt.io/qt-6/stylesheet-examples.html for examples on the correct CSS selectors. Search on Stack\r\n> Overflow/Qt Forum/etc if you cannot find the specific CSS selectors.\r\n\r\n1. Edit `base.qss` and `presets.py` with the relevant variable and color.\r\n2. Run `generate_qss.py` to generate `light.qss` and `dark.qss` located in `qss/themes` and `comel/themes` folder.\r\n\r\n## Known Issues\r\n\r\n1. The default Qt arrow icons does not play nicely when using Qt Style Sheets. While there is a way to bundle custom\r\n   icons, I'm not fancy with the extra steps needed to compile Qt `.qrc` into Python file. I might create wrapper class\r\n   for the affected widgets in future updates.\r\n2. This library does not cover every single widget styles. Create an issue if you encounter a widget that is missing\r\n   either light or dark styling.\r\n3. **QMdiArea** and **QMdiSubWindow** is missing the window resize handle after applying Comel stylesheets. Suspecting\r\n   one of the selector override to be the root cause.\r\n\r\n## Why Comel?\r\n\r\n![](examples/icons/icons8-fat-cat-96.png)\r\n\r\nQt is pronounced as \"cute\". Comel means **cute** in Bahasa Melayu aka Malay language. Also, the name of my childhood\r\ncat.\r\n\r\n## Credits\r\n\r\n- Uses [darkdetect](https://github.com/albertosottile/darkdetect) for detecting the operating system dark mode.\r\n- Uses icons from [Icons8](https://icons8.com).\r\n- Special thanks to [izzthedude](https://github.com/izzthedude) for experimenting with this idea.\r\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 Huey Yeng  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Opinionated PySide6 Light/Dark Theme Toggler.",
    "version": "0.2.4",
    "project_urls": {
        "Bug Reports": "https://github.com/hueyyeng/Comel/issues",
        "Homepage": "https://github.com/hueyyeng/Comel",
        "Source": "https://github.com/hueyyeng/Comel"
    },
    "split_keywords": [
        "python",
        " library",
        " qt",
        " widgets",
        " development"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "17f3eec05ab18aaa374bb17d5f5fcb3ba51ca18571945c1e83f247381533cc13",
                "md5": "49370d15192485fcb55d92d40181ffee",
                "sha256": "afb796dd6542d487c66040dc5634b6ffb06dc04d6b985431e17abcc1da49e09a"
            },
            "downloads": -1,
            "filename": "Comel-0.2.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "49370d15192485fcb55d92d40181ffee",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 36103,
            "upload_time": "2024-04-19T09:28:30",
            "upload_time_iso_8601": "2024-04-19T09:28:30.719581Z",
            "url": "https://files.pythonhosted.org/packages/17/f3/eec05ab18aaa374bb17d5f5fcb3ba51ca18571945c1e83f247381533cc13/Comel-0.2.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7e1f02763cec2b14f3b506ba2b369ddd3fad115dc1b162201f507a348b5f7bd2",
                "md5": "3884c2293b8b04e611415c8ccb07c88e",
                "sha256": "f65d1230ccf0ec18e96bad46be66a9d8faf4b3ee30d2d63133657a6ed6f54340"
            },
            "downloads": -1,
            "filename": "comel-0.2.4.tar.gz",
            "has_sig": false,
            "md5_digest": "3884c2293b8b04e611415c8ccb07c88e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 19622,
            "upload_time": "2024-04-19T09:28:32",
            "upload_time_iso_8601": "2024-04-19T09:28:32.495464Z",
            "url": "https://files.pythonhosted.org/packages/7e/1f/02763cec2b14f3b506ba2b369ddd3fad115dc1b162201f507a348b5f7bd2/comel-0.2.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-19 09:28:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hueyyeng",
    "github_project": "Comel",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "darkdetect",
            "specs": []
        },
        {
            "name": "PySide6",
            "specs": []
        }
    ],
    "lcname": "comel"
}
        
Elapsed time: 0.25118s