Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
QtWidgets.QMessageBox.warning(
None,
'Error',
f'BCML requires Python 3.7 or higher, but your Python version is {ver[0]}.{ver[1]}'
)
sys.exit(0)
is_64bits = sys.maxsize > 2**32
if not is_64bits:
QtWidgets.QMessageBox.warning(
None,
'Error',
'BCML requires 64 bit Python, but it looks like you\'re running 32 bit.'
)
sys.exit(0)
if util.get_settings_bool('dark_theme'):
app.setStyleSheet(DARK_THEME)
if 'Roboto Lt' in QtGui.QFontDatabase().families(QtGui.QFontDatabase.Latin):
app.setFont(QtGui.QFont('Roboto Lt', 10, weight=QtGui.QFont.DemiBold))
application = MainWindow()
try:
application.show()
application.SetupChecks()
if len(sys.argv) > 1:
parg = process_args()
if parg:
application.InstallClicked(parg)
app.exec_()
except Exception: # pylint: disable=broad-except
tb = traceback.format_exc(limit=-2)
e = util.get_work_dir() / 'error.log'
QtWidgets.QMessageBox.warning(
# pylint: disable=unused-argument
super(SettingsDialog, self).__init__()
self.setupUi(self)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(
str(util.get_exec_dir() / 'data' / 'bcml.ico')))
self.setWindowIcon(icon)
self.txtCemu.setText(str(util.get_cemu_dir()))
self.txtGameDump.setText(str(util.get_game_dir()))
try:
self.txtMlc.setText(str(util.get_mlc_dir()))
except FileNotFoundError:
self.txtMlc.setText('')
self.chkDark.setChecked(util.get_settings_bool('dark_theme'))
self.chkGuessMerge.setChecked(not util.get_settings_bool('guess_merge'))
self.drpLang.addItems(texts.LANGUAGES)
self.drpLang.setCurrentText(util.get_settings()['lang'])
self.btnBrowseCemu.clicked.connect(self.BrowseCemuClicked)
self.btnBrowseGame.clicked.connect(self.BrowseGameClicked)
self.btnBrowseMlc.clicked.connect(self.BrowseMlcClicked)
def OrderClicked(self):
load_reverse = not util.get_settings_bool('load_reverse')
util.set_settings_bool('load_reverse', load_reverse)
self.LoadMods()
self.btnOrder.setIcon(self._order_icons[load_reverse])
higher = 'top' if not load_reverse else 'bottom'
lower = 'bottom' if not load_reverse else 'top'
self.listWidget.setToolTip('Drag and drop to change mod load order. Mods at the'
f'{higher} of the list override mods at the {lower}.')
def LoadMods(self):
self.statusBar().showMessage('Loading mods...')
self.listWidget.clear()
self._mods = sorted(util.get_installed_mods(disabled=True), key=lambda imod: imod.priority,
reverse=not util.get_settings_bool('load_reverse'))
for mod in self._mods:
mod_item = QtWidgets.QListWidgetItem()
mod_item.setText(mod.name)
mod_item.setData(QtCore.Qt.UserRole, mod)
if util.is_mod_disabled(mod):
mod_item.setTextColor(QtGui.QColor(211, 47, 47))
self.listWidget.addItem(mod_item)
self._mod_infos = {}
self.lblModInfo.linkActivated.connect(self.link)
self.lblModInfo.setText('No mod selected')
self.lblImage.setPixmap(self._logo)
self.lblImage.setFixedSize(256, 144)
self.statusBar().showMessage(f'{len(self._mods)} mods installed')
if self._mods:
self.btnRemerge.setEnabled(True)
self.btnExport.setEnabled(True)
def log_merged_files_rstb(original_pool: multiprocessing.Pool = None):
""" Generates an RSTB log for the master BCML modpack containing merged files """
print('Updating RSTB for merged files...')
diffs = {}
files = [item for item in util.get_master_modpack_dir().rglob('**/*') if item.is_file()]
guess = util.get_settings_bool('guess_merge')
for file in files:
if file.parent == 'logs':
continue
if file.suffix not in RSTB_EXCLUDE_EXTS and file.name not in RSTB_EXCLUDE_NAMES:
size = calculate_size(file)
if size == 0 and guess:
if file.suffix in util.AAMP_EXTS:
size = guess_aamp_size(file)
elif file.suffix in ['.bfres', '.sbfres']:
size = guess_bfres_size(file)
canon = util.get_canon_name(file.relative_to(util.get_master_modpack_dir()))
if canon:
diffs[canon] = size
sarc_files = [file for file in files if util.is_file_sarc(str(file)) \
and file.suffix != '.ssarc']
if sarc_files:
def __init__(self):
super(MainWindow, self).__init__()
self.setupUi(self)
self._mods = []
self._mod_infos = {}
self._progress = None
self._thread = None
self._cemu_exe = None
self.setWindowIcon(util.get_icon('bcml.ico'))
load_reverse = util.get_settings_bool('load_reverse')
self.menRemerge = QtWidgets.QMenu()
self.actMergeRstb = QtWidgets.QAction('Remerge RSTB')
self.actMergePacks = QtWidgets.QAction('Remerge Packs')
self.actMergeTexts = QtWidgets.QAction('Remerge Texts')
self.actMergeActors = QtWidgets.QAction('Remerge Actor Info')
self.actMergeGamedata = QtWidgets.QAction('Remerge Game/Save Data')
self.actMergeMaps = QtWidgets.QAction('Remerge Maps')
self.actDeepMerge = QtWidgets.QAction('Refresh Deep Merge')
self.actMergeRstb.triggered.connect(self.MergeRstb_Clicked)
self.actMergePacks.triggered.connect(self.MergePacks_Clicked)
self.actMergeTexts.triggered.connect(self.MergeTexts_Clicked)
self.actMergeActors.triggered.connect(self.MergeActors_Clicked)
self.actMergeGamedata.triggered.connect(self.MergeGamedata_Clicked)
self.actMergeMaps.triggered.connect(self.MergeMaps_Clicked)
self.actDeepMerge.triggered.connect(self.DeepMerge_Clicked)