Skip to content

Commit ea131b3

Browse files
Daniel NunesUtumno
authored andcommitted
Re-enable disabled NoMerge mods post bashed patch RRR
Under # 51 <--- RRR Utumno: SSS - self.mods_to_reselect to initData, add finally, trying to avoid double refresh doSave is True by default but should be specified explicitly Co-authored-by: MrD <the.ubik@gmail.com>
1 parent 0c1b83e commit ea131b3

2 files changed

Lines changed: 21 additions & 4 deletions

File tree

Mopy/bash/basher/mod_links.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -918,7 +918,7 @@ def __init__(self, doCBash=False):
918918
self._text = _(u'Rebuild Patch (CBash *BETA*)...') if doCBash else _(
919919
u'Rebuild Patch...')
920920
self._help = _(u'Rebuild the Bashed Patch (CBash)') if doCBash else _(
921-
u'Rebuild the Bashed Patch')
921+
u'Rebuild the Bashed Patch')
922922

923923
def _initData(self, window, selection):
924924
super(_Mod_Patch_Update, self)._initData(window, selection)
@@ -927,6 +927,7 @@ def _initData(self, window, selection):
927927
'bash.patch.configs', {})
928928
thisIsCBash = configIsCBash(config)
929929
self.CBashMismatch = bool(thisIsCBash != self.doCBash)
930+
self.mods_to_reselect = set()
930931

931932
@balt.conversation
932933
def Execute(self):
@@ -935,6 +936,12 @@ def Execute(self):
935936
if not self._Execute(): return # prevent settings save
936937
except CancelError:
937938
return # prevent settings save
939+
finally:
940+
if self.mods_to_reselect: # may be cleared in PatchDialog#PatchExecute
941+
for mod in self.mods_to_reselect:
942+
bosh.modInfos.lo_activate(mod, doSave=False)
943+
bosh.modInfos.cached_lo_save_active()
944+
self.window.RefreshUI(refreshSaves=True)
938945
# save data to disc in case of later improper shutdown leaving the
939946
# user guessing as to what options they built the patch with
940947
Link.Frame.SaveSettings()
@@ -1015,7 +1022,7 @@ def _Execute(self):
10151022
liststyle='tree',bOk=_(u'Continue Despite Errors')) as warning:
10161023
if not warning.askOkModal(): return
10171024
with PatchDialog(self.window, self._selected_info, self.doCBash,
1018-
importConfig) as patchDialog:
1025+
importConfig, self.mods_to_reselect) as patchDialog:
10191026
patchDialog.ShowModal()
10201027
return self._selected_item
10211028

@@ -1073,7 +1080,10 @@ def _ask_deactivate_mergeable(self, active_prior_to_patch):
10731080
(noMerge, noMergeKey),
10741081
(deactivate, deactivateKey), ]:
10751082
deselect |= set(dialog.getChecked(key, lst))
1076-
if not deselect: return
1083+
if not deselect:
1084+
return
1085+
else:
1086+
self.mods_to_reselect = set(noMerge) & deselect
10771087
with balt.BusyCursor():
10781088
bosh.modInfos.lo_deactivate(deselect, doSave=True)
10791089
self.window.RefreshUI(refreshSaves=True)

Mopy/bash/basher/patcher_dialog.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ class PatchDialog(balt.Dialog):
5353
:type patchers: list[basher.gui_patchers._PatcherPanel]
5454
"""
5555

56-
def __init__(self,parent,patchInfo,doCBash=None,importConfig=True):
56+
def __init__(self, parent, patchInfo, doCBash, importConfig,
57+
mods_to_reselect):
58+
self.mods_to_reselect = mods_to_reselect
5759
self.parent = parent
5860
if (doCBash or doCBash is None) and bass.settings['bash.CBashEnabled']:
5961
doCBash = True
@@ -243,6 +245,11 @@ def PatchExecute(self): # TODO(ut): needs more work to reduce P/C differences to
243245
balt.WryeLog(self.parent, readme, patch_name.s,
244246
log_icons=Resources.bashBlue)
245247
#--Select?
248+
if self.mods_to_reselect:
249+
for mod in self.mods_to_reselect:
250+
bosh.modInfos.lo_activate(mod, doSave=False)
251+
self.mods_to_reselect.clear()
252+
bosh.modInfos.cached_lo_save_active() ##: also done below duh
246253
count, message = 0, _(u'Activate %s?') % patch_name.s
247254
if load_order.cached_is_active(patch_name) or (
248255
bass.inisettings['PromptActivateBashedPatch'] and

0 commit comments

Comments
 (0)