Skip to content

Commit 914fcc2

Browse files
committed
- fixes regression in plus authorization
- limits strings passed to eval() - adds PID derivative filter size setting - updated axis settings in Orbiter machine setup - updates translations
1 parent e65190d commit 914fcc2

41 files changed

Lines changed: 198968 additions & 198789 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/artisanlib/canvas.py

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5862,7 +5862,7 @@ def updateLCDtime(self) -> None:
58625862
# if more than max cool (from statistics) past DROP and not yet COOLend turn the time LCD red:
58635863
if (self.timeindex[0]!=-1 and self.timeindex[6] != 0 and not self.timeindex[7] and
58645864
len(self.timex) > self.timeindex[6] and (tx - self.timex[self.timeindex[6]]) > 4*60):
5865-
self.aw.setTimerColor('slowcoolingtimer')
5865+
self.aw.setTimerColorSignal.emit('slowcoolingtimer')
58665866

58675867
if self.chargeTimerFlag and self.timeindex[0] == -1 and self.chargeTimerPeriod != 0:
58685868
if self.chargeTimerPeriod > ts:
@@ -6915,6 +6915,7 @@ def shiftValueEvalsignBackground(timex:list[float], timeb:list[float], readings:
69156915
def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:int|None = None,
69166916
RTsname:str|None = None, RTsval:float|None = None, t_offset:float = 0.) -> float:
69176917
if len(mathexpression):
6918+
eval_limit:int = 300 # size limit of the input string to handed over to eval()
69186919
mathdictionary:dict[str,None|float|Callable[[Any], float|None]|Callable[[Any, Any], float|None]] = {} # zuban:ignore[assignment,unused-ignore]
69196920
mathdictionary.update(self.mathdictionary_base) # extend by the standard math symbolic formulas
69206921

@@ -7132,7 +7133,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:int|Non
71327133
body = mathexpression[i+3:end_idx]
71337134
val = -1
71347135
try:
7135-
absolute_index = eval(body,{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
7136+
absolute_index = eval(body[:eval_limit],{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
71367137
if absolute_index > -1:
71377138
if nint == 1: #ET
71387139
val = sample_temp1[absolute_index]
@@ -7246,7 +7247,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:int|Non
72467247
body = mathexpression[i+k+3:end_idx]
72477248
val = -1
72487249
try:
7249-
absolute_index = eval(body,{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
7250+
absolute_index = eval(body[:eval_limit],{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
72507251
if absolute_index > -1:
72517252
valn:float|None = -1
72527253
if nint == 1: #DeltaET
@@ -7384,7 +7385,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:int|Non
73847385
body = 'b' + body
73857386
val = -1
73867387
try:
7387-
absolute_index = eval(body,{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
7388+
absolute_index = eval(body[:eval_limit],{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
73887389
if absolute_index > -1:
73897390
val = timex[absolute_index]
73907391
except Exception: # pylint: disable=broad-except
@@ -7484,7 +7485,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:int|Non
74847485
body = mathexpression[i+3:end_idx]
74857486
val = -1
74867487
try:
7487-
absolute_index = eval(body,{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
7488+
absolute_index = eval(body[:eval_limit],{'__builtins__':None},mathdictionary) # pylint: disable=eval-used
74887489
if absolute_index > -1:
74897490
if nint == 1: #ET
74907491
val = self.temp1B[absolute_index]
@@ -7634,7 +7635,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:int|Non
76347635
# if any variable is bound to the error value -1 we return -1 for the full formula
76357636
reslt = -1
76367637
else:
7637-
reslt = float(eval(me, {'__builtins__':None}, mathdictionary)) # pylint: disable=eval-used
7638+
reslt = float(eval(me[:eval_limit], {'__builtins__':None}, mathdictionary)) # pylint: disable=eval-used
76387639
except TypeError:
76397640
reslt = -1
76407641
except ValueError:
@@ -8142,7 +8143,7 @@ def reset(self,redraw:bool = True, soundOn:bool = True, keepProperties:bool = Fa
81428143
self.aw.keyboardmoveindex = 0 # points to the last activated button in keyboardButtonList; we start with the CHARGE button
81438144
self.aw.resetKeyboardButtonMarks()
81448145

8145-
self.aw.setTimerColor('timer')
8146+
self.aw.setTimerColorSignal.emit('timer')
81468147

81478148
try:
81488149
self.aw.ntb.update() # reset the MPL navigation history
@@ -14327,7 +14328,7 @@ def OnRecorder(self) -> None:
1432714328
_log.exception(e)
1432814329

1432914330
# reset LCD timer color that might have been reset by the RS PID in monitoring mode:
14330-
self.aw.setTimerColor('timer')
14331+
self.aw.setTimerColorSignal.emit('timer')
1433114332
if self.delta_ax is not None:
1433214333
y_label = self.delta_ax.set_ylabel('')
1433314334
y_label.set_in_layout(False) # remove y-axis labels from tight_layout calculation
@@ -14409,7 +14410,7 @@ def OnRecorder(self) -> None:
1440914410
# set CHARGEtimer
1441014411
if self.chargeTimerFlag:
1441114412
if self.chargeTimerPeriod > 0:
14412-
self.aw.setTimerColor('slowcoolingtimer')
14413+
self.aw.setTimerColorSignal.emit('slowcoolingtimer')
1441314414
QTimer.singleShot(self.chargeTimerPeriod*1000, self.fireChargeTimer)
1441414415

1441514416
_log.info('MODE: START RECORDING')
@@ -14609,7 +14610,7 @@ def markCharge(self, noaction:bool = False) -> None:
1460914610
if self.aw.pidcontrol.pidOnCHARGE and not self.aw.pidcontrol.pidActive: # Arduino/TC4, Hottop, MODBUS
1461014611
self.aw.pidcontrol.pidOn()
1461114612
if self.chargeTimerPeriod > 0:
14612-
self.aw.setTimerColor('timer')
14613+
self.aw.setTimerColorSignal.emit('timer')
1461314614
try:
1461414615
# adjust startofx to the new timeindex[0] as it depends on timeindex[0]
1461514616
if self.locktimex:
@@ -15322,7 +15323,7 @@ def markDrop(self, noaction:bool = False) -> None:
1532215323
# we check if this is the first DROP mark on this roast
1532315324
firstDROP = self.timeindex[6] == 0 # on UNDO DROP we do not send the record to plus
1532415325
if self.aw.buttonDROP.isFlat() and self.timeindex[6] > 0:
15325-
self.aw.setTimerColor('timer') # reset cooling timer color back to the default
15326+
self.aw.setTimerColorSignal.emit('timer') # reset cooling timer color back to the default
1532615327
self.autoDropIdx = -1 # disable autoDROP to allow manual re-DROP
1532715328
# undo wrongly set FCs
1532815329
# deactivate autoDROP
@@ -15346,7 +15347,7 @@ def markDrop(self, noaction:bool = False) -> None:
1534615347
if 6 in self.l_annotations_dict:
1534715348
del self.l_annotations_dict[6]
1534815349
elif not self.aw.buttonDROP.isFlat():
15349-
self.aw.setTimerColor('rstimer') # cooling timer color
15350+
self.aw.setTimerColorSignal.emit('rstimer') # cooling timer color
1535015351
self.incBatchCounter()
1535115352
# generate UUID
1535215353
if self.roastUUID is None: # there might be already one assigned by undo and redo the markDROP!

0 commit comments

Comments
 (0)