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


Python NSMutableDictionary.dictionary方法代码示例

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


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

示例1: _common_init

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
 def _common_init(self):
     """_common_init"""
     
     self.userNS = NSMutableDictionary.dictionary()
     self.waitingForEngine = False
     
     self.lines = {}
     self.tabSpaces = 4
     self.tabUsesSpaces = True
     self.currentBlockID = self.next_block_ID()
     self.blockRanges = {} # blockID=>CellBlock
开发者ID:dhomeier,项目名称:ipython-py3k,代码行数:13,代码来源:cocoa_frontend.py

示例2: getItemView

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
 def getItemView(self):
     array = NSMutableArray.array()
     context = NSMutableDictionary.dictionary()
     context.setObject_forKey_(self, NSNibOwner)
     context.setObject_forKey_(array, NSNibTopLevelObjects)
     path = NSBundle.mainBundle().pathForResource_ofType_("AlertPanelView", "nib")
     if not NSBundle.loadNibFile_externalNameTable_withZone_(path, context, self.zone()):
         raise RuntimeError("Internal Error. Could not find AlertPanelView.nib")
     for obj in array:
         if isinstance(obj, NSBox):
             return obj
     else:
         raise RuntimeError("Internal Error. Could not find NSBox in AlertPanelView.nib")
开发者ID:bitsworking,项目名称:blink-cocoa,代码行数:15,代码来源:AlertPanel.py

示例3: createMovFile

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
def createMovFile(fullfilepath):
	MEDIA_SPECS = [																										### specs in media header
		'QTMovieCurrentSizeAttribute', 'QTMovieCreationTimeAttribute', 'QTMovieHasAudioAttribute',
		'QTMovieHasVideoAttribute', 'QTMovieTimeScaleAttribute']
	
	TRACK_SPECS = [																										### specs in track header
		'QTTrackDisplayNameAttribute', 'QTTrackBoundsAttribute',
		'QTTrackFormatSummaryAttribute', 'QTTrackIDAttribute', 'QTTrackMediaTypeAttribute']

	attribs = NSMutableDictionary.dictionary()
	attribs['QTMovieFileNameAttribute'] = fullfilepath
	
	file = nbc.NBCFile(fullfilepath)
	mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(attribs,objc.nil)										#init mov object
	if error:
		print error, file
	else:
		for track in mov.tracks():																						#pull individual tracks
			try:			
				tracktype = track.trackAttributes()['QTTrackMediaTypeAttribute']
				if (tracktype == TIMECODE):
					file.tctrack = track
				elif (tracktype == VIDEO):
					file.videotrack = track
					file.codec = 'PRH' #file.videotrack.trackAttributes()['QTTrackFormatSummaryAttribute']						#get codec
				elif (tracktype == AUDIO):
					file.audiotracks.append(track.trackAttributes()['QTTrackDisplayNameAttribute'])
				
			except KeyError, e:
				continue	
		try:
			frameRate = mov.duration()[1]												#set framerate
			duration = mov.duration()[0]
	#		print frameRate
			#print duration
			durMinutes = duration/frameRate/60														#get minutes of duration
			durSeconds = int((round(duration/frameRate/60.00,2)-(duration/frameRate/60))*60)		#get seconds of duration(fraction of minutes multiplied by 60 to get actual seconds)
			#print durMinutes
			##print durSeconds
			file.minutes = durMinutes
			file.seconds = durSeconds
			if ((frameRate == 2500) or (frameRate == 25)):
				file.timecode = 'E'
			if ((frameRate == 23976) or (frameRate == 24000)):
				file.timecode = 'P'
			if ((frameRate == 30000) or (frameRate == 2997)):
				file.timecode = 'D'
		except Exception, e:
			print e
开发者ID:Pescolly,项目名称:Metadata-Reading-and-Entry,代码行数:51,代码来源:PyQTMovie2.py

示例4: printAttributes

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
	def printAttributes(self):																							#print out various attributes
		attribs = NSMutableDictionary.dictionary()
		attribs['QTMovieFileNameAttribute'] = self.filename
		mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(attribs,objc.nil)
		if error:
			print error
		else:
			print 'Duration:',mov.duration()[0]/mov.duration()[1]/60.0
			for i in self.MEDIA_SPECS:
				print i,":", type(mov.movieAttributes()[i])
			for i in mov.tracks():
				for j in self.TRACK_SPECS:
					try:
						print i.trackAttributes()[j]
					except KeyError, e:
						continue	
开发者ID:Pescolly,项目名称:Metadata-Reading-and-Entry,代码行数:18,代码来源:pyqtmovie.py

示例5:

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
                 'a replacement items list. '
                 'Is this OS version supported?')

# Update entries that already exist
for item in items:
    replace = item.valueForKey_('replace')
    if importedData.has_key(replace):
        importedItem = importedData[replace]
        item.setObject_forKey_(importedItem['enabled'], 'on')
        item.setObject_forKey_(importedItem['replacement'], 'with')
        del importedData[replace]
        updated += 1

# Add new entries
for key, importedItem in importedData.iteritems():
    item = NSMutableDictionary.dictionary()
    item.setObject_forKey_(importedItem['enabled'], 'on')
    item.setObject_forKey_(key, 'replace')
    item.setObject_forKey_(importedItem['replacement'], 'with')
    items.addObject_(item)
    added += 1

# Update the preferences
prefs.setPersistentDomain_forName_(globalPrefs, '.GlobalPreferences')
prefs.synchronize()

# Release the preferences from memory
NSUserDefaults.resetStandardUserDefaults()

# Build notification userInfo object
userInfo = {}
开发者ID:ikonst,项目名称:mac-tex-substitutions,代码行数:33,代码来源:load.py

示例6: createMovFile

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
def createMovFile(fullfilepath):
	MEDIA_SPECS = [																										### specs in media header
		'QTMovieCurrentSizeAttribute', 'QTMovieCreationTimeAttribute', 'QTMovieHasAudioAttribute',
		'QTMovieHasVideoAttribute', 'QTMovieTimeScaleAttribute']
	
	TRACK_SPECS = [																										### specs in track header
		'QTTrackDisplayNameAttribute', 'QTTrackBoundsAttribute',
		'QTTrackFormatSummaryAttribute', 'QTTrackIDAttribute', 'QTTrackMediaTypeAttribute']

	attribs = NSMutableDictionary.dictionary()
	attribs['QTMovieFileNameAttribute'] = fullfilepath
	
	file = nbc.NBCFile(fullfilepath)
	mov, error = QTKit.QTMovie.alloc().initWithAttributes_error_(attribs,objc.nil)										#init mov object
	if error:
		print error
	else:
		for track in mov.tracks():																						#pull individual tracks
			try:			
				tracktype = track.trackAttributes()['QTTrackMediaTypeAttribute']
				if (tracktype == TIMECODE):
					file.tctrack = track
				elif (tracktype == VIDEO):
					file.videotrack = track
					file.codec = 'PRH' #file.videotrack.trackAttributes()['QTTrackFormatSummaryAttribute']						#get codec
				elif (tracktype == AUDIO):
					file.audiotracks.append(track.trackAttributes()['QTTrackDisplayNameAttribute'])
				
			except KeyError, e:
				continue	

		frameRate = mov.duration()[1]												#set framerate
		duration = mov.duration()[0]
		print frameRate
		#print duration
		durMinutes = duration/frameRate/60														#get minutes of duration
		durSeconds = int((round(duration/frameRate/60.00,2)-(duration/frameRate/60))*60)		#get seconds of duration(fraction of minutes multiplied by 60 to get actual seconds)
		#print durMinutes
		##print durSeconds
		file.minutes = durMinutes
		file.seconds = durSeconds
		if ((frameRate == 2500) or (frameRate == 25)):
			file.timecode = 'E'
		if (frameRate == 23976):
			file.timecode = 'P'
		if (frameRate == 30000):
			file.timecode = 'D'

		if (file.videotrack.currentSize().height > 1050 and file.videotrack.currentSize().height < 1110):				#set standard with height
			if (file.timecode == 'P'):
				file.standard = 3																						#MVIS CODES: 3 - 1080-2398
			if (file.timecode == 'E'):
				file.standard = 2																						#... 2 - 1080 50i
			if (file.timecode == 'D'):
				file.standard = 1																						#... 1 - 1080 5994i
		elif (file.videotrack.currentSize().height > 470 and file.videotrack.currentSize().height < 490):
			file.standard = 'N'																							#... N - NTSC
		elif (file.videotrack.currentSize().height > 560 and file.videotrack.currentSize().height < 590):
			file.standard = 'P'																							#... P - PAL
		else:
			file.standard = None
开发者ID:Pescolly,项目名称:Metadata-Reading-and-Entry,代码行数:63,代码来源:pyqtmovie-04-21-2014.py

示例7: vars

# 需要导入模块: from Foundation import NSMutableDictionary [as 别名]
# 或者: from Foundation.NSMutableDictionary import dictionary [as 别名]
from Foundation import NSMutableDictionary
from Foundation import NSMutableArray
if not PLIST_APPLICATION_INFO_LOCATION:
   print '[ERROR] Cannot find plist file %(PLIST_APPLICATION_INFO_LOCATION)'
   sys.exit(1)
application_info = NSMutableDictionary.dictionaryWithContentsOfFile_(PLIST_APPLICATION_INFO_LOCATION)
PLIST_BUNDLE_IDENTIFIER = application_info.objectForKey_('CFBundleIdentifier')
if PLIST_BUNDLE_IDENTIFIER_SUFFIX != '':
   PLIST_BUNDLE_IDENTIFIER = PLIST_BUNDLE_IDENTIFIER + PLIST_BUNDLE_IDENTIFIER_SUFFIX
PLIST_BUNDLE_VERSION = application_info.objectForKey_('CFBundleVersion')
print '[DEBUG] Bundle identifier = %(PLIST_BUNDLE_IDENTIFIER)s' % vars()
print '[DEBUG] Bundle version    = %(PLIST_BUNDLE_VERSION)s' % vars()


root = NSMutableDictionary.dictionary()
items = NSMutableArray.array()
root.setObject_forKey_(items,'items')
main_item = NSMutableDictionary.dictionary()
items.addObject_(main_item)

assets = NSMutableArray.array()
main_item['assets'] = assets

asset_item = NSMutableDictionary.dictionary()

assets.addObject_(asset_item)
asset_item['kind'] = 'software-package'
asset_item['url'] = IPA_URL

metadata = NSMutableDictionary.dictionary()
开发者ID:programming086,项目名称:cintegration,代码行数:32,代码来源:plist-creator.py


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