Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
Add Launch Game to operation done,
Browse files Browse the repository at this point in the history
fixed text mods with only new files
  • Loading branch information
NiceneNerd committed Sep 3, 2019
1 parent 6780044 commit 9fbe8d4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
24 changes: 20 additions & 4 deletions bcml/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ def PerformOperation(self, func, *args, title: str = 'Operation In Progress'):


def OperationFinished(self):
title = self._progress.windowTitle()
self._progress.close()
del self._progress
self.btnInstall.setEnabled(True)
Expand All @@ -328,18 +329,33 @@ def OperationFinished(self):
self.btnCemu.setEnabled(True)
self.btnOrder.setEnabled(True)
self.LoadMods()
QtWidgets.QMessageBox.information(
self, 'Complete', 'Operation finished!')
msg_done = QtWidgets.QMessageBox(
QtWidgets.QMessageBox.Information,
f'{title} Finished',
'Operation complete!',
parent=self
)
msg_done.addButton('OK', QtWidgets.QMessageBox.NoRole)
msg_done.addButton('Launch Game', QtWidgets.QMessageBox.ActionRole)
result = msg_done.exec_()
del self._thread
util.clear_temp_dir()
if result == 1:
self.CemuClicked()

def OperationError(self):
self.btnInstall.setEnabled(True)
self.btnRemerge.setEnabled(True)
self.btnExport.setEnabled(True)
self.btnRestore.setEnabled(True)
self.btnCemu.setEnabled(True)
self.btnOrder.setEnabled(True)
QtWidgets.QMessageBox.critical(
self, 'Error', f'BCML has encountered an error while performing an operation.'
f'Error details:\n\n{self._thread.error}')
self,
'Error',
f'BCML has encountered an error while performing an operation. '
f'Error details:\n\n{self._thread.error}'
)
self.LoadMods()
self._progress.close()
del self._progress
Expand Down
11 changes: 7 additions & 4 deletions bcml/texts.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,10 +198,11 @@ def get_modded_msyts(msg_sarc: sarc.SARC, lang: str = 'USen',
elif m_hash != hashes[msbt]:
write_msbts.append((tmp_dir / msbt, m_data.tobytes()))
modded_msyts.append(msbt.replace('.msbt', '.msyt'))
pool = multiprocessing.Pool()
pool.map(write_msbt, write_msbts)
pool.close()
pool.join()
if write_msbts:
pool = multiprocessing.Pool()
pool.map(write_msbt, write_msbts)
pool.close()
pool.join()
return modded_msyts, added_msbts


Expand Down Expand Up @@ -248,6 +249,8 @@ def get_modded_texts(modded_msyts: list, tmp_dir: Path = util.get_work_dir() / '
text_edits = {}
check_msyts = [msyt for msyt in list(ref_dir.rglob('**/*.msyt'))
if str(msyt.relative_to(ref_dir)).replace('\\', '/') in modded_msyts]
if not check_msyts:
return {}
num_threads = min(multiprocessing.cpu_count(), len(check_msyts))
thread_checker = partial(threaded_compare_texts,
tmp_dir=tmp_dir, ref_dir=ref_dir)
Expand Down

0 comments on commit 9fbe8d4

Please sign in to comment.