Refactor Wine not detected warning in its own class

This commit is contained in:
Mathieu Comandon 2018-11-03 01:04:55 -07:00
parent 50f642eff9
commit d2acd4249f
2 changed files with 19 additions and 9 deletions

View file

@ -187,15 +187,10 @@ class Game:
dialogs.ErrorDialog("Runtime currently updating",
"Game might not work as expected")
if "wine" in self.runner_name and not wine.get_system_wine_version():
dialogs.DontShowAgainDialog(
'hide-wine-systemwide-install-warning',
"Wine is not installed on your system.",
secondary_message="Having Wine installed on your system guarantees that "
"Wine builds from Lutris will have all required dependencies.\n\nPlease "
"follow the instructions given in the <a "
"href='https://github.com/lutris/lutris/wiki/Wine'>Lutris Wiki</a> to "
"install Wine."
)
# TODO find a reference to the root window or better yet a way not
# to have Gtk dependent code in this class.
root_window = None
dialogs.WineNotInstalledWarning(parent=root_window)
return True
def play(self):

View file

@ -389,3 +389,18 @@ class DontShowAgainDialog(Gtk.MessageDialog):
if dont_show_checkbutton.get_active():
settings.write_setting(setting, True)
self.destroy()
class WineNotInstalledWarning(DontShowAgainDialog):
"""Display a warning if Wine is not detected on the system"""
def __init__(self, parent=None):
super().__init__(
'hide-wine-systemwide-install-warning',
"Wine is not installed on your system.",
secondary_message="Having Wine installed on your system guarantees that "
"Wine builds from Lutris will have all required dependencies.\n\nPlease "
"follow the instructions given in the <a "
"href='https://github.com/lutris/lutris/wiki/Wine'>Lutris Wiki</a> to "
"install Wine.",
parent=parent
)