本文整理汇总了Python中AppKit.NSBundle.bundleWithIdentifier_方法的典型用法代码示例。如果您正苦于以下问题:Python NSBundle.bundleWithIdentifier_方法的具体用法?Python NSBundle.bundleWithIdentifier_怎么用?Python NSBundle.bundleWithIdentifier_使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AppKit.NSBundle
的用法示例。
在下文中一共展示了NSBundle.bundleWithIdentifier_方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: initialize
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
def initialize(cls):
# Register ourselves as a Mail.app plugin and add an entry for our
# 'Fill Text' and Wrap Text' actions to the Edit menu.
application = NSApplication.sharedApplication()
bundle = NSBundle.bundleWithIdentifier_('uk.me.cdw.MailWrap')
cls.registerBundle()
editmenu = application.mainMenu().itemAtIndex_(2).submenu()
editmenu.addItem_(NSMenuItem.separatorItem())
mask = NSCommandKeyMask | NSAlternateKeyMask
editmenu.addItemWithTitle_action_keyEquivalent_('Fill Text',
'fillText', '\\').setKeyEquivalentModifierMask_(mask)
mask = NSCommandKeyMask
editmenu.addItemWithTitle_action_keyEquivalent_('Wrap Text',
'wrapText', "\\").setKeyEquivalentModifierMask_(mask)
# Read our configuration settings if present. Otherwise, set the
# correct default values.
defaults = NSUserDefaults.standardUserDefaults()
defaults = defaults.dictionaryForKey_('MailWrap') or {}
ComposeViewController._fixAttribution = defaults.get('FixAttribution', False)
EditingMessageWebView._bulletLists = defaults.get('BulletLists', True)
EditingMessageWebView._indentWidth = int(defaults.get('IndentWidth', 2))
EditingMessageWebView._wrapWidth = int(defaults.get('WrapWidth', 72))
# Report the plugin name and version to the com.apple.mail log.
version = bundle.objectForInfoDictionaryKey_('CFBundleVersion')
NSLog('Loaded MailWrap %s' % version)
示例2: initWithApp_
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
def initWithApp_(self, app):
self = super(Menu, self).init()
if self is None:
return None
self.app = app
self.mainwindow = NSApplication.sharedApplication().mainWindow()
self.bundle = NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix')
return self
示例3: init
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
def init(self):
bundle = NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix')
nib = bundle.loadNibNamed_owner_topLevelObjects_('QuoteFixPreferencesModule', self, None)
if not nib or nib[0] < 1:
raise AssertionError('unable to load nib')
nib[1].retain()
self.view = filter(lambda _: isinstance(_, NSBox), nib[1])[0]
self.setMinSize_(self.view.boundsSize())
self.setPreferencesView_(self.view)
return self
示例4: awakeFromNib
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
def awakeFromNib(self):
self.currentVersionUpdater.setStringValue_(self.app.version)
self.updateInterval.setSelectedSegment_(self.app.check_update_interval)
self.setLastUpdateCheck()
# set donate image
bundle = NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix')
path = bundle.pathForResource_ofType_("donate", "gif")
image = NSImage.alloc().initByReferencingFile_(path)
self.donateButton.setImage_(image)
# check custom signature matcher
self.check_signature_matcher(self.customSignatureMatcher)
self.customSignatureMatcherDefault.setStringValue_(self.app.default_signature_matcher)
# set attribution previews
self.set_preview(self.customReplyAttribution)
self.set_preview(self.customForwardingAttribution)
self.set_preview(self.customSendAgainAttribution)
示例5: initialize
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
def initialize(cls):
# instantiate updater
updater = Updater()
# register ourselves
objc.runtime.MVMailBundle.registerBundle()
# extract plugin version from Info.plist
bundle = NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix')
version = bundle.infoDictionary().get('CFBundleVersion', '??')
# initialize app
app = App(version, updater)
# initialize our posing classes with app instance
DocumentEditor.registerQuoteFixApplication(app)
MessageHeaders.registerQuoteFixApplication(app)
MailApp.registerQuoteFixApplication(app)
QuoteFixPreferencesController.registerQuoteFixApplication(app)
CustomizedAttribution.registerQuoteFixApplication(app)
# announce that we have loaded
NSLog("QuoteFix Plugin (version %s) registered with Mail.app" % version)
示例6: init
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
def init(self):
context = { NSNibTopLevelObjects : [] }
nib = NSNib.alloc().initWithNibNamed_bundle_("QuoteFixPreferencesModule.nib", NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix'))
inited = nib.instantiateNibWithExternalNameTable_(context)
self.view = filter(lambda _: isinstance(_, NSBox), context[NSNibTopLevelObjects])[0]
self.setMinSize_(self.view.boundsSize())
self.setPreferencesView_(self.view)
return self
示例7: __init__
# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import bundleWithIdentifier_ [as 别名]
from AppKit import NSBundle, NSObject
from Foundation import NSLog
from datetime import datetime
from logger import logger
import objc, os, os.path
# load Sparkle framework
BUNDLE = NSBundle.bundleWithIdentifier_('name.klep.mail.QuoteFix')
frameworkspath = BUNDLE.privateFrameworksPath()
sparklepath = os.path.join(frameworkspath, 'Sparkle.framework')
sparkle = dict() # use 'private' storage to keep Sparkle classes in
objc.loadBundle('Sparkle', sparkle, bundle_path = sparklepath)
class Updater:
def __init__(self):
# instantiate Sparkle updater
try:
self.updater = sparkle['SUUpdater'].updaterForBundle_(BUNDLE)
except:
NSLog("QuoteFix: updater error - cannot initialize the updater for QuoteFix. This usually happens because of compatibility issues between Mail plugins. Updates are disabled, but QuoteFix should function normally.")
self.enabled = False
return
# set delegate
self.updater.setDelegate_(UpdaterDelegate.alloc().init().retain())
# reset update cycle
self.updater.resetUpdateCycle()
# updates are enabled