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


Python NSRunLoop.currentRunLoop方法代码示例

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


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

示例1: end

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
    def end(self):
        if self.ended:
            return

        self.sessionController.log_debug(u"End %s" % self)

        self.ended = True

        NSApp.delegate().contactsWindowController.hideLocalVideoWindow()
        status = self.status
        if status in [STREAM_IDLE, STREAM_FAILED]:
            self.changeStatus(STREAM_IDLE)
        elif status == STREAM_PROPOSING:
            self.sessionController.cancelProposal(self.stream)
            self.changeStatus(STREAM_CANCELLING)
        else:
            self.sessionController.endStream(self)
            self.changeStatus(STREAM_IDLE)

        self.removeFromSession()
        self.videoWindowController.close()
        self.notification_center.discard_observer(self, sender=self.sessionController)

        dealloc_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(5.0, self, "deallocTimer:", None, False)
        NSRunLoop.currentRunLoop().addTimer_forMode_(dealloc_timer, NSRunLoopCommonModes)
        NSRunLoop.currentRunLoop().addTimer_forMode_(dealloc_timer, NSEventTrackingRunLoopMode)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:28,代码来源:VideoController.py

示例2: __init__

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
 def __init__(self, image):
     NSBundle.loadNibNamed_owner_("ScreensharingPreviewPanel", self)
     self.view.setImage_(image)
     self.timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(5.0, self, "closeTimer:", None, False)
     NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSModalPanelRunLoopMode)
     NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSDefaultRunLoopMode)
     self.window.orderFront_(None)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:9,代码来源:ScreensharingPreviewPanel.py

示例3: applicationDidFinishLaunching_

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
  def applicationDidFinishLaunching_(self, notification):
    self.noDevice = None

    #Create menu
    self.menu = NSMenu.alloc().init()

    self.barItem = dict()

    # Load images
    self.noDeviceImage = NSImage.alloc().initByReferencingFile_('icons/no_device.png')
    self.barImage = dict(kb = NSImage.alloc().initByReferencingFile_('icons/kb.png'),
			 magicMouse = NSImage.alloc().initByReferencingFile_('icons/magic_mouse.png'),
			 mightyMouse = NSImage.alloc().initByReferencingFile_('icons/mighty_mouse.png'),
			 magicTrackpad = NSImage.alloc().initByReferencingFile_('icons/TrackpadIcon.png'))

    #Define menu items
    self.statusbar = NSStatusBar.systemStatusBar()
    self.menuAbout = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('About BtBatStat', 'about:', '')
    self.separator_menu_item = NSMenuItem.separatorItem()
    self.menuQuit = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_('Quit', 'terminate:', '')

    # Get the timer going
    self.timer = NSTimer.alloc().initWithFireDate_interval_target_selector_userInfo_repeats_(start_time, 10.0, self, 'tick:', None, True)
    NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSDefaultRunLoopMode)
    self.timer.fire()

    #Add menu items
    self.menu.addItem_(self.menuAbout)
    self.menu.addItem_(self.separator_menu_item)
    self.menu.addItem_(self.menuQuit)

    #Check for updates
    checkForUpdates()
开发者ID:Ku2f,项目名称:btbatstat,代码行数:35,代码来源:BtBatStat.py

示例4: find_apps_in_dirs

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
def find_apps_in_dirs(dirlist):
    """Do spotlight search for type applications within the
    list of directories provided. Returns a list of paths to applications
    these appear to always be some form of unicode string.
    """
    applist = []
    query = NSMetadataQuery.alloc().init()
    query.setPredicate_(
        NSPredicate.predicateWithFormat_('(kMDItemKind = "Application")'))
    query.setSearchScopes_(dirlist)
    query.startQuery()
    # Spotlight isGathering phase - this is the initial search. After the
    # isGathering phase Spotlight keeps running returning live results from
    # filesystem changes, we are not interested in that phase.
    # Run for 0.3 seconds then check if isGathering has completed.
    runtime = 0
    maxruntime = 20
    while query.isGathering() and runtime <= maxruntime:
        runtime += 0.3
        NSRunLoop.currentRunLoop(
            ).runUntilDate_(NSDate.dateWithTimeIntervalSinceNow_(0.3))
    query.stopQuery()

    if runtime >= maxruntime:
        display.display_warning(
            'Spotlight search for applications terminated due to excessive '
            'time. Possible causes: Spotlight indexing is turned off for a '
            'volume; Spotlight is reindexing a volume.')

    for item in query.results():
        pathname = item.valueForAttribute_('kMDItemPath')
        if pathname and not is_excluded_filesystem(pathname):
            applist.append(pathname)

    return applist
开发者ID:chrisgrande,项目名称:munki,代码行数:37,代码来源:info.py

示例5: awakeFromNib

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
    def awakeFromNib(self):
        NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, "contactSelectionChanged:", NSTableViewSelectionDidChangeNotification, self.contactTable)

        timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(0.3, self, "refreshContactsTimer:", None, True)
        NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSModalPanelRunLoopMode)
        NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSDefaultRunLoopMode)

        self.contactTable.setDoubleAction_("doubleClick:")
开发者ID:uditha-atukorala,项目名称:blink,代码行数:10,代码来源:HistoryViewer.py

示例6: start

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
 def start(self):
     if not self._status:
         self._nsdate = NSDate.date()
         self._nstimer = NSTimer.alloc().initWithFireDate_interval_target_selector_userInfo_repeats_(
             self._nsdate, self._interval, self, 'callback:', None, True)
         NSRunLoop.currentRunLoop().addTimer_forMode_(self._nstimer, NSDefaultRunLoopMode)
         _TIMERS.add(self)
         self._status = True
开发者ID:philippeowagner,项目名称:rumps,代码行数:10,代码来源:rumps.py

示例7: isDone

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
 def isDone(self):
     '''Check if the connection request is complete. As a side effect,
     allow the delegates to work by letting the run loop run for a bit'''
     if self.done:
         return self.done
     # let the delegates do their thing
     NSRunLoop.currentRunLoop().runUntilDate_(
         NSDate.dateWithTimeIntervalSinceNow_(.1))
     return self.done
开发者ID:SteveKueng,项目名称:munki,代码行数:11,代码来源:gurl.py

示例8: enableAutoAnswer

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
 def enableAutoAnswer(self, view, session, delay=30):
     if session not in self.autoAnswerTimers:
         label = view.viewWithTag_(15)
         info = dict(delay = delay, session = session, label = label, time = time.time())
         timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, "timerTickAutoAnswer:", info, True)
         NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSRunLoopCommonModes)
         NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSEventTrackingRunLoopMode)
         self.autoAnswerTimers[session] = timer
         self.timerTickAutoAnswer_(timer)
         label.setHidden_(False)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:12,代码来源:AlertPanel.py

示例9: _finish

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
 def _finish(self):
     self.smp_running = False
     self.finished = True
     self.secretText.setEnabled_(False)
     self.questionText.setEnabled_(False)
     self.progressBar.setDoubleValue_(9)
     self.continueButton.setEnabled_(True)
     self.continueButton.setTitle_('Finish')
     self.cancelButton.setHidden_(True)
     self.timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(5, self, "verificationFinished:", None, False)
     NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSRunLoopCommonModes)
开发者ID:uditha-atukorala,项目名称:blink,代码行数:13,代码来源:ChatOTR.py

示例10: _NH_SIPApplicationDidStart

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
    def _NH_SIPApplicationDidStart(self, notification):
        settings = SIPSimpleSettings()
        if settings.presence_state.timestamp is None:
            settings.presence_state.timestamp = ISOTimestamp.now()
            settings.save()

        self.get_location([account for account in AccountManager().iter_accounts() if account is not BonjourAccount()])
        self.publish()

        idle_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, "updateIdleTimer:", None, True)
        NSRunLoop.currentRunLoop().addTimer_forMode_(idle_timer, NSRunLoopCommonModes)
        NSRunLoop.currentRunLoop().addTimer_forMode_(idle_timer, NSEventTrackingRunLoopMode)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:14,代码来源:PresencePublisher.py

示例11: start

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
    def start(self):
        notification_center = NotificationCenter()
        notification_center.add_observer(self, name="BlinkFileTransferDidEnd")
        notification_center.add_observer(self, name="AudioStreamDidChangeHoldState")
        notification_center.add_observer(self, name="CFGSettingsObjectDidChange")
        notification_center.add_observer(self, name="ChatViewControllerDidDisplayMessage")
        notification_center.add_observer(self, name="ConferenceHasAddedAudio")
        notification_center.add_observer(self, name="BlinkWillCancelProposal")

        self.cleanupTimer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(3, self, "cleanupTimer:", None, True)
        NSRunLoop.currentRunLoop().addTimer_forMode_(self.cleanupTimer, NSRunLoopCommonModes)
        NSRunLoop.currentRunLoop().addTimer_forMode_(self.cleanupTimer, NSEventTrackingRunLoopMode)
        self.started = True
开发者ID:uditha-atukorala,项目名称:blink,代码行数:15,代码来源:SessionRinger.py

示例12: finishLaunching

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
    def finishLaunching(self):
        """Setup the menu and run the app loop."""
        self._setup_menu_bar()

        # Create a timer which fires the update_ method every 1second,
        # and add it to the runloop
        NSRunLoop.currentRunLoop().addTimer_forMode_(
            NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats_(1, self, "update:", "", True),
            NSEventTrackingRunLoopMode,
        )

        print("Sentinel is now running.")
        print("CTRL+C does not work here.")
        print("You can quit through the menu bar (Sentinel -> Quit).")
开发者ID:andreoliwa,项目名称:python-dontforget,代码行数:16,代码来源:menu.py

示例13: _NH_MediaStreamDidStart

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
    def _NH_MediaStreamDidStart(self, sender, data):
        super(VideoController, self)._NH_MediaStreamDidStart(sender, data)
        self.started = True
        sample_rate = self.stream.clock_rate/1000
        codec = beautify_video_codec(self.stream.codec)
        self.sessionController.log_info("Video stream established to %s:%s using %s %0.fkHz codec" % (self.stream.remote_rtp_address, self.stream.remote_rtp_port, codec, sample_rate))

        self.videoWindowController.show()
        self.changeStatus(STREAM_CONNECTED)

        if self.sessionController.hasStreamOfType("chat") and self.videoWindowController.always_on_top:
            self.videoWindowController.toogleAlwaysOnTop()

        self.statistics_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(STATISTICS_INTERVAL, self, "updateStatisticsTimer:", None, True)
        NSRunLoop.currentRunLoop().addTimer_forMode_(self.statistics_timer, NSRunLoopCommonModes)
        NSRunLoop.currentRunLoop().addTimer_forMode_(self.statistics_timer, NSEventTrackingRunLoopMode)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:18,代码来源:VideoController.py

示例14: enableAnsweringMachine

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
 def enableAnsweringMachine(self, view, session, run_now=False):
     try:
         timer = self.answeringMachineTimers[session]
     except KeyError:
         settings = SIPSimpleSettings()
         amLabel = view.viewWithTag_(15)
         delay = 0 if run_now else settings.answering_machine.answer_delay
         info = dict(delay = delay, session = session, label = amLabel, time = time.time())
         timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, "timerTickAnsweringMachine:", info, True)
         NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSRunLoopCommonModes)
         NSRunLoop.currentRunLoop().addTimer_forMode_(timer, NSEventTrackingRunLoopMode)
         self.answeringMachineTimers[session] = timer
         self.timerTickAnsweringMachine_(timer)
         amLabel.setHidden_(False)
     else:
         if run_now:
             self.acceptAudioStreamAnsweringMachine(session)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:19,代码来源:AlertPanel.py

示例15: findDomains

# 需要导入模块: from Foundation import NSRunLoop [as 别名]
# 或者: from Foundation.NSRunLoop import currentRunLoop [as 别名]
def findDomains(serviceName, seconds=5.0):
    runloop = NSRunLoop.currentRunLoop()
    browser = NSNetServiceBrowser.new()
    pbd = PrintingBrowserDelegate.new()
    browser.setDelegate_(pbd)
    browser.searchForServicesOfType_inDomain_(serviceName, "")
    untilWhen = NSDate.dateWithTimeIntervalSinceNow_(seconds)
    runloop.runUntilDate_(untilWhen)
开发者ID:benoit-pierre,项目名称:pyobjc,代码行数:10,代码来源:rendezvous.py


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