@@ -65,6 +65,31 @@ def read_config() -> configparser.ConfigParser:
6565requests .delete = partial (requests .delete , headers = {"Authorization" : f"Bearer { token } " })
6666
6767
68+ def write_config (config : configparser .ConfigParser ):
69+ mcch = os .environ .get ("MURFEY_CLIENT_CONFIG_HOME" )
70+ murfey_client_config_home = Path (mcch ) if mcch else Path .home ()
71+ with open (murfey_client_config_home / ".murfey" , "w" ) as configfile :
72+ config .write (configfile )
73+
74+
75+ def main_loop (
76+ source_watchers : List [murfey .client .watchdir .DirWatcher ],
77+ appearance_time : float ,
78+ transfer_all : bool ,
79+ ):
80+ log .info (
81+ f"Murfey { murfey .__version__ } on Python { '.' .join (map (str , sys .version_info [0 :3 ]))} entering main loop"
82+ )
83+ if appearance_time > 0 :
84+ modification_time : float | None = time .time () - appearance_time * 3600
85+ else :
86+ modification_time = None
87+ while True :
88+ for sw in source_watchers :
89+ sw .scan (modification_time = modification_time , transfer_all = transfer_all )
90+ time .sleep (15 )
91+
92+
6893def _enable_webbrowser_in_cygwin ():
6994 """Helper function to make webbrowser.open() work in CygWin"""
7095 if "cygwin" in platform .system ().lower () and shutil .which ("cygstart" ):
@@ -288,7 +313,9 @@ def run():
288313
289314 status_bar = StatusBar ()
290315
291- machine_data = requests .get (f"{ murfey_url .geturl ()} /machine" ).json ()
316+ machine_data = requests .get (
317+ f"{ murfey_url .geturl ()} /instruments/{ instrument_name } /machine"
318+ ).json ()
292319 gain_ref : Path | None = None
293320
294321 instance_environment = MurfeyInstanceEnvironment (
@@ -323,28 +350,3 @@ def run():
323350 )
324351 app .run ()
325352 rich_handler .redirect = False
326-
327-
328- def main_loop (
329- source_watchers : List [murfey .client .watchdir .DirWatcher ],
330- appearance_time : float ,
331- transfer_all : bool ,
332- ):
333- log .info (
334- f"Murfey { murfey .__version__ } on Python { '.' .join (map (str , sys .version_info [0 :3 ]))} entering main loop"
335- )
336- if appearance_time > 0 :
337- modification_time : float | None = time .time () - appearance_time * 3600
338- else :
339- modification_time = None
340- while True :
341- for sw in source_watchers :
342- sw .scan (modification_time = modification_time , transfer_all = transfer_all )
343- time .sleep (15 )
344-
345-
346- def write_config (config : configparser .ConfigParser ):
347- mcch = os .environ .get ("MURFEY_CLIENT_CONFIG_HOME" )
348- murfey_client_config_home = Path (mcch ) if mcch else Path .home ()
349- with open (murfey_client_config_home / ".murfey" , "w" ) as configfile :
350- config .write (configfile )
0 commit comments