more styles

This commit is contained in:
Talley Lambert
2021-04-25 10:17:20 -04:00
parent 3edeac7216
commit 95d836cd8a
7 changed files with 17 additions and 10 deletions

1
.gitignore vendored
View File

@@ -78,3 +78,4 @@ target/
# written by setuptools_scm
*/_version.py
.vscode/settings.json
screenshots

View File

@@ -9,7 +9,7 @@ Version](https://img.shields.io/pypi/pyversions/QtRangeSlider.svg?color=green)](
**The missing multi-handle range slider widget for PyQt & PySide**
![slider](screenshots/slider.png)
![slider](images/slider.png)
The goal of this package is to provide a Range Slider (a slider with 2 or more
handles) that feels as "native" as possible. Styles should match the OS by
@@ -152,17 +152,17 @@ QSlider::sub-page:horizontal {
### macOS
![mac](screenshots/demo_macos.png)
![mac](images/demo_macos.png)
### Window
(coming)
<!-- ![mac](screenshots/demo_windows.png) -->
<!-- ![mac](images/demo_windows.png) -->
### Linux
(coming)
<!-- ![mac](screenshots/demo_linux.png) -->
<!-- ![mac](images/demo_linux.png) -->
## Issues

View File

@@ -95,7 +95,6 @@ class DemoWidget(QtW.QWidget):
self.layout().addWidget(right)
self.setGeometry(600, 300, 580, 300)
self.activateWindow()
QtW.QApplication.processEvents()
self.show()
@@ -113,4 +112,7 @@ if __name__ == "__main__":
if "-x" in sys.argv:
app.exec_()
else:
demo.grab().save(str(dest / "demo_widget.png"))
import platform
QtW.QApplication.processEvents()
demo.grab().save(str(dest / f"demo_{platform.system().lower()}.png"))

BIN
images/demo_darwin.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 86 KiB

After

Width:  |  Height:  |  Size: 86 KiB

View File

@@ -75,7 +75,7 @@ class RangeSliderStyle:
CATALINA_STYLE = RangeSliderStyle(
brush_active="#3B88FD",
brush_inactive="#8F8F8F",
brush_disabled="#BBBBBB",
brush_disabled="#D2D2D2",
horizontal_thickness=3,
vertical_thickness=3,
tick_bar_alpha=0.3,
@@ -85,6 +85,8 @@ CATALINA_STYLE = RangeSliderStyle(
BIG_SUR_STYLE = replace(
CATALINA_STYLE,
brush_active="#0A81FE",
brush_inactive="#D5D5D5",
brush_disabled="#E6E6E6",
tick_offset=0,
horizontal_thickness=4,
vertical_thickness=4,
@@ -181,10 +183,12 @@ def update_styles_from_stylesheet(obj: "QRangeSlider"):
for line in reversed(content.splitlines()):
bgrd = re.search(r"background(-color)?:\s*([^;]+)", line)
if bgrd:
obj._style.brush_active = parse_color(bgrd.groups()[-1])
color = parse_color(bgrd.groups()[-1])
obj._style.brush_active = color
# TODO: parse for inactive and disabled
obj._style.brush_inactive = color
obj._style.brush_disabled = color
obj._style.has_stylesheet = True
# TODO: bar color inactive?
# TODO: bar color disabled?
class_name = type(obj).__name__
_ss = f"\n{class_name}::sub-page:{orientation}{{background: none}}"
# TODO: block double event

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB