6464ReactiveType = TypeVar ("ReactiveType" )
6565
6666token = read_config ()["Murfey" ].get ("token" , "" )
67+ instrument_name = read_config ()["Murfey" ].get ("instrument_name" , "" )
6768
6869requests .get = partial (requests .get , headers = {"Authorization" : f"Bearer { token } " })
6970requests .post = partial (requests .post , headers = {"Authorization" : f"Bearer { token } " })
@@ -261,8 +262,9 @@ def __init__(
261262 self ._context = SPAModularContext
262263
263264 def compose (self ):
265+
264266 machine_data = requests .get (
265- f"{ self .app ._environment .url .geturl ()} /machine"
267+ f"{ self .app ._environment .url .geturl ()} /instruments/ { instrument_name } / machine"
266268 ).json ()
267269 self ._dir_tree = _DirectoryTree (
268270 str (self ._selected_dir ),
@@ -311,7 +313,7 @@ def _add_directory(self, directory: str, add_destination: bool = True):
311313 return
312314 self .app ._environment .sources .append (source )
313315 machine_data = requests .get (
314- f"{ self .app ._environment .url .geturl ()} /machine"
316+ f"{ self .app ._environment .url .geturl ()} /instruments/ { instrument_name } / machine"
315317 ).json ()
316318 self .app ._default_destinations [source ] = (
317319 f"{ machine_data .get ('rsync_module' ) or 'data' } /{ datetime .now ().year } "
@@ -701,7 +703,7 @@ def on_button_pressed(self, event: Button.Pressed):
701703 )
702704 log .info (f"Posted visit registration: { response .status_code } " )
703705 machine_data = requests .get (
704- f"{ self .app ._environment .url .geturl ()} /machine"
706+ f"{ self .app ._environment .url .geturl ()} /instruments/ { instrument_name } / machine"
705707 ).json ()
706708
707709 if self ._switch_status :
@@ -768,12 +770,16 @@ def on_button_pressed(self, event: Button.Pressed):
768770 )
769771 log .info (f"Posted visit registration: { response .status_code } " )
770772 machine_data = requests .get (
771- f"{ self .app ._environment .url .geturl ()} /machine"
773+ f"{ self .app ._environment .url .geturl ()} /instruments/ { instrument_name } / machine"
772774 ).json ()
773775
774776 self .app .install_screen (
775777 DirectorySelection (
776- [p for p in machine_data .get ("data_directories" , []) if p .exists ()]
778+ [
779+ p
780+ for p in machine_data .get ("data_directories" , [])
781+ if Path (p ).exists ()
782+ ]
777783 ),
778784 "directory-select" ,
779785 )
@@ -789,11 +795,7 @@ def on_button_pressed(self, event: Button.Pressed):
789795 )
790796 self .app .push_screen ("gain-ref-select" )
791797 else :
792- if self ._switch_status :
793- self .app .push_screen ("directory-select" )
794- else :
795- self .app .install_screen (LaunchScreen (basepath = Path ("./" )), "launcher" )
796- self .app .push_screen ("launcher" )
798+ self .app .push_screen ("directory-select" )
797799
798800 if machine_data .get ("upstream_data_directories" ):
799801 upstream_downloads = requests .get (
@@ -819,7 +821,7 @@ def compose(self):
819821
820822 def on_button_pressed (self , event : Button .Pressed ):
821823 machine_data = requests .get (
822- f"{ self .app ._environment .url .geturl ()} /machine"
824+ f"{ self .app ._environment .url .geturl ()} /instruments/ { instrument_name } / machine"
823825 ).json ()
824826 if machine_data .get ("upstream_data_download_directory" ):
825827 # Create the directory locally to save files to
@@ -1012,7 +1014,7 @@ def compose(self):
10121014 not in machine_config ["create_directories" ].values ()
10131015 ):
10141016 machine_data = requests .get (
1015- f"{ self .app ._environment .url .geturl ()} /machine"
1017+ f"{ self .app ._environment .url .geturl ()} /instruments/ { instrument_name } / machine"
10161018 ).json ()
10171019 dest = determine_default_destination (
10181020 self .app ._visit ,
0 commit comments