@@ -203,28 +203,17 @@ def select_controller_path(self, controller_path: Optional[Path]) -> None:
203
203
else None
204
204
)
205
205
206
- def create_selected_ports_dict (self ) -> dict [str , str ]:
207
- selected_ports_dict = {}
208
- if self .selected_midi_in is not None :
209
- selected_ports_dict ["in" ] = self .selected_midi_in
210
-
211
- if self .selected_midi_out is not None :
212
- selected_ports_dict ["out" ] = self .selected_midi_out
213
- return selected_ports_dict
214
-
215
206
def select_midi_in (self , port_name : Optional [str ]) -> None :
216
207
"""Updates currently selected MIDI input port name.
217
208
218
209
Does not have any immediate effect except updating the value.
219
210
"""
220
211
self .selected_midi_in = port_name
221
212
if self .selected_controller :
222
- selected_ports_dict = self .create_selected_ports_dict ()
223
-
224
- if selected_ports_dict :
225
- self .recent_midi_ports_for_controller [self .selected_controller .path ] = (
226
- selected_ports_dict
227
- )
213
+ self .recent_midi_ports_for_controller [self .selected_controller .path ] = {
214
+ "in" : self .selected_midi_in ,
215
+ "out" : self .selected_midi_out ,
216
+ }
228
217
229
218
def select_midi_out (self , port_name : Optional [str ]) -> None :
230
219
"""Updates currently selected MIDI output port name.
@@ -233,12 +222,10 @@ def select_midi_out(self, port_name: Optional[str]) -> None:
233
222
"""
234
223
self .selected_midi_out = port_name
235
224
if self .selected_controller :
236
- selected_ports_dict = self .create_selected_ports_dict ()
237
-
238
- if selected_ports_dict :
239
- self .recent_midi_ports_for_controller [self .selected_controller .path ] = (
240
- selected_ports_dict
241
- )
225
+ self .recent_midi_ports_for_controller [self .selected_controller .path ] = {
226
+ "in" : self .selected_midi_in ,
227
+ "out" : self .selected_midi_out ,
228
+ }
242
229
243
230
def stop_handling (self ) -> None :
244
231
"""Stops handling any MIDI signals."""
0 commit comments