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


Python NSBundle.loadNibFile_externalNameTable_withZone_方法代码示例

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


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

示例1: executeVanillaTest

# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import loadNibFile_externalNameTable_withZone_ [as 别名]
def executeVanillaTest(cls, nibPath=None, calls=None, **kwargs):
    """
    Execute a Vanilla UI class in a mini application.
    """
    app = NSApplication.sharedApplication()
    delegate = _VanillaMiniAppDelegate.alloc().init()
    app.setDelegate_(delegate)

    if nibPath:
        NSBundle.loadNibFile_externalNameTable_withZone_(nibPath, {}, None)
    else:
        mainMenu = NSMenu.alloc().initWithTitle_("Vanilla Test")

        fileMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_("File", None, "")
        fileMenu = NSMenu.alloc().initWithTitle_("File")
        fileMenuItem.setSubmenu_(fileMenu)
        mainMenu.addItem_(fileMenuItem)

        editMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_("Edit", None, "")
        editMenu = NSMenu.alloc().initWithTitle_("Edit")
        editMenuItem.setSubmenu_(editMenu)
        mainMenu.addItem_(editMenuItem)

        helpMenuItem = NSMenuItem.alloc().initWithTitle_action_keyEquivalent_("Help", None, "")
        helpMenu = NSMenu.alloc().initWithTitle_("Help")
        helpMenuItem.setSubmenu_(helpMenu)
        mainMenu.addItem_(helpMenuItem)

        app.setMainMenu_(mainMenu)

    if cls is not None:
        cls(**kwargs)

    if calls is not None:
        for call, kwargs in calls:
            call(**kwargs)

    app.activateIgnoringOtherApps_(True)
    AppHelper.runEventLoop()
开发者ID:LettError,项目名称:vanilla,代码行数:41,代码来源:testTools.py

示例2: install

# 需要导入模块: from AppKit import NSBundle [as 别名]
# 或者: from AppKit.NSBundle import loadNibFile_externalNameTable_withZone_ [as 别名]
#   http://twistedmatrix.com/documents/13.0.0/api/twisted.internet._threadedselect.html
#
#
import os
from PyObjCTools import AppHelper
from AppKit import NSApplication, NSApp, NSBundle, NSLog  # @UnresolvedImport
import objc

objc.setVerbose(True)  # @UndefinedVariable

# Specialized reactor for integrating with arbitrary foreign event loop, such as those you find in GUI toolkits.
from twisted.internet._threadedselect import install

reactor = install()

# import modules containing classes required to start application and load MainMenu.nib
import XierpaAppDelegate

app = NSApplication.sharedApplication()
nibPath = os.path.join(
    os.path.dirname(__file__), "dist", "Xierpa3.app", "Contents", "Resources", "en.lproj", "MainMenu.nib"
)
NSBundle.loadNibFile_externalNameTable_withZone_(nibPath, {}, None)  # @UndefinedVariable
delegate = XierpaAppDelegate.XierpaAppDelegate.alloc().init()  # @UndefinedVariable
app.setDelegate_(delegate)

# Bring app to top
NSApp.activateIgnoringOtherApps_(True)

AppHelper.runEventLoop()
开发者ID:petrvanblokland,项目名称:Xierpa3App,代码行数:32,代码来源:run.py


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