Commit e10c7309bd8c6d722c5ececd22acd08ef3d12d58
1 parent
872a2de4
Exists in
master
Compatibility multi OS.
Showing
2 changed files
with
17 additions
and
9 deletions
Show diff stats
gui/tp_audine_elec/tp_audine_elec.py
... | ... | @@ -52,6 +52,7 @@ if __name__ == "__main__": |
52 | 52 | infos = {} |
53 | 53 | infos['demarrer_acq'] = "Appuyez sur le bouton Acquisition pour prendre une image" |
54 | 54 | infos['acq_en_cours'] = "Acquisition en cours. Attendre quelques secondes... Prendre des mesures à l'oscilloscope" |
55 | + infos['acq_impossible'] = "Acquisition impossible sur cet OS. Utiliser un Raspberry PI" | |
55 | 56 | var = {} |
56 | 57 | |
57 | 58 | def save_config(): |
... | ... | @@ -118,21 +119,22 @@ if __name__ == "__main__": |
118 | 119 | t0 = time.time() |
119 | 120 | message = f'subprocess.run({argus},capture_output=True)' |
120 | 121 | print(message) |
121 | - uname = platform.uname() | |
122 | + release = platform.release() | |
122 | 123 | image = False |
123 | - if "raspi" in uname[2]: | |
124 | + if "raspi" in release: | |
124 | 125 | # Launch the process only for Raspberry |
125 | 126 | res = subprocess.run(argus, capture_output=True) |
126 | 127 | stdo = res.stdout |
128 | + print(stdo) | |
127 | 129 | #lstdos = str(stdo).split("\\n") |
128 | 130 | image = True |
129 | 131 | else: |
130 | - pass | |
132 | + var['info'].set(infos['acq_impossible']) | |
133 | + tkroot.update() | |
134 | + time.sleep(5) | |
131 | 135 | dt = time.time() - t0 |
132 | 136 | message = f"Acquisition done in {dt:.3f} sec" |
133 | - print(message) | |
134 | - print(stdo) | |
135 | - # --- | |
137 | + print(message) # --- | |
136 | 138 | if meth=="full_frame" and image==True: |
137 | 139 | time.sleep(0.5) |
138 | 140 | fullfile = ima1.load("/home/user/Documents/image.fit") | ... | ... |
src/libtt/setup.py
... | ... | @@ -23,9 +23,15 @@ elif psystem == "Darwin": |
23 | 23 | distro_name = psystem |
24 | 24 | distro_version = distribution[0] |
25 | 25 | elif psystem == "Linux": |
26 | - distribution = platform.freedesktop_os_release() | |
27 | - distro_name = distribution['NAME'] | |
28 | - distro_version = distribution['VERSION_ID'] | |
26 | + release = platform.release | |
27 | + if "microsoft" in release: | |
28 | + # release = '5.10.16.3-microsoft-standard-WSL2' | |
29 | + distro_name = release.split("-")[3] | |
30 | + distro_version = release.split("-")[0] | |
31 | + else | |
32 | + distribution = platform.freedesktop_os_release() | |
33 | + distro_name = distribution['NAME'] | |
34 | + distro_version = distribution['VERSION_ID'] | |
29 | 35 | print(f"\n{distro_name=}") |
30 | 36 | print(f"\n{distro_version=}") |
31 | 37 | ... | ... |