def __init__(self, view, model, context): self.view = view self.model = model self.context = context self._selected_data = [] self._start_x = [self.view.start_time] self._end_x = [self.view.end_time] self._fit_status = [None] self._fit_chi_squared = [0.0] self._fit_function = [None] self._tf_asymmetry_mode = False self._fit_function_cache = [None] self._number_of_fits_cached = 0 self._multi_domain_function = None self.manual_selection_made = False self.automatically_update_fit_name = True self.thread_success = True self.update_selected_workspace_guess() self.gui_context_observer = GenericObserverWithArgPassing( self.handle_gui_changes_made) self.selected_group_pair_observer = GenericObserver( self.handle_selected_group_pair_changed) self.selected_plot_type_observer = GenericObserver( self.handle_selected_plot_type_changed) self.input_workspace_observer = GenericObserver( self.handle_new_data_loaded) self.disable_tab_observer = GenericObserver( lambda: self.view.setEnabled(False)) self.enable_tab_observer = GenericObserver( lambda: self.view.setEnabled(True)) self.update_view_from_model_observer = GenericObserverWithArgPassing( self.update_view_from_model)
def __init__(self, view, model): super(ResultsTabPresenter, self).__init__() self.view = view self.model = model self.new_fit_performed_observer = GenericObserver( self.on_new_fit_performed) self.update_view_from_model_observer = GenericObserver( self.update_view_from_model) self._init_view()
def __init__(self, view, model): self._view = view self._model = model self.load_run_widget = None self.load_file_widget = None self.view.on_subwidget_loading_started(self.disable_loading) self.view.on_subwidget_loading_finished(self.enable_loading) self.view.on_file_widget_data_changed( self.handle_file_widget_data_changed) self.view.on_run_widget_data_changed( self.handle_run_widget_data_changed) self.view.on_clear_button_clicked(self.clear_data_and_view) self._view.on_multiple_load_type_changed( self.handle_multiple_files_option_changed) self._use_threading = True self.instrumentObserver = LoadWidgetPresenter.InstrumentObserver(self) self.loadNotifier = LoadWidgetPresenter.LoadNotifier(self) self.disable_observer = LoadWidgetPresenter.DisableObserver(self) self.enable_observer = LoadWidgetPresenter.EnableObserver(self) self.update_view_from_model_observer = GenericObserver( self.update_view_from_model)
def __init__(self, load, fft_widget, maxent_widget, parent=None): super(TransformWidget, self).__init__(parent) self._fft = fft_widget(load=load, parent=self) self._maxent = maxent_widget(load=load, parent=self) self._selector = TransformSelectionWidget(parent=self) self.LoadObserver = LoadObserver(self) self.load = load self.instrumentObserver = instrumentObserver(self) self.GroupPairObserver = GroupPairObserver(self) self.enable_observer = EnableObserver(self) self.disable_observer = DisableObserver(self) self.phase_quad_observer = PhaseQuadObserver(self) groupedViews = self.getViews() self._view = TransformView(self._selector.widget, groupedViews, parent) self._selector.setSelectionConnection(self.updateDisplay) self.updateDisplay('FFT') self.update_view_from_model_observer = GenericObserver( self.update_view_from_model) # to make it compatable with the old GUI try: self.load.update_view_from_model_notifier.add_subscriber( self.update_view_from_model_observer) except: pass
def __init__(self, view, load): self.view = view self.load = load self.thread = None # set data self.getWorkspaceNames() # connect self.view.maxEntButtonSignal.connect(self.handleMaxEntButton) self.view.cancelSignal.connect(self.cancel) self.phase_table_observer = GenericObserver(self.update_phase_table_options)
def __init__(self, view, model, context): """ :param view: A reference to the QWidget object for plotting :param model: A refence to a model which contains the plotting logic :param context: A reference to the Muon context object """ self._view = view self._model = model self.context = context self._view.on_plot_button_clicked(self.handle_data_updated) self._view.on_rebin_options_changed( self.handle_use_raw_workspaces_changed) self._view.on_plot_type_changed(self.handle_plot_type_changed) self.input_workspace_observer = GenericObserver(self.handle_data_updated) self.fit_observer = GenericObserver(self.handle_fit_completed) self.group_pair_observer = GenericObserver(self.handle_group_pair_to_plot_changed) self.plot_type_observer = GenericObserver(self.handle_group_pair_to_plot_changed) self.rebin_options_set_observer = GenericObserver(self.handle_rebin_options_set) self.plot_type_changed_notifier = GenericObservable() self._force_redraw = False if self.context._frequency_context: for ext in FREQUENCY_EXTENSIONS.keys(): self._view.addItem(FREQ_PLOT_TYPE+FREQUENCY_EXTENSIONS[ext]) self._view.addItem(FREQ_PLOT_TYPE+"All") self.instrument_observer = GenericObserver(self.handle_instrument_changed) self.keep = False
def __init__(self, view, model, grouping_table_widget=None, pairing_table_widget=None): self._view = view self._model = model self.grouping_table_widget = grouping_table_widget self.pairing_table_widget = pairing_table_widget # Synchronize the two tables self._view.on_grouping_table_changed( self.pairing_table_widget.update_view_from_model) self._view.on_pairing_table_changed( self.grouping_table_widget.update_view_from_model) self._view.set_description_text(self.text_for_description()) self._view.on_add_pair_requested(self.add_pair_from_grouping_table) self._view.on_clear_grouping_button_clicked(self.on_clear_requested) self._view.on_load_grouping_button_clicked( self.handle_load_grouping_from_file) self._view.on_save_grouping_button_clicked( self.handle_save_grouping_file) self._view.on_default_grouping_button_clicked( self.handle_default_grouping_button_clicked) # monitors for loaded data changing self.loadObserver = GroupingTabPresenter.LoadObserver(self) self.instrumentObserver = GroupingTabPresenter.InstrumentObserver(self) # notifiers self.groupingNotifier = GroupingTabPresenter.GroupingNotifier(self) self.grouping_table_widget.on_data_changed(self.group_table_changed) self.pairing_table_widget.on_data_changed(self.pair_table_changed) self.enable_editing_notifier = GroupingTabPresenter.EnableEditingNotifier( self) self.disable_editing_notifier = GroupingTabPresenter.DisableEditingNotifier( self) self.calculation_finished_notifier = GenericObservable() self.guessAlphaObserver = GroupingTabPresenter.GuessAlphaObserver(self) self.pairing_table_widget.guessAlphaNotifier.add_subscriber( self.guessAlphaObserver) self.message_observer = GroupingTabPresenter.MessageObserver(self) self.gui_variables_observer = GroupingTabPresenter.GuiVariablesChangedObserver( self) self.enable_observer = GroupingTabPresenter.EnableObserver(self) self.disable_observer = GroupingTabPresenter.DisableObserver(self) self.update_view_from_model_observer = GenericObserver( self.update_view_from_model)
def __init__(self, fitting_context): """ Construct a model around the given FitContext object :param fitting_context: A FitContext detailing the outputs from the fitting """ self._fit_context = fitting_context self._results_table_name = DEFAULT_TABLE_NAME self._selected_fit_function = None self._update_selected_fit_function() self._new_fit_observer = GenericObserver(self._on_new_fit_performed) fitting_context.new_fit_notifier.add_subscriber(self._new_fit_observer)
def __init__(self, view, model, context): """ :param view: A reference to the QWidget object for plotting :param model: A refence to a model which contains the plotting logic :param context: A reference to the Muon context object """ self._view = view self._model = model self.context = context self._view.on_plot_button_clicked(self.handle_data_updated) self._view.on_rebin_options_changed( self.handle_use_raw_workspaces_changed) self._view.on_plot_type_changed(self.handle_plot_type_changed) self.input_workspace_observer = GenericObserver( self.handle_data_updated) self.fit_observer = GenericObserver(self.handle_fit_completed) self.group_pair_observer = GenericObserver( self.handle_group_pair_to_plot_changed) self.rebin_options_set_observer = GenericObserver( self.handle_rebin_options_set) self.instrument_observer = GenericObserver( self.handle_instrument_changed) self.keep = False
def __init__(self, view, model, subwidgets): self._view = view self._model = model self._subwidgets = subwidgets self.instrumentObserver = HomeTabPresenter.InstrumentObserver(self) self.loadObserver = HomeTabPresenter.LoadObserver(self) self.groupingObserver = HomeTabPresenter.GroupingObserver(self) self.enable_observer = HomeTabPresenter.EnableWidgetObserver(self) self.disable_observer = HomeTabPresenter.DisableWidgetObserver(self) self.update_view_from_model_observer = GenericObserver(self.update_all_widgets) self.update_all_widgets()