コード例 #1
0
 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)
コード例 #2
0
    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)
コード例 #3
0
    def awakeFromNib(self):
        NSNotificationCenter.defaultCenter().addObserver_selector_name_object_(self, "contactSelectionChanged:", NSTableViewSelectionDidChangeNotification, self.contactTable)

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

        self.contactTable.setDoubleAction_("doubleClick:")
コード例 #4
0
    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:")
コード例 #5
0
 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)
コード例 #6
0
 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)
コード例 #7
0
ファイル: AlertPanel.py プロジェクト: bitsworking/blink-cocoa
 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)
コード例 #8
0
ファイル: ChatOTR.py プロジェクト: uditha-atukorala/blink
 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)
コード例 #9
0
    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)
コード例 #10
0
    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)
コード例 #11
0
    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
コード例 #12
0
ファイル: Task.py プロジェクト: mnabeelp/PyGUI
 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)
コード例 #13
0
ファイル: ChatOTR.py プロジェクト: ronaldoussoren/blink-cocoa
 def _finish(self, result=False):
     self.finished = True
     self.smp_running = False
     self.requested_by_remote = False
     self.secretText.setEnabled_(False)
     self.questionText.setEnabled_(False)
     self.progressBar.setDoubleValue_(9)
     self.continueButton.setEnabled_(False)
     self.continueButton.setTitle_(NSLocalizedString("Finish", "Button Title"))
     self.cancelButton.setHidden_(True)
     self.continueButton.setEnabled_(True)
     wait_interval = 5 if result else 10
     self.timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(wait_interval, self, "verificationFinished:", None, False)
     NSRunLoop.currentRunLoop().addTimer_forMode_(self.timer, NSRunLoopCommonModes)
コード例 #14
0
    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)
コード例 #15
0
ファイル: Task.py プロジェクト: karlmatthew/pygtk-craigslist
 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)
コード例 #16
0
ファイル: AlertPanel.py プロジェクト: bitsworking/blink-cocoa
 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)
コード例 #17
0
    def end(self):
        if self.ended:
            return

        self.sessionController.log_debug("End %s" % self)
        self.ended = True

        if self.sessionController.waitingForLocalVideo:
            self.stop_wait_for_camera_timer()
            self.sessionController.cancelBeforeDNSLookup()

        if self.sessionController.video_consumer == "audio":
            NSApp.delegate().contactsWindowController.detachVideo(
                self.sessionController)
        elif self.sessionController.video_consumer == "chat":
            NSApp.delegate().chatWindowController.detachVideo(
                self.sessionController)

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

        self.removeFromSession()

        self.videoRecorder.stop()

        self.videoWindowController.close()

        self.notification_center.remove_observer(
            self,
            sender=self.sessionController,
            name='VideoRemovedByRemoteParty')

        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)
コード例 #18
0
    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()
コード例 #19
0
    def _NH_MediaStreamDidStart(self, sender, data):
        self.started = True
        sample_rate = self.stream.sample_rate / 1000
        codec = beautify_video_codec(self.stream.codec)
        self.sessionController.log_info(
            "Video stream established to %s:%s using %s codec" %
            (self.stream.remote_rtp_address, self.stream.remote_rtp_port,
             codec))

        self.changeStatus(STREAM_CONNECTED)
        self.sessionController.setVideoConsumer(
            self.sessionController.video_consumer)

        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)
コード例 #20
0
    def __init__(self, owner):
        BlinkLogger().log_debug('Starting Ringtone Manager')
        self.owner = owner
        notification_center = NotificationCenter()
        notification_center.add_observer(self, name="BlinkFileTransferDidEnd")
        notification_center.add_observer(self,
                                         name="RTPStreamDidChangeHoldState")
        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.update_ringtones()
コード例 #21
0
    def startOutgoing(self, is_update):
        if self.videoWindowController:
            self.videoWindowController.initLocalVideoWindow()

        self.ended = False
        self.notification_center.add_observer(self, sender=self.stream)
        self.notification_center.add_observer(self,
                                              sender=self.sessionController)
        self.notification_center.add_observer(self,
                                              sender=self.sessionController,
                                              name='VideoRemovedByRemoteParty')
        if is_update and self.sessionController.canProposeMediaStreamChanges():
            self.changeStatus(STREAM_PROPOSING)
        else:
            self.changeStatus(STREAM_WAITING_DNS_LOOKUP)

        self.wait_for_camera_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
            5.0, self, "localVideoReadyTimer:", None, False)
        NSRunLoop.currentRunLoop().addTimer_forMode_(
            self.wait_for_camera_timer, NSRunLoopCommonModes)
        NSRunLoop.currentRunLoop().addTimer_forMode_(
            self.wait_for_camera_timer, NSEventTrackingRunLoopMode)
コード例 #22
0
    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()
コード例 #23
0
    def captureButtonClicked_(self, sender):
        if self.countdownCheckbox.state() == NSOnState:
            self.countdown_counter = 5
            self.previewButton.setHidden_(True)
            self.captureButton.setHidden_(True)
            self.countdownCheckbox.setHidden_(True)
            self.mirrorButton.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.mirrorButton.setHidden_(True)
            self.countdownProgress.setHidden_(True)
            self.executeCapture()
コード例 #24
0
    def importButtonClicked_(self, sender):
        BlinkLogger().log_info("Import private key")
        pincode = str(self.pincode.stringValue()).strip()
        data = self.encryptedKeyPair.decode()
        keyPair = self.decrypt(data, pincode)

        try:
            keyPair = keyPair.decode()
        except UnicodeDecodeError as e:
            self.status.setTextColor_(NSColor.redColor())
            BlinkLogger().log_error("Import private key failed: %s" % str(e))
            self.status.setStringValue_(
                NSLocalizedString("Key import failed", "status label"))
        else:
            public_key_checksum_match = re.findall(
                r"--PUBLIC KEY SHA1 CHECKSUM--(\w+)--", keyPair)
            private_key_checksum_match = re.findall(
                r"--PRIVATE KEY SHA1 CHECKSUM--(\w+)--", keyPair)

            if (public_key_checksum_match):
                public_key_checksum = public_key_checksum_match[0]
            else:
                public_key_checksum = None

            if (private_key_checksum_match):
                private_key_checksum = private_key_checksum_match[0]
            else:
                private_key_checksum = None

            public_key = ''
            private_key = ''

            start_public = False
            start_private = False

            for l in keyPair.split("\n"):
                if l == "-----BEGIN RSA PUBLIC KEY-----":
                    start_public = True
                    start_private = False

                if l == "-----END RSA PUBLIC KEY-----":
                    public_key = public_key + l
                    start_public = False
                    start_private = False

                if l == "-----BEGIN RSA PRIVATE KEY-----":
                    start_public = False
                    start_private = True

                if l == "-----END RSA PRIVATE KEY-----":
                    private_key = private_key + l
                    start_public = False
                    start_private = False

                if start_public:
                    public_key = public_key + l + '\n'

                if start_private:
                    private_key = private_key + l + '\n'

            if (public_key and private_key and public_key_checksum):
                self.importButton.setEnabled_(False)
                BlinkLogger().log_info("Key imported sucessfully")
                self.status.setTextColor_(NSColor.greenColor())
                self.status.setStringValue_(
                    NSLocalizedString("Key imported sucessfully",
                                      "status label"))
                self.checksum.setStringValue_(public_key_checksum)

                self.account.sms.private_key = private_key
                self.account.sms.public_key = public_key
                self.account.sms.public_key_checksum = public_key_checksum
                self.account.save()

                if self.dealloc_timer is None:
                    self.dealloc_timer = NSTimer.timerWithTimeInterval_target_selector_userInfo_repeats_(
                        6.0, self, "deallocTimer:", None, True)
                    NSRunLoop.currentRunLoop().addTimer_forMode_(
                        self.dealloc_timer, NSRunLoopCommonModes)
                    NSRunLoop.currentRunLoop().addTimer_forMode_(
                        self.dealloc_timer, NSEventTrackingRunLoopMode)

            else:
                BlinkLogger().log_error("Key import failed")
                self.status.setStringValue_(
                    NSLocalizedString("Key import failed", "status label"))
                self.status.setTextColor_(NSColor.redColor())
コード例 #25
0
ファイル: AlertPanel.py プロジェクト: bitsworking/blink-cocoa
 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)
コード例 #26
0
 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)
コード例 #27
0
 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)
コード例 #28
0
    def __init__(self, sessionController):

        self.notification_center = NotificationCenter()
        self.notification_center.add_observer(
            self, name='CFGSettingsObjectDidChange')

        self.sessionController = None
        self.audio_stream = None
        self.video_stream = None
        self.chat_stream = None

        self.add_session(sessionController)
        self.add_audio_stream()
        self.add_video_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_(
            NSLocalizedString("SIP Session", "Label"),
            NSDictionary.dictionaryWithObject_forKey_(
                NSColor.orangeColor(), NSForegroundColorAttributeName))
        self.sessionBox.setTitle_(sessionBoxTitle)

        audioBoxTitle = NSAttributedString.alloc().initWithString_attributes_(
            NSLocalizedString("Audio Stream", "Label"),
            NSDictionary.dictionaryWithObject_forKey_(
                NSColor.orangeColor(), NSForegroundColorAttributeName))
        self.audioBox.setTitle_(audioBoxTitle)

        videoBoxTitle = NSAttributedString.alloc().initWithString_attributes_(
            NSLocalizedString("Video Stream", "Label"),
            NSDictionary.dictionaryWithObject_forKey_(
                NSColor.orangeColor(), NSForegroundColorAttributeName))
        self.videoBox.setTitle_(videoBoxTitle)

        chatBoxTitle = NSAttributedString.alloc().initWithString_attributes_(
            NSLocalizedString("Chat Stream", "Label"),
            NSDictionary.dictionaryWithObject_forKey_(
                NSColor.orangeColor(), NSForegroundColorAttributeName))
        self.chatBox.setTitle_(chatBoxTitle)

        settings = SIPSimpleSettings()

        self.audio_rtt_graph.setLineWidth_(1.0)
        self.audio_rtt_graph.setLineSpacing_(1.0)
        self.audio_rtt_graph.setAboveLimit_(
            settings.gui.rtt_threshold)  # if higher show red color
        self.audio_rtt_graph.setMinimumHeigth_(settings.gui.rtt_threshold)

        self.audio_packet_loss_rx_graph.setLineWidth_(1.0)
        self.audio_packet_loss_rx_graph.setLineSpacing_(1.0)
        self.audio_packet_loss_rx_graph.setAboveLimit_(
            3)  # if higher than 3% show red color
        self.audio_packet_loss_rx_graph.setLineColor_(NSColor.greenColor())
        self.audio_packet_loss_rx_graph.setMinimumHeigth_(5)

        self.audio_packet_loss_tx_graph.setLineWidth_(1.0)
        self.audio_packet_loss_tx_graph.setLineSpacing_(1.0)
        self.audio_packet_loss_tx_graph.setAboveLimit_(
            3)  # if higher than 3% show red color
        self.audio_packet_loss_tx_graph.setLineColor_(NSColor.greenColor())
        self.audio_packet_loss_tx_graph.setMinimumHeigth_(5)

        self.rx_speed_graph.setLineWidth_(1.0)
        self.rx_speed_graph.setLineSpacing_(0.0)
        self.rx_speed_graph.setLineColor_(NSColor.greenColor())
        self.rx_speed_graph.setMinimumHeigth_(100000)
        self.rx_speed_graph.setAboveLimit_(120000)

        self.tx_speed_graph.setLineWidth_(1.0)
        self.tx_speed_graph.setLineSpacing_(0.0)
        self.tx_speed_graph.setLineColor_(NSColor.blueColor())
        self.tx_speed_graph.setMinimumHeigth_(100000)
        self.tx_speed_graph.setAboveLimit_(120000)

        self.video_rx_speed_graph.setLineWidth_(1.0)
        self.video_rx_speed_graph.setLineSpacing_(0.0)
        self.video_rx_speed_graph.setLineColor_(NSColor.greenColor())
        self.video_rx_speed_graph.setMinimumHeigth_(100000)
        self.video_rx_speed_graph.setAboveLimit_(99999999)

        self.video_tx_speed_graph.setLineWidth_(1.0)
        self.video_tx_speed_graph.setLineSpacing_(0.0)
        self.video_tx_speed_graph.setLineColor_(NSColor.blueColor())
        self.video_tx_speed_graph.setMinimumHeigth_(100000)
        self.video_tx_speed_graph.setAboveLimit_(99999999)

        self.resetSession()
        self.updatePanelValues()