本文整理汇总了Python中PyObjCTools.AppHelper.stopEventLoop方法的典型用法代码示例。如果您正苦于以下问题:Python AppHelper.stopEventLoop方法的具体用法?Python AppHelper.stopEventLoop怎么用?Python AppHelper.stopEventLoop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyObjCTools.AppHelper
的用法示例。
在下文中一共展示了AppHelper.stopEventLoop方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _runMainRunLoop
# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 别名]
def _runMainRunLoop(self):
# Create background thread to run user code.
self._user_thread = threading.Thread(target=self._user_thread_main)
self._user_thread.daemon = True
self._user_thread.start()
# Run main loop. This call will never return!
try:
AppHelper.runConsoleEventLoop(installInterrupt=True)
except KeyboardInterrupt:
AppHelper.stopEventLoop()
sys.exit(0)
示例2: run_mainloop_with
# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 别名]
def run_mainloop_with(self, target):
"""Start the OS's main loop to process asyncronous BLE events and then
run the specified target function in a background thread. Target
function should be a function that takes no parameters and optionally
return an integer response code. When the target function stops
executing or returns with value then the main loop will be stopped and
the program will exit with the returned code.
Note that an OS main loop is required to process asyncronous BLE events
and this function is provided as a convenience for writing simple tools
and scripts that don't need to be full-blown GUI applications. If you
are writing a GUI application that has a main loop (a GTK glib main loop
on Linux, or a Cocoa main loop on OSX) then you don't need to call this
function.
"""
# Create background thread to run user code.
self._user_thread = threading.Thread(target=self._user_thread_main,
args=(target,))
self._user_thread.daemon = True
self._user_thread.start()
# Run main loop. This call will never return!
try:
AppHelper.runConsoleEventLoop(installInterrupt=True)
except KeyboardInterrupt:
AppHelper.stopEventLoop()
sys.exit(0)
示例3: endLoop
# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 别名]
def endLoop(self):
AppHelper.stopEventLoop()
示例4: about
# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 别名]
def about(self, sender):
#rumps.alert("My quit message")
self.apiServer.shutdown()
AppHelper.stopEventLoop()
print "after stop"
#@rumps.clicked("Arbitrary", "Depth", "It's pretty easy") # very simple to access nested menu items
#def does_something(self, sender):
# my_data = {'poop': 88}
# rumps.notification(title='Hi', subtitle='There.', message='Friend!', data=my_data)
#@rumps.clicked("Preferences")
#def not_actually_prefs(self, sender):
# if not sender.icon:
# sender.icon = 'level_4.png'
# sender.state = not sender.state
#@rumps.timer(4) # create a new thread that calls the decorated function every 4 seconds
#def write_unix_time(self, sender):
# with self.rumps_app.open('times', 'a') as f: # this opens files in your app's Application Support folder
# f.write('The unix time now: {}\n'.format(time.time()))
#@rumps.clicked("Arbitrary")
#def change_statusbar_title(self, sender):
# app.title = 'Hello World' if self.rumps_app.title != 'Hello World' else 'World, Hello'
示例5: centralManager_didDisconnectPeripheral_error_
# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import stopEventLoop [as 别名]
def centralManager_didDisconnectPeripheral_error_(self, manager, peripheral, error):
log.debug("centralManager_didDisconnectPeripheral_error_")
self.connected = False
#AppHelper.stopEventLoop()