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()
|
parent = feature.getParent()
|
||||||
if not parent: return
|
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' ]
|
boards = [ board for board in parent.Group if hasattr(board, 'Type') and board.Type == 'KiConnect::Board' ]
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_connected(self):
|
def is_connected(self):
|
||||||
|
'''
|
||||||
|
Returns connection status
|
||||||
|
'''
|
||||||
|
|
||||||
return self.feature.Connected
|
return self.feature.Connected
|
||||||
|
|
||||||
def ping_connection(self, feature):
|
def ping_connection(self, feature):
|
||||||
|
'''
|
||||||
|
Ping the KiCAD API to determine if it's connected
|
||||||
|
'''
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.kicad.ping()
|
self.kicad.ping()
|
||||||
|
|
||||||
feature.Connected = True
|
feature.Connected = True
|
||||||
feature.Label2 = 'Connected'
|
feature.Label2 = 'Connected'
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
print(e)
|
||||||
feature.Connected = False
|
feature.Connected = False
|
||||||
feature.Label2 = 'Disconnected'
|
feature.Label2 = 'Disconnected'
|
||||||
pass
|
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
class APIViewProvider(BaseViewProvider):
|
class APIViewProvider(BaseViewProvider):
|
||||||
|
|
Loading…
Add table
Reference in a new issue