diff --git a/.gitignore b/.gitignore index 4d5a7f9..5f51624 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,4 @@ target/ # written by setuptools_scm */_version.py .vscode/settings.json +screenshots diff --git a/README.md b/README.md index aa7d344..7cf18ba 100644 --- a/README.md +++ b/README.md @@ -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) - + ### Linux (coming) - + ## Issues diff --git a/examples/demo_widget.py b/examples/demo_widget.py index 5b38a55..7fd1018 100644 --- a/examples/demo_widget.py +++ b/examples/demo_widget.py @@ -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")) diff --git a/images/demo_darwin.png b/images/demo_darwin.png new file mode 100644 index 0000000..51483d6 Binary files /dev/null and b/images/demo_darwin.png differ diff --git a/screenshots/slider.png b/images/slider.png similarity index 100% rename from screenshots/slider.png rename to images/slider.png diff --git a/qtrangeslider/_style.py b/qtrangeslider/_style.py index 4e2d6c9..00f2163 100644 --- a/qtrangeslider/_style.py +++ b/qtrangeslider/_style.py @@ -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 diff --git a/screenshots/demo_macos.png b/screenshots/demo_macos.png deleted file mode 100644 index 612758a..0000000 Binary files a/screenshots/demo_macos.png and /dev/null differ