Skip to content

Commit

Permalink
- fixes regression introduced in v2.8.4 which broke persisting volume…
Browse files Browse the repository at this point in the history
… changes made in Roast Properties dialog

- fixes phases bar rendering in case CHARGE is not set
  • Loading branch information
MAKOMO committed Mar 13, 2024
1 parent a96b657 commit 7e03dd7
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 47 deletions.
4 changes: 2 additions & 2 deletions src/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.10.2</string>
<string>2.10.3</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
Expand All @@ -131,7 +131,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>Artisan 2.10.2</string>
<string>Artisan 2.10.3</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSArchitecturePriority</key>
Expand Down
95 changes: 57 additions & 38 deletions src/artisanlib/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6175,7 +6175,7 @@ def xaxistosm(self,redraw:bool = True, min_time:Optional[float] = None, max_time

if bool(self.aw.comparator):
starttime = 0
elif self.timeindex[0] != -1 and self.timeindex[0] < len(self.timex):
elif -1 < self.timeindex[0] < len(self.timex):
starttime = self.timex[self.timeindex[0]]
else:
starttime = 0
Expand Down Expand Up @@ -11615,6 +11615,12 @@ def OffMonitorCloseDown(self) -> None:
_log.debug('MODE: OffMonitorCloseDown')
try:
self.threadserver.terminatingSignal.disconnect(self.OffMonitorCloseDown)

# reset WebLCDs
resLCD = '-.-' if self.LCDdecimalplaces else '--'
if self.aw.WebLCDs:
self.updateWebLCDs(bt=resLCD,et=resLCD)

if len(self.timex) < 3:
# clear data from monitoring-only mode
self.clearMeasurements()
Expand Down Expand Up @@ -11690,10 +11696,7 @@ def OffMonitorCloseDown(self) -> None:
self.aw.buttonONOFF.setText(QApplication.translate('Button', 'ON')) # text means click to turn OFF (it is ON)
# reset time LCD color to the default (might have been changed to red due to long cooling!)
self.aw.updateReadingsLCDsVisibility()
# reset WebLCDs
resLCD = '-.-' if self.LCDdecimalplaces else '--'
if self.aw.WebLCDs:
self.updateWebLCDs(bt=resLCD,et=resLCD)

if not self.aw.HottopControlActive:
self.aw.hideExtraButtons(changeDefault=False)
self.aw.updateSlidersVisibility() # update visibility of sliders based on the users preference
Expand Down Expand Up @@ -11785,6 +11788,7 @@ def OffMonitor(self) -> None:
except Exception as e: # pylint: disable=broad-except
_log.exception(e)


self.threadserver.terminatingSignal.connect(self.OffMonitorCloseDown)
self.flagon = False

Expand Down Expand Up @@ -14065,12 +14069,13 @@ def calcStatistics(self, TP_index:int) -> Tuple[int,List[float]]:

#if DROP
if self.timeindex[6] and self.timeindex[2]:
totaltime = self.timex[self.timeindex[6]]-self.timex[self.timeindex[0]]
starttime = (self.timex[self.timeindex[0]] if -1 < self.timeindex[0] < len(self.timex) else 0)
totaltime = self.timex[self.timeindex[6]]-starttime
if totaltime == 0:
return dryEndIndex, statisticstimes

statisticstimes[0] = totaltime
dryphasetime = dryEndTime - self.timex[self.timeindex[0]] # self.aw.float2float(dryEndTime - self.timex[self.timeindex[0]])
dryphasetime = dryEndTime - starttime # self.aw.float2float(dryEndTime - starttime)
midphasetime = self.timex[self.timeindex[2]] - dryEndTime # self.aw.float2float(self.timex[self.timeindex[2]] - dryEndTime)
finishphasetime = self.timex[self.timeindex[6]] - self.timex[self.timeindex[2]] # self.aw.float2float(self.timex[self.timeindex[6]] - self.timex[self.timeindex[2]])

Expand Down Expand Up @@ -14098,6 +14103,8 @@ def writestatistics(self, TP_index:int) -> None:

LP:Optional[float] = None

starttime = (self.timex[self.timeindex[0]] if -1 < self.timeindex[0] < len(self.timex) else 0)

dryEndIndex, statisticstimes = self.calcStatistics(TP_index)

if statisticstimes[0] == 0:
Expand Down Expand Up @@ -14167,7 +14174,7 @@ def writestatistics(self, TP_index:int) -> None:

# Draw mid phase rectangle
rect = patches.Rectangle(
(self.timex[self.timeindex[0]]+self.statisticstimes[1],
(starttime+self.statisticstimes[1],
statisticsheight),
width = self.statisticstimes[2],
height = statisticsbarheight,
Expand All @@ -14177,15 +14184,17 @@ def writestatistics(self, TP_index:int) -> None:
self.ax.add_patch(rect)

# Draw dry phase rectangle
rect = patches.Rectangle(
(self.timex[self.timeindex[0]],
statisticsheight),
width = self.statisticstimes[1],
height = statisticsbarheight,
color = self.palette['rect1'],
alpha=0.5,
path_effects=[])
self.ax.add_patch(rect)
if self.timeindex[0] > -1:
# only if CHARGE is set
rect = patches.Rectangle(
(starttime,
statisticsheight),
width = self.statisticstimes[1],
height = statisticsbarheight,
color = self.palette['rect1'],
alpha=0.5,
path_effects=[])
self.ax.add_patch(rect)

fmtstr = '{0:.1f}' if self.LCDdecimalplaces else '{0:.0f}'
if self.statisticstimes[0]:
Expand All @@ -14203,31 +14212,39 @@ def writestatistics(self, TP_index:int) -> None:
LP = self.temp2[TP_index]

if self.statisticsflags[0]:
text = self.ax.text(self.timex[self.timeindex[0]]+ self.statisticstimes[1]/2.,statisticsupper,st1 + ' '+ dryphaseP+'%',color=self.palette['text'],ha='center',
fontsize='medium'
)
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass
if self.timeindex[0] > -1:
# only if CHARGE is set
text = self.ax.text(starttime + self.statisticstimes[1]/2.,statisticsupper,
f'{st1} {dryphaseP}%',
color=self.palette['text'],ha='center',
fontsize='medium'
)
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass
if self.timeindex[2]: # only if FCs exists
if self.statisticstimes[2]*100./self.statisticstimes[0]>1: # annotate only if mid phase is at least 1% of the total
text = self.ax.text(self.timex[self.timeindex[0]]+ self.statisticstimes[1]+self.statisticstimes[2]/2.,statisticsupper,st2+ ' ' + midphaseP+'%',color=self.palette['text'],ha='center',
text = self.ax.text(starttime + self.statisticstimes[1]+self.statisticstimes[2]/2.,statisticsupper,
(f'{st2} {midphaseP}%' if self.timeindex[0] > -1 else st2),
color=self.palette['text'],ha='center',
fontsize='medium'
)
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass
text = self.ax.text(self.timex[self.timeindex[0]]+ self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]/2.,statisticsupper,st3 + ' ' + finishphaseP+ '%',color=self.palette['text'],ha='center',
text = self.ax.text(starttime + self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]/2.,statisticsupper,
(f'{st3} {finishphaseP}%' if self.timeindex[0] > -1 else st3),
color=self.palette['text'],ha='center',
fontsize='medium'
)
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass
if self.timeindex[7]: # only if COOL exists
text = self.ax.text(self.timex[self.timeindex[0]]+ self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]+self.statisticstimes[4]/2.,statisticsupper,st4,color=self.palette['text'],ha='center',
text = self.ax.text(starttime + self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]+self.statisticstimes[4]/2.,statisticsupper,st4,color=self.palette['text'],ha='center',
fontsize='medium'
)
try:
Expand Down Expand Up @@ -14255,25 +14272,27 @@ def writestatistics(self, TP_index:int) -> None:
if rates_of_changes[5] != -1:
st3 = st3 + fmtstr.format(rates_of_changes[5], self.mode, rates_of_changes[2], unit)

text = self.ax.text(self.timex[self.timeindex[0]] + self.statisticstimes[1]/2.,statisticslower,st1,
color=self.palette['text'],
ha='center',
fontsize='medium')
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass

if self.timeindex[0] > -1:
text = self.ax.text(starttime + self.statisticstimes[1]/2.,statisticslower,st1,
color=self.palette['text'],
ha='center',
fontsize='medium')
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass
if self.timeindex[2]: # only if FCs exists
if self.statisticstimes[2]*100./self.statisticstimes[0]>1: # annotate only if mid phase is at least 1% of the total
text = self.ax.text(self.timex[self.timeindex[0]] + self.statisticstimes[1]+self.statisticstimes[2]/2.,statisticslower,st2,color=self.palette['text'],ha='center',
text = self.ax.text(starttime + self.statisticstimes[1]+self.statisticstimes[2]/2.,statisticslower,st2,color=self.palette['text'],ha='center',
#fontproperties=statsprop # fails be rendered in PDF exports on MPL v3.4.x
fontsize='medium'
)
try:
text.set_in_layout(False)
except Exception: # pylint: disable=broad-except
pass
text = self.ax.text(self.timex[self.timeindex[0]] + self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]/2.,statisticslower,st3,color=self.palette['text'],ha='center',
text = self.ax.text(starttime + self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]/2.,statisticslower,st3,color=self.palette['text'],ha='center',
#fontproperties=statsprop # fails be rendered in PDF exports on MPL v3.4.x
fontsize='medium'
)
Expand All @@ -14282,7 +14301,7 @@ def writestatistics(self, TP_index:int) -> None:
except Exception: # pylint: disable=broad-except
pass
if self.timeindex[7]: # only if COOL exists
text = self.ax.text(self.timex[self.timeindex[0]]+ self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]+max(self.statisticstimes[4]/2.,self.statisticstimes[4]/3.),statisticslower,st4,color=self.palette['text'],ha='center',
text = self.ax.text(starttime + self.statisticstimes[1]+self.statisticstimes[2]+self.statisticstimes[3]+max(self.statisticstimes[4]/2.,self.statisticstimes[4]/3.),statisticslower,st4,color=self.palette['text'],ha='center',
#fontproperties=statsprop # fails be rendered in PDF exports on MPL v3.4.x
fontsize='medium'
)
Expand Down
10 changes: 5 additions & 5 deletions src/artisanlib/roast_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -4839,14 +4839,14 @@ def accept(self) -> None:
v1 = self.aw.qmc.volume[1]
v2 = self.aw.qmc.volume[2]
try:
w0 = float(comma2dot(self.volumeinedit.text()))
v0 = float(comma2dot(self.volumeinedit.text()))
except Exception: # pylint: disable=broad-except
w0 = 0
v0 = 0
try:
w1 = float(comma2dot(self.volumeoutedit.text()))
v1 = float(comma2dot(self.volumeoutedit.text()))
except Exception: # pylint: disable=broad-except
w1 = 0
w2 = self.volumeUnitsComboBox.currentText()
v1 = 0
v2 = self.volumeUnitsComboBox.currentText()
self.aw.qmc.volume = (v0,v1,v2)
#update density
d0 = self.aw.qmc.density[0]
Expand Down
4 changes: 2 additions & 2 deletions wiki/ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ v2.10.4 (XX, 2024)

* ADDITIONS
- adds metadata to PDF, SVG and PNG exports
* NEW HARDWARE SUPPORT
* CHANGES
* FIXES
- fixes regression which broke the PID dialog for MODBUS, S7, TC4 and Kaleido ([Issue #1480](../../../issues/1480))
- fixes regression which broke devices Omega HH309 34 and the just introduced Digi-Sense 20250-07 and Extech 42570 ([PR #1481](../../../pull/1481))
- fixes regression introduced in v2.8.4 which broke persisting volume changes made in Roast Properties dialog
- fixes Linux builds for some configuration
- fixes phases bar rendering in case CHARGE is not set

----
v2.10.2 (February 29, 2024)
Expand Down

0 comments on commit 7e03dd7

Please sign in to comment.