Skip to content

Commit c11216c

Browse files
committed
fix: fix Qmax update after load new parsed data
1 parent 1e60597 commit c11216c

2 files changed

Lines changed: 32 additions & 6 deletions

File tree

news/fix-qmax-update.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* <news item>
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/srfit/fitbase/profilegenerator.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -163,15 +163,18 @@ def set_profile(self, profile):
163163
will store the calculated signal.
164164
"""
165165
if self.profile is not None:
166-
self.profile.removeObserver(self._flush)
166+
self.profile.removeObserver(self._on_profile_changed)
167167

168168
self.profile = profile
169-
self.profile.addObserver(self._flush)
170-
self._flush(other=(self,))
169+
self.profile.addObserver(self._on_profile_changed)
170+
self._on_profile_changed(other=(self,))
171+
return
171172

172-
# Merge the profiles metadata with our own
173-
self.meta.update(self.profile.meta)
174-
self.processMetaData()
173+
def _on_profile_changed(self, other=()):
174+
if self.profile is not None:
175+
self.meta.update(self.profile.meta)
176+
self.processMetaData()
177+
self._flush(other=other)
175178
return
176179

177180
def processMetaData(self):

0 commit comments

Comments
 (0)