Skip to content

Commit f1f5649

Browse files
Fixing call to _sample_state_update when sample is unmounted (called without sample argument)
1 parent 0ecf1af commit f1f5649

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

mxcubeweb/core/adapter/sample_changer_adapter.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,6 @@ def _loaded_sample_changed(self, sample):
106106
namespace="/hwr",
107107
)
108108

109-
self._sc_contents_update()
110-
111109
self._sc_load_ready(address)
112110
except Exception:
113111
logging.getLogger("HWR").exception("Error setting loaded sample")
@@ -130,19 +128,19 @@ def _sc_unload(self, location):
130128

131129
self.app.server.emit("sc", msg, namespace="/hwr")
132130

133-
def _sample_state_update(self, sample):
134-
sample_data = {
135-
"sampleID": sample.get_address(),
136-
"location": sample.get_address(),
137-
"state": sample.state
138-
}
139-
140-
self.app.server.emit(
141-
"sc_sample_state_update",
142-
{"sample": sample_data},
143-
namespace="/hwr",
144-
)
131+
def _sample_state_update(self, sample=None):
132+
if sample:
133+
sample_data = {
134+
"sampleID": sample.get_address(),
135+
"location": sample.get_address(),
136+
"state": sample.state,
137+
}
145138

139+
self.app.server.emit(
140+
"sc_sample_state_update",
141+
{"sample": sample_data},
142+
namespace="/hwr",
143+
)
146144

147145
def _sc_maintenance_update(self, *args):
148146
if len(args) == 3:

0 commit comments

Comments
 (0)