Ejemplo n.º 1
0
    def __init__(self, name=""):
        super(Chapter, self).__init__()
        self.name = name
        self.book = None
        self.root = SoSeparator()
        self.root.setName("Chapter:root")
        self.pagesSwitch = SoSwitch()
        self.pagesSwitch.setName("Chapter:pages")
        self.root.addChild(self.pagesSwitch)

        self.__pages = nodeDict()
        ## ============================
        self.setupGui()
Ejemplo n.º 2
0
    def __init__(self):
        self.animation = None
        self.root = SoSwitch()
        self.separator = SoSeparator()
        self.drawStyle = SoDrawStyle()
        self.translation = SoTranslation()

        self.root.addChild(self.separator)
        self.separator.addChild(self.drawStyle)
        self.separator.addChild(self.translation)

        self.translation.translation = (0, 0, 0)

        self.show()
Ejemplo n.º 3
0
def make_hideable(node, show=True):
    """
    Creates a SoSwitch with node as children, and puts it in property node.root
    """
    switch = SoSwitch()
    switch.addChild(node)
    node.root = switch

    def getVisible(self):
        return self.root.whichChild.getValue() != SO_SWITCH_NONE

    def setVisible(self, val):
        self.root.whichChild = SO_SWITCH_ALL if val else SO_SWITCH_NONE

    node.__class__.visible = property(getVisible, setVisible)
    node.visible = show
    return node
Ejemplo n.º 4
0
def wrap(node, show=True):
    """wrap node with a SoSwitch, returns the switch"""
    switch = SoSwitch()
    switch.addChild(getattr(node, 'root', node))
    switch.whichChild = SO_SWITCH_ALL if show else SO_SWITCH_NONE
    return switch