1
0
mirror of https://github.com/gryf/fs-uae-wrapper.git synced 2025-12-19 04:20:23 +01:00

Extract getting the title to a new method in wrapper base class

This commit is contained in:
2017-01-02 13:48:24 +01:00
parent 38a9604916
commit 22d152bb64

View File

@@ -108,16 +108,10 @@ class Base(object):
def _extract(self): def _extract(self):
"""Extract archive to temp dir""" """Extract archive to temp dir"""
item = '' title = self._get_title()
gui_msg = self.all_options.get('wrapper_gui_msg', '0')
if gui_msg == '1':
item = self.all_options.get('title')
if not item:
item = self.all_options['wrapper_archive']
curdir = os.path.abspath('.') curdir = os.path.abspath('.')
os.chdir(self.dir) os.chdir(self.dir)
result = utils.extract_archive(self.arch_filepath, item) result = utils.extract_archive(self.arch_filepath, title)
os.chdir(curdir) os.chdir(curdir)
return result return result
@@ -129,6 +123,19 @@ class Base(object):
os.chdir(curdir) os.chdir(curdir)
return True return True
def _get_title(self):
"""
Return the title if found in configuration. As a fallback archive file
name will be used as title.
"""
title = ''
gui_msg = self.all_options.get('wrapper_gui_msg', '0')
if gui_msg == '1':
title = self.all_options.get('title')
if not title:
title = self.all_options['wrapper_archive']
return title
def _save_save(self): def _save_save(self):
""" """
Get the saves from emulator and store it where configuration is placed Get the saves from emulator and store it where configuration is placed