Skip to content

Commit

Permalink
preserve the zoom state on marking the CHARGE event without modifying…
Browse files Browse the repository at this point in the history
… the navigation stack
  • Loading branch information
MAKOMO committed Sep 26, 2024
1 parent 6a5ccef commit 2797fa4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 8 additions & 10 deletions src/artisanlib/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -6301,7 +6301,7 @@ def eval_math_expression(self,mathexpression:str, t:float, equeditnumber:Optiona
return -1

#format X axis labels
def xaxistosm(self,redraw:bool = True, min_time:Optional[float] = None, max_time:Optional[float] = None) -> None:
def xaxistosm(self,redraw:bool = True, min_time:Optional[float] = None, max_time:Optional[float] = None, set_xlim:bool = True) -> None:
if self.ax is None:
return
try:
Expand All @@ -6322,7 +6322,8 @@ def xaxistosm(self,redraw:bool = True, min_time:Optional[float] = None, max_time

endtime = endofx + starttime

self.ax.set_xlim(startofx,endtime)
if set_xlim:
self.ax.set_xlim(startofx,endtime)

if self.xgrid != 0:

Expand Down Expand Up @@ -12829,9 +12830,10 @@ def markChargeTrigger(self) -> None:
# if noaction is True, the button event action is not triggered
@pyqtSlot(bool)
def markCharge(self, noaction:bool = False) -> None:
zoomed_in: bool = False # True if zoomed in; in that case we prevent xaxistoxm to reset the x-axis limits (set_xlim)
try:
if self.aw.ntb._nav_stack(): # pylint: disable=protected-access # if ZOOMED in we push state on stack
self.aw.ntb.push_current() # remember current canvas ZOOM/POSITION on stack
if self.aw.ntb._nav_stack(): # pylint: disable=protected-access
zoomed_in = True
except Exception: # pylint: disable=broad-except
pass
removed = False
Expand Down Expand Up @@ -12864,7 +12866,7 @@ def markCharge(self, noaction:bool = False) -> None:
del self.l_annotations_dict[0]
self.timeindex[0] = -1
removed = True
self.xaxistosm(redraw=False)
self.xaxistosm(redraw=False, set_xlim=not zoomed_in)
elif not self.aw.buttonCHARGE.isFlat():
if self.device == 18 and self.aw.simulator is None: #manual mode
tx,et,bt = self.aw.ser.NONE()
Expand Down Expand Up @@ -12909,7 +12911,7 @@ def markCharge(self, noaction:bool = False) -> None:
self.endofx = self.resetmaxtime
except Exception: # pylint: disable=broad-except
pass
self.xaxistosm(redraw=False) # need to fix uneven x-axis labels like -0:13
self.xaxistosm(redraw=False, set_xlim=not zoomed_in) # need to fix uneven x-axis labels like -0:13

if self.BTcurve or self.ETcurve:
temp = (self.temp2[self.timeindex[0]] if self.BTcurve else self.temp1[self.timeindex[0]])
Expand Down Expand Up @@ -12979,10 +12981,6 @@ def markCharge(self, noaction:bool = False) -> None:
if self.roastpropertiesAutoOpenFlag:
self.aw.openPropertiesSignal.emit()
self.aw.onMarkMoveToNext(self.aw.buttonCHARGE)
try:
self.aw.ntb._update_view() # type:ignore[has-type] # pylint: disable=protected-access # recallcanvas ZOOM/POSITION from stack
except Exception: # pylint: disable=broad-except
pass

# called via markTPSignal (queued), triggered by external device
# does directly call markTP()
Expand Down
3 changes: 3 additions & 0 deletions wiki/ReleaseHistory.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ v3.0.3
- reduce the size of builds by removing unnecessary files
- removes the optional delay on reads from serial MODBUS
- adds optional delay after connect before sending requests to serial MODBUS to allow to wait for Arduino slaves to complete reboot ([Issue #1694](../../../issues/1694))
- limits the visible length of long popup lists in Devices and Statistics Dialog

* FIXES
- updates Cropster XLS importer ([Issue #1685](../../../issues/1685))
Expand All @@ -30,6 +31,8 @@ v3.0.3
- fixes a regression which prevented loading settings written (slightly broken) by Artisan v3.0 ([Discussion #1692](../../../discussions/1692))
- fixes a regression communicating with some serial MODBUS devices resulting from a more strict protocol interpretation by the underlying MODBUS pymodbus lib 3.7 introduced in Artisan v3.0.2, by adding a 'strict' flag (default off) to the serial MODBUS configuration ([Issue #1694](../../../issues/1694))
- removes incorrectly reconstructed custom events outside of the CHARGE to DROP period on quitting the designer ([Discussion #1696](../../../discussions/1696))
- makes validation of numeric configuration input more robust ([Issue #1700](../../../issues/1700))
- ensures that splitter state in Comparator is properly reset on Factory Reset



Expand Down

0 comments on commit 2797fa4

Please sign in to comment.