本文整理汇总了Python中PyObjCTools.NibClassBuilder.extractClasses方法的典型用法代码示例。如果您正苦于以下问题:Python NibClassBuilder.extractClasses方法的具体用法?Python NibClassBuilder.extractClasses怎么用?Python NibClassBuilder.extractClasses使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyObjCTools.NibClassBuilder
的用法示例。
在下文中一共展示了NibClassBuilder.extractClasses方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OpenGLDemoView
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
This creates a directory "dist" containing OpenGLDemo.app. (The
-A option causes the files to be symlinked to the .app bundle instead
of copied. This means you don't have to rebuild the app if you edit the
sources or nibs.)
This example requires PyOpenGL
"""
from PyObjCTools import NibClassBuilder, AppHelper
from objc import getClassList, objc_object
from AppKit import *
from Foundation import *
from OpenGL.GL import *
NibClassBuilder.extractClasses("OpenGLDemo")
ClearColors = redIndex, greenIndex, blueIndex, alphaIndex = range(4)
class OpenGLDemoView(NibClassBuilder.AutoBaseClass):
def awakeFromNib(self):
self.color_index = alphaIndex
def initWithFrame_(self, frame):
attribs = [
NSOpenGLPFANoRecovery,
NSOpenGLPFAWindow,
NSOpenGLPFAAccelerated,
NSOpenGLPFADoubleBuffer,
NSOpenGLPFAColorSize, 24,
示例2: blit
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
FigureCanvasAgg.draw(self)
def blit(self, bbox):
pass
def start_event_loop(self,timeout):
FigureCanvasBase.start_event_loop_default(self,timeout)
start_event_loop.__doc__=FigureCanvasBase.start_event_loop_default.__doc__
def stop_event_loop(self):
FigureCanvasBase.stop_event_loop_default(self)
stop_event_loop.__doc__=FigureCanvasBase.stop_event_loop_default.__doc__
NibClassBuilder.extractClasses('Matplotlib.nib', mplBundle)
class MatplotlibController(NibClassBuilder.AutoBaseClass):
# available outlets:
# NSWindow plotWindow
# PlotView plotView
def awakeFromNib(self):
# Get a reference to the active canvas
NSApp().setDelegate_(self)
self.app = NSApp()
self.canvas = Gcf.get_active().canvas
self.plotView.canvas = self.canvas
self.canvas.plotView = self.plotView
self.plotWindow.setAcceptsMouseMovedEvents_(True)
示例3: MethodListController
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
import objc
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
NibClassBuilder.extractClasses( u"EYETest" )
class MethodListController(NibClassBuilder.AutoBaseClass):
searchString = None
def arrangeObjects_(self, objects):
supermethod = super(MethodListController, self).arrangeObjects_
if not self.searchString:
return supermethod(objects)
if len(self.searchString)==0:
return supermethod(objects)
sublist = []
for obj in objects:
for a in obj.keys():
if obj[a].find(self.searchString) !=-1:
sublist+=[obj]
break
return supermethod(sublist)
def performSearch_(self, sender):
self.searchString = unicode(sender.stringValue())
self.rearrangeObjects()
示例4: ASTranslateDocument
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
"""ASTranslate"""
import AppKit
from PyObjCTools import NibClassBuilder, AppHelper
import osascript
import eventformatter
NibClassBuilder.extractClasses("ASTranslateDocument")
_ci = osascript.Interpreter()
class ASTranslateDocument(NibClassBuilder.AutoBaseClass): # (NSDocument)
# Outlets:
# codeView
# resultView
_script = None # an osascript.Script instance
def _appendResult(self, s):
self.resultView.textStorage().appendAttributedString_(
AppKit.NSAttributedString.alloc().initWithString_(u"%s\n\n" % s)
)
def windowNibName(self): # a default NSWindowController is created automatically
return "ASTranslateDocument"
def windowControllerDidLoadNib_(self, controller):
示例5: HostRecord
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
objc.loadBundle(
"Keychain",
Keychain.__dict__,
bundle_path="%s/%s" % (NSBundle.mainBundle().bundlePath(),
"Contents/Frameworks/Keychain.framework"))
except ImportError: # we were built with --alias, perhaps
objc.loadBundle(
"Keychain",
Keychain.__dict__,
bundle_path="/Library/Frameworks/Keychain.framework")
INTERVALS = {'seconds': 1.0,
'minutes': 60.0,
'hours': 3600.0}
NibClassBuilder.extractClasses("Preferences")
class HostRecord(object):
def __init__(self,
keychain,
hostname=u'talc.socialtext.net',
port=u'21010',
ssl=False,
username=u'',
interval_value=30,
interval_granularity=u'seconds',
active=True):
self.keychain = keychain
self.hostname = hostname
示例6: PseudoUTF8Output
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
import traceback
import sets
import keyword
import time
from code import InteractiveConsole, softspace
from StringIO import StringIO
import objc
from objc import YES, NO, selector
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
import os
myBundle = NSBundle.bundleWithPath_(os.path.dirname(os.path.dirname(os.environ['RESOURCEPATH'])).decode('utf8'))
NibClassBuilder.extractClasses("PyInterpreter.nib", bundle=myBundle)
try:
sys.ps1
except AttributeError:
sys.ps1 = ">>> "
try:
sys.ps2
except AttributeError:
sys.ps2 = "... "
class PseudoUTF8Output(object):
softspace = 0
def __init__(self, writemethod):
self._write = writemethod
示例7:
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
import objc
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
NibClassBuilder.extractClasses("editor")
from EditorController import EditorController
from ContextsController import ContextsController
if __name__ == "__main__":
print "We already have one running"
#AppHelper.runEventLoop()
示例8: ITunesCommunication
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder
import iTunes
# We tell NibClassBuilder to examine and remember all
# classes from the CDInfoDocument NIB file. This way,
# we can subclass our ITunesCommunication from AutoBaseClass
# later on, and its actual baseclass will be ITunesCommunication
# from the NIB file.
# Since the NIB files are in the application, NOT the plugin, we
# need to specify this explicitly. Typicaly, NIB files would be in the
# plugins.
NibClassBuilder.extractClasses("CDInfoDocument", bundle=NSBundle.mainBundle())
class ITunesCommunication(NibClassBuilder.AutoBaseClass):
def init(self):
self = super(ITunesCommunication, self).init()
if self is None:
return None
# subclass specific initialization here
# nib not loaded yet
self.itunes = iTunes.iTunes()
return self
def getITunesInfo(self):
curtrk = self.itunes.current_track
try:
current_track = self.itunes.get(curtrk)
示例9: MyItem
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
## Copyright 2004, Andrew Loewenstern. All Rights Reserved
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder
NibClassBuilder.extractClasses("TorrentWindow")
from BTAppController import NoTorrentSelected
from Preferences import *
DEFAULT_RATE = 0
DEFAULT_SLOTS = 0
MIN_SLOTS = 1
class MyItem(NSToolbarItem):
def validate(self):
self.setEnabled_(self.target().enabled())
class QueueItem(NSToolbarItem):
def validate(self):
if defaults.integerForKey_(DOQUEUE) == 1:
示例10: Wrapper
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
import objc
from Foundation import *
from AppKit import *
from PyObjCTools import NibClassBuilder, AppHelper
import cPickle
NibClassBuilder.extractClasses("GPDoc")
import sys
sys.path.append('/Users/mwh/Source/lsprof')
import lsprof
WRAPPED={}
class Wrapper (NSObject):
"""
NSOutlineView doesn't retain values, which means we cannot use normal
python values as values in an outline view.
"""
def init_(self, value):
self.value = value
return self
def __str__(self):
return '<Wrapper for %s>'%self.value
def description(self):
return str(self)
示例11: FilteringControllerDocument
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
#
# FilteringControllerDocument.py
# FilteringController
#
# Converted by u.fiedler on 05.02.05.
#
# The original version was written in Objective-C by Malcolm Crawford
# at http://homepage.mac.com/mmalc/CocoaExamples/controllers.html
from PyObjCTools import NibClassBuilder, AppHelper
import objc
from Foundation import NSKeyedArchiver, NSKeyedUnarchiver
NibClassBuilder.extractClasses("FilteringControllerDocument")
class FilteringControllerDocument(NibClassBuilder.AutoBaseClass):
# the actual base class is NSDocument
# The following outlets are added to the class:
# peopleController
def init(self):
self = super(FilteringControllerDocument, self).init()
if self is None: return None
self._k_people = []
return self
def windowNibName(self):
return u"FilteringControllerDocument"
def windowControllerDidLoadNib_(self, controller):
super(FilteringControllerDocument, self).windowControllerDidLoadNib_(controller)
示例12: PythonBrowserWindowController
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
To build the demo program, run this line in Terminal.app:
$ python setup.py py2app -A
This creates a directory "dist" containing PythonBrowser.app. (The
-A option causes the files to be symlinked to the .app bundle instead
of copied. This means you don't have to rebuild the app if you edit the
sources or nibs.)
"""
from Foundation import NSObject
from PyObjCTools import NibClassBuilder
import sys
NibClassBuilder.extractClasses("PythonBrowser")
# class defined in PythonBrowser.nib
class PythonBrowserWindowController(NibClassBuilder.AutoBaseClass):
# the actual base class is NSWindowController
# The following outlets are added to the class:
# outlineView
def __new__(cls, obj):
# "Pythonic" constructor
return cls.alloc().initWithObject_(obj)
def initWithObject_(self, obj):
from PythonBrowserModel import PythonBrowserModel
self = self.initWithWindowNibName_("PythonBrowser")
示例13: Copyright
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
#
# InfoController.py
# PyImtool
#
# Created by Francesco Pierfederici on Thu Jun 03 2004.
# Copyright (c) 2004 Francesco Pierfederici. All rights reserved.
#
# globals and the like
from utilities import *
from PyObjCTools import NibClassBuilder
NibClassBuilder.extractClasses("InfoPanel")
# load the MagnifiedView class
path = os.path.abspath(os.path.join(PATH, "../Resources/MagnifiedView.bundle"))
import objc
objc.loadBundle("MagnifiedView", globals(), bundle_path=path)
MagnifiedView = objc.lookUpClass("MagnifiedView")
del objc
# class defined in InfoPanel.nib
class InfoController(NibClassBuilder.AutoBaseClass):
# the actual base class is WSWindowController
# The following outlets are added to the class:
# window
# [x|y|int|name|title|ext]Filed
示例14:
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
from PyObjCTools import NibClassBuilder, AppHelper
import Foundation, AppKit, WebKit
from Foundation import *
from AppKit import *
import objc; objc.setVerbose(1)
import PyDocURLProtocol
import PyDocEvents
PyDocURLProtocol.setup()
NibClassBuilder.extractClasses('PyDocBrowser')
# the web browser doesn't have or need any code really
if __name__ == '__main__':
AppHelper.runEventLoop()
示例15: uniq
# 需要导入模块: from PyObjCTools import NibClassBuilder [as 别名]
# 或者: from PyObjCTools.NibClassBuilder import extractClasses [as 别名]
from tagger.constants import *
from tagger.exceptions import *
import os, glob, types
import encodings
try:
import cjkcodecs.aliases
from cjkcodecs import *
except:
pass
from encodings import aliases
NibClassBuilder.extractClasses("MusicTagger")
"""
TODO: have to deal properly with mixed encodings, like TRACK being one
encoding and title's being another.
How to build:
python buildapp.py --standalone --package encodings build
"""
def uniq(list):
last = None
list.sort()
result = []