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


Python AppHelper.runEventLoop方法代码示例

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


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

示例1: run

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def run(self):
        """
        Perform various setup tasks then start application run loop.
        """
        nsapplication = NSApplication.sharedApplication()
        nsapplication.activateIgnoringOtherApps_(True)  # NSAlerts in front

        self._nsapp = NSApp.alloc().init()
        self._nsapp._app = self.__dict__  # allow for dynamic modification based on this App instance
        self._nsapp.initializeStatusBar()
        nsapplication.setDelegate_(self._nsapp)
        #NSUserNotificationCenter.defaultUserNotificationCenter().setDelegate_(self._nsapp)

        setattr(App, '*app_instance', self)  # class level ref to running instance (for passing self to App subclasses)
        t = b = None
        for t in getattr(timer, '*timers', []):
            t.start()
        for b in getattr(clicked, '*buttons', []):
            b(self)  # we waited on registering clicks so we could pass self to access _menu attribute
        del t, b

        AppHelper.runEventLoop()
        #sys.exit(0) 
开发者ID:beville,项目名称:ComicStreamer,代码行数:25,代码来源:rumps.py

示例2: serve_forever

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def serve_forever():
    app = NSApplication.sharedApplication()
    delegate = MacTrayObject.alloc().init()
    app.setDelegate_(delegate)
    AppHelper.runEventLoop() 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:7,代码来源:mac_tray.py

示例3: install

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def install(runLoop=None, runner=None):
    """
    Configure the twisted mainloop to be run inside CFRunLoop.

    @param runLoop: the run loop to use.

    @param runner: the function to call in order to actually invoke the main
        loop.  This will default to C{CFRunLoopRun} if not specified.  However,
        this is not an appropriate choice for GUI applications, as you need to
        run NSApplicationMain (or something like it).  For example, to run the
        Twisted mainloop in a PyObjC application, your C{main.py} should look
        something like this::

            from PyObjCTools import AppHelper
            from twisted.internet.cfreactor import install
            install(runner=AppHelper.runEventLoop)
            # initialize your application
            reactor.run()

    @return: The installed reactor.

    @rtype: C{CFReactor}
    """

    reactor = CFReactor(runLoop=runLoop, runner=runner)
    from twisted.internet.main import installReactor
    installReactor(reactor)
    return reactor 
开发者ID:proxysh,项目名称:Safejumper-for-Desktop,代码行数:30,代码来源:cfreactor.py

示例4: main

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def main():
  app = NSApplication.sharedApplication()
  delegate = AppDelegate.alloc().init()
  NSApp().setDelegate_(delegate)
  AppHelper.callLater(_BUCKET_SIZE_SECONDS, record)
  AppHelper.runEventLoop() 
开发者ID:numenta,项目名称:nupic.rogue,代码行数:8,代码来源:keys.py

示例5: install

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def install(runLoop=None, runner=None):
    """
    Configure the twisted mainloop to be run inside CFRunLoop.

    @param runLoop: the run loop to use.

    @param runner: the function to call in order to actually invoke the main
        loop.  This will default to L{CFRunLoopRun} if not specified.  However,
        this is not an appropriate choice for GUI applications, as you need to
        run NSApplicationMain (or something like it).  For example, to run the
        Twisted mainloop in a PyObjC application, your C{main.py} should look
        something like this::

            from PyObjCTools import AppHelper
            from twisted.internet.cfreactor import install
            install(runner=AppHelper.runEventLoop)
            # initialize your application
            reactor.run()

    @return: The installed reactor.

    @rtype: L{CFReactor}
    """

    reactor = CFReactor(runLoop=runLoop, runner=runner)
    from twisted.internet.main import installReactor
    installReactor(reactor)
    return reactor 
开发者ID:kuri65536,项目名称:python-for-android,代码行数:30,代码来源:cfreactor.py

示例6: run

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def run(self, **options):
        """Performs various setup tasks including creating the underlying Objective-C application, starting the timers,
        and registering callback functions for click events. Then starts the application run loop.

        .. versionchanged:: 0.2.1
            Accepts `debug` keyword argument.

        :param debug: determines if application should log information useful for debugging. Same effect as calling
                      :func:`rumps.debug_mode`.

        """
        dont_change = object()
        debug = options.get('debug', dont_change)
        if debug is not dont_change:
            debug_mode(debug)

        nsapplication = NSApplication.sharedApplication()
        nsapplication.activateIgnoringOtherApps_(True)  # NSAlerts in front
        self._nsapp = NSApp.alloc().init()
        self._nsapp._app = self.__dict__  # allow for dynamic modification based on this App instance
        nsapplication.setDelegate_(self._nsapp)
        if _NOTIFICATIONS:
            try:
                notification_center = _default_user_notification_center()
            except RuntimeError:
                pass
            else:
                notification_center.setDelegate_(self._nsapp)

        setattr(App, '*app_instance', self)  # class level ref to running instance (for passing self to App subclasses)
        t = b = None
        for t in getattr(timer, '*timers', []):
            t.start()
        for b in getattr(clicked, '*buttons', []):
            b(self)  # we waited on registering clicks so we could pass self to access _menu attribute
        del t, b

        self._nsapp.initializeStatusBar()

        AppHelper.runEventLoop() 
开发者ID:Tautulli,项目名称:Tautulli,代码行数:42,代码来源:rumps.py

示例7: run

# 需要导入模块: from PyObjCTools import AppHelper [as 别名]
# 或者: from PyObjCTools.AppHelper import runEventLoop [as 别名]
def run(self):
        app = NSApplication.sharedApplication()
        osxthing = MacOSXThing.alloc().init()
        osxthing.indicator = self
        app.setDelegate_(osxthing)
        try:
            AppHelper.runEventLoop()
        except:
            traceback.print_exc() 
开发者ID:mailpile,项目名称:gui-o-matic,代码行数:11,代码来源:macosx.py


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