(self)
| 1768 | dialog.present() |
| 1769 | |
| 1770 | def _sync_fields_from_host(self): |
| 1771 | if not self.current_host: |
| 1772 | return |
| 1773 | self.is_loading = True |
| 1774 | self.patterns_entry.set_text(" ".join(self.current_host.patterns)) |
| 1775 | self.hostname_entry.set_text(self.current_host.get_option("HostName") or "") |
| 1776 | self.user_entry.set_text(self.current_host.get_option("User") or "") |
| 1777 | port_value = self.current_host.get_option("Port") or "22" |
| 1778 | try: |
| 1779 | port_int = int(port_value) if port_value.isdigit() else 22 |
| 1780 | self.port_entry.set_value(port_int) |
| 1781 | except (ValueError, AttributeError): |
| 1782 | self.port_entry.set_value(22) |
| 1783 | self.identity_entry.set_text(self.current_host.get_option("IdentityFile") or "") |
| 1784 | self.forward_agent_switch.set_active( |
| 1785 | (self.current_host.get_option("ForwardAgent") or "").lower() == "yes" |
| 1786 | ) |
| 1787 | self.proxy_jump_entry.set_text(self.current_host.get_option("ProxyJump") or "") |
| 1788 | self.proxy_cmd_entry.set_text( |
| 1789 | self.current_host.get_option("ProxyCommand") or "" |
| 1790 | ) |
| 1791 | self.local_forward_entry.set_text( |
| 1792 | self.current_host.get_option("LocalForward") or "" |
| 1793 | ) |
| 1794 | self.remote_forward_entry.set_text( |
| 1795 | self.current_host.get_option("RemoteForward") or "" |
| 1796 | ) |
| 1797 | self.compression_switch.set_active( |
| 1798 | (self.current_host.get_option("Compression") or "no").lower() == "yes" |
| 1799 | ) |
| 1800 | interval_value = self.current_host.get_option("ServerAliveInterval") or "0" |
| 1801 | try: |
| 1802 | interval_int = int(interval_value) if interval_value.isdigit() else 0 |
| 1803 | self.serveralive_interval_entry.set_value(interval_int) |
| 1804 | except (ValueError, AttributeError): |
| 1805 | self.serveralive_interval_entry.set_value(0) |
| 1806 | count_value = self.current_host.get_option("ServerAliveCountMax") or "3" |
| 1807 | try: |
| 1808 | count_int = int(count_value) if count_value.isdigit() else 3 |
| 1809 | self.serveralive_count_entry.set_value(count_int) |
| 1810 | except (ValueError, AttributeError): |
| 1811 | self.serveralive_count_entry.set_value(3) |
| 1812 | self.tcp_keepalive_switch.set_active( |
| 1813 | (self.current_host.get_option("TCPKeepAlive") or "yes").lower() == "yes" |
| 1814 | ) |
| 1815 | shk2 = (self.current_host.get_option("StrictHostKeyChecking") or "ask").lower() |
| 1816 | mapping2 = {"ask": 0, "yes": 1, "no": 2} |
| 1817 | self.strict_host_key_row.set_selected(mapping2.get(shk2, 0)) |
| 1818 | self._load_custom_options(self.current_host) |
| 1819 | self.is_loading = False |
| 1820 | |
| 1821 | def _replace_textview_with_sourceview(self): |
| 1822 | """Replace the regular TextView with GtkSourceView for syntax highlighting.""" |
no test coverage detected