Skip to content

Commit 2f53daf

Browse files
committed
FFF fix FOMOD PNGs
I could swear I commited this to nightly long ago, along with the main pngcrush work, but it seems to have gotten lost somewhere along the way. So here's a better version, that refactors the two nearly identical methods.
1 parent 4feb620 commit 2f53daf

1 file changed

Lines changed: 10 additions & 17 deletions

File tree

Mopy/bash/bosh/bain.py

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1307,11 +1307,11 @@ def _fix_pngs(pngs_to_fix, progress=None):
13071307
u'\n%s\n%s' % (_(u'Fixing PNGs...'), target_png))
13081308
archives.fix_png(tmp_dir.join(target_png).s)
13091309

1310-
def wizard_file(self):
1311-
with balt.Progress(_(u'Extracting wizard files...'), u'\n' + u' ' * 60,
1310+
def _extract_wizard_files(self, wizard_file_name, wizard_prog_title):
1311+
with balt.Progress(wizard_prog_title, u'\n' + u' ' * 60,
13121312
abort=True) as progress:
13131313
# Extract the wizard, and any images as well
1314-
files_to_extract = [self.hasWizard]
1314+
files_to_extract = [wizard_file_name]
13151315
files_to_extract.extend(x for (x, _s, _c) in self.fileSizeCrcs if
13161316
x.lower().endswith((
13171317
u'bmp', u'jpg', u'jpeg', u'png',
@@ -1323,22 +1323,15 @@ def wizard_file(self):
13231323
unpack_dir = self.unpackToTemp(files_to_extract,
13241324
bolt.SubProgress(progress,0,0.7), recurse=True)
13251325
self._fix_pngs(pngs_to_fix, bolt.SubProgress(progress, 0.7, 0.9))
1326-
return unpack_dir.join(self.hasWizard)
1326+
return unpack_dir.join(wizard_file_name)
1327+
1328+
def wizard_file(self):
1329+
return self._extract_wizard_files(self.hasWizard,
1330+
_(u'Extracting wizard files...'))
13271331

13281332
def fomod_file(self):
1329-
with balt.Progress(_(u'Extracting fomod files...'), u'\n' + u' ' * 60,
1330-
abort=True) as progress:
1331-
files_to_extract = [self.has_fomod_conf]
1332-
files_to_extract.extend(x for (x, _s, _c) in self.fileSizeCrcs if
1333-
x.lower().endswith((
1334-
u'bmp', u'jpg', u'jpeg', u'png',
1335-
u'gif', u'pcx', u'pnm', u'tif',
1336-
u'tiff', u'tga', u'iff', u'xpm',
1337-
u'ico', u'cur', u'ani',)))
1338-
unpack_dir = self.unpackToTemp(files_to_extract,
1339-
bolt.SubProgress(progress, 0, 0.9),
1340-
recurse=True)
1341-
return unpack_dir.join(self.has_fomod_conf)
1333+
return self._extract_wizard_files(self.has_fomod_conf,
1334+
_(u'Extracting FOMOD files...'))
13421335

13431336
#------------------------------------------------------------------------------
13441337
class InstallerProject(Installer):

0 commit comments

Comments
 (0)