def _update_editor(self, editor, editor_factory, identifier, aliquot, layout=True, use_date_range=False, calculate_age=False): if editor is None: editor = editor_factory() # if layout: # self.task.split_editors(-2, -1) # else: # if not self._polling: # self.task.activate_editor(editor) #gather analyses tool=None if hasattr(editor, 'search_tool'): tool = editor.search_tool ans = self._get_analyses(tool, identifier, aliquot, use_date_range) ans = self._sort_analyses(ans) if calculate_age: for ai in ans: ai.calculate_age() editor.set_items(ans, update_graph=False) group_analyses_by_key(editor.analyses, 'labnumber') editor.clear_aux_plot_limits() do_later(editor.rebuild) # editor.rebuild() return editor
def _group_by(self, key): editor = self.active_editor if editor: items = self.unknowns_pane.items group_analyses_by_key(editor, items, key) self.unknowns_pane.refresh_needed = True editor.rebuild()
def _make_editor(self, ans, editor_name, options, prog, apply_grouping, apply_graph_grouping, save_args): if isinstance(editor_name, tuple): editor_name, save_name = editor_name else: editor_name, save_name = editor_name, editor_name editor = getattr(self, '_{}_editor'.format(editor_name)) if editor is None: klass = getattr(self, '{}_editor_klass'.format(editor_name)) editor = klass(processor=self) editor.plotter_options_manager.set_plotter_options( options[editor_name]) editor.set_items(ans, progress=prog, update_graph=False, use_cache=False) if apply_grouping: group_analyses_by_key(editor, editor.analyses, apply_grouping) if apply_graph_grouping: unks = editor.analyses unks = sorted(unks, key=apply_graph_grouping) editor.analyses = unks for i, (si, gi) in enumerate(groupby(unks, key=apply_graph_grouping)): for ai in gi: ai.graph_id = i # idxs = [unks.index(ai) for ai in gi] # editor.set_graph_group(idxs, i) # fill add placeholder graphs #if n <= than 3 (should be ncols) repeat unks ncol = 2 if i < ncol: for j in range(ncol - i): uc = unks[0].clone_traits() uc.graph_id = i + j + 1 unks.extend([uc]) editor.analyses = unks editor.show_caption = self._config_options.get('show_caption', False) editor.caption_path = self._config_options.get('caption_path', None) editor.caption_text = self._config_options.get('caption_text', None) editor.clear_aux_plot_limits() editor.rebuild() func = getattr(self, '_save_{}'.format(save_name)) func(editor, *save_args) setattr(self, '_{}_editor'.format(editor_name), editor)
def _update_editor(self, editor, editor_factory, identifier, aliquot, layout=True, use_date_range=False): if editor is None: editor = editor_factory() if layout: self.task.split_editors(-2, -1) else: if not self._polling: self.task.activate_editor(editor) #gather analyses ans = self._get_analyses(identifier, aliquot, use_date_range) editor.unknowns = ans group_analyses_by_key(editor, editor.unknowns, 'labnumber') # self.task.group_by_labnumber() return editor
def _make_editor(self, ans, editor_name, options, prog, apply_grouping, save_args): if isinstance(editor_name, tuple): editor_name, save_name=editor_name else: editor_name,save_name=editor_name, editor_name editor=getattr(self, '_{}_editor'.format(editor_name)) if editor is None: klass=getattr(self, '{}_editor_klass'.format(editor_name)) editor=klass(processor=self) editor.plotter_options_manager.set_plotter_options(options[editor_name]) unks = self.make_analyses(ans, progress=prog, use_cache=False) editor.set_items(unks) if apply_grouping: group_analyses_by_key(editor, editor.analyses, apply_grouping) editor.rebuild() func=getattr(self, '_save_{}'.format(save_name)) func(editor, *save_args) setattr(self, '_{}_editor'.format(editor_name), editor)
def _make_editor(self, ans, editor_name, options, prog, apply_grouping, save_args): if isinstance(editor_name, tuple): editor_name, save_name = editor_name else: editor_name, save_name = editor_name, editor_name editor = getattr(self, '_{}_editor'.format(editor_name)) if editor is None: klass = getattr(self, '{}_editor_klass'.format(editor_name)) editor = klass(processor=self) editor.plotter_options_manager.set_plotter_options( options[editor_name]) unks = self.make_analyses(ans, progress=prog, use_cache=False) editor.set_items(unks) if apply_grouping: group_analyses_by_key(editor, editor.analyses, apply_grouping) editor.rebuild() func = getattr(self, '_save_{}'.format(save_name)) func(editor, *save_args) setattr(self, '_{}_editor'.format(editor_name), editor)
def group_by(self, key): group_analyses_by_key(self.items, key) self.refresh()
def run(self, state): unks = getattr(state, self.analysis_kind) group_analyses_by_key(unks, key=self._generate_key())