def add_content(self, position, widget):
        widget.viewport = CocoaViewport(widget.native)

        for child in widget.interface.children:
            child._impl.container = widget

        # Turn the autoresizing mask on the widget into constraints.
        # This makes the widget fill the available space inside the
        # SplitContainer.
        # FIXME Use Constraints to enforce min width and height of the widgets otherwise width of 0 is possible.
        widget.native.translatesAutoresizingMaskIntoConstraints = True
        self.native.addSubview(widget.native)
Beispiel #2
0
    def add_content(self, label, widget):
        """ Adds a new option to the option container.

        Args:
            label (str): The label for the option container
            widget: The widget or widget tree that belongs to the label.
        """
        widget.viewport = CocoaViewport(widget.native)

        for child in widget.interface.children:
            child._impl.container = widget

        item = NSTabViewItem.alloc().initWithIdentifier(len(self.interface.content) - 1)
        item.label = label

        # Turn the autoresizing mask on the widget widget
        # into constraints. This makes the widget fill the
        # available space inside the OptionContainer.
        widget.native.translatesAutoresizingMaskIntoConstraints = True

        item.view = widget.native
        self.native.addTabViewItem(item)
Beispiel #3
0
    def set_content(self, widget):
        self.native.documentView = widget.native
        widget.viewport = CocoaViewport(self.native.documentView)

        for child in widget.interface.children:
            child._impl.container = widget