Ejemplo n.º 1
0
    def __init__(self, context, fft_widget, maxent_widget, parent=None):
        super(TransformWidget, self).__init__(parent)
        self._fft = fft_widget(load=context, parent=self)
        self._maxent = maxent_widget(context=context, parent=self)
        self._selector = TransformSelectionWidget(parent=self)
        self.load_observer = LoadObserver(self)
        self.context = context
        self.instrumentObserver = instrumentObserver(self)
        self.GroupPairObserver = GenericObserver(self.handle_new_group_pair)
        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)
        self.disable_view()
        # to make it compatable with the old GUI
        try:
            self.context.update_view_from_model_notifier.add_subscriber(
                self.update_view_from_model_observer)
        except:
            pass
Ejemplo n.º 2
0
class TransformWidget(QtGui.QWidget):
    def __init__(self, load, parent=None):
        super(TransformWidget, self).__init__(parent)
        self._fft = FFTWidget(load=load, parent=self)
        self._maxent = MaxEntWidget(load=load, parent=self)
        self._selector = TransformSelectionWidget(parent=self)

        groupedViews = self.getViews()

        self._view = TransformView(self._selector.widget, groupedViews, parent)

        self._selector.setSelectionConnection(self.updateDisplay)

    @property
    def widget(self):
        return self._view

    def mockWidget(self, mockView):
        self._view = mockView

    def closeEvent(self, event):
        self._selector.closeEvent(event)
        self._fft.closeEvent(event)
        self._maxent.closeEvent(event)

    def updateDisplay(self, method):
        self._view.hideAll()
        self._view.show(method)

    def getViews(self):
        groupedViews = {}
        groupedViews["FFT"] = self._fft.widget
        groupedViews["MaxEnt"] = self._maxent.widget
        return groupedViews
Ejemplo n.º 3
0
class TransformWidget(QtGui.QWidget):
    def __init__(self, load, parent=None):
        super(TransformWidget,self).__init__(parent)
        self._fft = FFTWidget(load=load,parent=self)
        self._maxent = MaxEntWidget(load=load,parent=self)
        self._selector = TransformSelectionWidget(parent=self)

        groupedViews = self.getViews()

        self._view = TransformView(self._selector.widget, groupedViews,parent)

        self._selector.setSelectionConnection(self.updateDisplay)

    @property
    def widget(self):
        return self._view

    def mockWidget(self, mockView):
        self._view = mockView

    def closeEvent(self,event):
        self._selector.closeEvent(event)
        self._fft.closeEvent(event)
        self._maxent.closeEvent(event)

    def updateDisplay(self,method):
        self._view.hideAll()
        self._view.show(method)

    def getViews(self):
        groupedViews = {}
        groupedViews["FFT"] = self._fft.widget
        groupedViews["MaxEnt"] = self._maxent.widget
        return groupedViews
Ejemplo n.º 4
0
    def __init__(self, load, parent=None):
        super(TransformWidget, self).__init__(parent)
        self._fft = FFTWidget(load=load, parent=self)
        self._maxent = MaxEntWidget(load=load, parent=self)
        self._selector = TransformSelectionWidget(parent=self)

        groupedViews = self.getViews()

        self._view = TransformView(self._selector.widget, groupedViews, parent)

        self._selector.setSelectionConnection(self.updateDisplay)
Ejemplo n.º 5
0
class TransformWidget(QtWidgets.QWidget):

    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.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')

    @property
    def widget(self):
        return self._view

    def mockWidget(self, mockView):
        self._view = mockView

    def closeEvent(self, event):
        self._selector.closeEvent(event)
        self._fft.closeEvent(event)
        self._maxent.closeEvent(event)

    def updateDisplay(self, method):
        self._view.hideAll()
        self._view.showMethod(method)

    def getViews(self):
        groupedViews = {}
        groupedViews["FFT"] = self._fft.widget
        groupedViews["MaxEnt"] = self._maxent.widget
        return groupedViews

    def handle_new_data_loaded(self):
        self._maxent.runChanged()
        self._fft.runChanged()

    def handle_new_instrument(self):
        self._maxent.clear()

    def handle_new_group_pair(self):
        # may have new groups/pairs for multiple runs
        self._fft.runChanged()

    def disable_view(self):
        self._view.setEnabled(False)

    def enable_view(self):
        self._view.setEnabled(True)
Ejemplo n.º 6
0
    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.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')
Ejemplo n.º 7
0
    def __init__(self, load, parent=None):
        super(TransformWidget,self).__init__(parent)
        self._fft = FFTWidget(load=load,parent=self)
        self._maxent = MaxEntWidget(load=load,parent=self)
        self._selector = TransformSelectionWidget(parent=self)

        groupedViews = self.getViews()

        self._view = TransformView(self._selector.widget, groupedViews,parent)

        self._selector.setSelectionConnection(self.updateDisplay)
Ejemplo n.º 8
0
class TransformWidget(QtWidgets.QWidget):
    def __init__(self, context, fft_widget, maxent_widget, parent=None):
        super(TransformWidget, self).__init__(parent)
        self._fft = fft_widget(load=context, parent=self)
        self._maxent = maxent_widget(context=context, parent=self)
        self._selector = TransformSelectionWidget(parent=self)
        self.load_observer = LoadObserver(self)
        self.context = context
        self.instrumentObserver = instrumentObserver(self)
        self.GroupPairObserver = GenericObserver(self.handle_new_group_pair)
        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)
        self.disable_view()
        # to make it compatable with the old GUI
        try:
            self.context.update_view_from_model_notifier.add_subscriber(
                self.update_view_from_model_observer)
        except:
            pass

    def update_view_from_model(self):
        self._fft.update_view_from_model()
        self._maxent.update_view_from_model()

    @property
    def widget(self):
        return self._view

    def mockWidget(self, mockView):
        self._view = mockView

    def closeEvent(self, event):
        self._selector.closeEvent(event)
        self._fft.closeEvent(event)
        self._maxent.closeEvent(event)

    def updateDisplay(self, method):
        self._view.hideAll()
        self._view.showMethod(method)

    def getViews(self):
        groupedViews = {}
        groupedViews["FFT"] = self._fft.widget
        groupedViews["MaxEnt"] = self._maxent.widget
        return groupedViews

    def handle_new_data_loaded(self):
        self._maxent.runChanged()
        self._fft.runChanged()
        if self.getViews()["FFT"].workspace == "":
            self.disable_view()
        else:
            self.enable_view()

    def handle_new_instrument(self):
        self._maxent.clear()

    def handle_new_group_pair(self):
        # may have new groups/pairs for multiple runs
        self._fft.runChanged()
        self._maxent.presenter.update_phase_table_options()

    def disable_view(self):
        self._view.setEnabled(False)

    def enable_view(self):
        self._view.setEnabled(True)

    def set_up_calculation_observers(self, enable, disable):
        # assume FFT are cheap enough that disable/enable GUI would make no
        # difference
        self._maxent._presenter.calculation_finished_notifier.add_subscriber(
            enable)
        self._maxent._presenter.calculation_started_notifier.add_subscriber(
            disable)

    def new_data_observer(self, observer):
        self._maxent._presenter.calculation_finished_notifier.add_subscriber(
            observer)
        self._fft._presenter.calculation_finished_notifier.add_subscriber(
            observer)