@@ -741,7 +741,7 @@ def fill_inputs_with_project_configs(self) -> None:
741741 input = self .query_one ("#configs_gdrive_client_id_input" )
742742 value = (
743743 ""
744- if cfg_to_load . get ( "gdrive_client_id" , None ) is None
744+ if cfg_to_load [ "gdrive_client_id" ] is None
745745 else cfg_to_load ["gdrive_client_id" ]
746746 )
747747 input .value = value
@@ -750,7 +750,7 @@ def fill_inputs_with_project_configs(self) -> None:
750750 input = self .query_one ("#configs_gdrive_root_folder_id" )
751751 value = (
752752 ""
753- if cfg_to_load . get ( "gdrive_root_folder_id" , None ) is None
753+ if cfg_to_load [ "gdrive_root_folder_id" ] is None
754754 else cfg_to_load ["gdrive_root_folder_id" ]
755755 )
756756 input .value = value
@@ -759,7 +759,7 @@ def fill_inputs_with_project_configs(self) -> None:
759759 input = self .query_one ("#configs_aws_access_key_id_input" )
760760 value = (
761761 ""
762- if cfg_to_load . get ( "aws_access_key_id" , None ) is None
762+ if cfg_to_load [ "aws_access_key_id" ] is None
763763 else cfg_to_load ["aws_access_key_id" ]
764764 )
765765 input .value = value
@@ -768,13 +768,23 @@ def fill_inputs_with_project_configs(self) -> None:
768768 select = self .query_one ("#configs_aws_region_select" )
769769 value = (
770770 Select .BLANK
771- if cfg_to_load . get ( "aws_region" , None ) is None
771+ if cfg_to_load [ "aws_region" ] is None
772772 else cfg_to_load ["aws_region" ]
773773 )
774774 select .value = value
775775
776776 def setup_widgets_to_display (self , connection_method : str | None ) -> None :
777+ """
778+ Sets up widgets to display based on the chosen `connection_method` on the
779+ radiobutton. The widgets pertaining to the chosen connection method will be
780+ be displayed. This is done by dedicated functions for each connection method
781+ which display widgets on receiving a `True` flag.
782+
783+ Also, this function handles other TUI changes like displaying "setup connection"
784+ button, disabling central path input in a local only project, etc.
777785
786+ Called on mount, on radiobuttons' switch and upon saving project configs.
787+ """
778788 if connection_method :
779789 assert connection_method in [
780790 "local_filesystem" ,
@@ -783,6 +793,7 @@ def setup_widgets_to_display(self, connection_method: str | None) -> None:
783793 "aws" ,
784794 ], "Unexpected Connection Method"
785795
796+ # Connection specific widgets
786797 connection_widget_display_functions = {
787798 "ssh" : self .switch_ssh_widgets_display ,
788799 "gdrive" : self .switch_gdrive_widgets_display ,
@@ -795,6 +806,7 @@ def setup_widgets_to_display(self, connection_method: str | None) -> None:
795806 else :
796807 widget_func (False )
797808
809+ # Central path input
798810 self .query_one ("#configs_central_path_input" ).disabled = (
799811 connection_method is None
800812 )
@@ -811,6 +823,7 @@ def setup_widgets_to_display(self, connection_method: str | None) -> None:
811823 )
812824
813825 # fmt: off
826+ # Setup connection button
814827 if (
815828 not connection_method
816829 or connection_method == "local_filesystem"
0 commit comments