本文整理汇总了Python中Foundation.NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_方法的典型用法代码示例。如果您正苦于以下问题:Python NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_方法的具体用法?Python NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_怎么用?Python NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Foundation.NSTimer
的用法示例。
在下文中一共展示了NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: end
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例2: __init__
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例3: awakeFromNib
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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:")
示例4: enableAutoAnswer
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例5: _finish
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例6: _NH_SIPApplicationDidStart
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例7: start
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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
示例8: _NH_MediaStreamDidStart
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例9: enableAnsweringMachine
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [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)
示例10: start
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [as 别名]
def start(self):
self.stop()
#ns_timer = \
# NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
# self._interval, self._target, '_ns_fire', None, self._repeat)
ns_timer = \
NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
self._interval, trigger, 'fire:', None, self._repeat)
self._ns_timer = ns_timer
ns_timer_to_task[ns_timer] = self
ns_run_loop = NSRunLoop.currentRunLoop()
ns_run_loop.addTimer_forMode_(
ns_timer, NSDefaultRunLoopMode)
ns_run_loop.addTimer_forMode_(
ns_timer, NSEventTrackingRunLoopMode)
ns_run_loop.addTimer_forMode_(
ns_timer, NSModalPanelRunLoopMode)
示例11: captureButtonClicked_
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [as 别名]
def captureButtonClicked_(self, sender):
if self.countdownCheckbox.state() == NSOnState:
self.countdown_counter = 10
self.previewButton.setHidden_(True)
self.captureButton.setHidden_(True)
self.countdownCheckbox.setHidden_(True)
self.countdownProgress.setHidden_(False)
self.countdownProgress.startAnimation_(None)
self.countdownProgress.setIndeterminate_(False)
self.countdownProgress.setDoubleValue_(self.countdown_counter)
self.timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1, self, "executeTimerCapture:", None, True)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSModalPanelRunLoopMode)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSDefaultRunLoopMode)
else:
self.countdownCheckbox.setHidden_(True)
self.countdownProgress.setHidden_(True)
self.executeCapture()
示例12: __init__
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [as 别名]
def __init__(self, sessionController):
self.notification_center = NotificationCenter()
self.sessionController = None
self.audio_stream = None
self.chat_stream = None
self.add_session(sessionController)
self.add_audio_stream()
self.add_chat_stream()
self.timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(1.0, self, "updateTimer:", None, True)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSModalPanelRunLoopMode)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSDefaultRunLoopMode)
NSBundle.loadNibNamed_owner_("SessionInfoPanel", self)
sessionBoxTitle = NSAttributedString.alloc().initWithString_attributes_("SIP Session", NSDictionary.dictionaryWithObject_forKey_(NSColor.orangeColor(), NSForegroundColorAttributeName))
self.sessionBox.setTitle_(sessionBoxTitle)
audioBoxTitle = NSAttributedString.alloc().initWithString_attributes_("Audio Stream", NSDictionary.dictionaryWithObject_forKey_(NSColor.orangeColor(), NSForegroundColorAttributeName))
self.audioBox.setTitle_(audioBoxTitle)
chatBoxTitle = NSAttributedString.alloc().initWithString_attributes_("Chat Stream", NSDictionary.dictionaryWithObject_forKey_(NSColor.orangeColor(), NSForegroundColorAttributeName))
self.chatBox.setTitle_(chatBoxTitle)
self.audio_rtt_graph.setLineWidth_(1.0)
self.audio_rtt_graph.setLineSpacing_(1.0)
self.audio_rtt_graph.setAboveLimit_(200) # if higher than 200 ms show red color
self.audio_rtt_graph.setMinimumHeigth_(200)
self.audio_packet_loss_graph.setLineWidth_(1.0)
self.audio_packet_loss_graph.setLineSpacing_(1.0)
self.audio_packet_loss_graph.setAboveLimit_(3) # if higher than 3% show red color
self.audio_packet_loss_graph.setLineColor_(NSColor.greenColor())
self.audio_packet_loss_graph.setMinimumHeigth_(5)
self.resetSession()
self.updatePanelValues()
示例13: startSpeechSynthesizerTimer
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [as 别名]
def startSpeechSynthesizerTimer(self):
self.speech_synthesizer_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(2, self, "startSpeaking:", None, False)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.speech_synthesizer_timer, NSRunLoopCommonModes)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.speech_synthesizer_timer, NSEventTrackingRunLoopMode)
示例14: startDeallocTimer
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [as 别名]
def startDeallocTimer(self):
# workaround to keep the object alive as cocoa still sends delegate tableview messages after close
self.dealloc_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(2.0, self, "deallocTimer:", None, False)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.dealloc_timer, NSRunLoopCommonModes)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.dealloc_timer, NSEventTrackingRunLoopMode)
示例15: startIdleTimer
# 需要导入模块: from Foundation import NSTimer [as 别名]
# 或者: from Foundation.NSTimer import timerWithTimeInterval_target_selector_userInfo_repeats_ [as 别名]
def startIdleTimer(self):
if self.idle_timer is None:
self.idle_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(0.5, self, "updateIdleTimer:", None, True)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.idle_timer, NSRunLoopCommonModes)
NSRunLoop.currentRunLoop().addTimer_forMode_(self.idle_timer, NSEventTrackingRunLoopMode)