def getVisibleItemIds(self):
        """Gets the visible item ids.

        @see: L{Select.getVisibleItemIds}
        """
        visible = list()
        # Iterates trough hierarchical tree using a stack of iterators
        iteratorStack = deque()
        ids = self.rootItemIds()
        if ids is not None:
            iteratorStack.append(ids)
        while len(iteratorStack) > 0:
            # Gets the iterator for current tree level
            i = iter( iteratorStack[-1] )

            # If the level is finished, back to previous tree level
            try:
                itemId = i.next()
                visible.append(itemId)
                # Adds children if expanded, or close the tag
                if self.isExpanded(itemId) and self.hasChildren(itemId):
                    iteratorStack.append( self.getChildren(itemId) )
            except __HOLE__:
                # Removes used iterator from the stack
                # Adds the item on current level
                iteratorStack.pop()

        return visible
dataset/ETHPy150Open rwl/muntjac/muntjac/ui/tree.py/Tree.getVisibleItemIds