本文整理汇总了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)
示例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
示例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))
示例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)
示例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()