Пример #1
0
 def _default_layout_default(self):
     l = TaskLayout(left=VSplitter(
         PaneItem('hardware.devices'),
         Tabbed(PaneItem('hardware.configuration'), PaneItem(
             'hardware.info'))))
     return l
Пример #2
0
    def get_layout_for_area(self, q_dock_area, include_sizes=True):
        """ Gets a LayoutItem for the specified dock area.
        """
        # Build the initial set of leaf-level items.
        items = set()
        rects = {}
        for child in self.control.children():
            # Iterate through *visibile* dock widgets. (Inactive tabbed dock
            # widgets are "visible" but have invalid positions.)
            if (
                isinstance(child, QtGui.QDockWidget)
                and child.isVisible()
                and self.control.dockWidgetArea(child) == q_dock_area
                and child.x() >= 0
                and child.y() >= 0
            ):
                # Get the list of dock widgets in this tab group in order.
                geometry = child.geometry()
                tabs = [
                    tab
                    for tab in self.control.tabifiedDockWidgets(child)
                    if tab.isVisible()
                ]
                if tabs:
                    tab_bar = self._get_tab_bar(child)
                    tab_index = tab_bar.currentIndex()
                    tabs.insert(tab_index, child)
                    geometry = tab_bar.geometry().united(geometry)

                # Create the leaf-level item for the child.
                if tabs:
                    panes = [
                        self._prepare_pane(dock_widget, include_sizes)
                        for dock_widget in tabs
                    ]
                    item = Tabbed(*panes, active_tab=panes[tab_index].id)
                else:
                    item = self._prepare_pane(child, include_sizes)
                items.add(item)
                rects[item] = geometry

        # Build the layout tree bottom-up, in multiple passes.
        while len(items) > 1:
            add, remove = set(), set()

            for item1, item2 in combinations(items, 2):
                if item1 not in remove and item2 not in remove:
                    rect1, rect2 = rects[item1], rects[item2]
                    orient = self._get_division_orientation(rect1, rect2, True)
                    if orient == QtCore.Qt.Horizontal:
                        if rect1.y() < rect2.y():
                            item = VSplitter(item1, item2)
                        else:
                            item = VSplitter(item2, item1)
                    elif orient == QtCore.Qt.Vertical:
                        if rect1.x() < rect2.x():
                            item = HSplitter(item1, item2)
                        else:
                            item = HSplitter(item2, item1)
                    else:
                        continue
                    rects[item] = rect1.united(rect2)
                    add.add(item)
                    remove.update((item1, item2))

            if add or remove:
                items.update(add)
                items.difference_update(remove)
            else:
                # Raise an exception instead of falling into an infinite loop.
                raise RuntimeError(
                    "Unable to extract layout from QMainWindow."
                )

        if items:
            return items.pop()
        return None
Пример #3
0
 def _default_layout_default(self):
     return TaskLayout(id='pychron.recall',
                       left=HSplitter(
                           Tabbed(PaneItem('pychron.browser')),
                           PaneItem('pychron.processing.controls')))
Пример #4
0
 def _default_layout_default(self):
     # return TaskLayout(left=PaneItem('pychron.browser.pane'))
     return TaskLayout(
         left=Tabbed(PaneItem('pychron.browser.pane'),
                     PaneItem('pychron.browser.analysis_groups.pane')))
Пример #5
0
 def _default_layout_default(self):
     return TaskLayout(left=Tabbed(PaneItem('pychron.browser'),
                                   PaneItem('pychron.export.destination')))
Пример #6
0
    def _default_layout_default(self):
        #return TaskLayout(left=PaneItem('pychron.lasers.client'))

        return TaskLayout(
            left=Splitter(
                PaneItem('pychron.experiment.wait', height=100),
                Tabbed(
                    PaneItem('pychron.experiment.factory'),
                    PaneItem('pychron.experiment.isotope_evolution'),
                    #                                                PaneItem('pychron.experiment.summary'),
                ),
                orientation='vertical'
            ),
            right=Splitter(
                Tabbed(
                    PaneItem('pychron.experiment.stats'),
                    PaneItem('pychron.console', height=425),
                    PaneItem('pychron.experiment.explanation', height=425),
                ),
                #                                          PaneItem('pychron.extraction_line.canvas_dock'),
                #                                         PaneItem('pychron.experiment.wait'),
                orientation='vertical'
            ),
            top=PaneItem('pychron.experiment.controls')
        )
        #============= EOF =============================================
        #         editor = self.active_editor
        #         if editor is None:
        #             if self.editor_area.editors:
        #                 editor = self.editor_area.editors[0]
        #
        #         if editor:
        #             p = editor.path
        #             p = add_extension(p, '.txt')
        #
        #             if os.path.isfile(p):
        #                 # make a backup copy of the original experiment file
        #                 shutil.copyfile(p, '{}.orig'.format(p))
        #
        # #                 group = editor.group
        # #                 min_idx = editor.merge_id
        # #                 text = open(p, 'r').read()
        # #                 hash_val = hashlib.sha1(text).hexdigest()
        # #                 qs = [ei.queue
        # #                         for ei in self.editor_area.editors
        # #                             if ei.group == group and ei.merge_id >= min_idx]
        #                 qs = [ei.queue for ei in self.editor_area.editors]
        #                 # launch execution thread
        #                 # if successful open an auto figure task
        # #                 if self.manager.execute_queues(qs, p, text, hash_val):
        #                 if self.manager.execute_queues(qs, p):
        #                     self._open_auto_figure()

        #     def merge(self):
        #         eqs = [self.active_editor.queue]
        #         self.active_editor.merge_id = 1
        #         self.active_editor.group = self.group_count
        #         self.group_count += 1
        #         for i, ei in enumerate(self.editor_area.editors):
        #             if not ei == self.active_editor:
        #                 eqs.append(ei.queue)
        #                 ei.merge_id = i + 2
        #                 ei.group = self.group_count
        #
        #         path = self.save_file_dialog()
        #         if path:
        #             self.active_editor.save(path, eqs)
        #             for ei in self.editor_area.editors:
        #                 ei.path = path
Пример #7
0
 def _default_layout_default(self):
     return TaskLayout(left=PaneItem('pychron.labbook.browser'),
                       right=Tabbed(PaneItem('pychron.labbook.labels'),
                                    PaneItem('pychron.labbook.file_history')))