def create_raw_pane(self):
        self.raw_model = RawPaneModel(self._context)
        name =self.raw_model.name
        self.plotting_canvas_widgets[name] = PlottingCanvasWidget(self._parent, context=
                                                                        self._context.plot_panes_context[name],
                                                                        plot_model=self.raw_model)
        self._views[name] = RawPaneView(self._parent)
        self._views[name].add_canvas_widget(self.plotting_canvas_widgets[name].widget)

        self.modes[RAW] = RawPanePresenter(self._views[name], self.raw_model,
                                                 self._context,self.plotting_canvas_widgets[name].presenter)
        self._panes.append(self.modes[RAW])
    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])
Esempio n. 4
0
    def create_maxent_pane(self):
        self.dual_model = DualPlotMaxentPaneModel(self._context, self.data_model, RawPaneModel(self._context))
        name = self.dual_model.name
        dual_quick_edit = DualQuickEditWidget(self._context.plot_panes_context[name], self._parent)
        self.plotting_canvas_widgets[name] = PlottingCanvasWidget(self._parent, context=
                                                                        self._context.plot_panes_context[name],
                                                                        plot_model=self.dual_model, figure_options=dual_quick_edit)

        self._views[name] = DualPlotMaxentPaneView(self._parent)
        self._views[name].add_canvas_widget(self.plotting_canvas_widgets[name].widget)

        self.modes[MAXENT] = DualPlotMaxentPanePresenter(self._views[name], self.dual_model,
                                                         self._context,
                                                         self.plotting_canvas_widgets[name].presenter)
        self._panes.append(self.modes[MAXENT])
        self.maxent_mode.update_freq_units.add_subscriber(self.fit_mode.update_fit_pane_observer)
        self.fit_mode.update_maxent_plot.add_subscriber(self.maxent_mode.update_x_label_observer)
Esempio n. 5
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)
    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)