File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change
1
+ import warnings
1
2
from dataclasses import dataclass
2
3
3
4
from pyglet .input import Controller
@@ -128,11 +129,19 @@ def __init__(self, ui: UIManager):
128
129
129
130
def on_connect (self , controller : Controller ):
130
131
controller .push_handlers (self )
131
- controller .open ()
132
+
133
+ try :
134
+ controller .open ()
135
+ except Exception as e :
136
+ warnings .warn (f"Failed to open controller { controller } : { e } " )
132
137
133
138
def on_disconnect (self , controller : Controller ):
134
139
controller .remove_handlers (self )
135
- controller .close ()
140
+
141
+ try :
142
+ controller .close ()
143
+ except Exception as e :
144
+ warnings .warn (f"Failed to close controller { controller } : { e } " )
136
145
137
146
# Controller event mapping
138
147
def on_stick_motion (self , controller : Controller , name , value ):
You can’t perform that action at this time.
0 commit comments