Skip to content

Commit a0c3b43

Browse files
InfernioSharlikran
authored andcommitted
Properly handle game-specific xEdit and CK names RRR
I *was* just going to introduce a quick bush.game variable and use it in the approriate strings, but one thing led to another, the CS/CK got involved, and it turned into a bigger refactoring that also features a bunch of typo corrections, improved translation possibilities, etc. But the main draw is that we now always show the right name for xEdit and the CS/CK/GECK, unless I missed something :P Note that I added GameInfo.xe as a class for this - I expect it to grow with further refactoring in the future, as mentioned in links.py. Another important part of this is GameInfo.cs -> GameInfo.ck. This isn't due to my bias against the CS, but due to bolt.Path.cs already existing and thereby making any searches for '.cs' annoying. Closes # 239 <--- RRR
1 parent 9e835a1 commit a0c3b43

32 files changed

Lines changed: 196 additions & 147 deletions

Mopy/bash/basher/app_buttons.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,8 @@ class _Mods_xEditExpert(BoolLink):
342342

343343
def __init__(self):
344344
super(_Mods_xEditExpert, self).__init__()
345-
self._text, self.key = bush.game.xEdit_expert
345+
self._text = _(u'%s Expert') % bush.game.xe.full_name
346+
self.key = bush.game.xe.expert_key
346347

347348
class App_Tes4View(App_Button):
348349
"""Allow some extra args for Tes4View."""
@@ -382,7 +383,7 @@ class App_Tes4View(App_Button):
382383
# or name ends with Trans.exe
383384
def __init__(self,*args,**kwdargs):
384385
App_Button.__init__(self,*args,**kwdargs)
385-
if bush.game.xEdit_expert:
386+
if bush.game.xe.expert_key:
386387
self.mainMenu.append(_Mods_xEditExpert())
387388

388389
def IsPresent(self):
@@ -395,8 +396,8 @@ def IsPresent(self):
395396
return True
396397

397398
def Execute(self):
398-
is_expert = bush.game.xEdit_expert and bass.settings[
399-
bush.game.xEdit_expert[1]]
399+
is_expert = bush.game.xe.expert_key and bass.settings[
400+
bush.game.xe.expert_key]
400401
extraArgs = bass.inisettings[
401402
'xEditCommandLineArguments'].split() if is_expert else []
402403
if balt.getKeyState_Control():
@@ -504,7 +505,7 @@ def version(self):
504505

505506
#------------------------------------------------------------------------------
506507
class TESCS_Button(App_Button):
507-
"""CS button. Needs a special Tooltip when OBSE is enabled."""
508+
"""CS/CK button. Needs a special tooltip when OBSE is enabled."""
508509
@property
509510
def obseTip(self):
510511
# TESCS (version)

Mopy/bash/basher/constants.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,8 @@
396396
'fo3View.iKnowWhatImDoing':False,
397397
'fnvView.iKnowWhatImDoing':False,
398398
'enderalView.iKnowWhatImDoing':False,
399+
'tes5vrView.iKnowWhatImDoing':False,
400+
'fo4vrView.iKnowWhatImDoing':False,
399401
#--BOSS:
400402
'BOSS.ClearLockTimes':True,
401403
'BOSS.AlwaysUpdate':True,

Mopy/bash/basher/installer_links.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,10 @@ def Execute(self):
625625
class Installer_ExportAchlist(OneItemLink, _InstallerLink):
626626
"""Write an achlist file with all the destinations files for this
627627
installer in this configuration."""
628-
_text = _(u"Export Achlist")
628+
_text = _(u'Export Achlist')
629629
_mode_info_dir = u'Mod Info Exports'
630-
_help = _(u'Create achlist file for use by the CK')
630+
_help = (_(u'Create achlist file for use by the %s.') %
631+
bush.game.ck.long_name)
631632

632633
def _enable(self):
633634
isSingle = super(Installer_ExportAchlist, self)._enable()

Mopy/bash/basher/links.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,11 @@ def _init_tool_buttons(): # tooldirs must have been initialized
8181
u' '.join((_(u"Launch"),bush.game.displayName,u'%(version)s'))))
8282
BashStatusBar.buttons.append( #TESCS/CreationKit
8383
TESCS_Button(
84-
bass.dirs['app'].join(bush.game.cs.exe),
85-
imageList(bush.game.cs.image_name),
86-
u' '.join((_(u"Launch"),bush.game.cs.cs_abbrev)),
87-
u' '.join((_(u"Launch"),bush.game.cs.cs_abbrev,u'%(version)s')),
88-
bush.game.cs.se_args,
84+
bass.dirs['app'].join(bush.game.ck.exe),
85+
imageList(bush.game.ck.image_name),
86+
u' '.join((_(u"Launch"),bush.game.ck.ck_abbrev)),
87+
u' '.join((_(u"Launch"),bush.game.ck.ck_abbrev,u'%(version)s')),
88+
bush.game.ck.se_args,
8989
uid=u'TESCS'))
9090
BashStatusBar.buttons.append( #OBMM
9191
App_Button(bass.dirs['app'].join(u'OblivionModManager.exe'),
@@ -103,6 +103,9 @@ def _init_tool_buttons(): # tooldirs must have been initialized
103103
imageList(u'tools/tes4view%s.png'),
104104
_(u"Launch TES4View"),
105105
uid=u'TES4View'))
106+
# TODO(inf) Refactor this! I made bush.game.xe a class precisely for stuff
107+
# like this - so add stuff like xe.command_line_arg and drop these 30+
108+
# braindead lines
106109
BashStatusBar.buttons.append( #Tes4Edit
107110
App_Tes4View((bass.tooldirs['Tes4EditPath'], u'-TES4 -edit'),
108111
imageList(u'tools/tes4edit%s.png'),

Mopy/bash/basher/mod_links.py

Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,23 +93,27 @@ def Execute(self):
9393
# File submenu ----------------------------------------------------------------
9494
# the rest of the File submenu links come from file_links.py
9595
class Mod_CreateDummyMasters(OneItemLink):
96-
"""TES4Edit tool, makes dummy plugins for each missing master, for use if looking at a 'Filter' patch."""
96+
"""xEdit tool, makes dummy plugins for each missing master, for use if
97+
looking at a 'Filter' patch."""
9798
_text = _(u'Create Dummy Masters...')
98-
_help = _(u"TES4Edit tool, makes dummy plugins for each missing master of"
99-
u" the selected mod, for use if looking at a 'Filter' patch")
99+
_help = _(u'Creates empty plugins for each missing master of the selected '
100+
u'mod, allowing it to be loaded by tools like %s or the %s.') % (
101+
bush.game.xe.full_name, bush.game.ck.long_name)
100102

101103
def _enable(self):
102104
return super(Mod_CreateDummyMasters, self)._enable() and \
103105
self._selected_info.getStatus() == 30 # Missing masters
104106

105107
def Execute(self):
106108
"""Create Dummy Masters"""
107-
msg = _(u"This is an advanced feature for editing 'Filter' patches in "
108-
u"TES4Edit. It will create dummy plugins for each missing "
109-
u"master. Are you sure you want to continue?") + u'\n\n' + _(
110-
u"To remove these files later, use 'Clean Dummy Masters...'")
109+
msg = _(u'This is an advanced feature, originally intended for '
110+
u"viewing and editing 'Filter' patches in %s. It will create "
111+
u'empty plugins for each missing master. Are you sure you '
112+
u'want to continue?\n\nTo remove these files later, use '
113+
u"'Clean Dummy Masters...'") % bush.game.xe.full_name
111114
if not self._askYes(msg, title=_(u'Create Files')): return
112-
doCBash = bass.settings['bash.CBashEnabled'] # something odd's going on, can't rename temp names
115+
# something odd's going on, can't rename temp names
116+
doCBash = bass.settings['bash.CBashEnabled']
113117
if doCBash:
114118
newFiles = []
115119
to_refresh = []
@@ -1670,8 +1674,8 @@ def Execute(self):
16701674
class Mod_FlipMasters(OneItemLink, _Esm_Esl_Flip):
16711675
"""Swaps masters between esp and esm versions."""
16721676
_help = _(u'Flips the ESM flag on all masters of the selected plugin, '
1673-
u'allowing you to load it in the %(csName)s.') % (
1674-
{'csName': bush.game.cs.long_name})
1677+
u'allowing you to load it in the %(ck_name)s.') % (
1678+
{u'ck_name': bush.game.ck.long_name})
16751679

16761680
def _initData(self, window, selection,
16771681
__reEspExt=re.compile(u'' r'\.esp(.ghost)?$', re.I | re.U)):
@@ -1696,10 +1700,10 @@ def _enable(self): return self.enable
16961700

16971701
@balt.conversation
16981702
def Execute(self):
1699-
message = _(u"WARNING! For advanced modders only! Flips the ESM flag "
1700-
u"of all ESP masters of the selected plugin. Useful for "
1701-
u"loading ESP-mastered mods in the %(csName)s.") % (
1702-
{'csName': bush.game.cs.long_name})
1703+
message = _(u'WARNING! For advanced modders only! Flips the ESM flag '
1704+
u'of all ESP masters of the selected plugin. Useful for '
1705+
u'loading ESP-mastered mods in the %(ck_name)s.') % (
1706+
{u'ck_name': bush.game.ck.long_name})
17031707
if not self._askContinue(message, 'bash.flipMasters.continue'): return
17041708
updated = [self._selected_item]
17051709
for masterPath in self.espMasters:
@@ -1714,11 +1718,12 @@ def Execute(self):
17141718
class Mod_SetVersion(OneItemLink):
17151719
"""Sets version of file back to 0.8."""
17161720
_text = _(u'Version 0.8')
1717-
_help = _(u'Sets version of file back to 0.8')
1718-
message = _(u"WARNING! For advanced modders only! This feature allows you "
1719-
u"to edit newer official mods in the TES Construction Set by resetting"
1720-
u" the internal file version number back to 0.8. While this will make "
1721-
u"the mod editable, it may also break the mod in some way.")
1721+
_help = _(u'Sets version of file back to 0.8.')
1722+
message = _(u'WARNING! For advanced modders only! This feature allows you '
1723+
u'to edit newer official mods in the %s by resetting the '
1724+
u'internal file version number back to 0.8. While this will '
1725+
u'make the mod editable, it may also break the mod in some '
1726+
u'way.' % bush.game.ck.long_name)
17221727

17231728
def _enable(self):
17241729
return (super(Mod_SetVersion, self)._enable() and

Mopy/bash/basher/patcher_dialog.py

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
import time
3131
from datetime import timedelta
3232
from . import BashFrame ##: drop this - decouple !
33-
from .. import bass, bosh, bolt, balt, env, load_order
33+
from .. import balt, bass, bolt, bosh, bush, env, load_order
3434
from ..balt import Link, Resources, set_event_hook, Events, HorizontalLine
3535
from ..bolt import SubProgress, GPath, Path
3636
from ..exception import BoltError, CancelError, FileEditError, \
@@ -324,24 +324,27 @@ def _save_cbash(self, patchFile, patch_name):
324324
raise
325325

326326
def _pretry(self, patch_name):
327-
return balt.askYes(self, (
328-
_(u'Bash encountered and error when saving %(patch_name)s.') +
329-
u'\n\n' + _(u'Either Bash needs Administrator Privileges to '
330-
u'save the file, or the file is in use by another process '
331-
u'such as TES4Edit.') + u'\n' + _(u'Please close any program '
332-
u'that is accessing %(patch_name)s, and provide Administrator '
333-
u'Privileges if prompted to do so.') + u'\n\n' +
334-
_(u'Try again?')) % {'patch_name': patch_name.s},
335-
_(u'Bash Patch - Save Error'))
327+
return balt.askYes(
328+
self, _(u'Bash encountered an error when saving %(patch_name)s.'
329+
u'\n\nEither Bash needs Administrator Privileges to save '
330+
u'the file, or the file is in use by another process such '
331+
u'as %(xedit_name)s.\nPlease close any program that is '
332+
u'accessing %(patch_name)s, and provide Administrator '
333+
u'Privileges if prompted to do so.\n\nTry again?') % {
334+
u'patch_name': patch_name.s,
335+
u'xedit_name': bush.game.xe.full_name},
336+
_(u'Bashed Patch - Save Error'))
336337

337338
def _cretry(self, patch_name):
338-
return balt.askYes(self, (
339-
_(u'Bash encountered an error when renaming %s to %s.') + u'\n\n' +
340-
_(u'The file is in use by another process such as TES4Edit.') +
341-
u'\n' + _(u'Please close the other program that is accessing %s.')
342-
+ u'\n\n' + _(u'Try again?')) % (
343-
patch_name.temp.s, patch_name.s, patch_name.s),
344-
_(u'Bash Patch - Save Error'))
339+
return balt.askYes(
340+
self, _(u'Bash encountered an error when renaming '
341+
u'%(temp_patch)s to %(patch_name)s.\n\nThe file is in use '
342+
u'by another process such as %(xedit_name)s.\nPlease '
343+
u'close the other program that is accessing %s.\n\nTry '
344+
u'again?') % {
345+
u'temp_patch': patch_name.temp.s, u'patch_name': patch_name.s,
346+
u'xedit_name': bush.game.xe.full_name},
347+
_(u'Bashed Patch - Save Error'))
345348

346349
def __config(self):
347350
config = {'ImportedMods': set()}

Mopy/bash/bosh/__init__.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2613,12 +2613,14 @@ def _setOblivionVersions(self):
26132613
else: self.voCurrent = None # just in case
26142614

26152615
def _retry(self, old, new):
2616-
return balt.askYes(self,
2617-
_(u'Bash encountered an error when renaming %s to %s.') + u'\n\n' +
2618-
_(u'The file is in use by another process such as TES4Edit.') +
2619-
u'\n' + _(u'Please close the other program that is accessing %s.')
2620-
+ u'\n\n' + _(u'Try again?') % (old.s, new.s, old.s),
2621-
_(u'File in use'))
2616+
return balt.askYes(
2617+
self, _(u'Bash encountered an error when renaming %(old)s to '
2618+
u'%(new)s.\n\nThe file is in use by another process such '
2619+
u'as %(xedit_name)s.\nPlease close the other program that '
2620+
u'is accessing %(new)s.\n\nTry again?') % {
2621+
u'xedit_name': bush.game.xe.full_name, u'old': old.s,
2622+
u'new': new.s},
2623+
_(u'File in use'))
26222624

26232625
def _get_version_paths(self, newVersion):
26242626
baseName = self.masterName # Oblivion.esm, say it's currently SI one

Mopy/bash/bosh/_mergeability.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,10 @@ def is_esl_capable(modInfo, _minfos, reasons):
151151
#--Skipped over types?
152152
if modFile.topsSkipped:
153153
if not verbose: return False
154-
reasons.append(_(u'Record type: ') + u', '.join(sorted(
155-
modFile.topsSkipped)) + u' ; currently unsupported by ESLify ' \
156-
u'verification. Use xEdit to check ESL '
157-
u'qualifications and modify ESL flag.')
154+
reasons.append(_(u'Record type(s): %s; currently unsupported by ESL '
155+
u'verification. Use %s to check ESL qualifications '
156+
u'and modify ESL flag.') % (
157+
u', '.join(sorted(modFile.topsSkipped)), bush.game.xe.full_name))
158158
#--Form greater then 0xFFF
159159
lenMasters = len(modFile.tes4.masters)
160160
for rec_typ,block in modFile.tops.iteritems():

Mopy/bash/bosh/mods_metadata.py

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ def checkMods(self, showModList=False, showCRC=False, showVersion=True,
300300
if removeEslFlag:
301301
log.setHeader(u'=== ' + _(u'Potentially Incorrect ESL Flag'))
302302
log(_(u'Following mods have an ESL flag, but may not qualify. '
303-
u'Run \'Check ESL Qualifications\' on them and/or check '
304-
u'them with xEdit to be sure.'))
303+
u"Run 'Check ESL Qualifications' on them and/or check "
304+
u'them with %s to be sure.') % bush.game.xe.full_name)
305305
for mod in sorted(removeEslFlag):
306306
log(u'* __' + mod.s + u'__')
307307
if shouldDeactivateB:
@@ -327,34 +327,42 @@ def checkMods(self, showModList=False, showCRC=False, showVersion=True,
327327
log(u'* __'+mod.s+u'__')
328328
if shouldClean:
329329
log.setHeader(
330-
u'=== ' + _(u'Mods that need cleaning with TES4Edit'))
331-
log(_(u'Following mods have identical to master (ITM) records,'
332-
u' deleted records (UDR), or other issues that should be'
333-
u' fixed with TES4Edit. Visit the %(cleaning_wiki_url)s'
334-
u' for more information.') % {
335-
'cleaning_wiki_url': self._cleaning_wiki_url})
330+
u'=== ' + _(u'Mods that need cleaning with %s') %
331+
bush.game.xe.full_name)
332+
log(_(u'Following mods have identical to master (ITM) '
333+
u'records, deleted records (UDR), or other issues that '
334+
u'should be fixed with %(xedit_name)s. Visit the '
335+
u'%(cleaning_wiki_url)s for more information.') % {
336+
u'cleaning_wiki_url': self._cleaning_wiki_url,
337+
u'xedit_name': bush.game.xe.full_name})
336338
for mod in sorted(shouldClean.keys()):
337339
log(u'* __'+mod.s+u':__ %s' % shouldClean[mod])
338340
if shouldCleanMaybe:
339341
log.setHeader(
340342
u'=== ' + _(u'Mods with special cleaning instructions'))
341343
log(_(u'Following mods have special instructions for cleaning '
342-
u'with TES4Edit'))
344+
u'with %s') % bush.game.xe.full_name)
343345
for mod in sorted(shouldCleanMaybe):
344346
log(u'* __'+mod[0].s+u':__ '+mod[1])
345347
elif mod_checker and not shouldClean:
346348
log.setHeader(
347-
u'=== ' + _(u'Mods that need cleaning with TES4Edit'))
348-
log(_(u'Congratulations all mods appear clean.'))
349+
u'=== ' + _(u'Mods that need cleaning with %s') %
350+
bush.game.xe.full_name)
351+
log(_(u'Congratulations, all mods appear clean.'))
349352
if invalidVersion:
350-
ver_list = u', '.join(
351-
sorted(bush.game.esp.validHeaderVersions))
353+
# Always an ASCII byte string, so this is fine
354+
header_sig = unicode(
355+
bush.game_mod.records.MreHeader.classType,
356+
encoding='ascii')
357+
ver_list = u', '.join(sorted([
358+
unicode(v) for v in bush.game.esp.validHeaderVersions]))
352359
log.setHeader(
353-
u'=== ' + _(u'Mods with non standard TES4 versions'))
354-
log(_(u"Following mods have a TES4 version that isn't "
355-
u"recognized as (one of) the standard version(s) "
356-
u"(%s). It is untested what effect this can have on "
357-
u"%s.") % (ver_list, bush.game.displayName))
360+
u'=== ' + _(u'Mods with non-standard %s versions') %
361+
header_sig)
362+
log(_(u"The following mods have a %s version that isn't "
363+
u'recognized as one of the standard versions '
364+
u'(%s). It is untested what effects this can have on '
365+
u'%s.') % (header_sig, ver_list, bush.game.displayName))
358366
for mod in sorted(invalidVersion):
359367
log(u'* __'+mod[0].s+u':__ '+mod[1])
360368
#--Missing/Delinquent Masters
@@ -832,18 +840,18 @@ def copyPrev(size):
832840
else:
833841
copy(rec_size)
834842
#--Save
835-
retry = _(u'Bash encountered an error when saving %s.') + u'\n\n' \
836-
+ _(u'The file is in use by another process such as TES4Edit.'
837-
) + u'\n' + _(u'Please close the other program that is '
838-
u'accessing %s.') + u'\n\n' + _(u'Try again?')
843+
retry = _(u'Bash encountered an error when saving %(newpath)s.'
844+
u'\n\nThe file is in use by another process such as '
845+
u'%(xedit_name)s.\nPlease close the other program that '
846+
u'is accessing %(newpath)s.\n\nTry again?') % {
847+
u'newpath': path.stail, u'xedit_name': bush.game.xe.full_name}
839848
if changed:
840849
cleaner.modInfo.makeBackup()
841850
try:
842851
path.untemp()
843852
except OSError as werr:
844853
while werr.errno == errno.EACCES and balt.askYes(
845-
None, retry % (path.stail, path.stail),
846-
path.stail + _(u' - Save Error')):
854+
None, retry, _(u'%s - Save Error') % path.stail):
847855
try:
848856
path.untemp()
849857
break

Mopy/bash/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self):
6363

6464
# File exceptions -------------------------------------------------------------
6565
class FileError(BoltError):
66-
"""TES4/Tes4SaveFile Error: File is corrupted."""
66+
"""An error that occurred while handling a file."""
6767
def __init__(self, in_name, message):
6868
## type: (Union[Path, unicode], unicode) -> None
6969
super(FileError, self).__init__(message)

0 commit comments

Comments
 (0)