當前位置: 首頁>>代碼示例>>Python>>正文


Python NSDictionary.dictionaryWithObject_forKey_方法代碼示例

本文整理匯總了Python中Foundation.NSDictionary.dictionaryWithObject_forKey_方法的典型用法代碼示例。如果您正苦於以下問題:Python NSDictionary.dictionaryWithObject_forKey_方法的具體用法?Python NSDictionary.dictionaryWithObject_forKey_怎麽用?Python NSDictionary.dictionaryWithObject_forKey_使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Foundation.NSDictionary的用法示例。


在下文中一共展示了NSDictionary.dictionaryWithObject_forKey_方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: awakeFromNib

# 需要導入模塊: from Foundation import NSDictionary [as 別名]
# 或者: from Foundation.NSDictionary import dictionaryWithObject_forKey_ [as 別名]
 def awakeFromNib(self):
     smileys = SmileyManager().get_smiley_list()
     menu = self.smileyButton.menu()
     while menu.numberOfItems() > 0:
         menu.removeItemAtIndex_(0)
     bigText = NSAttributedString.alloc().initWithString_attributes_(" ", NSDictionary.dictionaryWithObject_forKey_(NSFont.systemFontOfSize_(16), NSFontAttributeName))
     for text, file in smileys:
         image = NSImage.alloc().initWithContentsOfFile_(file)
         if not image:
             print "cant load %s"%file
             continue
         image.setScalesWhenResized_(True)
         image.setSize_(NSMakeSize(16, 16))
         atext = bigText.mutableCopy()
         atext.appendAttributedString_(NSAttributedString.alloc().initWithString_(text))
         item = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_(text, "insertSmiley:", "")
         menu.addItem_(item)
         item.setTarget_(self)
         item.setAttributedTitle_(atext)
         item.setRepresentedObject_(NSAttributedString.alloc().initWithString_(text))
         item.setImage_(image)
開發者ID:uditha-atukorala,項目名稱:blink,代碼行數:23,代碼來源:ChatPrivateMessageController.py

示例2: idealWidth

# 需要導入模塊: from Foundation import NSDictionary [as 別名]
# 或者: from Foundation.NSDictionary import dictionaryWithObject_forKey_ [as 別名]
    def idealWidth(self):
        attribs = NSDictionary.dictionaryWithObject_forKey_(NSFont.systemFontOfSize_(11), NSFontAttributeName)
        size = self.label.sizeWithAttributes_(attribs)

        return size.width + 14 + 20
開發者ID:bitsworking,項目名稱:blink-cocoa,代碼行數:7,代碼來源:FancyTabSwitcher.py

示例3: append_error_line

# 需要導入模塊: from Foundation import NSDictionary [as 別名]
# 或者: from Foundation.NSDictionary import dictionaryWithObject_forKey_ [as 別名]
 def append_error_line(self, textView, line):
     red = NSDictionary.dictionaryWithObject_forKey_(NSColor.redColor(), NSForegroundColorAttributeName)
     textView.textStorage().appendAttributedString_(NSAttributedString.alloc().initWithString_attributes_(line+"\n", red))
     textView.scrollRangeToVisible_(NSMakeRange(textView.textStorage().length()-1, 1))
開發者ID:uditha-atukorala,項目名稱:blink,代碼行數:6,代碼來源:DebugWindow.py

示例4: updateButtons

# 需要導入模塊: from Foundation import NSDictionary [as 別名]
# 或者: from Foundation.NSDictionary import dictionaryWithObject_forKey_ [as 別名]
    def updateButtons(self):
        for button in (self.holdButton, self.hangupButton, self.chatButton, self.infoButton, self.muteButton, self.aspectButton, self.contactsButton, self.fullscreenButton, self.myvideoButton, self.pauseButton):

            lightGrayTitle = NSAttributedString.alloc().initWithString_attributes_(button.label(), NSDictionary.dictionaryWithObject_forKey_(NSColor.lightGrayColor(), NSForegroundColorAttributeName))
            button.setLabel_(lightGrayTitle)
開發者ID:bitsworking,項目名稱:blink-cocoa,代碼行數:7,代碼來源:VideoControlPanel.py

示例5: __init__

# 需要導入模塊: from Foundation import NSDictionary [as 別名]
# 或者: from Foundation.NSDictionary import dictionaryWithObject_forKey_ [as 別名]
    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_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.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_(1200000)

        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_(1200000)

        self.resetSession()
        self.updatePanelValues()
開發者ID:bitsworking,項目名稱:blink-cocoa,代碼行數:73,代碼來源:SessionInfoController.py


注:本文中的Foundation.NSDictionary.dictionaryWithObject_forKey_方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。