Example #1
0
    def make_left_navbar(self):
        """
            Creates the structures tree hierarchy widget and populates 
            it with structures names from the brainglobe-api's Atlas.hierarchy
            tree view.
        """
        # Create QTree widget
        treeView = QTreeView()
        treeView.setExpandsOnDoubleClick(False)
        treeView.setHeaderHidden(True)
        treeView.setStyleSheet(update_css(tree_css, self.palette))
        treeView.setWordWrap(False)

        treeModel = QStandardItemModel()
        rootNode = treeModel.invisibleRootItem()

        # Add element's hierarchy
        tree = self.scene.atlas.hierarchy
        items = {}
        for n, node in enumerate(tree.expand_tree()):
            # Get Node info
            node = tree.get_node(node)
            if node.tag in ["VS", "fiber tracts"]:
                continue

            # Get brainregion name
            name = self.scene.atlas._get_from_structure(
                node.identifier, "name"
            )

            # Create Item
            item = StandardItem(
                name,
                node.tag,
                tree.depth(node.identifier),
                self.palette["text"],
            )

            # Get/assign parents
            parent = tree.parent(node.identifier)
            if parent is not None:
                if parent.identifier not in items.keys():
                    continue
                else:
                    items[parent.identifier].appendRow(item)

            # Keep track of added nodes
            items[node.identifier] = item
            if n == 0:
                root = item

        # Finish up
        rootNode.appendRow(root)
        treeView.setModel(treeModel)
        treeView.expandToDepth(2)
        self.treeView = treeView

        return treeView
Example #2
0
    def __init__(self, main_window, palette):
        """
            Creates a new window for user to input
            which regions to add to scene.

            Arguments:
            ----------

            main_window: reference to the App's main window
            palette: main_window's palette, used to style widgets
        """
        super().__init__()
        self.setWindowTitle("Add brain regions")
        self.ui()
        self.main_window = main_window
        self.setStyleSheet(update_css(style, palette))
Example #3
0
    def __init__(self, main_window, palette):
        """
        Creates a new window for user to input
        which regions to add to scene.

        Arguments:
        ----------

        main_window: reference to the App's main window
        palette: main_window's palette, used to style widgets
        """
        super().__init__()
        self.setWindowTitle("Add brain regions")
        self.ui()
        self.main_window = main_window
        self.setStyleSheet(update_css(style, palette))

        # Start timer to autoclose
        self.timer = QtCore.QTimer(self)
        self.timer.setInterval(1500)
        self.timer.timeout.connect(self.close)
        self.timer.start()
Example #4
0
    def __init__(self, theme="dark", **kwargs):
        super().__init__()

        # Get palette
        self.palette = _themes[theme]
        self.theme = theme

        # set the title and icon of main window
        self.setWindowTitle("BRAINGLOBE - brainrender GUI")

        logo_path = resource_filename("brainrender.gui.icons",
                                      "BG_logo_mini.svg")
        self.setWindowIcon(QtGui.QIcon(logo_path))

        # set the size of window
        self.Width = 3000
        self.height = int(0.618 * self.Width)
        self.resize(self.Width, self.height)

        # Create UI
        self.get_icons()
        self.initUI()
        self.setStyleSheet(update_css(style, self.palette))