notes and minor changes to ping

This commit is contained in:
Morgan 'ARR\!' Allen 2025-04-30 13:13:40 -07:00
parent e05f3f6a3c
commit caa3225ef8

View file

@ -26,23 +26,38 @@ class APIObject(BaseObject):
parent = feature.getParent()
if not parent: return
# XXX This gets all of the KiConnect::Board features but then does nothing with them
# future multi-board support?
boards = [ board for board in parent.Group if hasattr(board, 'Type') and board.Type == 'KiConnect::Board' ]
@property
def is_connected(self):
'''
Returns connection status
'''
return self.feature.Connected
def ping_connection(self, feature):
'''
Ping the KiCAD API to determine if it's connected
'''
try:
self.kicad.ping()
feature.Connected = True
feature.Label2 = 'Connected'
return True
except Exception as e:
print(e)
feature.Connected = False
feature.Label2 = 'Disconnected'
pass
return False
class APIViewProvider(BaseViewProvider):