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


Python NSBundle.bundleWithIdentifier_方法代碼示例

本文整理匯總了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)
開發者ID:javigon,項目名稱:mailwrap,代碼行數:35,代碼來源:MailWrap.py

示例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
開發者ID:GLOP1978,項目名稱:quotefixformac,代碼行數:10,代碼來源:menu.py

示例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
開發者ID:robertklep,項目名稱:quotefixformac,代碼行數:12,代碼來源:preferences.py

示例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)
開發者ID:robertklep,項目名稱:quotefixformac,代碼行數:21,代碼來源:preferences.py

示例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)
開發者ID:ics-forks,項目名稱:quotefixformac,代碼行數:25,代碼來源:QuoteFix.py

示例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
開發者ID:ics-forks,項目名稱:quotefixformac,代碼行數:10,代碼來源:preferences.py

示例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
開發者ID:GLOP1978,項目名稱:quotefixformac,代碼行數:33,代碼來源:updater.py


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