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