Skip to content

Commit c39c69d

Browse files
committed
Fix manager loop in headless mode
1 parent 0be68b7 commit c39c69d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/goofi/manager.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,15 @@ def __init__(
135135
self._save_path = None
136136
self._unsaved_changes = False
137137

138-
# start the blocking non-daemon post-initialization thread to leave the main thread free for the GUI (limitation of MacOS)
139-
Thread(target=self.post_init, args=(filepath, duration), daemon=False).start()
138+
if self.headless:
139+
# there is no GUI, so we can run everything in the main thread
140+
self.post_init(filepath, duration)
141+
else:
142+
# start the blocking non-daemon post-initialization thread to leave the main thread free for the GUI (limitation of MacOS)
143+
Thread(target=self.post_init, args=(filepath, duration), daemon=False).start()
140144

141-
# initialize the GUI
142-
# NOTE: this is a blocking call, so it must be the last thing we do
143-
if not self.headless:
145+
# initialize the GUI
146+
# NOTE: this is a blocking call, so it must be the last thing we do
144147
Window(self)
145148

146149
def post_init(self, filepath: Optional[str] = None, duration: float = 0) -> None:

0 commit comments

Comments
 (0)