|
13 | 13 | from AnyQt.QtWidgets import ( |
14 | 14 | QGraphicsItem, QGraphicsPathItem, QGraphicsWidget, |
15 | 15 | QGraphicsDropShadowEffect, QGraphicsSceneHoverEvent, QStyle, |
16 | | - QGraphicsSceneMouseEvent |
17 | | -) |
| 16 | + QGraphicsSceneMouseEvent, |
| 17 | + QApplication) |
18 | 18 | from AnyQt.QtGui import ( |
19 | 19 | QPen, QBrush, QColor, QPainterPath, QTransform, QPalette, QFont, |
20 | 20 | ) |
21 | 21 | from AnyQt.QtCore import Qt, QPointF, QRectF, QLineF, QEvent, QPropertyAnimation, Signal, QTimer |
22 | 22 |
|
23 | | -from .nodeitem import AnchorPoint, SHADOW_COLOR |
| 23 | +from .nodeitem import AnchorPoint, DEFAULT_SHADOW_COLOR |
24 | 24 | from .graphicstextitem import GraphicsTextItem |
25 | 25 | from .utils import stroke_path, qpainterpath_sub_path |
26 | 26 | from ...registry import InputSignal, OutputSignal |
@@ -52,7 +52,7 @@ def __init__(self, parent): |
52 | 52 | self.setPen(QPen(QBrush(QColor("#9CACB4")), 2.0)) |
53 | 53 |
|
54 | 54 | self.shadow = QGraphicsDropShadowEffect( |
55 | | - blurRadius=5, color=QColor(SHADOW_COLOR), |
| 55 | + blurRadius=5, color=QColor(DEFAULT_SHADOW_COLOR), |
56 | 56 | offset=QPointF(0, 0) |
57 | 57 | ) |
58 | 58 | self.setGraphicsEffect(self.shadow) |
@@ -718,27 +718,46 @@ def __updatePen(self): |
718 | 718 | # type: () -> None |
719 | 719 | self.prepareGeometryChange() |
720 | 720 | self.__boundingRect = None |
721 | | - if self.__dynamic: |
722 | | - if self.__dynamicEnabled: |
723 | | - color = QColor(0, 150, 0, 150) |
724 | | - else: |
725 | | - color = QColor(150, 0, 0, 150) |
726 | 721 |
|
727 | | - normal = QPen(QBrush(color), 2.0) |
728 | | - hover = QPen(QBrush(color.darker(120)), 2.0) |
729 | | - else: |
730 | | - normal = QPen(QBrush(QColor("#9CACB4")), 2.0) |
731 | | - hover = QPen(QBrush(QColor("#959595")), 2.0) |
| 722 | + app = QApplication.instance() |
| 723 | + darkMode = app.property('darkMode') |
732 | 724 |
|
| 725 | + if self.__dynamic: |
| 726 | + # TODO |
| 727 | + pass |
| 728 | + # if self.__dynamicEnabled: |
| 729 | + # color = QColor(0, 150, 0, 150) |
| 730 | + # else: |
| 731 | + # color = QColor(150, 0, 0, 150) |
| 732 | + # |
| 733 | + # normal = QPen(QBrush(color), 2.0) |
| 734 | + # hover = QPen(QBrush(color.darker(120)), 2.0) |
733 | 735 | if self.__state & LinkItem.Empty: |
734 | 736 | pen_style = Qt.DashLine |
735 | 737 | else: |
736 | 738 | pen_style = Qt.SolidLine |
737 | 739 |
|
| 740 | + if darkMode: |
| 741 | + brush = QBrush(QColor('#EEEEEE')) |
| 742 | + hover = QPen( |
| 743 | + QBrush(QColor('#FFFFFF')), |
| 744 | + 3.0 if pen_style == Qt.SolidLine else 2.0 |
| 745 | + ) |
| 746 | + else: |
| 747 | + brush = QBrush(QColor('#878787')) |
| 748 | + hover = QPen( |
| 749 | + brush.color().darker(105), |
| 750 | + 3.0 if pen_style == Qt.SolidLine else 2.0 |
| 751 | + ) |
| 752 | + normal = QPen( |
| 753 | + brush, |
| 754 | + 3.0 if pen_style == Qt.SolidLine and self.__state else 2.0 |
| 755 | + ) |
| 756 | + |
738 | 757 | normal.setStyle(pen_style) |
739 | 758 | hover.setStyle(pen_style) |
740 | 759 |
|
741 | | - if self.hover or self.isSelected(): |
| 760 | + if self.hover or self.isSelected() or self.__isSelectedImplicit(): |
742 | 761 | pen = hover |
743 | 762 | else: |
744 | 763 | pen = normal |
|
0 commit comments