def METHOD_NAME(self):
    # Stop timer if window is not visible
    if not self.isVisible():
        self._refresh_on_active = True
        self._refresh_timer.stop()
    # Skip refreshing if window is not active
    elif not self._window_is_active:
        self._refresh_on_active = True
    # Window is active and visible so we're refreshing buttons
    else:
        self.refresh()