Skip to content

Commit 2d58083

Browse files
committed
Mopy/bash/basher/patcher_dialog.py patchers -> gui_patchers EEE patcher->p
1 parent 5f0887a commit 2d58083

1 file changed

Lines changed: 23 additions & 23 deletions

File tree

Mopy/bash/basher/patcher_dialog.py

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
class PatchDialog(balt.Dialog):
5151
"""Bash Patch update dialog.
5252
53-
:type patchers: list[basher.gui_patchers._PatcherPanel]
53+
:type _gui_patchers: list[basher.gui_patchers._PatcherPanel]
5454
"""
5555

5656
def __init__(self, parent, patchInfo, doCBash, importConfig,
@@ -80,15 +80,15 @@ def __init__(self, parent, patchInfo, doCBash, importConfig,
8080
patchConfigs = {}
8181
isFirstLoad = 0 == len(patchConfigs)
8282
self.patchInfo = patchInfo
83-
self.patchers = [copy.deepcopy(p) for p in (
83+
self._gui_patchers = [copy.deepcopy(p) for p in (
8484
CBash_gui_patchers if doCBash else PBash_gui_patchers)]
85-
self.patchers.sort(key=lambda a: a.__class__.name)
86-
self.patchers.sort(key=lambda a: groupOrder[a.__class__.group])
87-
for patcher in self.patchers:
85+
self._gui_patchers.sort(key=lambda a: a.__class__.name)
86+
self._gui_patchers.sort(key=lambda a: groupOrder[a.__class__.group])
87+
for patcher in self._gui_patchers:
8888
patcher.getConfig(patchConfigs) #--Will set patcher.isEnabled
8989
patcher.SetIsFirstLoad(isFirstLoad)
9090
self.currentPatcher = None
91-
patcherNames = [patcher.getName() for patcher in self.patchers]
91+
patcherNames = [patcher.getName() for patcher in self._gui_patchers]
9292
#--GUI elements
9393
self.gExecute = OkButton(self, label=_(u'Build Patch'))
9494
self.gExecute.on_clicked.subscribe(self.PatchExecute)
@@ -116,7 +116,7 @@ def __init__(self, parent, patchInfo, doCBash, importConfig,
116116
self.gRevertToDefault = RevertButton(self,
117117
label=_(u'Revert To Default'))
118118
self.gRevertToDefault.on_clicked.subscribe(self.DefaultConfig)
119-
for index,patcher in enumerate(self.patchers):
119+
for index,patcher in enumerate(self._gui_patchers):
120120
self.gPatchers.Check(index,patcher.isEnabled)
121121
self.defaultTipText = _(u'Items that are new since the last time this patch was built are displayed in bold')
122122
self.gTipText = Label(self,self.defaultTipText)
@@ -144,19 +144,19 @@ def __init__(self, parent, patchInfo, doCBash, importConfig,
144144
]).apply_to(self)
145145
self.SetIcons(Resources.bashMonkey)
146146
#--Patcher panels
147-
for patcher in self.patchers:
147+
for patcher in self._gui_patchers:
148148
patcher.GetConfigPanel(self, self.config_layout,
149149
self.gTipText).Hide()
150-
initial_select = min(len(self.patchers)-1,1)
150+
initial_select = min(len(self._gui_patchers) - 1, 1)
151151
if initial_select >= 0:
152152
self.gPatchers.SetSelection(initial_select) # callback not fired
153-
self.ShowPatcher(self.patchers[initial_select]) # so this is needed
153+
self.ShowPatcher(self._gui_patchers[initial_select]) # so this is needed
154154
self.SetOkEnable()
155155

156156
#--Core -------------------------------
157157
def SetOkEnable(self):
158-
"""Sets enable state for Ok button."""
159-
self.gExecute.enabled = any(p.isEnabled for p in self.patchers)
158+
"""Enable Build Patch button if at least one patcher is enabled."""
159+
self.gExecute.enabled = any(p.isEnabled for p in self._gui_patchers)
160160

161161
def ShowPatcher(self,patcher):
162162
"""Show patcher panel."""
@@ -182,7 +182,7 @@ def PatchExecute(self): # TODO(ut): needs more work to reduce P/C differences to
182182
self._saveConfig(patch_name)
183183
#--Do it
184184
log = bolt.LogFile(StringIO.StringIO())
185-
patchers = [patcher for patcher in self.patchers if patcher.isEnabled]
185+
patchers = [p for p in self._gui_patchers if p.isEnabled]
186186
patchFile = CBash_PatchFile(patch_name, patchers) if self.doCBash \
187187
else PatchFile(self.patchInfo, patchers)
188188
patchFile.init_patchers_data(SubProgress(progress, 0, 0.1)) #try to speed this up!
@@ -345,7 +345,7 @@ def _cretry(self, patch_name):
345345

346346
def __config(self):
347347
config = {'ImportedMods': set()}
348-
for patcher in self.patchers: patcher.saveConfig(config)
348+
for p in self._gui_patchers: p.saveConfig(config)
349349
return config
350350

351351
def _saveConfig(self, patch_name):
@@ -397,7 +397,7 @@ def ImportConfig(self):
397397
self._load_config(patchConfigs)
398398

399399
def _load_config(self, patchConfigs, set_first_load=False, default=False):
400-
for index, patcher in enumerate(self.patchers):
400+
for index, patcher in enumerate(self._gui_patchers):
401401
patcher.import_config(patchConfigs, set_first_load=set_first_load,
402402
default=default)
403403
self.gPatchers.Check(index, patcher.isEnabled)
@@ -438,14 +438,14 @@ def DefaultConfig(self):
438438

439439
def SelectAll(self):
440440
"""Select all patchers and entries in patchers with child entries."""
441-
for index,patcher in enumerate(self.patchers):
441+
for index,patcher in enumerate(self._gui_patchers):
442442
self.gPatchers.Check(index,True)
443443
patcher.mass_select()
444444
self.gExecute.enabled = True
445445

446446
def DeselectAll(self):
447447
"""Deselect all patchers and entries in patchers with child entries."""
448-
for index,patcher in enumerate(self.patchers):
448+
for index,patcher in enumerate(self._gui_patchers):
449449
self.gPatchers.Check(index,False)
450450
patcher.mass_select(select=False)
451451
self.gExecute.enabled = False
@@ -458,26 +458,26 @@ def OnSize(self,event):
458458
def OnSelect(self,event):
459459
"""Responds to patchers list selection."""
460460
itemDex = event.GetSelection()
461-
self.ShowPatcher(self.patchers[itemDex])
461+
self.ShowPatcher(self._gui_patchers[itemDex])
462462
self.gPatchers.SetSelection(itemDex)
463463

464464
def CheckPatcher(self, patcher):
465465
"""Enable a patcher - Called from a patcher's OnCheck method."""
466-
index = self.patchers.index(patcher)
466+
index = self._gui_patchers.index(patcher)
467467
self.gPatchers.Check(index)
468468
self.SetOkEnable()
469469

470470
def BoldPatcher(self, patcher):
471471
"""Set the patcher label to bold font. Called from a patcher when
472472
it realizes it has something new in its list"""
473-
index = self.patchers.index(patcher)
473+
index = self._gui_patchers.index(patcher)
474474
get_font = self.gPatchers.GetFont()
475475
self.gPatchers.SetItemFont(index, balt.Font.Style(get_font, bold=True))
476476

477477
def OnCheck(self,event):
478478
"""Toggle patcher activity state."""
479479
index = event.GetSelection()
480-
patcher = self.patchers[index]
480+
patcher = self._gui_patchers[index]
481481
patcher.isEnabled = self.gPatchers.IsChecked(index)
482482
self.gPatchers.SetSelection(index)
483483
self.ShowPatcher(patcher) # SetSelection does not fire the callback
@@ -492,8 +492,8 @@ def OnMouse(self,event):
492492
self.mouse_dex = mouseItem
493493
elif event.Leaving():
494494
pass # will be set to defaultTipText
495-
if 0 <= mouseItem < len(self.patchers):
496-
patcherClass = self.patchers[mouseItem].__class__
495+
if 0 <= mouseItem < len(self._gui_patchers):
496+
patcherClass = self._gui_patchers[mouseItem].__class__
497497
tip = patcherClass.tip or re.sub(u'' r'\..*', u'.',
498498
patcherClass.text.split(u'\n')[0], flags=re.U)
499499
self.gTipText.label_text = tip

0 commit comments

Comments
 (0)