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


Python Resources.get方法代码示例

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


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

示例1: updateEncryptionLock

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def updateEncryptionLock(self, msgid, encryption=None):
        if encryption is None:
            return

        if encryption == '':
            lock_icon_path = Resources.get('unlocked-darkgray.png')
        else:
            lock_icon_path = Resources.get('locked-green.png' if encryption == 'verified' else 'locked-red.png')
        script = "updateEncryptionLock('%s','%s')" % (msgid, lock_icon_path)
        self.executeJavaScript(script)
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:12,代码来源:ChatViewController.py

示例2: play_hangup

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def play_hangup(self):
        settings = SIPSimpleSettings()

        if settings.audio.silent:
            return

        if time.time() - self.last_hangup_tone_time > HANGUP_TONE_THROTLE_DELAY:
            hangup_tone = WavePlayer(SIPApplication.voice_audio_mixer, Resources.get('hangup_tone.wav'), volume=30)
            NotificationCenter().add_observer(self, sender=hangup_tone, name="WavePlayerDidEnd")
            SIPApplication.voice_audio_bridge.add(hangup_tone)
            hangup_tone.start()
            self.last_hangup_tone_time = time.time()
开发者ID:wilane,项目名称:blink-cocoa,代码行数:14,代码来源:SessionRinger.py

示例3: showMessage

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def showMessage(self, call_id, msgid, direction, sender, icon_path, text, timestamp, is_html=False, state='', recipient='', is_private=False, history_entry=False, media_type='chat', encryption=None):
        lock_icon_path = ''
        if encryption is not None:
            if encryption == '':
                lock_icon_path = Resources.get('unlocked-darkgray.png')
            else:
                lock_icon_path = Resources.get('locked-green.png' if encryption == 'verified' else 'locked-red.png')

        if not history_entry and not self.delegate.isOutputFrameVisible():
            self.delegate.showChatViewWhileVideoActive()

        # keep track of rendered messages to toggle the smileys or search their content later
        rendered_message = ChatMessageObject(call_id, msgid, text, is_html, timestamp, media_type)
        self.rendered_messages.append(rendered_message)

        if timestamp.date() != datetime.date.today():
            displayed_timestamp = time.strftime("%F %T", time.localtime(calendar.timegm(timestamp.utctimetuple())))
        else:
            displayed_timestamp = time.strftime("%T", time.localtime(calendar.timegm(timestamp.utctimetuple())))

        text = processHTMLText(text, self.expandSmileys, is_html)
        private = 1 if is_private else "null"

        if is_private and recipient:
            label = 'Private message to %s' % cgi.escape(recipient) if direction == 'outgoing' else 'Private message from %s' % cgi.escape(sender)
        else:
            if hasattr(self.delegate, "sessionController"):
                label = cgi.escape(self.delegate.sessionController.nickname or self.account.display_name or self.account.id) if sender is None else cgi.escape(sender)
            else:
                label = cgi.escape(self.account.display_name or self.account.id) if sender is None else cgi.escape(sender)

        script = """renderMessage('%s', '%s', '%s', '%s', "%s", '%s', '%s', %s, '%s')""" % (msgid, direction, label, icon_path, text, displayed_timestamp, state, private, lock_icon_path)

        if self.finishedLoading:
            self.executeJavaScript(script)
        else:
            self.messageQueue.append(script)

        if hasattr(self.delegate, "chatViewDidGetNewMessage_"):
            self.delegate.chatViewDidGetNewMessage_(self)
开发者ID:uditha-atukorala,项目名称:blink,代码行数:42,代码来源:ChatViewController.py

示例4: init_configurations

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def init_configurations(self):
        account_manager = AccountManager()
        settings = SIPSimpleSettings()

        self.notification_center.add_observer(self, sender=settings)

        # fixup default account
        self._selected_account = account_manager.default_account
        if self._selected_account is None:
            self._selected_account = account_manager.get_accounts()[0]

        default_ca = open(Resources.get('ca.crt'), "r").read().strip()
        self.set_default_certificate_authority(default_ca)
开发者ID:wilane,项目名称:blink-cocoa,代码行数:15,代码来源:SIPManager.py

示例5: init_configurations

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def init_configurations(self):
        account_manager = AccountManager()
        settings = SIPSimpleSettings()

        # fixup default account
        self._selected_account = account_manager.default_account
        if self._selected_account is None:
            self._selected_account = account_manager.get_accounts()[0]

        # save default ca if needed
        ca = open(Resources.get('ca.crt'), "r").read().strip()
        try:
            X509Certificate(ca)
        except GNUTLSError, e:
            BlinkLogger().log_error(u"Invalid Certificate Authority: %s" % e)
            return
开发者ID:uditha-atukorala,项目名称:blink,代码行数:18,代码来源:SIPManager.py

示例6: __init__

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def __init__(self, session, audio_stream):
        self.session = session
        self.stream = audio_stream
        self.start_time = None

        notification_center = NotificationCenter()
        notification_center.add_observer(self, sender=self.stream)

        self.beep = WavePlayer(SIPApplication.voice_audio_mixer, Resources.get('answering_machine_tone.wav'))
        notification_center.add_observer(self, sender=self.beep)

        message_wav = SIPSimpleSettings().answering_machine.unavailable_message
        if message_wav:
            self.unavailable_message = WavePlayer(SIPApplication.voice_audio_mixer, message_wav.sound_file.path, message_wav.sound_file.volume, 1, 2, False)
            notification_center.add_observer(self, sender=self.unavailable_message)
            self.stream.bridge.add(self.unavailable_message)
        else:
            self.unavailable_message = None
            self.stream.bridge.add(self.beep)

        self.stream.device.input_muted = True
开发者ID:uditha-atukorala,项目名称:blink,代码行数:23,代码来源:AnsweringMachine.py

示例7: update_ringtones

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def update_ringtones(self, account=None):
        settings = SIPSimpleSettings()

        if account is None:
            account = AccountManager().default_account

        app = SIPApplication()

        def change_tone(name, new_tone):
            current = getattr(self, name)
            if current and current.is_active:
                current.stop()
                if new_tone:
                    new_tone.start()
            setattr(self, name, new_tone)

        change_tone("initial_hold_tone", WavePlayer(app.voice_audio_mixer, Resources.get('hold_tone.wav'), volume=10))
        app.voice_audio_bridge.add(self.initial_hold_tone)
        change_tone("secondary_hold_tone", WavePlayer(app.voice_audio_mixer, Resources.get('hold_tone.wav'), loop_count=0, pause_time=45, volume=10, initial_play=False))
        app.voice_audio_bridge.add(self.secondary_hold_tone)

        if account:
            audio_primary_ringtone = account.sounds.audio_inbound.sound_file if account.sounds.audio_inbound is not None else None
        else:
            audio_primary_ringtone = None

        if audio_primary_ringtone and not settings.audio.silent:
            # Workaround not to use same device from two bridges. -Saul
            if settings.audio.alert_device is not None and app.alert_audio_mixer.real_output_device == app.voice_audio_mixer.real_output_device:
                new_tone = WavePlayer(app.voice_audio_mixer, audio_primary_ringtone.path, loop_count=0, pause_time=6)
                app.voice_audio_bridge.add(new_tone)
            else:
                new_tone = WavePlayer(app.alert_audio_mixer, audio_primary_ringtone.path, loop_count=0, pause_time=6)
                app.alert_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("audio_primary_ringtone", new_tone)

        if audio_primary_ringtone and not settings.audio.silent:
            new_tone = WavePlayer(app.voice_audio_mixer, Resources.get('ring_tone.wav'), loop_count=0, pause_time=6)
            app.voice_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("audio_secondary_ringtone", new_tone)

        if audio_primary_ringtone and not settings.audio.silent:
            # Workaround not to use same device from two bridges. -Saul
            if settings.audio.alert_device is not None and app.alert_audio_mixer.real_output_device == app.voice_audio_mixer.real_output_device:
                new_tone = WavePlayer(app.voice_audio_mixer, Resources.get('ring_tone.wav'), loop_count=0, pause_time=6)
                app.voice_audio_bridge.add(new_tone)
            else:
                new_tone = WavePlayer(app.alert_audio_mixer, Resources.get('ring_tone.wav'), loop_count=0, pause_time=6)
                app.alert_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("chat_primary_ringtone", new_tone)

        if audio_primary_ringtone and not settings.audio.silent:
            new_tone = WavePlayer(app.voice_audio_mixer, Resources.get('ring_tone.wav'), loop_count=0, pause_time=6)
            app.voice_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("chat_secondary_ringtone", new_tone)

        chat_message_outgoing_sound = settings.sounds.message_sent
        if chat_message_outgoing_sound and not settings.audio.silent:
            new_tone = WavePlayer(app.voice_audio_mixer, chat_message_outgoing_sound.path, volume=chat_message_outgoing_sound.volume)
            app.voice_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("chat_message_outgoing_sound", new_tone)

        chat_message_incoming_sound = settings.sounds.message_received
        if chat_message_incoming_sound and not settings.audio.silent:
            new_tone = WavePlayer(app.voice_audio_mixer, chat_message_incoming_sound.path, volume=chat_message_incoming_sound.volume)
            app.voice_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("chat_message_incoming_sound", new_tone)

        file_transfer_outgoing_sound = settings.sounds.file_sent
        if file_transfer_outgoing_sound and not settings.audio.silent:
            new_tone = WavePlayer(app.voice_audio_mixer, file_transfer_outgoing_sound.path, volume=file_transfer_outgoing_sound.volume)
            app.voice_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("file_transfer_outgoing_sound", new_tone)

        file_transfer_incoming_sound = settings.sounds.file_received
        if file_transfer_incoming_sound and not settings.audio.silent:
            new_tone = WavePlayer(app.voice_audio_mixer, file_transfer_incoming_sound.path, volume=file_transfer_incoming_sound.volume)
            app.voice_audio_bridge.add(new_tone)
        else:
            new_tone = None
        change_tone("file_transfer_incoming_sound", new_tone)
开发者ID:wilane,项目名称:blink-cocoa,代码行数:97,代码来源:SessionRinger.py

示例8: showMessage

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
    def showMessage(self, call_id, msgid, direction, sender, icon_path, text, timestamp, is_html=False, state='', recipient='', is_private=False, history_entry=False, media_type='chat', encryption=None):
        lock_icon_path = Resources.get('unlocked-darkgray.png')
        if encryption is not None:
            if encryption == '':
                lock_icon_path = Resources.get('unlocked-darkgray.png')
            else:
                lock_icon_path = Resources.get('locked-green.png' if encryption == 'verified' else 'locked-red.png')

        if self.last_sender == sender:
            icon_path = "null"
        else:
            icon_path = "'%s'" % icon_path

        self.last_sender = sender

        if not history_entry and not self.delegate.isOutputFrameVisible():
            self.delegate.showChatViewWhileVideoActive()

        # keep track of rendered messages to toggle the smileys or search their content later
        rendered_message = ChatMessageObject(call_id, msgid, text, is_html, timestamp, media_type)
        self.rendered_messages.append(rendered_message)

        if timestamp.date() != datetime.date.today():
            displayed_timestamp = time.strftime("%F %T", time.localtime(calendar.timegm(timestamp.utctimetuple())))
        else:
            displayed_timestamp = time.strftime("%T", time.localtime(calendar.timegm(timestamp.utctimetuple())))

        if is_html:
            # urlify links
            soup = BeautifulSoup(text)
            ps = soup.find_all('p')
            for p in ps:
                if not p.string:
                    continue
                ptext = p.string.strip()
                p.clear()
                tokens = _url_pattern.split(ptext)
                for token in tokens:
                    if _url_pattern.match(token):
                        new_tag = soup.new_tag("a", href=token)
                        new_tag.string = token
                        p.append(new_tag)
                    else:
                        p.append(token)

            text = soup.prettify()

        text = processHTMLText(text, self.expandSmileys, is_html)
        private = 1 if is_private else "null"

        if is_private and recipient:
            label = NSLocalizedString("Private message to %s", "Label") % cgi.escape(recipient) if direction == 'outgoing' else NSLocalizedString("Private message from %s", "Label") % cgi.escape(sender)
        else:
            if hasattr(self.delegate, "sessionController"):
                label = cgi.escape(self.delegate.sessionController.nickname or self.account.display_name or self.account.id) if sender is None else cgi.escape(sender)
            else:
                label = cgi.escape(self.account.display_name or self.account.id) if sender is None else cgi.escape(sender)

        script = """renderMessage('%s', '%s', '%s', %s, "%s", '%s', '%s', %s, '%s', '%s')""" % (msgid, direction, label, icon_path, text, displayed_timestamp, state, private, lock_icon_path, self.previous_msgid)

        if self.finishedLoading:
            self.executeJavaScript(script)
        else:
            self.messageQueue.append(script)

        if hasattr(self.delegate, "chatViewDidGetNewMessage_"):
            self.delegate.chatViewDidGetNewMessage_(self)

        self.previous_msgid = msgid
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:71,代码来源:ChatViewController.py

示例9: _get_path

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
 def _get_path(self):
     return Resources.get(self.__dict__['path'])
开发者ID:uditha-atukorala,项目名称:blink,代码行数:4,代码来源:datatypes.py

示例10: sound_file

# 需要导入模块: from resources import Resources [as 别名]
# 或者: from resources.Resources import get [as 别名]
 def sound_file(self):
     if isinstance(self._sound_file, self.DefaultSoundFile):
         return UserSoundFile(Resources.get(self._sound_file.setting))
     else:
         return self._sound_file
开发者ID:uditha-atukorala,项目名称:blink,代码行数:7,代码来源:datatypes.py


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