mirror of
https://github.com/pyapp-kit/superqt.git
synced 2026-01-05 03:40:47 +01:00
more styles
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -78,3 +78,4 @@ target/
|
|||||||
# written by setuptools_scm
|
# written by setuptools_scm
|
||||||
*/_version.py
|
*/_version.py
|
||||||
.vscode/settings.json
|
.vscode/settings.json
|
||||||
|
screenshots
|
||||||
|
|||||||
@@ -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**
|
**The missing multi-handle range slider widget for PyQt & PySide**
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
The goal of this package is to provide a Range Slider (a slider with 2 or more
|
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
|
handles) that feels as "native" as possible. Styles should match the OS by
|
||||||
@@ -152,17 +152,17 @@ QSlider::sub-page:horizontal {
|
|||||||
|
|
||||||
### macOS
|
### macOS
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Window
|
### Window
|
||||||
|
|
||||||
(coming)
|
(coming)
|
||||||
<!--  -->
|
<!--  -->
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
(coming)
|
(coming)
|
||||||
<!--  -->
|
<!--  -->
|
||||||
|
|
||||||
## Issues
|
## Issues
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ class DemoWidget(QtW.QWidget):
|
|||||||
self.layout().addWidget(right)
|
self.layout().addWidget(right)
|
||||||
self.setGeometry(600, 300, 580, 300)
|
self.setGeometry(600, 300, 580, 300)
|
||||||
self.activateWindow()
|
self.activateWindow()
|
||||||
QtW.QApplication.processEvents()
|
|
||||||
self.show()
|
self.show()
|
||||||
|
|
||||||
|
|
||||||
@@ -113,4 +112,7 @@ if __name__ == "__main__":
|
|||||||
if "-x" in sys.argv:
|
if "-x" in sys.argv:
|
||||||
app.exec_()
|
app.exec_()
|
||||||
else:
|
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
BIN
images/demo_darwin.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 38 KiB |
|
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 86 KiB |
@@ -75,7 +75,7 @@ class RangeSliderStyle:
|
|||||||
CATALINA_STYLE = RangeSliderStyle(
|
CATALINA_STYLE = RangeSliderStyle(
|
||||||
brush_active="#3B88FD",
|
brush_active="#3B88FD",
|
||||||
brush_inactive="#8F8F8F",
|
brush_inactive="#8F8F8F",
|
||||||
brush_disabled="#BBBBBB",
|
brush_disabled="#D2D2D2",
|
||||||
horizontal_thickness=3,
|
horizontal_thickness=3,
|
||||||
vertical_thickness=3,
|
vertical_thickness=3,
|
||||||
tick_bar_alpha=0.3,
|
tick_bar_alpha=0.3,
|
||||||
@@ -85,6 +85,8 @@ CATALINA_STYLE = RangeSliderStyle(
|
|||||||
BIG_SUR_STYLE = replace(
|
BIG_SUR_STYLE = replace(
|
||||||
CATALINA_STYLE,
|
CATALINA_STYLE,
|
||||||
brush_active="#0A81FE",
|
brush_active="#0A81FE",
|
||||||
|
brush_inactive="#D5D5D5",
|
||||||
|
brush_disabled="#E6E6E6",
|
||||||
tick_offset=0,
|
tick_offset=0,
|
||||||
horizontal_thickness=4,
|
horizontal_thickness=4,
|
||||||
vertical_thickness=4,
|
vertical_thickness=4,
|
||||||
@@ -181,10 +183,12 @@ def update_styles_from_stylesheet(obj: "QRangeSlider"):
|
|||||||
for line in reversed(content.splitlines()):
|
for line in reversed(content.splitlines()):
|
||||||
bgrd = re.search(r"background(-color)?:\s*([^;]+)", line)
|
bgrd = re.search(r"background(-color)?:\s*([^;]+)", line)
|
||||||
if bgrd:
|
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
|
obj._style.has_stylesheet = True
|
||||||
# TODO: bar color inactive?
|
|
||||||
# TODO: bar color disabled?
|
|
||||||
class_name = type(obj).__name__
|
class_name = type(obj).__name__
|
||||||
_ss = f"\n{class_name}::sub-page:{orientation}{{background: none}}"
|
_ss = f"\n{class_name}::sub-page:{orientation}{{background: none}}"
|
||||||
# TODO: block double event
|
# TODO: block double event
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 38 KiB |
Reference in New Issue
Block a user