Beispiel #1
0
    def _default_layout_default(self):
        return TaskLayout(
            id='pychron.processing',
            left=HSplitter(
                PaneItem('pychron.browser'),
                Tabbed(PaneItem('pychron.processing.figures.saved_figures'),
                       PaneItem('pychron.processing.unknowns'),
                       PaneItem('pychron.processing.figures.plotter_options'),
                       PaneItem('pychron.plot_editor'))))


#============= EOF =============================================
#@classmethod
# def group_by(cls, editor, items, key):
#     ids = []
#     for it in items:
#         v = key(it)
#         if not v in ids:
#             ids.append(v)
#
#     sitems = sorted(items, key=key)
#     for k, analyses in groupby(sitems, key=key):
#         gid = ids.index(k)
#         idxs = [items.index(ai) for ai in analyses]
#         editor.set_group(idxs, gid, refresh=False)
# def _append_figure(self, klass):
#     """
#         if selected_samples append all analyses
#         else append selected analyses
#
#     """
#     return
#
#     if isinstance(self.active_editor, klass):
#         sa = self.analysis_table.selected
#         if sa:
#             ts = self.manager.make_analyses(sa)
#         else:
#             ts = [ai for si in self.selected_sample
#                   for ai in self._get_sample_analyses(si)]
#
#         ans = self.manager.make_analyses(ts)
#         if ans:
#             pans = self.active_editor.analyses
#             uuids = [p.uuid for p in pans]
#             fans = [ai for ai in ans if ai.uuid not in uuids]
#
#             pans.extend(fans)
#             self.active_editor.trait_set(unknowns=pans)
#
#         gid = 0
#         for _, gans in groupby(self.active_editor.unknowns, key=lambda x: x.sample):
#             for ai in gans:
#                 ai.group_id = gid
#             gid += 1
#
#         self.active_editor.rebuild(compress_groups=False)
Beispiel #2
0
 def _default_layout_default(self):
     return TaskLayout(
         id='pychron.processing.reduction',
         left=HSplitter(
             browser_pane_item(),
             Tabbed(PaneItem('pychron.processing.unknowns'),
                    PaneItem('pychron.processing.references'),
                    PaneItem('pychron.processing.controls'))))
     # ============= EOF =============================================
Beispiel #3
0
 def _default_layout_default(self):
     return TaskLayout(
         id='pychron.processing.ic_factor',
         left=HSplitter(
             PaneItem('pychron.browser'),
             VSplitter(
                 Tabbed(PaneItem('pychron.processing.unknowns'),
                        PaneItem('pychron.processing.references')),
                 PaneItem('pychron.processing.controls'),
             )))
Beispiel #4
0
 def _default_layout_default(self):
     return TaskLayout(
         id='pychron.processing',
         left=HSplitter(
             VSplitter(
                 PaneItem('pychron.processing.irradiation'),
                 Tabbed(PaneItem('pychron.processing.unknowns'),
                        PaneItem('pychron.processing.references'),
                        PaneItem('pychron.processing.analyses')),
                 PaneItem('pychron.processing.controls'))))
 def _default_layout_default(self):
     return TaskLayout(
         id='pychron.processing.isotope_evolution',
         left=HSplitter(
             browser_pane_item(),
             # Tabbed(PaneItem('pychron.browser'),
             #        PaneItem('pychron.search.query')
             # ),
             VSplitter(
                 Tabbed(PaneItem('pychron.plot_editor'),
                        PaneItem('pychron.processing.unknowns')),
                 PaneItem('pychron.processing.controls'))))
Beispiel #6
0
 def _default_layout_default(self):
     return TaskLayout(
         id='pychron.processing.blanks',
         left=HSplitter(
             Tabbed(
                 PaneItem('pychron.browser'),
                 PaneItem('pychron.search.query'),
             ),
             Tabbed(
                 PaneItem('pychron.processing.unknowns'),
                 PaneItem('pychron.processing.references'),
                 PaneItem('pychron.processing.controls')
             ),
         ),
     )
Beispiel #7
0
    def _default_layout_default(self):
        return TaskLayout(
            id='pychron.repository',
            left=HSplitter(PaneItem('pychron.browser'), )
            #                           left=HSplitter(

            #                                     PaneItem('pychron.browser'),
            #                                     Splitter(
            #                                          Tabbed(
            #                                                 PaneItem('pychron.processing.unknowns'),
            # #                                                 PaneItem('pychron.processing.figures.plotter_options')
            #                                                 ),
            # #                                          Tabbed(
            # #                                                 PaneItem('pychron.processing.controls'),
            # #                                                 PaneItem('pychron.processing.editor'),
            # #                                                 ),
            #                                          orientation='vertical'
            #                                          )
            #                                     ),
        )
Beispiel #8
0
    def _default_layout_default(self):
        a = Tabbed(browser_pane_item(),
                   PaneItem('pychron.processing.figures.plotter_options'))
        b = PaneItem('pychron.processing.unknowns')
        left = HSplitter(a, b)

        # HSplitter(VSplitter(
        #                       Tabbed(browser_pane_item(),
        #                              PaneItem('pychron.processing.figures.plotter_options'),
        #                              PaneItem('pychron.plot_editor'))),
        #                              PaneItem('pychron.processing.unknowns'))

        return TaskLayout(id='pychron.processing',
                          left=left)

# return TaskLayout(
#     id='pychron.processing',
# left=HSplitter(
#     browser_pane_item(),
#     Tabbed(
#         # PaneItem('pychron.processing.figures.saved_figures'),
#         PaneItem('pychron.processing.unknowns'),
#         PaneItem('pychron.processing.figures.plotter_options'),
#         PaneItem('pychron.plot_editor'))))
# ============= EOF =============================================
#@classmethod
# def group_by(cls, editor, items, key):
#     ids = []
#     for it in items:
#         v = key(it)
#         if not v in ids:
#             ids.append(v)
#
#     sitems = sorted(items, key=key)
#     for k, analyses in groupby(sitems, key=key):
#         gid = ids.index(k)
#         idxs = [items.index(ai) for ai in analyses]
#         editor.set_group(idxs, gid, refresh=False)
# def _append_figure(self, klass):
#     """
#         if selected_samples append all analyses
#         else append selected analyses
#
#     """
#     return
#
#     if isinstance(self.active_editor, klass):
#         sa = self.analysis_table.selected
#         if sa:
#             ts = self.manager.make_analyses(sa)
#         else:
#             ts = [ai for si in self.selected_sample
#                   for ai in self._get_sample_analyses(si)]
#
#         ans = self.manager.make_analyses(ts)
#         if ans:
#             pans = self.active_editor.analyses
#             uuids = [p.uuid for p in pans]
#             fans = [ai for ai in ans if ai.uuid not in uuids]
#
#             pans.extend(fans)
#             self.active_editor.trait_set(unknowns=pans)
#
#         gid = 0
#         for _, gans in groupby(self.active_editor.unknowns, key=lambda x: x.sample):
#             for ai in gans:
#                 ai.group_id = gid
#             gid += 1
#
#         self.active_editor.rebuild(compress_groups=False)
# # new figure editor
# editor = klass(
# name=name,
# processor=self.manager)
#
# if ans is None:
#         ans = self.unknowns_pane.items
#
#     if ans:
#         editor.analyses = ans
#         editor.set_name()
#         editor.rebuild()
#         # if set_ans:
#         #     self.unknowns_pane.items = ans
#
#     self._open_editor(editor)
#
#     # add_associated = False
#     # if not add_associated:
#     #     self.debug('Not adding associated editors')
#     # else:
#     #     if tklass and add_table:
#     #         # open table
#     #         teditor = self._new_table(ans, name, tklass)
#     #         if teditor:
#     #             editor.associated_editors.append(weakref.ref(teditor)())
#     #
#     #     if add_iso:
#     #         # open associated isochron
#     #         ieditor = self._new_associated_isochron(ans, name)
#     #         if ieditor:
#     #             editor.associated_editors.append(weakref.ref(ieditor)())
#     #             ieditor.parent_editor = editor
#
#     # activate figure editor
#     # self.editor_area.activate_editor(editor)
#     return editor
    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
Beispiel #10
0
 def _default_layout_default(self):
     return TaskLayout(id='pychron.recall',
                       left=HSplitter(
                           Tabbed(PaneItem('pychron.browser')),
                           PaneItem('pychron.processing.controls')))