Пример #1
0
 def _create_table_batch(self, ws, parent, window_flags, view, model):
     model = model if model is not None else TableWorkspaceDisplayModel(ws)
     table_model = TableModel(parent=parent, data_model=model)
     view = view if view else TableWorkspaceDisplayView(presenter=self, parent=parent, window_flags=window_flags,
                                                        table_model=table_model)
     self.presenter = TableWorkspaceDataPresenterBatch(model, view)
     return view, model
Пример #2
0
    def __init__(self,
                 ws,
                 plot=None,
                 parent=None,
                 model=None,
                 view=None,
                 name=None,
                 ads_observer=None,
                 container=None,
                 window_width=600,
                 window_height=400):
        """
        Creates a display for the provided workspace.

        :param ws: Workspace to be displayed
        :param parent: Parent of the widget
        :param plot: Plotting function that will be used to plot workspaces. This requires Matplotlib directly.
                     Passed in as parameter to allow mocking
        :param model: Model to be used by the widget. Passed in as parameter to allow mocking
        :param view: View to be used by the widget. Passed in as parameter to allow mocking
        :param name: Custom name for the window
        :param ads_observer: ADS observer to be used by the presenter. If not provided the default
                             one is used. Mainly intended for testing.
        """
        model = model if model is not None else TableWorkspaceDisplayModel(ws)
        view = view if view else TableWorkspaceDisplayView(self, parent)
        TableWorkspaceDataPresenter.__init__(self, model, view)

        self.name = name if name else self.model.get_name()
        self.container = container if container else StatusBarView(
            parent,
            self.view,
            self.name,
            window_width=window_width,
            window_height=window_height,
            presenter=self)

        DataCopier.__init__(self, self.container.status_bar)

        self.parent = parent
        self.plot = plot
        self.view.set_context_menu_actions(self.view)

        self.ads_observer = ads_observer if ads_observer else WorkspaceDisplayADSObserver(
            self)

        self.refresh()

        # connect to cellChanged signal after the data has been loaded
        self.view.itemChanged.connect(self.handleItemChanged)
Пример #3
0
 def _create_table_standard(self, ws, parent, window_flags, view, model):
     model = model if model is not None else TableWorkspaceDisplayModel(ws)
     view = view if view else TableWorkspaceDisplayView(
         presenter=self, parent=parent, window_flags=window_flags)
     self.presenter = TableWorkspaceDataPresenterStandard(model, view)
     return view, model
Пример #4
0
 def __init__(self, *args, **kwargs):
     self._key_handler = kwargs.pop('key_handler')
     TableWorkspaceDisplayView.__init__(self, *args, **kwargs)
     self.source_model = self.model()
     self.proxy_model = None
Пример #5
0
 def __init__(self, *args, **kwargs):
     self._key_handler = kwargs.pop('key_handler')
     TableWorkspaceDisplayView.__init__(self, *args, **kwargs)