Пример #1
0
    def test_session_panel_controller_notifies_fields_changed(self):
        session_panel_controller = SessionPanel.SessionPanelController()
        fields = dict()

        def fields_changed(d):
            fields.update(d)

        session_panel_controller.on_fields_changed = fields_changed

        ApplicationData.get_session_metadata_model(
        ).microscopist = "Ned Flanders"
        ApplicationData.get_session_metadata_model().site = "Earth"

        self.assertEqual({
            "microscopist": "Ned Flanders",
            "site": "Earth"
        }, fields)
Пример #2
0
 def set_field(self, field_id: str, value: str) -> None:
     setattr(ApplicationData.get_session_metadata_model(), field_id, value)
Пример #3
0
 def field_values(self):
     return ApplicationData.get_session_metadata_model().to_dict_value()
Пример #4
0
 def __init__(self):
     self.__property_changed_listener = ApplicationData.get_session_metadata_model(
     ).property_changed_event.listen(self.__property_changed)
     self.on_fields_changed = None
Пример #5
0
 def field_values(self) -> StructuredModel.DictValue:
     return ApplicationData.get_session_metadata_model().to_dict_value()
Пример #6
0
 def __init__(self) -> None:
     self.__property_changed_listener = ApplicationData.get_session_metadata_model(
     ).property_changed_event.listen(self.__property_changed)
     self.on_fields_changed: typing.Optional[typing.Callable[
         [StructuredModel.DictValue], None]] = None