def create_fit_pane(self):
        self.fit_model = PlotTimeFitPaneModel(self._context)
        name = self.fit_model.name
        self.plotting_canvas_widgets[name] = PlottingCanvasWidget(self._parent, context=
                                                                        self._context.plot_panes_context[name],
                                                                        plot_model=self.fit_model)
        self._views[name] = BasePaneView(self._parent)
        self._views[name].add_canvas_widget(self.plotting_canvas_widgets[name].widget)

        self.modes[FIT] = PlotFitPanePresenter(self._views[name], self.fit_model,
                                               self._context,self._context.fitting_context,
                                               self.plotting_canvas_widgets[name].presenter)
        self._panes.append(self.modes[FIT])
    def create_data_pane(self):
        self.data_model = PlotDataPaneModel(self._context)
        # names need to match the model for the use outside of this file
        name = self.data_model.name
        self.plotting_canvas_widgets[name] = PlottingCanvasWidget(self._parent, context=
                                                                        self._context.plot_panes_context[name],
                                                                        plot_model=self.data_model)
        self._views[name] = BasePaneView(self._parent)
        self._views[name].add_canvas_widget(self.plotting_canvas_widgets[name].widget)

        self.modes[DATA] = PlotDataPanePresenter(self._views[name], self.data_model,
                                                 self._context,self.plotting_canvas_widgets[name].presenter)
        self._panes.append(self.modes[DATA])
Exemplo n.º 3
0
    def __init__(self,
                 context=None,
                 get_active_fit_results=lambda: [],
                 parent=None):

        self.data_model = EAPlotDataPaneModel(context)

        self.plotting_canvas_widgets = {
            self.data_model.name:
            PlottingCanvasWidget(
                parent,
                context=context.plot_panes_context[self.data_model.name],
                plot_model=self.data_model)
        }

        # The UI view
        self._view1 = BasePaneView(parent)
        self._view1.add_canvas_widget(
            self.plotting_canvas_widgets[self.data_model.name].widget)

        # set up presenter
        self.view = MainPlotWidgetView(parent)
        self.model = EAPlotDataPaneModel(context)
        # generate the presenter

        self.data_mode = EAPlotDataPanePresenter(
            self._view1, self.data_model, context,
            self.plotting_canvas_widgets[self.data_model.name].presenter)

        self.presenter = MainPlotWidgetPresenter(self.view, [self.data_mode])
        self._current_plot_mode = self.presenter.get_plot_mode
        self.presenter.set_plot_mode_changed_slot(
            self.handle_plot_mode_changed_by_user)

        for observer in self.presenter.workspace_replaced_in_ads_observers:
            context.update_plots_notifier.add_subscriber(observer)
        for observer in self.presenter.workspace_deleted_from_ads_observers:
            context.deleted_plots_notifier.add_subscriber(observer)
Exemplo n.º 4
0
class EAPlotWidget(object):
    def __init__(self,
                 context=None,
                 get_active_fit_results=lambda: [],
                 parent=None):

        self.data_model = EAPlotDataPaneModel(context)

        self.plotting_canvas_widgets = {
            self.data_model.name:
            PlottingCanvasWidget(
                parent,
                context=context.plot_panes_context[self.data_model.name],
                plot_model=self.data_model)
        }

        # The UI view
        self._view1 = BasePaneView(parent)
        self._view1.add_canvas_widget(
            self.plotting_canvas_widgets[self.data_model.name].widget)

        # set up presenter
        self.view = MainPlotWidgetView(parent)
        self.model = EAPlotDataPaneModel(context)
        # generate the presenter

        self.data_mode = EAPlotDataPanePresenter(
            self._view1, self.data_model, context,
            self.plotting_canvas_widgets[self.data_model.name].presenter)

        self.presenter = MainPlotWidgetPresenter(self.view, [self.data_mode])
        self._current_plot_mode = self.presenter.get_plot_mode
        self.presenter.set_plot_mode_changed_slot(
            self.handle_plot_mode_changed_by_user)

        for observer in self.presenter.workspace_replaced_in_ads_observers:
            context.update_plots_notifier.add_subscriber(observer)
        for observer in self.presenter.workspace_deleted_from_ads_observers:
            context.deleted_plots_notifier.add_subscriber(observer)

    def set_plot_view(self, plot_mode):
        self.view.set_plot_mode(plot_mode)

    @property
    def data_changed_observers(self):
        return self.presenter.data_changed_observers

    @property
    def workspace_deleted_from_ads_observers(self):
        return self.presenter.workspace_deleted_from_ads_observers

    @property
    def rebin_options_set_observers(self):
        return self.presenter.rebin_options_set_observers

    @property
    def data_index(self):
        return self.view.get_index(self.data_mode.name)

    def handle_plot_mode_changed_by_user(self):
        pass

    def close(self):
        self.view.close()
    def __init__(self,
                 context=None,
                 get_active_fit_results=lambda: [],
                 parent=None):
        self.data_model = PlotDataPaneModel(context)
        self.fit_model = PlotFreqFitPaneModel(context)
        #self.raw_model = RawPaneModel(context)
        self.plot_maxent_model = DualPlotMaxentPaneModel(
            context, self.data_model, RawPaneModel(context))
        #models = [self.data_model, self.fit_model, self.raw_model, self.plot_maxent_model]
        models = [self.data_model, self.fit_model, self.plot_maxent_model]

        self.view = MainPlotWidgetView(parent)
        self.model = PlotDataPaneModel(context)
        # The plotting canvas widgets
        self.plotting_canvas_widgets = {}
        # The UI view
        self._views = {}

        for model in models:

            if model == self.plot_maxent_model:
                dual_quick_edit = DualQuickEditWidget(
                    context.plot_panes_context[model.name], parent)
                self.plotting_canvas_widgets[
                    model.name] = PlottingCanvasWidget(
                        parent,
                        context=context.plot_panes_context[model.name],
                        plot_model=model,
                        figure_options=dual_quick_edit)
                self._views[model.name] = DualPlotMaxentPaneView(parent)

            #elif model == self.raw_model:
            #    self.plotting_canvas_widgets[model.name] = PlottingCanvasWidget(parent, context=
            #                                                                     context.plot_panes_context[model.name],
            #                                                                     plot_model=model)
            #    self._views[model.name] = RawPaneView(parent)

            else:
                self.plotting_canvas_widgets[
                    model.name] = PlottingCanvasWidget(
                        parent,
                        context=context.plot_panes_context[model.name],
                        plot_model=model)
                self._views[model.name] = BasePaneView(parent)
            self._views[model.name].add_canvas_widget(
                self.plotting_canvas_widgets[model.name].widget)

        #self.plotting_canvas_widgets[self.raw_model.name].disable_plot_selection()
        # set up presenter

        # generate the presenters
        name = self.data_model.name
        self.data_mode = PlotDataPanePresenter(
            self._views[name], self.data_model, context,
            self.plotting_canvas_widgets[name].presenter)

        name = self.fit_model.name
        self.fit_mode = PlotFreqFitPanePresenter(
            self._views[name], self.fit_model, context,
            context.fitting_context,
            self.plotting_canvas_widgets[name].presenter)

        #name = self.raw_model.name
        #self.raw_mode = RawPanePresenter(self._views[name], self.raw_model,
        #                                         context,self.plotting_canvas_widgets[name].presenter)

        name = self.plot_maxent_model.name
        self.maxent_mode = DualPlotMaxentPanePresenter(
            self._views[name], self.plot_maxent_model, context,
            self.plotting_canvas_widgets[name].presenter)

        self.presenter = MainPlotWidgetPresenter(
            self.view, [self.data_mode, self.fit_mode, self.maxent_mode])
        #[self.data_mode, self.raw_mode, self.fit_mode, self.maxent_mode])

        self._current_plot_mode = self.presenter.get_plot_mode
        self.presenter.set_plot_mode_changed_slot(
            self.handle_plot_mode_changed_by_user)

        for observer in self.presenter.workspace_replaced_in_ads_observers:
            context.update_plots_notifier.add_subscriber(observer)
        for observer in self.presenter.workspace_deleted_from_ads_observers:
            context.deleted_plots_notifier.add_subscriber(observer)