slaclab / pydm

Python Display Manager
http://slaclab.github.io/pydm/
Other
111 stars 76 forks source link

ENH: Add a method for pausing/resuming the drawing of an image #1054

Closed jbellister-slac closed 7 months ago

jbellister-slac commented 7 months ago

Context

A request from slack that it would be nice to have a way to pause drawing updates to the image in the PyDMImageView widget. This PR adds a simple method for doing that, same as is done for pausing plotting updates in BasePlot.

Testing

Verified functionality with an example like this

from os import path
from pydm import Display
from qtpy.QtWidgets import QVBoxLayout, QPushButton

class ImageExample(Display):

  def __init__(self):
    super().__init__()

    self.my_layout = QVBoxLayout(self)

    self.button = QPushButton()
    self.button.clicked.connect(self.ui.PyDMImageView.toggleRedraw)

    self.my_layout.addWidget(self.button)

  def ui_filename(self):
    return 'image.ui'

  def ui_filepath(self):
    return path.join(path.dirname(path.realpath(__file__)), self.ui_filename())