mirror of
https://github.com/lutris/lutris
synced 2024-09-15 13:59:50 +00:00
confused and confusing commit
This commit is contained in:
parent
37a3b49133
commit
582f809ea8
16
bin/lutris
16
bin/lutris
|
@ -23,6 +23,8 @@ import optparse
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
LAUNCH_PATH=dirname(realpath(__file__))
|
||||
if LAUNCH_PATH != "/usr/bin":
|
||||
LAUNCH_PATH=dirname(realpath(__file__))
|
||||
if LAUNCH_PATH != "/usr/bin":
|
||||
SOURCE_PATH=normpath(os.path.join(LAUNCH_PATH, '..'))
|
||||
sys.path.insert(0, SOURCE_PATH)
|
||||
|
@ -89,22 +91,12 @@ if game:
|
|||
lutris_game.play()
|
||||
else:
|
||||
installer = Installer(game)
|
||||
success = installer.pre_install()
|
||||
if not success:
|
||||
log.logger.error("Unable to install game")
|
||||
log.logger.error(installer.installer_errors)
|
||||
if 'INSTALLER_UNREACHABLE' in installer.installer_errors:
|
||||
ErrorDialog("Can't find an installer for \"%s\""
|
||||
% game)
|
||||
else:
|
||||
log.logger.info("Ready! Launching installer.")
|
||||
installer.install()
|
||||
exit()
|
||||
gtk.main()
|
||||
else:
|
||||
log.logger.info('Showing main window')
|
||||
lutris_window = new_lutris_window()
|
||||
lutris_window.show()
|
||||
gtk.gdk.threads_init()
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.main()
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
|
|
4
debian/control
vendored
4
debian/control
vendored
|
@ -9,8 +9,8 @@ Standards-Version: 3.9.1
|
|||
Package: lutris
|
||||
Architecture: all
|
||||
Depends: ${misc:Depends}, ${python:Depends}, python-xdg, python-gconf,
|
||||
python-gobject, python-apt, python-gtk2, python-yaml, joy2key
|
||||
Recommends: python-apport, python-pyglet, joy2key
|
||||
python-gobject, python-apt, python-gtk2, python-yaml
|
||||
Recommends: python-apport, python-pyglet, joy2key
|
||||
Description: Install and play any video game easily
|
||||
Lutris is a gaming platform for GNU/Linux. It's goal is to make
|
||||
gaming on Linux as easy as possible by taking care of installing
|
||||
|
|
|
@ -22,14 +22,24 @@ import logging
|
|||
import lutris.constants as constants
|
||||
|
||||
class LutrisConfig():
|
||||
"""Class where all the configuration handling happens.
|
||||
|
||||
Lutris configuration uses a cascading mecanism where
|
||||
each higher, more specific level override the lower ones.
|
||||
|
||||
The config files are stored in a YAML format and are easy to edit manually.
|
||||
|
||||
"""
|
||||
def __init__(self, runner=None, game=None):
|
||||
#Check if configuration directories exists and create them if needed.
|
||||
#FIXME: This isn't the right place for this piece of code, it has
|
||||
# nothing to do with configuration files.
|
||||
config_paths = [constants.lutris_config_path,
|
||||
constants.runner_config_path,
|
||||
constants.GAME_CONFIG_PATH,
|
||||
constants.COVER_PATH,
|
||||
constants.tmp_path,
|
||||
constants.cache_path]
|
||||
constants.TMP_PATH,
|
||||
constants.LUTRIS_CACHE_PATH]
|
||||
for config_path in config_paths:
|
||||
if not os.path.exists(config_path):
|
||||
os.mkdir(config_path)
|
||||
|
|
|
@ -16,14 +16,15 @@
|
|||
#
|
||||
|
||||
from os.path import realpath, normpath, dirname, join, exists, expanduser
|
||||
from xdg import BaseDirectory
|
||||
import sys
|
||||
|
||||
name = "Lutris"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
website = "http://lutris.net"
|
||||
protocol_version = 1
|
||||
#installer_prefix = "http://lutris.net/media/installers/"
|
||||
installer_prefix = "http://localhost:8000/media/installers/"
|
||||
INSTALLER_URL = "http://lutris.net/media/installers/"
|
||||
#installer_prefix = "http://localhost:8000/media/installers/"
|
||||
CONFIG_EXTENSION = ".yml"
|
||||
license = 'GPL-3'
|
||||
copyright = "(c) 2010 Lutris Gaming Platform"
|
||||
|
@ -55,13 +56,15 @@ if not exists(DATA_PATH):
|
|||
lutris_icon_file = "media/logo.svg"
|
||||
lutris_icon_path = join(DATA_PATH, lutris_icon_file)
|
||||
|
||||
lutris_config_path = join(expanduser('~'), '.config', 'lutris')
|
||||
lutris_config_path = join(BaseDirectory.xdg_config_home, 'lutris')
|
||||
LUTRIS_DATA_PATH = join(BaseDirectory.xdg_data_home, 'lutris')
|
||||
LUTRIS_CACHE_PATH = join(BaseDirectory.xdg_cache_home, 'lutris')
|
||||
|
||||
system_config_file = 'system' + CONFIG_EXTENSION
|
||||
system_config_full_path = join(lutris_config_path, system_config_file)
|
||||
runner_config_path = join(lutris_config_path, 'runners')
|
||||
GAME_CONFIG_PATH = join(lutris_config_path, 'games')
|
||||
COVER_PATH = join(lutris_config_path, 'covers')
|
||||
tmp_path = join(lutris_config_path, 'tmp')
|
||||
TMP_PATH = tmp_path
|
||||
cache_path = join(lutris_config_path, 'cache')
|
||||
cache_path = LUTRIS_CACHE_PATH
|
||||
TMP_PATH = join(LUTRIS_CACHE_PATH, 'tmp')
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ class GoogleImageDialog(gtk.Dialog):
|
|||
gtk.Dialog.__init__(self)
|
||||
self.set_title(game)
|
||||
self.set_size_request(800,260)
|
||||
|
||||
|
||||
self.thumbnails_scroll_window = gtk.ScrolledWindow()
|
||||
self.thumbnails_scroll_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
self.vbox.pack_start(self.thumbnails_scroll_window)
|
||||
|
@ -54,7 +54,7 @@ class GoogleImageDialog(gtk.Dialog):
|
|||
cancel_button = gtk.Button(None, gtk.STOCK_CANCEL)
|
||||
cancel_button.connect("clicked", self.close)
|
||||
self.action_area.pack_start(cancel_button)
|
||||
|
||||
|
||||
self.show_all()
|
||||
|
||||
def close(self,widget=None):
|
||||
|
@ -71,9 +71,9 @@ class GoogleImageDialog(gtk.Dialog):
|
|||
self.progress_bar.set_text("Getting Images ...")
|
||||
self.progress_bar.show()
|
||||
self.thumbnails_scroll_window.add_with_viewport(self.progress_bar)
|
||||
|
||||
|
||||
self.google_image = GoogleImage()
|
||||
self.thumbs_path = lutris.constants.tmp_path
|
||||
self.thumbs_path = lutris.constants.TMP_PATH
|
||||
self.google_image.get_google_image_page(self.search_entry.get_text())
|
||||
google_fetcher = GoogleFetcher(self.google_image,self.thumbs_path)
|
||||
timer_id = gobject.timeout_add(25, self.refresh_status)
|
||||
|
@ -82,7 +82,7 @@ class GoogleImageDialog(gtk.Dialog):
|
|||
def show_images(self):
|
||||
self.progress_bar.destroy()
|
||||
self.progress_bar=None
|
||||
|
||||
|
||||
self.thumbnails_table = gtk.Table(rows=2,columns=20,homogeneous=False)
|
||||
self.thumbnails_table.show()
|
||||
self.thumbnails_scroll_window.add_with_viewport(self.thumbnails_table)
|
||||
|
@ -100,7 +100,7 @@ class GoogleImageDialog(gtk.Dialog):
|
|||
self.thumbnails_table.attach(image_button,index,index+1,0,1,xpadding = 3, ypadding = 3)
|
||||
self.thumbnails_table.attach(image_info,index,index+1,1,2,xpadding = 3, ypadding = 3)
|
||||
index = index + 1
|
||||
|
||||
|
||||
def refresh_status(self):
|
||||
fraction = self.google_image.fetch_count / 20.0
|
||||
self.progress_bar.set_fraction(fraction)
|
||||
|
@ -114,15 +114,15 @@ class GoogleImageDialog(gtk.Dialog):
|
|||
logging.debug("grabbing %s" % file)
|
||||
self.google_image.get_pic_at(int(file.split('.')[0]),os.path.join(lutris.constants.cover_path,self.game))
|
||||
self.destroy()
|
||||
|
||||
|
||||
class GoogleFetcher(threading.Thread):
|
||||
def __init__(self,google_image,thumbs_path):
|
||||
threading.Thread.__init__(self)
|
||||
threading.Thread.__init__(self)
|
||||
self.google_image = google_image
|
||||
self.thumbs_path = thumbs_path
|
||||
def run(self):
|
||||
self.google_image.scan_for_images(self.thumbs_path)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
google_img_dlg = GoogleImageDialog()
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class DownloadProgressBox(gtk.HBox):
|
|||
def progress(self):
|
||||
if self.downloader is None:
|
||||
return False
|
||||
data = self.downloader.progress
|
||||
data = max(self.downloader.progress, 100)
|
||||
frac = data/100.0
|
||||
self.progressbar.set_fraction(frac)
|
||||
self.progressbar.set_text("%d %%" % data)
|
||||
|
|
|
@ -22,15 +22,18 @@ TODO: The gui frontend
|
|||
"""
|
||||
|
||||
import os
|
||||
import gtk
|
||||
import yaml
|
||||
import shutil
|
||||
import urllib
|
||||
import urllib2
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
import lutris.constants
|
||||
from lutris.constants import LUTRIS_CACHE_PATH, INSTALLER_URL
|
||||
|
||||
from lutris.config import LutrisConfig
|
||||
from lutris.gui.common import DownloadDialog, ErrorDialog
|
||||
from lutris.util import log
|
||||
|
||||
def unzip(filename, dest=None):
|
||||
"""Unzips a file"""
|
||||
|
@ -70,14 +73,15 @@ def reporthook(piece, received_bytes, total_size):
|
|||
print "%d %%" % ((piece * received_bytes) * 100 / total_size)
|
||||
|
||||
|
||||
class Installer():
|
||||
class Installer(gtk.Dialog):
|
||||
""" Lutris installer """
|
||||
|
||||
def __init__(self, game):
|
||||
|
||||
gtk.Dialog.__init__(self)
|
||||
self.lutris_config = None
|
||||
self.game_name = game
|
||||
self.installer_dest_path = os.path.join(lutris.constants.cache_path,
|
||||
self.installer_dest_path = os.path.join(LUTRIS_CACHE_PATH,
|
||||
self.game_name + ".yml")
|
||||
# Stores a list of actions that will be sent back to the user
|
||||
# in order to complete the installation
|
||||
|
@ -99,6 +103,23 @@ class Installer():
|
|||
# Dictionary of the files needed to install the game
|
||||
self.gamefiles = {}
|
||||
|
||||
button = gtk.Button('Install')
|
||||
button.connect('clicked', self.launch_install)
|
||||
self.vbox.pack_start(button)
|
||||
|
||||
self.show_all()
|
||||
|
||||
def launch_install(self,widget, data=None):
|
||||
success = self.pre_install()
|
||||
if not success:
|
||||
log.logger.error("Unable to install game")
|
||||
log.logger.error(installer.installer_errors)
|
||||
if 'INSTALLER_UNREACHABLE' in self.installer_errors:
|
||||
ErrorDialog("Can't find an installer for \"%s\""
|
||||
% self.game_name)
|
||||
else:
|
||||
log.logger.info("Ready! Launching installer.")
|
||||
self.install()
|
||||
|
||||
def set_games_dir(self, path):
|
||||
""" Set the base path where the game will be installed """
|
||||
|
@ -108,7 +129,6 @@ class Installer():
|
|||
"""Reads the installer and checks everything is OK
|
||||
before beginning the install process
|
||||
"""
|
||||
|
||||
success = self.save_installer_content()
|
||||
if not success:
|
||||
return False
|
||||
|
@ -116,7 +136,7 @@ class Installer():
|
|||
self.games_dir = self.lutris_config.get_path()
|
||||
if not self.games_dir:
|
||||
self.installer_user_actions.append("ask_games_dir")
|
||||
logging.debug('Install dir missing')
|
||||
log.logger.debug('Install dir missing')
|
||||
return False
|
||||
|
||||
self.game_dir = os.path.join(self.games_dir, self.game_name)
|
||||
|
@ -148,19 +168,19 @@ class Installer():
|
|||
def save_installer_content(self):
|
||||
""" Save the downloaded installer to disk. """
|
||||
|
||||
full_url = lutris.constants.installer_prefix + self.game_name + '.yml'
|
||||
full_url = INSTALLER_URL + self.game_name + '.yml'
|
||||
request = urllib2.Request(url=full_url)
|
||||
try:
|
||||
response = urllib2.urlopen(request)
|
||||
except urllib2.URLError:
|
||||
logging.debug("Server is unreachable")
|
||||
log.logger.debug("Server is unreachable")
|
||||
self.installer_errors.append("INSTALLER_UNREACHABLE")
|
||||
success = False
|
||||
else:
|
||||
logging.debug("downloading %s" % full_url)
|
||||
installer_file = open(self.installer_dest_path, "w")
|
||||
installer_file.write(response.read())
|
||||
installer_file.close()
|
||||
DownloadDialog(full_url, self.installer_dest_path)
|
||||
#installer_file = open(self.installer_dest_path, "w")
|
||||
#installer_file.write(response.read())
|
||||
#installer_file.close()
|
||||
success = True
|
||||
|
||||
return success
|
||||
|
@ -231,8 +251,8 @@ class Installer():
|
|||
def _download(self, url, output=None):
|
||||
""" Downloads a file. """
|
||||
|
||||
logging.debug('Downloading ' + url)
|
||||
dest_dir = os.path.join(lutris.constants.tmp_path, self.game_name)
|
||||
log.logger.debug('Downloading ' + url)
|
||||
dest_dir = os.path.join(lutris.constants.TMP_PATH, self.game_name)
|
||||
if not os.path.exists(dest_dir):
|
||||
os.mkdir(dest_dir)
|
||||
if not output:
|
||||
|
@ -243,7 +263,8 @@ class Installer():
|
|||
if url.startswith("file://"):
|
||||
shutil.copy(url[7:], dest_dir)
|
||||
else:
|
||||
urllib.urlretrieve(url, dest_file, reporthook)
|
||||
DownloadDialog(url, dest_file)
|
||||
#urllib.urlretrieve(url, dest_file, reporthook)
|
||||
|
||||
return dest_file
|
||||
|
||||
|
|
|
@ -90,6 +90,19 @@ class atari800(Runner):
|
|||
self.rom = ""
|
||||
self.error_messages = self.error_messages + ["No disk image given."]
|
||||
|
||||
def package_installed(self):
|
||||
return super(atari800, self).is_installed
|
||||
|
||||
def is_installed(self):
|
||||
if self.package_installed is False:
|
||||
return False
|
||||
if not os.path.exists(os.path.join(os.path.expanduser('~'),
|
||||
'.config/lutris/runnerfiles/xf25.zip')):
|
||||
return False
|
||||
def install(self):
|
||||
if self.package_installed is False:
|
||||
super(atari800, self).install()
|
||||
|
||||
def find_good_bioses(self,machine=None):
|
||||
good_bios = {}
|
||||
for file in os.listdir(self.bios_path):
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
###############################################################################
|
||||
|
||||
from lutris.runners.runner import Runner
|
||||
from lutris.gui.common import NoticeDialog
|
||||
|
||||
class dolphin(Runner):
|
||||
"""Runner for the Gamecube / Wii emulator Dolphin
|
||||
|
@ -36,10 +37,15 @@ class dolphin(Runner):
|
|||
self.machine = "Gamecube, Wii"
|
||||
self.description = "Emulator for Nintendo Gamecube and Wii games"
|
||||
|
||||
|
||||
|
||||
|
||||
def install(self):
|
||||
NoticeDialog('Please activate the PlayDeb reposiories in order to install Dolphin')
|
||||
super(dolphin, self).install()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -35,14 +35,12 @@ class nulldc(wine):
|
|||
|
||||
Download link : http://nulldc.googlecode.com/files/nullDC_104_r50.7z
|
||||
|
||||
TODO: implement joy2key or use Lutris' own version
|
||||
"""
|
||||
|
||||
def __init__(self,settings=None):
|
||||
"""Initialize NullDC
|
||||
|
||||
TODO: Remove hardcoded stuff
|
||||
TODO; joy2key
|
||||
|
||||
joy2key $(xwininfo -root -tree | grep nullDC | grep -v VMU |\
|
||||
awk '{print $1}') \
|
||||
|
@ -94,9 +92,7 @@ class nulldc(wine):
|
|||
return True
|
||||
|
||||
def get_nulldc_path(self):
|
||||
""" Return the full path for the NullDC executable.
|
||||
|
||||
"""
|
||||
""" Return the full path for the NullDC executable."""
|
||||
if not self.nulldc_path:
|
||||
return ""
|
||||
else:
|
||||
|
|
|
@ -25,6 +25,7 @@ import hashlib
|
|||
import logging
|
||||
|
||||
from lutris.config import LutrisConfig
|
||||
from lutris.gui.common import ErrorDialog
|
||||
|
||||
class Runner(object):
|
||||
"""Generic runner (base class for other runners) """
|
||||
|
@ -101,6 +102,7 @@ class Runner(object):
|
|||
if not hasattr(self, 'package'):
|
||||
return False
|
||||
if self.is_installable is False:
|
||||
ErrorDialog('This runner is not yet installable')
|
||||
return False
|
||||
linux_dist = platform.dist()[0]
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class wine(Runner):
|
|||
|
||||
logging.debug("Setting wine registry key : %s\\%s to %s" %
|
||||
(path, key, value))
|
||||
reg_path = os.path.join(lutris.constants.tmp_path, 'winekeys.reg')
|
||||
reg_path = os.path.join(lutris.constants.TMP_PATH, 'winekeys.reg')
|
||||
#Make temporary reg file
|
||||
reg_file = open(reg_path, "w")
|
||||
reg_file.write("""REGEDIT4
|
||||
|
|
Loading…
Reference in a new issue