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


Python PyObjCTools.NibClassBuilder类代码示例

本文整理汇总了Python中PyObjCTools.NibClassBuilder的典型用法代码示例。如果您正苦于以下问题:Python NibClassBuilder类的具体用法?Python NibClassBuilder怎么用?Python NibClassBuilder使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: range

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,
开发者ID:fruitsamples,项目名称:PyObjC,代码行数:31,代码来源:OpenGLDemo.py

示例2: blit

        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)
开发者ID:CTPUG,项目名称:matplotlib-py3,代码行数:31,代码来源:backend_cocoaagg.py

示例3: MethodListController

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()
开发者ID:BackupTheBerlios,项目名称:eye99-svn,代码行数:26,代码来源:MethodListController.py

示例4: ASTranslateDocument

"""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):
开发者ID:ZoomerAnalytics,项目名称:appscript,代码行数:31,代码来源:ASTranslate.py

示例5: HostRecord

    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
开发者ID:kultus,项目名称:newsboy,代码行数:31,代码来源:NewsBoyPreferencesController.py

示例6: PseudoUTF8Output

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
开发者ID:fruitsamples,项目名称:PyObjC,代码行数:30,代码来源:InjectInterpreterPlugin.py

示例7:

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()
开发者ID:eikeon,项目名称:redfoot,代码行数:14,代码来源:editor.py

示例8: ITunesCommunication

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)
开发者ID:Joey-Lee,项目名称:pyobjc,代码行数:31,代码来源:ITunesCommunication_2.py

示例9: MyItem

# 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:
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:31,代码来源:ToolbarDelegate.py

示例10: Wrapper

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)
开发者ID:galaxy001,项目名称:libtorrent,代码行数:30,代码来源:GPDoc.py

示例11: FilteringControllerDocument

#
#  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)
开发者ID:fruitsamples,项目名称:PyObjC,代码行数:31,代码来源:FilteringControllerDocument.py

示例12: PythonBrowserWindowController

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")
开发者ID:fruitsamples,项目名称:PyObjC,代码行数:31,代码来源:PythonBrowser.py

示例13: Copyright

#
#  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
开发者ID:BackupTheBerlios,项目名称:pyimtool-svn,代码行数:31,代码来源:InfoController.py

示例14:

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()
开发者ID:fruitsamples,项目名称:PyObjC,代码行数:18,代码来源:PyDocBrowser.py

示例15: uniq

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 = []
开发者ID:liquidx,项目名称:tagencoder,代码行数:31,代码来源:MusicTagger.py


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