Remove attribute from ScriptInterpreter

This commit is contained in:
Mathieu Comandon 2018-05-08 00:14:23 -07:00
parent 36ab7c01f1
commit 000cec595c
3 changed files with 6 additions and 7 deletions

View file

@ -258,8 +258,9 @@ class InstallerDialog(Gtk.Window):
def prepare_install(self, script_index):
script = self.scripts[script_index]
self.interpreter = interpreter.ScriptInterpreter(script, self)
game_name = self._escape_text(self.interpreter.game_name)
self.title_label.set_markup(u"<b>Installing {}</b>".format(game_name))
self.title_label.set_markup(u"<b>Installing {}</b>".format(
self._escape_text(self.interpreter.game_name)
))
self.select_install_folder()
# --------------------------

View file

@ -58,8 +58,6 @@ class ScriptInterpreter(CommandsMixin):
self.target_path = None
self.parent = parent
self.reversion_data = {}
self.game_name = None
self.game_slug = None
self.game_files = {}
self.game_disc = None
self.cancelled = False
@ -76,7 +74,6 @@ class ScriptInterpreter(CommandsMixin):
self.version = installer['version']
self.slug = installer['slug']
self.year = installer.get('year')
self.name = installer['name']
self.runner = installer['runner']
self.game_name = installer['name']
self.game_slug = installer['game_slug']
@ -150,7 +147,7 @@ class ScriptInterpreter(CommandsMixin):
return False
# Check that installers contains all required fields
for field in ('runner', 'name', 'game_slug'):
for field in ('runner', 'game_name', 'game_slug'):
if not hasattr(self, field) or not getattr(self, field):
self.errors.append("Missing field '%s'" % field)
@ -570,7 +567,7 @@ class ScriptInterpreter(CommandsMixin):
}
self.game_id = pga.add_or_update(
name=self.name,
name=self.game_name,
runner=self.runner,
slug=self.game_slug,
directory=self.target_path,

View file

@ -33,6 +33,7 @@ class TestScriptInterpreter(TestCase):
'version': 'doom-gzdoom'
}
interpreter = ScriptInterpreter(installer, None)
self.assertEqual(interpreter.game_name, 'Doom')
self.assertFalse(interpreter.errors)
self.assertTrue(interpreter.is_valid())