mirror of
https://github.com/aclist/dztui.git
synced 2026-10-30 14:42:54 +01:00
fix: check cancel event in loop prior to mod directory creation
This commit is contained in:
1 parent
58a2bf0bfa
commit
b615869278
1 file changed
+26
-11
@@ -278,10 +278,11 @@ class ConnectionManager:
|
|||||||
self.thread_man.show_cancel(False)
|
self.thread_man.show_cancel(False)
|
||||||
self.thread_man.update_dialog(waiting_for_launch)
|
self.thread_man.update_dialog(waiting_for_launch)
|
||||||
while True:
|
while True:
|
||||||
# TODO: check cancel event
|
if self.is_cancel_pending():
|
||||||
if self.controller.get_exit_event().is_set():
|
|
||||||
# TODO: some facility to also close spawned steam process
|
# TODO: some facility to also close spawned steam process
|
||||||
return
|
return
|
||||||
|
# if self.controller.get_exit_event().is_set():
|
||||||
|
# return
|
||||||
if is_dayz_running():
|
if is_dayz_running():
|
||||||
break
|
break
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
@@ -293,17 +294,27 @@ class ConnectionManager:
|
|||||||
self.controller.add_to_history(self.history, self.record)
|
self.controller.add_to_history(self.history, self.record)
|
||||||
self.controller.open_page(NotebookPage.SERVERS)
|
self.controller.open_page(NotebookPage.SERVERS)
|
||||||
|
|
||||||
|
def is_cancel_pending(self) -> bool:
|
||||||
|
if self.controller.get_exit_event().is_set():
|
||||||
|
return True
|
||||||
|
if self.controller.get_cancel_event().is_set():
|
||||||
|
self.controller.clear_cancel_event()
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def _update_mods(self, raise_window: bool, menu_only: bool = False) -> None:
|
def _update_mods(self, raise_window: bool, menu_only: bool = False) -> None:
|
||||||
# NOTE: fast enqueue all mods in auto mode
|
# NOTE: fast enqueue all mods in auto mode
|
||||||
prefs = self.controller.get_prefs()
|
prefs = self.controller.get_prefs()
|
||||||
|
|
||||||
for title, mod, stamp, size in self.missing_mods:
|
for title, mod, stamp, size in self.missing_mods:
|
||||||
|
if self.is_cancel_pending():
|
||||||
|
return
|
||||||
# TODO: check cancel and exit events
|
# TODO: check cancel and exit events
|
||||||
if self.controller.get_exit_event().is_set():
|
# if self.controller.get_exit_event().is_set():
|
||||||
return
|
# return
|
||||||
if self.controller.get_cancel_event().is_set():
|
# if self.controller.get_cancel_event().is_set():
|
||||||
self.controller.clear_cancel_event()
|
# self.controller.clear_cancel_event()
|
||||||
return
|
# return
|
||||||
enqueue_mod(mod, self.appid)
|
enqueue_mod(mod, self.appid)
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
@@ -316,13 +327,17 @@ class ConnectionManager:
|
|||||||
|
|
||||||
# NOTE: Steam updates mod chunks in parallel, will finish at the same time
|
# NOTE: Steam updates mod chunks in parallel, will finish at the same time
|
||||||
while mod_path.is_dir() is False:
|
while mod_path.is_dir() is False:
|
||||||
|
if self.is_cancel_pending():
|
||||||
|
return
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
while True:
|
while True:
|
||||||
if self.controller.get_exit_event().is_set():
|
if self.is_cancel_pending():
|
||||||
return
|
|
||||||
if self.controller.get_cancel_event().is_set():
|
|
||||||
self.controller.clear_cancel_event()
|
|
||||||
return
|
return
|
||||||
|
# if self.controller.get_exit_event().is_set():
|
||||||
|
# return
|
||||||
|
# if self.controller.get_cancel_event().is_set():
|
||||||
|
# self.controller.clear_cancel_event()
|
||||||
|
# return
|
||||||
cur_size = get_mod_dir_size(mod_path)
|
cur_size = get_mod_dir_size(mod_path)
|
||||||
if cur_size == size:
|
if cur_size == size:
|
||||||
break
|
break
|
||||||
|
|||||||
Reference in new issue
Block a user