Updates the sensitivity of banner based on global dirty state and validity.
(self)
| 1676 | pass |
| 1677 | |
| 1678 | def _update_button_sensitivity(self): |
| 1679 | """Updates the sensitivity of banner based on global dirty state and validity.""" |
| 1680 | is_dirty = False |
| 1681 | try: |
| 1682 | main = self.app or self.get_root() |
| 1683 | parser = getattr(main, "parser", None) |
| 1684 | if parser is not None and getattr(parser, "config", None) is not None: |
| 1685 | is_dirty = bool(parser.config.is_dirty()) |
| 1686 | else: |
| 1687 | is_dirty = self.is_host_dirty() |
| 1688 | except Exception: |
| 1689 | is_dirty = self.is_host_dirty() |
| 1690 | field_errors = self._collect_field_errors() |
| 1691 | is_valid = not bool(field_errors) |
| 1692 | try: |
| 1693 | if getattr(self, "unsaved_banner", None): |
| 1694 | self.unsaved_banner.set_revealed(is_dirty) |
| 1695 | self.unsaved_banner.set_sensitive(is_dirty and is_valid) |
| 1696 | except Exception: |
| 1697 | pass |
| 1698 | |
| 1699 | def _on_test_connection(self, button): |
| 1700 | if not self.current_host: |
no test coverage detected