Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
5yutan5 committed Aug 25, 2021
0 parents commit b59fbae
Show file tree
Hide file tree
Showing 181 changed files with 3,674 additions and 0 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PYTHONPATH=./
23 changes: 23 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Compiled python files
*.py[oc]

# Compiled dirs
__pycache__/

# VSCode workspace identity file
*.code-workspace

# VSCode setting folder
*.vscode

# Virtual env
.venv/

# Pytest cache
.pytest_cache

# Pycharm setting folder
.idea

# System information folder for mac
.DS_Store
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2021 Yunosuke Ohsugi

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.
52 changes: 52 additions & 0 deletions NOTICE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Included Software, Images and Icons

## General Information

PyQtDarkTheme incorporates image assets from external sources,
it is covered by its own license and copyright notice.

Any file not listed here is covered by PyQtDarkTheme's MIT license,
described in the [LICENSE](LICENSE) file in this repository.

--------------------------------------------------------------------


## Material design icons

- Author: Google
- Site: https://fonts.google.com/icons
- Source: https://github.com/google/material-design-icons
- License: Apache License Version 2.0 | https://www.apache.org/licenses/LICENSE-2.0.txt

Modifications made to each files to change the icon color and angle.

The current Material design icons license summary can be viewed at:
https://github.com/google/material-design-icons/blob/master/LICENSE


Files covered:

All files under [qdarktheme/svg](qdarktheme/svg).


## QDarkStyleSheet(Source code)


Copyright (c) 2013- Colin Duquesnoy and others (see QDarkStyleSheet/AUTHORS.rst)


- Author: Colin Duquesnoy and others | [email protected]
https://github.com/ColinDuquesnoy/QDarkStyleSheet/graphs/contributors
- Site: https://github.com/ColinDuquesnoy/QDarkStyleSheet/
- Source: qss files of https://github.com/ColinDuquesnoy/QDarkStyleSheet/
- License: MIT License | https://opensource.org/licenses/MIT

Modifications made to adapt each file to qdarktheme.

The current QDarkStyleSheet license can be viewed at:
https://github.com/ColinDuquesnoy/QDarkStyleSheet/blob/master/LICENSE.rst


Files covered:

[qdarktheme/template.qss](qdarktheme/template.qss)
106 changes: 106 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
PyQtDarkTheme
=============

[![License](https://img.shields.io/github/license/5yutan5/PyQtDarkTheme)](/LICENSE)
[![Total alerts](https://img.shields.io/lgtm/alerts/g/5yutan5/PyQtDarkTheme.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/5yutan5/PyQtDarkTheme/alerts/)
[![Language grade: Python](https://img.shields.io/lgtm/grade/python/g/5yutan5/PyQtDarkTheme.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/5yutan5/PyQtDarkTheme/context:python)

Dark theme for PySide, PyQt and Qt Designer.

This python module applies a theme to a Qt applications(PySide6, PyQt6, PyQt5 and PySide2) using a qt stylesheets system.
There's a Light Theme too. Color and style balanced from the Dark theme for easy viewing in daylight.

### Dark Theme
![widget_gallery_dark_theme](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_dark.png)

### Light Theme
![widget_gallery_light_them](https://raw.githubusercontent.com/5yutan5/PyQtDarkTheme/main/images/widget_gallery_light.png)

## Requirements

- [Python 3.7+](https://www.python.org/downloads/release/python-396/)
- PySide6, PyQt6, PyQt5 or PySide2

## Installation

```plaintext
pip install git+https://github.com/5yutan5/PyQtDarkTheme
```

This command requires [Git](https://git-scm.com/downloads).

## Usage

```Python
import sys

import qdarktheme
from PySide6.QtWidgets import QApplication, QMainWindow, QPushButton

app = QApplication(sys.argv)
main_win = QMainWindow()
push_button = QPushButton("PyQtDarkTheme!!")
main_win.setCentralWidget(push_button)

app.setStyleSheet(qdarktheme.load_stylesheet())

main_win.show()

app.exec()

```

### Light theme

```Python
app.setStyleSheet(qdarktheme.load_stylesheet("light"))
```

### Check common widgets

Input the following command in a terminal to check common widgets.

```plaintext
python -m qdarktheme.examples.widget_gallery
```

## Custom Properties

This module provides several custom properties.
You can use `setProperty()` of the widget object to apply a modern style.

For example, if you set the QToolbar `type` property to `sidebar`, the style for the sidebar will be applied.

```Python
sidebar = QToolBar()
sidebar.setProperty("type", "sidebar")
```

| Widget | Property | Property value | Default | Command for demo |
|-------------|----------|---------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------|
| QToolBar | type | toolbar, sidebar | toolbar | [`python -m qdarktheme.examples.sidebar`](https://github.com/5yutan5/PyQtDarkTheme/blob/main/qdarktheme/examples/sidebar/__main__.py) |
| QPushButton | type | outlined, contained, text | outlined | [`python -m qdarktheme.examples.pushbutton`](https://github.com/5yutan5/PyQtDarkTheme/blob/main/qdarktheme/examples/pushbutton/__main__.py) |
| QLineEdit | state | normal, warning, error | normal | [`python -m qdarktheme.examples.lineedit`](https://github.com/5yutan5/PyQtDarkTheme/blob/main/qdarktheme/examples/lineedit/__main__.py) |
| QFrame | type | normal, h_line, v_line | normal | [`python -m qdarktheme.examples.line`](https://github.com/5yutan5/PyQtDarkTheme/blob/main/qdarktheme/examples/line/__main__.py) |

## Support Qt Designer

This module support Qt Designer.

How to use PyQtDarktheme with Qt Designer.
1. Run the following command in the terminal to launch the app that creates the template for the designer.
```plaintext
python -m qdarktheme.designer_supporter
```
1. Select a theme(dark or light) and press the Create button to create a template in any folder.
1. Copy the style sheet displayed in the text box.
1. Start Qt designer and save the ui file in the root of the template you created.
1. Paste the copied stylesheet into the top-level widget.
1. Register the resource file(.qrc) in the template to the resource browser.

> ⚠ Support for Qt’s resource system has been removed in PyQt6. Therefore, if you want to use Qt Designer in PyQt6, you need to delete the stylesheet in the ui file and load the stylesheet using `load_stylesheet()`.
## License

The icons used in the demo code are sourced from the [Material design icons](https://fonts.google.com/icons)(Apache License Version 2.0).
Any file not listed the [NOTICE.md](https://github.com/5yutan5/PyQtDarkTheme/blob/main/NOTICE.md) file is covered by PyQtDarkTheme's MIT license.
Binary file added dist/PyQtDarkTheme-0.0.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/PyQtDarkTheme-0.0.2.tar.gz
Binary file not shown.
Binary file added dist/PyQtDarkTheme-0.0.3-py3-none-any.whl
Binary file not shown.
Binary file added dist/PyQtDarkTheme-0.0.3.tar.gz
Binary file not shown.
Binary file added images/widget_gallery_dark.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/widget_gallery_light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit b59fbae

Please sign in to comment.