Skip to content

Commit

Permalink
[databrwoser] close data when widget is closed
Browse files Browse the repository at this point in the history
  • Loading branch information
janscience committed Sep 9, 2024
1 parent d42f567 commit 5f37bbc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/audian/audian.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,8 +1307,11 @@ def close(self, index=None):
if index is None:
index = self.tabs.currentIndex()
if not self.startup_active:
self.browsers.remove(self.tabs.widget(index))
w = self.tabs.widget(index)
self.browsers.remove(w)
self.tabs.removeTab(index)
w.close()
del w
if self.tabs.count() == 0:
self.tabs.addTab(self.startup, 'Startup')
self.startup.setVisible(True)
Expand Down
11 changes: 8 additions & 3 deletions src/audian/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ def clear_traces(self):


def __del__(self):
if not self.data is None:
self.data.close()

self.close()


def __len__(self):
return len(self.traces)

Expand Down Expand Up @@ -196,6 +195,12 @@ def open(self, unwrap, unwrap_clip):
trace.open(self.traces[source])
self.set_need_update()


def close(self):
if not self.data is None:
self.data.close()
self.data = None


def set_need_update(self):
if self.data is None:
Expand Down
4 changes: 4 additions & 0 deletions src/audian/databrowser.py
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ def open(self, gui, unwrap, unwrap_clip, highpass_cutoff, lowpass_cutoff):
else:
sl[lidx].addPoints((t1,), (0.0,), data=(ds,), tip=marker_tip)


def close(self):
self.data.close()


def show_metadata(self):

Expand Down

0 comments on commit 5f37bbc

Please sign in to comment.