Skip to content

Commit

Permalink
I don't really remember the changes I've made :(
Browse files Browse the repository at this point in the history
  • Loading branch information
YeisonCardona committed Feb 6, 2023
1 parent 097bd2a commit cb13754
Show file tree
Hide file tree
Showing 37 changed files with 240 additions and 42 deletions.
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Qt-Material
===========
# Qt-Material

This is another stylesheet for **PySide6**, **PySide2**, **PyQt5** and **PyQt6**, which looks like Material Design (close enough).

![GitHub top language](https://img.shields.io/github/languages/top/un-gcpds/qt-material)
Expand Down Expand Up @@ -32,6 +32,7 @@ And light:
* [Change theme in runtime](#change-theme-in-runtime)
* [Export theme](#export-theme)
* [Density scale](#density-scale)
* [Troubleshoots](#troubleshoots)

## Install

Expand Down Expand Up @@ -200,8 +201,13 @@ Then, the current stylesheet can be extended just with:


```python
apply_stylesheet(app, theme='light_blue.xml')
apply_stylesheet(app, theme='light_blue.xml', css_file='custom.css')
```

The stylesheet can also be changed on runtime by:


```python
stylesheet = app.styleSheet()
with open('custom.css') as file:
app.setStyleSheet(stylesheet + file.read().format(**os.environ))
Expand Down Expand Up @@ -382,7 +388,7 @@ apply_stylesheet(app, 'default', invert_secondary=False, extra=extra)

### QMenu

`QMenu` has multiple rendering for each Qt backend, and for each operating system. Even can be related with the style, like [fusion](https://doc.qt.io/qt-5/qtquickcontrols2-fusion.html). Then, the `extra` argument also supports`QMenu` parameters to configure this widgest for specific combinations.
`QMenu` has multiple rendering for each Qt backend, and for each operating system. Even can be related with the style, like [fusion](https://doc.qt.io/qt-5/qtquickcontrols2-fusion.html). Then, the `extra` argument also supports`QMenu` parameters to configure this widgest for specific combinations. This options are not affected by **density scale**.


```python
Expand Down
4 changes: 2 additions & 2 deletions docs/source/notebooks/readme.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Qt-Material\n",
"===========\n",
"# Qt-Material\n",
"\n",
"This is another stylesheet for **PySide6**, **PySide2**, **PyQt5** and **PyQt6**, which looks like Material Design (close enough).\n",
"\n",
"![GitHub top language](https://img.shields.io/github/languages/top/un-gcpds/qt-material)\n",
Expand Down
12 changes: 9 additions & 3 deletions docs/source/notebooks/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Navigation
- `Change theme in runtime <#change-theme-in-runtime>`__
- `Export theme <#export-theme>`__
- `Density scale <#density-scale>`__
- `Troubleshoots <#troubleshoots>`__

Install
-------
Expand Down Expand Up @@ -238,8 +239,12 @@ Then, the current stylesheet can be extended just with:

.. code:: ipython3
apply_stylesheet(app, theme='light_blue.xml')
apply_stylesheet(app, theme='light_blue.xml', css_file='custom.css')
The stylesheet can also be changed on runtime by:

.. code:: ipython3
stylesheet = app.styleSheet()
with open('custom.css') as file:
app.setStyleSheet(stylesheet + file.read().format(**os.environ))
Expand Down Expand Up @@ -456,7 +461,8 @@ QMenu
operating system. Even can be related with the style, like
`fusion <https://doc.qt.io/qt-5/qtquickcontrols2-fusion.html>`__. Then,
the ``extra`` argument also supports\ ``QMenu`` parameters to configure
this widgest for specific combinations.
this widgest for specific combinations. This options are not affected by
**density scale**.

.. code:: ipython3
Expand Down
1 change: 1 addition & 0 deletions examples/full_features/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
# 'padding': '50px 50px 50px 50px', # top, right, bottom, left
# }


########################################################################
class RuntimeStylesheets(QMainWindow, QtStyleTools):
# ----------------------------------------------------------------------
Expand Down
111 changes: 110 additions & 1 deletion examples/full_features/main_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="tab_11">
<attribute name="title">
Expand Down Expand Up @@ -2980,6 +2980,115 @@ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor i
<header location="global">QtWebEngineWidgets/QWebEngineView</header>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>tabWidget_4</tabstop>
<tabstop>groupBox</tabstop>
<tabstop>pushButton</tabstop>
<tabstop>pushButton_3</tabstop>
<tabstop>pushButton_6</tabstop>
<tabstop>pushButton_7</tabstop>
<tabstop>pushButton_11</tabstop>
<tabstop>pushButton_5</tabstop>
<tabstop>pushButton_4</tabstop>
<tabstop>groupBox_2</tabstop>
<tabstop>groupBox_3</tabstop>
<tabstop>radioButton</tabstop>
<tabstop>radioButton_4</tabstop>
<tabstop>radioButton_2</tabstop>
<tabstop>radioButton_3</tabstop>
<tabstop>checkBox</tabstop>
<tabstop>checkBox_3</tabstop>
<tabstop>checkBox_4</tabstop>
<tabstop>checkBox_2</tabstop>
<tabstop>pushButton_file_dialog</tabstop>
<tabstop>pushButton_folder_dialog</tabstop>
<tabstop>tabWidget_3</tabstop>
<tabstop>tabWidget</tabstop>
<tabstop>horizontalSlider_2</tabstop>
<tabstop>verticalSlider_2</tabstop>
<tabstop>treeWidget</tabstop>
<tabstop>listWidget_2</tabstop>
<tabstop>tableWidget</tabstop>
<tabstop>tabWidget_2</tabstop>
<tabstop>pushButton_18</tabstop>
<tabstop>pushButton_20</tabstop>
<tabstop>pushButton_19</tabstop>
<tabstop>pushButton_23</tabstop>
<tabstop>pushButton_22</tabstop>
<tabstop>pushButton_21</tabstop>
<tabstop>comboBox</tabstop>
<tabstop>comboBox_7</tabstop>
<tabstop>comboBox_5</tabstop>
<tabstop>comboBox_2</tabstop>
<tabstop>spinBox</tabstop>
<tabstop>doubleSpinBox</tabstop>
<tabstop>lineEdit</tabstop>
<tabstop>lineEdit_3</tabstop>
<tabstop>comboBox_3</tabstop>
<tabstop>comboBox_6</tabstop>
<tabstop>comboBox_4</tabstop>
<tabstop>spinBox_2</tabstop>
<tabstop>doubleSpinBox_2</tabstop>
<tabstop>lineEdit_2</tabstop>
<tabstop>dateEdit_2</tabstop>
<tabstop>listWidget</tabstop>
<tabstop>textEdit</tabstop>
<tabstop>plainTextEdit</tabstop>
<tabstop>pushButton_2</tabstop>
<tabstop>pushButton_12</tabstop>
<tabstop>pushButton_13</tabstop>
<tabstop>pushButton_14</tabstop>
<tabstop>pushButton_15</tabstop>
<tabstop>pushButton_16</tabstop>
<tabstop>pushButton_17</tabstop>
<tabstop>radioButton_7</tabstop>
<tabstop>radioButton_5</tabstop>
<tabstop>radioButton_6</tabstop>
<tabstop>radioButton_8</tabstop>
<tabstop>checkBox_5</tabstop>
<tabstop>checkBox_6</tabstop>
<tabstop>checkBox_7</tabstop>
<tabstop>checkBox_8</tabstop>
<tabstop>pushButton_8</tabstop>
<tabstop>pushButton_9</tabstop>
<tabstop>pushButton_10</tabstop>
<tabstop>pushButton_24</tabstop>
<tabstop>pushButton_25</tabstop>
<tabstop>pushButton_26</tabstop>
<tabstop>pushButton_27</tabstop>
<tabstop>radioButton_12</tabstop>
<tabstop>radioButton_10</tabstop>
<tabstop>radioButton_11</tabstop>
<tabstop>radioButton_9</tabstop>
<tabstop>checkBox_10</tabstop>
<tabstop>checkBox_11</tabstop>
<tabstop>checkBox_12</tabstop>
<tabstop>checkBox_9</tabstop>
<tabstop>timeEdit</tabstop>
<tabstop>dateEdit</tabstop>
<tabstop>dateTimeEdit</tabstop>
<tabstop>keySequenceEdit</tabstop>
<tabstop>calendarWidget</tabstop>
<tabstop>groupBox_7</tabstop>
<tabstop>pushButton_28</tabstop>
<tabstop>pushButton_32</tabstop>
<tabstop>lineEdit_4</tabstop>
<tabstop>pushButton_30</tabstop>
<tabstop>pushButton_33</tabstop>
<tabstop>pushButton_29</tabstop>
<tabstop>pushButton_31</tabstop>
<tabstop>doubleSpinBox_3</tabstop>
<tabstop>timeEdit_2</tabstop>
<tabstop>dateTimeEdit_2</tabstop>
<tabstop>comboBox_8</tabstop>
<tabstop>tabWidget_6</tabstop>
<tabstop>fontComboBox</tabstop>
<tabstop>tabWidget_5</tabstop>
<tabstop>tabWidget_7</tabstop>
<tabstop>spinBox_3</tabstop>
<tabstop>tableWidget_2</tabstop>
<tabstop>lineEdit_5</tabstop>
</tabstops>
<resources/>
<connections/>
</ui>
8 changes: 4 additions & 4 deletions examples/full_features/my_theme.xml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<resources>
<color name="primaryColor">#ff4081</color>
<color name="primaryLightColor">#ff79b0</color>
<color name="primaryColor">#00bcd4</color>
<color name="primaryLightColor">#62efff</color>
<color name="secondaryColor">#f5f5f5</color>
<color name="secondaryLightColor">#ffffff</color>
<color name="secondaryDarkColor">#e6e6e6</color>
<color name="secondaryLightColor">#e6e6e6</color>
<color name="secondaryDarkColor">#ffffff</color>
<color name="primaryTextColor">#3c3c3c</color>
<color name="secondaryTextColor">#555555</color>
</resources>
Binary file added examples/full_features/screenshots/dark.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 examples/full_features/screenshots/dark_blue.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 examples/full_features/screenshots/dark_cyan.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 examples/full_features/screenshots/dark_pink.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 examples/full_features/screenshots/dark_red.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 examples/full_features/screenshots/dark_teal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 examples/full_features/screenshots/light.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 examples/full_features/screenshots/light_red.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 5 additions & 3 deletions qt_material/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ def opacity(theme, value=0.5):


# ----------------------------------------------------------------------
def density(value, density_scale, border=0, scale=1, density_interval=4):
def density(
value, density_scale, border=0, scale=1, density_interval=4, min_=4
):
""""""
# https://material.io/develop/web/supporting/density
if isinstance(value, str) and value.startswith('@'):
Expand All @@ -360,8 +362,8 @@ def density(value, density_scale, border=0, scale=1, density_interval=4):
value + (density_interval * int(density_scale)) - (border * 2)
) * scale

if density < 0:
density = 0
if density <= 0:
density = min_
return density


Expand Down
Loading

0 comments on commit cb13754

Please sign in to comment.