Skip to content

Commit

Permalink
Merge pull request #41 from zdomke/dev_merge_fixes
Browse files Browse the repository at this point in the history
FIX: Minor Merge Fixes
  • Loading branch information
zdomke authored Sep 3, 2024
2 parents ab28a63 + acaea8c commit d76b88c
Showing 1 changed file with 31 additions and 29 deletions.
60 changes: 31 additions & 29 deletions archive_viewer/archive_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,6 @@ def configure_app(self):
self.ui.main_spltr.setCollapsible(0, False)
self.ui.main_spltr.setStretchFactor(0, 1)

@Slot()
def resetPlot(self):
self.axis_table_model.set_model_axes()
self.curves_model.set_model_curves()

def set_footer(self):
"""Set footer information for application. Includes logging, nodename,
username, PID, git version, Archiver URL, and current datetime
Expand All @@ -99,30 +94,6 @@ def set_footer(self):
self.ui.ftr_url_lbl.setText(os.getenv('PYDM_ARCHIVER_URL'))
self.ui.ftr_time_lbl.channel = "ca://" + datetime_pv

@Slot(QAbstractButton)
def set_plot_timerange(self, button: QAbstractButton) -> None:
"""Slot to be called when a timespan setting button is pressed.
This will enable autoscrolling along the x-axis and disable mouse
controls. If the "Cursor" button is pressed, then autoscrolling is
disabled and mouse controls are enabled.
Parameters
----------
button : QAbstractButton
The timespan setting button pressed. Determines which timespan
to set.
"""
logger.debug(f"Setting plot timerange")
if button not in self.button_spans:
logger.error(f"{button} is not a valid timespan button")
return
enable_scroll = button != self.ui.cursor_scale_btn
self.timespan = self.button_spans[button]
if enable_scroll:
logger.debug(f"Enabling plot autoscroll for {timespan}s")
else:
logger.debug("Disabling plot autoscroll, using mouse controls")
self.autoScroll(enable=enable_scroll)
def parse_macros_and_args(self, macros: Dict[str, str | list], args: List[str]) -> Tuple[str, list]:
"""Parse user provided macros and args into lists of PVs to use on
startup or which file to import on startup
Expand Down Expand Up @@ -196,6 +167,37 @@ def git_version():
capture_output=True)
return git_cmd.stdout.strip()

@Slot()
def resetPlot(self) -> None:
"""Reset the Axis model and the Curve model to empty states"""
self.axis_table_model.set_model_axes()
self.curves_model.set_model_curves()

@Slot(QAbstractButton)
def set_plot_timerange(self, button: QAbstractButton) -> None:
"""Slot to be called when a timespan setting button is pressed.
This will enable autoscrolling along the x-axis and disable mouse
controls. If the "Cursor" button is pressed, then autoscrolling is
disabled and mouse controls are enabled.
Parameters
----------
button : QAbstractButton
The timespan setting button pressed. Determines which timespan
to set.
"""
logger.debug(f"Setting plot timerange")
if button not in self.button_spans:
logger.error(f"{button} is not a valid timespan button")
return
enable_scroll = button != self.ui.cursor_scale_btn
self.timespan = self.button_spans[button]
if enable_scroll:
logger.debug(f"Enabling plot autoscroll for {self.timespan}s")
else:
logger.debug("Disabling plot autoscroll, using mouse controls")
self.autoScroll(enable=enable_scroll)


class LoggingHandler(Handler):
def __init__(self, logging_lbl: QLabel, level: int=0) -> None:
Expand Down

0 comments on commit d76b88c

Please # to comment.