本文整理汇总了Python中connector.Connector.addConnector方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.addConnector方法的具体用法?Python Connector.addConnector怎么用?Python Connector.addConnector使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类connector.Connector
的用法示例。
在下文中一共展示了Connector.addConnector方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import addConnector [as 别名]
class MainController:
def __init__(self, app):
self.deviceData = DeviceData()
self.view = MainView(None)
self.view.scanForDevices.Bind(wx.EVT_BUTTON, self.ScanForDevices)
self.view.syncActivities.Bind(wx.EVT_BUTTON, self.SyncActivities)
self.view.Bind(wx.EVT_MENU, self.OnAbout, self.view.aboutMenuItem)
self.view.Bind(wx.EVT_MENU, self.OnExit, self.view.exitMenuItem)
self.view.Show()
self.scanner = Scanner()
## TODO Preferences for Selected Scanners
self.scanner.addScanner(AntScanner())
self.connector = Connector()
## TODO Preferences for Selected Connectors
self.connector.addConnector(GarminConnector())
pub.subscribe(self.ScanningStarted, "SCANNING STARTED")
pub.subscribe(self.DeviceDetected, "DEVICE DETECTED")
pub.subscribe(self.ActivityRetrieved, "ACTIVITY RETRIEVED")
pub.subscribe(self.ScanningEnded, "SCANNING ENDED")
pub.subscribe(self.SyncStarted, "SYNC STARTED")
pub.subscribe(self.SyncEnded, "SYNC ENDED")
pub.subscribe(self.LoginSuccesful, "LOGIN SUCCESFUL")
pub.subscribe(self.LoginFailed, "LOGIN FAILED")
pub.subscribe(self.ActivitiesUploaded, "ACTIVITIES UPLOADED")
def ScanForDevices(self, evt):
self.scanner.scan()
def ScanningStarted(self, evt):
self.view.setStatus("Scanning started")
def ScanningEnded(self, evt):
self.view.setStatus("Scanning ended")
def DeviceDetected(self, evt):
self.view.setStatus("Device detected")
def ActivityRetrieved(self, evt):
self.view.setStatus("Retrieved activity")
def SyncActivities(self, evt):
self.connector.sync()
def SyncStarted(self, evt):
self.view.setStatus("Sync started")
def SyncEnded(self, evt):
self.view.setStatus("Sync ended")
def LoginSuccesful(self, evt):
self.view.setStatus("Login Succesful")
def LoginFailed(self, evt):
self.view.setStatus("Login Failed")
def ActivitiesUploaded(self, evt):
self.view.setStatus("Activities Uploaded")
def OnExit(self,e):
self.Close(True)
def OnAbout(self, event):
dlg = wx.MessageDialog( self.view, "A community-developed Linux version of the ANT Agent. Supports Garmin-based fitness devices that communicate either over USB serial or via the ANT USB connector. Developed by Philip Whitehouse, based on work by Braiden Kindt, Gustav Tiger and Collin (cpfair). Copyright 2014", "About ANT Agent for Linux", wx.OK);
dlg.ShowModal()
dlg.Destroy()