notes and minor changes to ping
This commit is contained in:
parent
e05f3f6a3c
commit
caa3225ef8
1 changed files with 16 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Reference in a new issue