Skip to content

Commit 2b8101b

Browse files
authored
chore: Ephys link UI updates (#662)
* Show connecting connect button as connecting, close process on exit * Give more space to connect button, nullify process after killing
1 parent 2856859 commit 2b8101b

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

Assets/Prefabs/UI/SettingsMenu/Menus/EphysLinkMenu.prefab

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4824,7 +4824,9 @@ PrefabInstance:
48244824
m_Modifications:
48254825
- target: {fileID: 1917941435178448969, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
48264826
propertyPath: m_Text
4827-
value: Connect
4827+
value: 'Connect
4828+
4829+
'
48284830
objectReference: {fileID: 0}
48294831
- target: {fileID: 2315289584108803517, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
48304832
propertyPath: m_OnClick.m_PersistentCalls.m_Calls.Array.size
@@ -4904,7 +4906,7 @@ PrefabInstance:
49044906
objectReference: {fileID: 0}
49054907
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
49064908
propertyPath: m_SizeDelta.x
4907-
value: 180.69582
4909+
value: 200.6693
49084910
objectReference: {fileID: 0}
49094911
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
49104912
propertyPath: m_SizeDelta.y
@@ -4940,7 +4942,7 @@ PrefabInstance:
49404942
objectReference: {fileID: 0}
49414943
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
49424944
propertyPath: m_AnchoredPosition.x
4943-
value: 1037.5765
4945+
value: 1046.1573
49444946
objectReference: {fileID: 0}
49454947
- target: {fileID: 8061307773979316499, guid: b70534dfc2e4a52489c512aabd5dd59d, type: 3}
49464948
propertyPath: m_AnchoredPosition.y
@@ -4995,7 +4997,7 @@ MonoBehaviour:
49954997
m_Name:
49964998
m_EditorClassIdentifier:
49974999
m_IgnoreLayout: 0
4998-
m_MinWidth: 180
5000+
m_MinWidth: 200
49995001
m_MinHeight: -1
50005002
m_PreferredWidth: -1
50015003
m_PreferredHeight: -1

Assets/Scripts/Pinpoint/UI/EphysLinkSettings/EphysLinkSettings.cs

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
using TMPro;
88
using UnityEngine;
99
using UnityEngine.Events;
10-
using UnityEngine.Serialization;
1110
using UnityEngine.UI;
1211

1312
// using Process = KS.Diagnostics.Process;
@@ -75,6 +74,11 @@ private void OnEnable()
7574
UpdateConnectionPanel();
7675
}
7776

77+
private void OnDestroy()
78+
{
79+
KillEphysLinkProcess();
80+
}
81+
7882
#endregion
7983

8084
#region UI Functions
@@ -171,8 +175,8 @@ public void OnLaunchEphysLinkPressed()
171175
_ => "sensapex"
172176
};
173177

174-
// Make args string.
175-
var args = $"-t {manipulatorTypeString}";
178+
// Make args string (ignore updates, select type).
179+
var args = $"-i -t {manipulatorTypeString}";
176180

177181
// Add Pathfinder port if selected.
178182
if (_manipulatorTypeDropdown.value == 2)
@@ -195,6 +199,7 @@ public void OnLaunchEphysLinkPressed()
195199
_manipulatorTypeDropdown.interactable = false;
196200
_launchEphysLinkButton.interactable = false;
197201
_connectButton.SetActive(true);
202+
_connectButtonText.text = "Connecting...";
198203

199204
// Attempt to connect to server.
200205
var attempts = 0;
@@ -269,13 +274,7 @@ public void OnConnectDisconnectPressed()
269274

270275
CommunicationManager.Instance.DisconnectFromServer(() =>
271276
{
272-
// Kill internally started Ephys Link process
273-
if (_ephysLinkProcess != null)
274-
{
275-
_ephysLinkProcess.Kill(true);
276-
_ephysLinkProcess.Dispose();
277-
}
278-
277+
KillEphysLinkProcess();
279278
UpdateConnectionPanel();
280279
});
281280
};
@@ -352,6 +351,14 @@ private void UpdateConnectionPanel()
352351
UpdateManipulatorPanels();
353352
}
354353

354+
private void KillEphysLinkProcess()
355+
{
356+
if (_ephysLinkProcess == null) return;
357+
_ephysLinkProcess.Kill(true);
358+
_ephysLinkProcess.Dispose();
359+
_ephysLinkProcess = null;
360+
}
361+
355362
#endregion
356363
}
357364
}

0 commit comments

Comments
 (0)