Ejemplo n.º 1
0
 def __init__(self,
              size,
              parentView=None,
              preferredEdge="top",
              behavior="semitransient"):
     if isinstance(parentView, VanillaBaseObject):
         parentView = parentView._getContentView()
     self._parentView = parentView
     self._preferredEdge = preferredEdge
     # content view and controller
     self._nsObject = getNSSubclass(
         self.contentViewClass).alloc().initWithFrame_(((0, 0), size))
     self._contentViewController = self.contentViewControllerClass.alloc(
     ).init()
     self._contentViewController.setView_(self._nsObject)
     # popover
     cls = getNSSubclass(self.nsPopoverClass)
     self._popover = cls.alloc().init()
     self._popover.setContentViewController_(self._contentViewController)
     self._popover.setBehavior_(_behaviorMap[behavior])
     # delegate
     self._delegate = VanillaPopoverDelegate.alloc().init()
     self._delegate.vanillaWrapper = weakref.ref(self)
     self._popover.setDelegate_(self._delegate)
     self._bindings = {}
Ejemplo n.º 2
0
 def _setupView(self, classOrName, posSize, callback=None):
     self._testForDeprecatedAttributes()
     cls = getNSSubclass(classOrName)
     self._nsObject = cls(self)
     self._posSize = posSize
     self._setCallback(callback)
     self._setAutosizingFromPosSize(posSize)
Ejemplo n.º 3
0
 def _setupView(self, classOrName, posSize, callback=None):
     self._testForDeprecatedAttributes()
     cls = getNSSubclass(classOrName)
     self._nsObject = cls(self)
     self._posSize = posSize
     self._setCallback(callback)
     self._setAutosizingFromPosSize(posSize)
Ejemplo n.º 4
0
 def __init__(self, size, parentView=None, preferredEdge="top", behavior="semitransient"):
     if isinstance(parentView, VanillaBaseObject):
         parentView = parentView._getContentView()
     self._parentView = parentView
     self._preferredEdge = preferredEdge
     # content view and controller
     self._nsObject = getNSSubclass(self.contentViewClass).alloc().initWithFrame_(((0, 0), size))
     self._contentViewController = self.contentViewControllerClass.alloc().init()
     self._contentViewController.setView_(self._nsObject)
     # popover
     cls = getNSSubclass(self.nsPopoverClass)
     self._popover = cls.alloc().init()
     self._popover.setContentViewController_(self._contentViewController)
     self._popover.setBehavior_(_behaviorMap[behavior])
     # delegate
     self._delegate = VanillaPopoverDelegate.alloc().init()
     self._delegate.vanillaWrapper = weakref.ref(self)
     self._popover.setDelegate_(self._delegate)
     self._bindings = {}
Ejemplo n.º 5
0
    def __init__(self, posSize, obj):
        self._model = PythonBrowserModel.alloc().initWithObject_(obj)

        self._posSize = posSize

        self._nsObject = getNSSubclass("NSScrollView")(self)
        self._nsObject.setAutohidesScrollers_(True)
        self._nsObject.setHasHorizontalScroller_(True)
        self._nsObject.setHasVerticalScroller_(True)
        self._nsObject.setBorderType_(AppKit.NSBezelBorder)
        self._nsObject.setDrawsBackground_(True)

        self._outlineView = getNSSubclass("NSOutlineView")(self)
        self._outlineView.setFrame_(((0, 0), (100, 100)))
        self._outlineView.setUsesAlternatingRowBackgroundColors_(True)
        self._outlineView.setAllowsColumnResizing_(True)
        self._outlineView.setRowHeight_(17.0)

        self._outlineView.setColumnAutoresizingStyle_(AppKit.NSTableViewUniformColumnAutoresizingStyle)
        columns = [
            ("name", "Name"),
            ("type", "Type"),
            ("value", "Value"),
            ("arguments", "Arguments")
        ]
        for key, title in columns:
            column = AppKit.NSTableColumn.alloc().initWithIdentifier_(key)
            column.setResizingMask_(AppKit.NSTableColumnAutoresizingMask | AppKit.NSTableColumnUserResizingMask )
            column.headerCell().setTitle_(title)
            dataCell = column.dataCell()
            dataCell.setDrawsBackground_(False)
            dataCell.setStringValue_("") # cells have weird default values
            column.setEditable_(False)
            self._outlineView.addTableColumn_(column)
            if key == "name":
                self._outlineView.setOutlineTableColumn_(column)

        self._outlineView.setDataSource_(self._model)
        self._outlineView.setDelegate_(self._model)

        self._nsObject.setDocumentView_(self._outlineView)
        self._setAutosizingFromPosSize(posSize)
Ejemplo n.º 6
0
    def __init__(self, posSize, obj):
        self._model = PythonBrowserModel.alloc().initWithObject_(obj)

        self._posSize = posSize

        self._nsObject = getNSSubclass("NSScrollView")(self)
        self._nsObject.setAutohidesScrollers_(True)
        self._nsObject.setHasHorizontalScroller_(True)
        self._nsObject.setHasVerticalScroller_(True)
        self._nsObject.setBorderType_(AppKit.NSBezelBorder)
        self._nsObject.setDrawsBackground_(True)

        self._outlineView = getNSSubclass("NSOutlineView")(self)
        self._outlineView.setFrame_(((0, 0), (100, 100)))
        self._outlineView.setUsesAlternatingRowBackgroundColors_(True)
        self._outlineView.setAllowsColumnResizing_(True)
        self._outlineView.setRowHeight_(17.0)

        self._outlineView.setColumnAutoresizingStyle_(AppKit.NSTableViewUniformColumnAutoresizingStyle)
        columns = [
            ("name", "Name"),
            ("type", "Type"),
            ("value", "Value"),
            ("arguments", "Arguments")
        ]
        for key, title in columns:
            column = AppKit.NSTableColumn.alloc().initWithIdentifier_(key)
            column.setResizingMask_(AppKit.NSTableColumnAutoresizingMask | AppKit.NSTableColumnUserResizingMask )
            column.headerCell().setTitle_(title)
            dataCell = column.dataCell()
            dataCell.setDrawsBackground_(False)
            dataCell.setStringValue_("") # cells have weird default values
            column.setEditable_(False)
            self._outlineView.addTableColumn_(column)
            if key == "name":
                self._outlineView.setOutlineTableColumn_(column)

        self._outlineView.setDataSource_(self._model)
        self._outlineView.setDelegate_(self._model)

        self._nsObject.setDocumentView_(self._outlineView)
        self._setAutosizingFromPosSize(posSize)
Ejemplo n.º 7
0
 def __init__(self, posSize, text="", callback=None, readOnly=False, checksSpelling=False):
     self._posSize = posSize
     self._nsObject = self.nsScrollViewClass.alloc().init()  # no need to do getNSSubclass() here
     self._nsObject.setHasVerticalScroller_(True)
     self._nsObject.setBorderType_(NSBezelBorder)
     self._nsObject.setDrawsBackground_(True)
     self._textView = getNSSubclass(self.nsTextViewClass)(self)
     self._textView.setAllowsUndo_(True)
     self._textView.setString_(text)
     self._textView.setContinuousSpellCheckingEnabled_(checksSpelling)
     self._textView.setAutoresizingMask_(NSViewWidthSizable | NSViewHeightSizable)
     self._textView.setEditable_(not readOnly)
     self._nsObject.setDocumentView_(self._textView)
     # do the base object init methods
     self._setCallback(callback)
     self._setAutosizingFromPosSize(posSize)
Ejemplo n.º 8
0
 def __init__(self,
              posSize,
              text="",
              callback=None,
              readOnly=False,
              checksSpelling=False):
     self._posSize = posSize
     self._nsObject = self.nsScrollViewClass.alloc().init(
     )  # no need to do getNSSubclass() here
     self._nsObject.setHasVerticalScroller_(True)
     self._nsObject.setBorderType_(NSBezelBorder)
     self._nsObject.setDrawsBackground_(True)
     self._textView = getNSSubclass(self.nsTextViewClass)(self)
     self._textView.setAllowsUndo_(True)
     self._textView.setString_(text)
     self._textView.setContinuousSpellCheckingEnabled_(checksSpelling)
     self._textView.setAutoresizingMask_(NSViewWidthSizable
                                         | NSViewHeightSizable)
     self._textView.setEditable_(not readOnly)
     self._nsObject.setDocumentView_(self._textView)
     # do the base object init methods
     self._setCallback(callback)
     self._setAutosizingFromPosSize(posSize)
Ejemplo n.º 9
0
 def __init__(self, posSize):
     l, t, w, h = posSize
     configuration = WKWebViewConfiguration.alloc().init()
     self._nsObject = getNSSubclass(self.nsViewClass).alloc().initWithFrame_configuration_(((l, t), (w, h)), configuration)
     self._posSize = posSize
     self._setAutosizingFromPosSize(posSize)