@@ -9412,15 +9412,13 @@ def default_xlabel_text(self) -> str:
94129412 @pyqtSlot(bool,bool,bool,bool,bool)
94139413 def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = True, takelock:bool = True, forceRenewAxis:bool = False, re_smooth_background:bool = False) -> None: # pyright: ignore [reportGeneralTypeIssues] # Code is too complex to analyze; reduce complexity by refactoring into subroutines or reducing conditional code paths
94149414# _log.debug("PRINT redraw(recomputeAllDeltas: %s, re_smooth_foreground: %s, takelock: %s, forceRenewAxis: %s, re_smooth_background: %s)",recomputeAllDeltas, re_smooth_foreground, takelock, forceRenewAxis, re_smooth_background)
9415-
94169415 if self.designerflag:
94179416 self.redrawdesigner(force=True)
94189417 elif self.aw.comparator is not None:
94199418 self.aw.comparator.redraw()
94209419 if self.aw.qpc is not None:
94219420 self.aw.qpc.redraw_phases()
9422- elif self.ax is not None:
9423- ax:Axes = self.ax
9421+ else:
94249422 titleB = ''
94259423 try:
94269424 #### lock shared resources ####
@@ -9442,7 +9440,7 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
94429440 rcParams['path.sketch'] = (scale, length, randomness)
94439441
94449442 # if no axis are set, we need to forceRenewAxis in any case
9445- if self.delta_ax is None:
9443+ if self.ax is None or self. delta_ax is None:
94469444 forceRenewAxis = True
94479445
94489446 xlabel_alpha_color = to_hex(to_rgba(self.palette['xlabel'], 0.47), keep_alpha=True)
@@ -11058,32 +11056,31 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1105811056 self.drawDeltaBT(trans,0,0)
1105911057
1106011058 if self.delta_ax is not None:
11061- delta_ax:_AxesBase = self.delta_ax
11062- delta_ax.set_yticks([]) # pyrefly:ignore[not-callable]
11059+ self.delta_ax.set_yticks([]) # pyrefly:ignore[not-callable]
1106311060 if two_ax_mode:
1106411061 self.aw.autoAdjustAxis(timex=False)
11065- delta_ax.set_ylim(self.zlimit_min,self.zlimit)
11062+ self. delta_ax.set_ylim(self.zlimit_min,self.zlimit)
1106611063 if self.zgrid > 0:
1106711064 major_locator = ticker.MultipleLocator(self.zgrid)
11068- delta_ax.yaxis.set_major_locator(major_locator)
11065+ self. delta_ax.yaxis.set_major_locator(major_locator)
1106911066 if len(major_locator()) > 50: # accept a maximum of 20 major ticks
1107011067 min_grid = (self.aw.qmc.zlimit - self.aw.qmc.zlimit_min) / 50
1107111068 # set grid to closest of min_grid from regular grids [1, 2, 5, 10, 20, 50, 100]
1107211069 major_locator.set_params(min([1, 2, 5, 10, 20, 50, 100], key=lambda x:abs(x-min_grid)))
11073- delta_major_tick_lines:list[Line2D] = delta_ax.get_yticklines() # pyrefly:ignore[not-callable]
11070+ delta_major_tick_lines:list[Line2D] = self. delta_ax.get_yticklines() # pyrefly:ignore[not-callable]
1107411071 for ytl in delta_major_tick_lines:
1107511072 ytl.set_markersize(10)
11076- for label in delta_ax.get_yticklabels(): # pyrefly:ignore[not-callable]
11073+ for label in self. delta_ax.get_yticklabels(): # pyrefly:ignore[not-callable]
1107711074 label.set_fontsize('small')
1107811075 if not self.LCDdecimalplaces:
11079- delta_ax.minorticks_off()
11076+ self. delta_ax.minorticks_off()
1108011077 else:
1108111078 minor_locator = ticker.AutoMinorLocator() # locator parameter n, default: n='auto' => 4 or 5, n=2 => 1
11082- delta_ax.yaxis.set_minor_locator(minor_locator)
11079+ self. delta_ax.yaxis.set_minor_locator(minor_locator)
1108311080 if len(minor_locator()) > 50:
1108411081 # we limit the total number of minor tick locators for performance and esthetic reasons
11085- delta_ax.yaxis.set_minor_locator(ticker.NullLocator())
11086- delta_minor_tick_lines:list[Line2D] = delta_ax.yaxis.get_minorticklines()
11082+ self. delta_ax.yaxis.set_minor_locator(ticker.NullLocator())
11083+ delta_minor_tick_lines:list[Line2D] = self. delta_ax.yaxis.get_minorticklines()
1108711084 for mtl in delta_minor_tick_lines:
1108811085 mtl.set_markersize(5)
1108911086
@@ -11129,10 +11126,9 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1112911126 self.extrastemp1[i] = self.extratemp1[i]
1113011127
1113111128 if self.aw.extraDelta1[i] and self.delta_ax is not None:
11132- delta_ax = self.delta_ax
11133- trans = delta_ax.transData
11129+ trans = self.delta_ax.transData
1113411130 else:
11135- trans = ax.transData
11131+ trans = self. ax.transData
1113611132 visible_extratemp1 : npt.NDArray[numpy.double]
1113711133 if not self.flagstart and not self.foregroundShowFullflag and (not self.autotimex or self.autotimexMode == 0) and len(self.extrastemp1[i]) > 0:
1113811134 visible_extratemp1 = numpy.concatenate((
@@ -11147,8 +11143,8 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1114711143 visible_extratemp1 = numpy.array(self.extrastemp1[i], dtype=numpy.double)
1114811144 # first draw the fill if any, but not during recording!
1114911145 if not self.flagstart and self.aw.extraFill1[i] > 0:
11150- ax.fill_between(self.extratimex[i], 0, visible_extratemp1,transform=trans,color=self.extradevicecolor1[i],alpha=self.aw.extraFill1[i]/100.,sketch_params=None)
11151- self.extratemp1lines.append(ax.plot(self.extratimex[i],visible_extratemp1,transform=trans,color=self.extradevicecolor1[i],
11146+ self. ax.fill_between(self.extratimex[i], 0, visible_extratemp1,transform=trans,color=self.extradevicecolor1[i],alpha=self.aw.extraFill1[i]/100.,sketch_params=None)
11147+ self.extratemp1lines.append(self. ax.plot(self.extratimex[i],visible_extratemp1,transform=trans,color=self.extradevicecolor1[i],
1115211148 sketch_params=None,
1115311149 path_effects=self.line_path_effects(self.glow, self.patheffects, self.aw.light_background_p, self.extralinewidths1[i],self.extradevicecolor1[i]),
1115411150 markersize=self.extramarkersizes1[i],
@@ -11181,10 +11177,9 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1118111177 self.extrastemp2[i] = self.extratemp2[i]
1118211178
1118311179 if self.aw.extraDelta2[i] and self.delta_ax is not None:
11184- delta_ax = self.delta_ax
11185- trans = delta_ax.transData
11180+ trans = self.delta_ax.transData
1118611181 else:
11187- trans = ax.transData
11182+ trans = self. ax.transData
1118811183 visible_extratemp2 : npt.NDArray[numpy.double]
1118911184 if not self.flagstart and not self.foregroundShowFullflag and (not self.autotimex or self.autotimexMode == 0) and len(self.extrastemp2[i]) > 0:
1119011185 visible_extratemp2 = numpy.concatenate((
@@ -11199,8 +11194,8 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1119911194 visible_extratemp2 = numpy.array(self.extrastemp2[i], dtype=numpy.double)
1120011195 # first draw the fill if any
1120111196 if not self.flagstart and self.aw.extraFill2[i] > 0:
11202- ax.fill_between(self.extratimex[i], 0, visible_extratemp2,transform=trans,color=self.extradevicecolor2[i],alpha=self.aw.extraFill2[i]/100.,sketch_params=None)
11203- self.extratemp2lines.append(ax.plot(self.extratimex[i],visible_extratemp2,transform=trans,color=self.extradevicecolor2[i],
11197+ self. ax.fill_between(self.extratimex[i], 0, visible_extratemp2,transform=trans,color=self.extradevicecolor2[i],alpha=self.aw.extraFill2[i]/100.,sketch_params=None)
11198+ self.extratemp2lines.append(self. ax.plot(self.extratimex[i],visible_extratemp2,transform=trans,color=self.extradevicecolor2[i],
1120411199 sketch_params=None,
1120511200 path_effects=self.line_path_effects(self.glow, self.patheffects, self.aw.light_background_p, self.extralinewidths2[i],self.extradevicecolor2[i]),
1120611201 markersize=self.extramarkersizes2[i],
@@ -11342,13 +11337,12 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1134211337 self.drawAUC()
1134311338
1134411339 #update label rotating_colors
11345- for label in ax.xaxis.get_ticklabels():
11340+ for label in self. ax.xaxis.get_ticklabels():
1134611341 label.set_color(self.palette['xlabel'])
11347- for label in ax.yaxis.get_ticklabels():
11342+ for label in self. ax.yaxis.get_ticklabels():
1134811343 label.set_color(self.palette['ylabel'])
1134911344 if two_ax_mode and self.delta_ax is not None:
11350- delta_ax = self.delta_ax
11351- for label in delta_ax.yaxis.get_ticklabels():
11345+ for label in self.delta_ax.yaxis.get_ticklabels():
1135211346 label.set_color(self.palette['ylabel'])
1135311347
1135411348 #write legend
@@ -11371,7 +11365,7 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1137111365 else:
1137211366 loc = self.legend._loc # type: ignore[attr-defined] # "Legend" has no attribute "_loc" # pylint: disable=protected-access
1137311367 try:
11374- leg = ax.legend(self.handles,self.labels, loc=loc,
11368+ leg = self. ax.legend(self.handles,self.labels, loc=loc,
1137511369 ncols=ncol,fancybox=True,prop=prop,shadow=False,frameon=True)
1137611370 leg.set_in_layout(False) # remove legend from tight_layout calculation
1137711371 self.legend = leg
@@ -11392,7 +11386,7 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1139211386 for line,text in zip(leg.get_lines(), leg.get_texts(), strict=True):
1139311387 text.set_color(line.get_color())
1139411388 except Exception as e: # pylint: disable=broad-except
11395- _log.exception (e)
11389+ _log.error (e)
1139611390
1139711391 else:
1139811392 self.legend = None
@@ -11414,39 +11408,37 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1141411408 # add projection and AUC guide lines last as those are removed by updategraphics for optimized redrawing and not cached
1141511409 if self.ETprojectFlag:
1141611410 if self.ETcurve:
11417- self.l_ETprojection, = ax.plot(self.ETprojection_tx, self.ETprojection_temp,color = self.palette['et'],
11411+ self.l_ETprojection, = self. ax.plot(self.ETprojection_tx, self.ETprojection_temp,color = self.palette['et'],
1141811412 dashes=dashes_setup,
1141911413 label=self.aw.arabicReshape(QApplication.translate('Label', 'ETprojection')),
1142011414 linestyle = '-.', linewidth= 8, alpha = .3,sketch_params=None,path_effects=[])
1142111415 if self.projectDeltaFlag and self.DeltaETflag and self.delta_ax is not None:
11422- delta_ax = self.delta_ax
11423- trans = delta_ax.transData
11424- self.l_DeltaETprojection, = ax.plot(self.DeltaETprojection_tx, self.DeltaETprojection_temp,color = self.palette['deltaet'],
11416+ trans = self.delta_ax.transData
11417+ self.l_DeltaETprojection, = self.ax.plot(self.DeltaETprojection_tx, self.DeltaETprojection_temp,color = self.palette['deltaet'],
1142511418 dashes=dashes_setup,
1142611419 transform=trans,
1142711420 label=self.aw.arabicReshape(QApplication.translate('Label', 'DeltaETprojection')),
1142811421 linestyle = '-.', linewidth= 8, alpha = .3,sketch_params=None,path_effects=[])
1142911422 if self.BTprojectFlag:
1143011423 if self.BTcurve:
11431- self.l_BTprojection, = ax.plot(self.BTprojection_tx, self.BTprojection_temp,color = self.palette['bt'],
11424+ self.l_BTprojection, = self. ax.plot(self.BTprojection_tx, self.BTprojection_temp,color = self.palette['bt'],
1143211425 dashes=dashes_setup,
1143311426 label=self.aw.arabicReshape(QApplication.translate('Label', 'BTprojection')),
1143411427 linestyle = '-.', linewidth= 8, alpha = .3,sketch_params=None,path_effects=[])
1143511428 if self.projectDeltaFlag and self.DeltaBTflag and self.delta_ax is not None:
11436- delta_ax = self.delta_ax
11437- trans = delta_ax.transData
11438- self.l_DeltaBTprojection, = ax.plot(self.DeltaBTprojection_tx, self.DeltaBTprojection_temp,color = self.palette['deltabt'],
11429+ trans = self.delta_ax.transData
11430+ self.l_DeltaBTprojection, = self.ax.plot(self.DeltaBTprojection_tx, self.DeltaBTprojection_temp,color = self.palette['deltabt'],
1143911431 dashes=dashes_setup,
1144011432 transform=trans,
1144111433 label=self.aw.arabicReshape(QApplication.translate('Label', 'DeltaBTprojection')),
1144211434 linestyle = '-.', linewidth= 8, alpha = .3,sketch_params=None,path_effects=[])
1144311435 if (self.device == 18 and self.aw.simulator is None) or self.showtimeguide: # not NONE device
11444- self.l_timeline = ax.axvline(self.timeclock.elapsedMilli(),color = self.palette['timeguide'],
11436+ self.l_timeline = self. ax.axvline(self.timeclock.elapsedMilli(),color = self.palette['timeguide'],
1144511437 label=self.aw.arabicReshape(QApplication.translate('Label', 'TIMEguide')),
1144611438 visible=self.flagstart,
1144711439 linestyle = '-', linewidth= 1, alpha = .5,sketch_params=None,path_effects=[])
11448- if self.AUCguideFlag and self.ax is not None :
11449- self.l_AUCguide = ax.axvline(self.AUCguideTime,visible=(self.AUCguideTime > 0 and self.AUCguideTime < self.endofx),color = self.palette['aucguide'],
11440+ if self.AUCguideFlag:
11441+ self.l_AUCguide = self. ax.axvline(self.AUCguideTime,visible=(self.AUCguideTime > 0 and self.AUCguideTime < self.endofx),color = self.palette['aucguide'],
1145011442 label=self.aw.arabicReshape(QApplication.translate('Label', 'AUCguide')),
1145111443 linestyle = '-', linewidth= 1, alpha = .5,sketch_params=None,path_effects=[])
1145211444
@@ -11483,6 +11475,7 @@ def redraw(self, recomputeAllDeltas:bool = True, re_smooth_foreground:bool = Tru
1148311475 if self.flagstart and self.timeindex[0] > -1:
1148411476 self.updategraphicsSignal.emit()
1148511477
11478+
1148611479 def checkOverlap(self, anno:'Annotation') -> bool:
1148711480 if self.ax is None:
1148811481 return False
0 commit comments