Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf1414fc

Browse files
committed
nicer color setting, no thinkening of the line after hoover
1 parentbfb7c28 commitf1414fc

File tree

1 file changed

+20
-27
lines changed

1 file changed

+20
-27
lines changed

‎Orange/widgets/utils/slidergraph.py‎

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,23 @@ class InteractiveInfiniteLine(InfiniteLine):
1111
"""
1212
A subclass of InfiniteLine that provides custom hover behavior.
1313
"""
14-
15-
def__init__(self,angle=90,pos=None,movable=False,bounds=None,**kwargs):
14+
15+
def__init__(self,angle=90,pos=None,movable=False,bounds=None,
16+
normal_pen=None,highlight_pen=None,**kwargs):
1617
super().__init__(angle=angle,pos=pos,movable=movable,bounds=bounds,**kwargs)
17-
self._normal_pen=None
18-
self._highlight_pen=None
19-
18+
self._normal_pen=normal_pen
19+
self._highlight_pen=highlight_pen
20+
self.setPen(normal_pen)
21+
2022
defhoverEvent(self,ev):
2123
"""
2224
Override hoverEvent to provide custom hover behavior.
23-
25+
2426
Parameters
2527
----------
2628
ev : HoverEvent
2729
The hover event from pyqtgraph
2830
"""
29-
ifnothasattr(ev,'isEnter'):
30-
return
3131

3232
ifev.isEnter()andself._highlight_penisnotNone:
3333
self.setPen(self._highlight_pen)
@@ -164,37 +164,30 @@ def _plot_cutpoint(self, x):
164164
self._line=None
165165
return
166166
ifself._lineisNone:
167-
# plot interactive vertical line
167+
normal_pen=mkPen(
168+
self.palette().text().color(),width=4,
169+
style=Qt.SolidLine,capStyle=Qt.RoundCap
170+
)
171+
highlight_pen=mkPen(
172+
self.palette().link().color(),width=4,
173+
style=Qt.SolidLine,capStyle=Qt.RoundCap
174+
)
175+
168176
self._line=InteractiveInfiniteLine(
169177
angle=90,pos=x,movable=True,
170178
bounds=self.selection_limitifself.selection_limitisnotNone
171-
else (self.x.min(),self.x.max())
179+
else (self.x.min(),self.x.max()),
180+
normal_pen=normal_pen,
181+
highlight_pen=highlight_pen
172182
)
173183
self._line.setCursor(Qt.SizeHorCursor)
174-
175-
# Create normal and highlight pens
176-
normal_pen=mkPen(self.palette().text().color(),width=4,style=Qt.SolidLine,capStyle=Qt.RoundCap)
177-
highlight_color=self.palette().highlight().color()
178-
highlight_color.setHsv(
179-
highlight_color.hue(),
180-
min(highlight_color.saturation()+30,255),
181-
max(highlight_color.value()-20,0)
182-
)
183-
highlight_pen=mkPen(highlight_color,width=10,style=Qt.SolidLine,capStyle=Qt.RoundCap)
184-
185-
# Set pens directly
186-
self._line._normal_pen=normal_pen
187-
self._line._highlight_pen=highlight_pen
188-
self._line.setPen(normal_pen)
189184
self._line.sigPositionChanged.connect(self._on_cut_changed)
190185
self.addItem(self._line)
191186
else:
192187
self._line.setValue(x)
193188

194189
self._update_horizontal_lines()
195190

196-
197-
198191
def_plot_horizontal_lines(self):
199192
"""
200193
Function plots the vertical dashed lines that points to the selected

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp