Get rid of ScummVM import

This commit is contained in:
Mathieu Comandon 2013-12-28 18:38:30 +01:00
parent ebce382aa0
commit 8b7c501abb
3 changed files with 7 additions and 80 deletions

View file

@ -11,13 +11,6 @@
<property name="can_focus">False</property>
<property name="stock">gtk-media-play</property>
</object>
<object class="GtkImage" id="viwe_grid_symbolic">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">4</property>
<property name="pixel_size">16</property>
<property name="icon_name">view-grid-symbolic</property>
</object>
<object class="GtkImage" id="view_list_symbolic">
<property name="visible">True</property>
<property name="can_focus">False</property>
@ -25,6 +18,13 @@
<property name="pixel_size">16</property>
<property name="icon_name">view-list-symbolic</property>
</object>
<object class="GtkImage" id="viwe_grid_symbolic">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">4</property>
<property name="pixel_size">16</property>
<property name="icon_name">view-grid-symbolic</property>
</object>
<object class="GtkWindow" id="window">
<property name="width_request">640</property>
<property name="height_request">300</property>
@ -99,30 +99,6 @@
<signal name="activate" handler="on_preferences_activate" swapped="no"/>
</object>
</child>
<child>
<object class="GtkMenuItem" id="import_menuitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Import</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="import_menu">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkMenuItem" id="scummvm_menuitem">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Import games from ScummVM</property>
<property name="label" translatable="yes">ScummVM</property>
<property name="use_underline">True</property>
<signal name="activate" handler="import_scummvm" swapped="no"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkImageMenuItem" id="quit_menuitem">
<property name="label">gtk-quit</property>

View file

@ -225,16 +225,6 @@ class LutrisWindow(object):
def on_image_downloaded(self, game_slug):
self.view.update_image(game_slug)
def import_scummvm(self, _widget, _data=None):
"""Callback for importing scummvm games"""
from lutris.runners.scummvm import import_games
new_games = import_games()
if not new_games:
dialogs.NoticeDialog("No ScummVM games found")
else:
for new_game in new_games:
self.view.add_game(new_game)
def on_search_entry_changed(self, widget):
self.view.emit('filter-updated', widget.get_text())

View file

@ -25,51 +25,12 @@ import os
import subprocess
from lutris import settings
from lutris.util.log import logger
from lutris.util.strings import slugify
from lutris.util.system import find_executable
from lutris.runners.runner import Runner
from lutris.config import LutrisConfig
from ConfigParser import ConfigParser
SCUMMVM_CONFIG_FILE = os.path.join(os.path.expanduser("~"), ".scummvmrc")
def add_game(game_id, realname):
"""Add scummvm from the auto-import"""
lutris_config = LutrisConfig()
lutris_config.config = {"runner": "scummvm",
"realname": realname,
"name": slugify(realname),
'game': {
'game_id': game_id
}}
lutris_config.save("game")
def import_games():
"""Parse the scummvm config file and imports the games in Lutris config
files."""
logger.info("Importing ScummVM games.")
imported_games = []
if not os.path.exists(SCUMMVM_CONFIG_FILE):
logger.info("No ScummVM config found")
return None
config_parser = ConfigParser()
config_parser.read(SCUMMVM_CONFIG_FILE)
config_sections = config_parser.sections()
if "scummvm" in config_sections:
config_sections.remove("scummvm")
for section in config_sections:
realname = config_parser.get(section, "description")
logger.info("Found ScummVM game %s", realname)
add_game(section, realname)
imported_games.append({'id': slugify(realname),
'name': realname,
'runner': 'scummvm'})
return imported_games
# pylint: disable=C0103
class scummvm(Runner):
"""Runs LucasArts games based on the Scumm engine"""