mirror of
https://github.com/lutris/lutris
synced 2024-11-02 11:48:38 +00:00
Eliminated last remaining eval calls. Fixes #705346
This commit is contained in:
parent
3d22b98e52
commit
b5cc535f76
3 changed files with 20 additions and 26 deletions
|
@ -20,24 +20,24 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
from lutris.runners import import_runner
|
||||||
import lutris.runners
|
|
||||||
|
|
||||||
from lutris.gui.configvbox import ConfigVBox
|
from lutris.gui.configvbox import ConfigVBox
|
||||||
|
|
||||||
class InstallerConfigVBox(ConfigVBox):
|
class InstallerConfigVBox(ConfigVBox):
|
||||||
|
"""This file is going to disapear anytime now."""
|
||||||
def __init__(self,lutris_config,caller):
|
def __init__(self,lutris_config,caller):
|
||||||
ConfigVBox.__init__(self,"game",caller)
|
ConfigVBox.__init__(self,"game",caller)
|
||||||
self.lutris_config = lutris_config
|
self.lutris_config = lutris_config
|
||||||
self.lutris_config.config_type = "game"
|
self.lutris_config.config_type = "game"
|
||||||
self.runner_class = self.lutris_config.runner
|
self.runner_classname = self.lutris_config.runner
|
||||||
runner = eval("lutris.runners."+self.runner_class+"."+self.runner_class+"()")
|
runner_cls = import_runner(self.runner_classname)
|
||||||
|
runner = runner_cls()
|
||||||
if hasattr(runner,"installer_options"):
|
if hasattr(runner,"installer_options"):
|
||||||
self.options = runner.installer_options
|
self.options = runner.installer_options
|
||||||
else:
|
else:
|
||||||
no_option_label = gtk.Label("No game options")
|
no_option_label = gtk.Label("No game options")
|
||||||
self.pack_start(no_option_label)
|
self.pack_start(no_option_label)
|
||||||
return
|
return
|
||||||
self.generate_widgets()
|
self.generate_widgets()
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -20,8 +20,7 @@
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
from lutris.runners import import_runner
|
||||||
import lutris.runners
|
|
||||||
from lutris.gui.configvbox import ConfigVBox
|
from lutris.gui.configvbox import ConfigVBox
|
||||||
|
|
||||||
class RunnerConfigVBox(ConfigVBox):
|
class RunnerConfigVBox(ConfigVBox):
|
||||||
|
@ -30,14 +29,12 @@ class RunnerConfigVBox(ConfigVBox):
|
||||||
runner configuration.
|
runner configuration.
|
||||||
"""
|
"""
|
||||||
def __init__(self, lutris_config, caller):
|
def __init__(self, lutris_config, caller):
|
||||||
runner = lutris_config.runner
|
runner_classname = lutris_config.runner
|
||||||
ConfigVBox.__init__(self, runner, caller)
|
ConfigVBox.__init__(self, runner_classname, caller)
|
||||||
|
runner_class = import_runner(runner_classname)
|
||||||
# FIXME ugly
|
runner = runer_class()
|
||||||
runner_instance = eval("lutris.runners."+runner+"."+runner+"()")
|
if hasattr(runner, "runner_options"):
|
||||||
|
self.options = runner.runner_options
|
||||||
if hasattr(runner_instance, "runner_options"):
|
|
||||||
self.options = runner_instance.runner_options
|
|
||||||
self.lutris_config = lutris_config
|
self.lutris_config = lutris_config
|
||||||
self.generate_widgets()
|
self.generate_widgets()
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -21,8 +21,7 @@
|
||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
|
|
||||||
import lutris.runners
|
from lutris.runners import import_runner
|
||||||
|
|
||||||
from lutris.config import LutrisConfig
|
from lutris.config import LutrisConfig
|
||||||
from lutris.gui.runnerconfigvbox import RunnerConfigVBox
|
from lutris.gui.runnerconfigvbox import RunnerConfigVBox
|
||||||
from lutris.gui.systemconfigvbox import SystemConfigVBox
|
from lutris.gui.systemconfigvbox import SystemConfigVBox
|
||||||
|
@ -91,11 +90,8 @@ class RunnersDialog(gtk.Dialog):
|
||||||
for runner in runner_list:
|
for runner in runner_list:
|
||||||
hbox = gtk.HBox()
|
hbox = gtk.HBox()
|
||||||
#Label
|
#Label
|
||||||
runner_module = __import__('lutris.runners.%s' % runner,
|
runner_class = import_runner(runner)
|
||||||
globals(), locals(), [runner], -1)
|
runner_instance = runner_class()
|
||||||
runner_cls = getattr(runner_module, runner)
|
|
||||||
runner_instance = runner_cls()
|
|
||||||
#runner_instance = eval("lutris.runners." + runner + "." + runner + "()")
|
|
||||||
machine = runner_instance.machine
|
machine = runner_instance.machine
|
||||||
runner_label = gtk.Label()
|
runner_label = gtk.Label()
|
||||||
runner_label.set_markup("<b>"+runner + "</b> ( " + machine + " ) ")
|
runner_label.set_markup("<b>"+runner + "</b> ( " + machine + " ) ")
|
||||||
|
@ -125,11 +121,12 @@ class RunnersDialog(gtk.Dialog):
|
||||||
def close(self, widget=None, other=None):
|
def close(self, widget=None, other=None):
|
||||||
self.destroy()
|
self.destroy()
|
||||||
|
|
||||||
def on_install_clicked(self,widget,runner):
|
def on_install_clicked(self,widget,runner_classname):
|
||||||
"""Install a runner"""
|
"""Install a runner"""
|
||||||
#FIXME : this is ugly !
|
#FIXME : this is ugly !
|
||||||
runner_instance = eval("lutris.runners." + runner + "." + runner + "()")
|
runner_class = import_runner(runner_classname)
|
||||||
runner_instance.install()
|
runner = runner_classname()
|
||||||
|
runner.install()
|
||||||
|
|
||||||
def on_configure_clicked(self,widget,runner):
|
def on_configure_clicked(self,widget,runner):
|
||||||
RunnerConfigDialog(runner)
|
RunnerConfigDialog(runner)
|
||||||
|
|
Loading…
Reference in a new issue