예제 #1
0
파일: __init__.py 프로젝트: lanery/odemis
    def create_simple_tab_model(self):
        main = gmodel.MainGUIData(None)  # no microscope backend
        tab = gmodel.MicroscopyGUIData(main)

        # Add one view
        fview = gmodel.MicroscopeView("fakeview")
        tab.views.value.append(fview)
        tab.focussedView.value = fview

        return tab
예제 #2
0
    def __init__(self):
        fview = guimodel.MicroscopeView("fakeview")
        self.focussedView = model.VigilantAttribute(fview)

        self.main = Object()
        self.main.light = None
        self.main.ebeam = None

        self.light = None
        self.light_filter = None
        self.ccd = None
        self.sed = None
        self.ebeam = None
예제 #3
0
    def create_cryo_tab_model(self):
        main = gmodel.MainGUIData(None)  # no microscope backend
        # add role, features and currentFeature directly
        main.role = "cryo"
        main.features = omodel.ListVA()
        main.currentFeature = omodel.VigilantAttribute(None)
        tab = gmodel.CryoGUIData(main)

        # Add one view
        fview = gmodel.MicroscopeView("fakeview")
        tab.views.value.append(fview)
        tab.focussedView.value = fview

        return tab
예제 #4
0
    def duplicate_tab_data_model(self, orig):
        """
        Duplicate a MicroscopyGUIData and adapt it for the acquisition window
        The streams will be shared, but not the views
        orig (MicroscopyGUIData)
        return (MicroscopyGUIData)
        """
        data_model = AcquisitionWindowData(orig.main)
        data_model.streams.value.extend(orig.streams.value)

        # create view (which cannot move or focus)
        view = guimodel.MicroscopeView("All")
        data_model.views.value = [view]
        data_model.focussedView.value = view
        return data_model
예제 #5
0
    def __init__(self):
        fview = gmodel.MicroscopeView("fakeview")
        self.focussedView = omodel.VigilantAttribute(fview)

        self.main = Object()  #pylint: disable=E0602
        self.main.light = None
        self.main.ebeam = None
        self.main.debug = omodel.VigilantAttribute(fview)
        self.focussedView = omodel.VigilantAttribute(fview)

        self.light = None
        self.light_filter = None
        self.ccd = None
        self.sed = None
        self.ebeam = None
        self.tool = None
        self.subscribe = None
예제 #6
0
    def duplicate_tab_data_model(self, orig):
        """
        Duplicate a MicroscopyGUIData and adapt it for the acquisition window
        The streams will be shared, but not the views
        orig (MicroscopyGUIData)
        return (MicroscopyGUIData)
        """
        new = copy.copy(orig) # shallow copy

        # create view (which cannot move or focus)
        view = guimodel.MicroscopeView(orig.focussedView.value.name.value)

        # differentiate it (only one view)
        new.views = {"all": view}
        new.focussedView = model.VigilantAttribute(view)
        new.viewLayout = model.IntEnumerated(guimodel.VIEW_LAYOUT_ONE,
                                             choices=set([guimodel.VIEW_LAYOUT_ONE]))

        return new
예제 #7
0
    def duplicate_tab_data_model(self, orig):
        """
        Duplicate a MicroscopyGUIData and adapt it for the acquisition window
        The streams will be shared, but not the views
        orig (MicroscopyGUIData)
        return (MicroscopyGUIData)
        """
        # TODO: we'd better create a new view and copy the streams
        new = copy.copy(orig)  # shallow copy

        new.streams = model.ListVA(orig.streams.value)  # duplicate

        # create view (which cannot move or focus)
        view = guimodel.MicroscopeView("All")

        # differentiate it (only one view)
        new.views = model.ListVA()
        new.views.value.append(view)
        new.focussedView = model.VigilantAttribute(view)
        new.viewLayout = model.IntEnumerated(guimodel.VIEW_LAYOUT_ONE,
                                             choices={guimodel.VIEW_LAYOUT_ONE})
        new.tool = model.IntEnumerated(TOOL_NONE, choices={TOOL_NONE})
        return new
예제 #8
0
    def test_stream_interface(self):

        test.gui_loop()

        tab_mod = self.create_simple_tab_model()
        stream_bar = self.app.test_frame.stream_bar

        _ = StreamBarController(tab_mod, stream_bar)

        # Hide the Stream add button
        self.assertEqual(stream_bar.btn_add_stream.IsShown(), True)
        stream_bar.hide_add_button()
        test.gui_loop()
        self.assertEqual(stream_bar.btn_add_stream.IsShown(), False)

        # Show Stream add button
        stream_bar.show_add_button()
        test.gui_loop()
        self.assertEqual(stream_bar.btn_add_stream.IsShown(), True)

        # Add an editable entry
        fake_cstream = FakeFluoStream("First Custom Stream")
        custom_entry = stream_comp.StreamPanel(stream_bar, fake_cstream)
        stream_bar.add_stream_panel(custom_entry)
        test.gui_loop()

        self.assertEqual(stream_bar.get_size(), 1)
        self.assertEqual(stream_bar.stream_panels.index(custom_entry), 0)

        # Add a fixed stream
        fake_fstream1 = FakeSEMStream("First Fixed Stream")
        fixed_entry = stream_comp.StreamPanel(stream_bar, fake_fstream1)
        stream_bar.add_stream_panel(fixed_entry)
        test.gui_loop()

        self.assertEqual(stream_bar.get_size(), 2)
        self.assertEqual(stream_bar.stream_panels.index(fixed_entry), 0)
        self.assertEqual(stream_bar.stream_panels.index(custom_entry), 1)

        # Add a fixed stream
        fake_fstream2 = FakeSEMStream("Second Fixed Stream")
        fixed_entry2 = stream_comp.StreamPanel(stream_bar, fake_fstream2)
        stream_bar.add_stream_panel(fixed_entry2)
        test.gui_loop()

        self.assertEqual(stream_bar.get_size(), 3)
        self.assertEqual(stream_bar.stream_panels.index(fixed_entry2), 1)
        self.assertEqual(stream_bar.stream_panels.index(custom_entry), 2)

        # Hide first stream by changing to a view that only show SEM streams
        semview = guimodel.MicroscopeView("SEM view",
                                          stream_classes=(SEMStream, ))
        # stream_bar.hide_stream(0)
        tab_mod.focussedView.value = semview
        test.gui_loop()
        self.assertEqual(stream_bar.get_size(), 3)
        self.assertFalse(custom_entry.IsShown())

        # Delete the second fixed stream
        stream_bar.remove_stream_panel(fixed_entry2)
        test.gui_loop()

        self.assertEqual(stream_bar.get_size(), 2)

        # Clear remaining streams
        stream_bar.clear()
        test.gui_loop()

        self.assertEqual(stream_bar.get_size(), 0)