当前位置: 首页>>代码示例>>Python>>正文


Python Connector.sync方法代码示例

本文整理汇总了Python中connector.Connector.sync方法的典型用法代码示例。如果您正苦于以下问题:Python Connector.sync方法的具体用法?Python Connector.sync怎么用?Python Connector.sync使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在connector.Connector的用法示例。


在下文中一共展示了Connector.sync方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from connector import Connector [as 别名]
# 或者: from connector.Connector import sync [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()
开发者ID:philipwhiuk,项目名称:garmin-Ant-GUI,代码行数:54,代码来源:main.py


注:本文中的connector.Connector.sync方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。