def save(self): app = get_app() # Only save the current log if it is not empty (i.e., it contains at # least one step). if app.experiment_log and len([x for x in app.experiment_log.get('step') if x is not None]): data = {"software version": app.version} data["device name"] = app.dmf_device.name data["protocol name"] = app.protocol.name data["notes"] = textview_get_text(app.protocol_controller. \ builder.get_object("textview_notes")) plugin_versions = {} for name in get_service_names(env='microdrop.managed'): service = get_service_instance_by_name(name) if service._enable: plugin_versions[name] = str(service.version) data['plugins'] = plugin_versions app.experiment_log.add_data(data) log_path = app.experiment_log.save() # save the protocol and device app.protocol.save(os.path.join(log_path,"protocol")) app.dmf_device.save(os.path.join(log_path,"device")) # create a new log experiment_log = ExperimentLog(app.experiment_log.directory) emit_signal("on_experiment_log_changed", experiment_log)
def on_textview_notes_focus_out_event(self, widget, data=None): if len(self.results.log.data[0])==0: self.results.log.data.append({}) self.results.log.data[-1]['core']['notes'] = \ textview_get_text(self.builder.get_object("textview_notes")) filename = os.path.join(self.results.log.directory, str(self.results.log.experiment_id), 'data') self.results.log.save(filename)