heavy refactoring started

This commit is contained in:
Mathieu Comandon 2010-09-01 04:40:01 +02:00
parent 594a217a66
commit 923300beca
16 changed files with 162 additions and 190 deletions

81
bin/lutris.py Executable file
View file

@ -0,0 +1,81 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2010 Mathieu Comandon <strycore@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
import sys
import os
import gtk
import logging
import optparse
# This is inspired by gwibber because the quickly method was starting to be
# annoying, there might be some issues left with running from source tree or
# packaged version (and running from source with the packaged version installed)
# See Gwibber source for more inspiration.
LAUNCH_PATH=os.path.abspath(sys.path[0])
DATA_PATH=os.path.join(LAUNCH_PATH, '..', 'data')
SOURCE_PATH=os.path.join(LAUNCH_PATH, '..')
sys.path.insert(0, SOURCE_PATH)
from lutris.installer import Installer
from lutris.gui.lutriswindow import LutrisWindow
def new_lutris_window():
""" Returns an instantiated LutrisWindow object. """
ui_filename = os.path.join(DATA_PATH, 'ui', 'LutrisWindow.ui')
if not os.path.exists(ui_filename):
raise IOError('File not found')
builder = gtk.Builder()
builder.add_from_file(ui_filename)
window = builder.get_object("lutris_window")
window.finish_initializing(builder,DATA_PATH)
return window
# Support for command line options.
parser = optparse.OptionParser(version="%prog %ver")
parser.add_option("-v", "--verbose", action="store_true",
dest="verbose", help="Show debug messages")
(options, args) = parser.parse_args()
# Set the logging level to show debug messages.
if options.verbose:
logging.basicConfig(level=logging.DEBUG)
logging.debug('logging enabled')
# Run the application.
game = None
for arg in args:
if arg.startswith('lutris://'):
print 'Installing ' + arg[9:]
game = arg[9:]
break
if game:
installer = Installer(game)
success = installer.pre_install()
if success is False:
print "Unable to install game"
print installer.installer_errors
else:
print "Ready! Launching installer."
installer.install()
exit()
else:
lutris_window = new_lutris_window()
lutris_window.show()
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()

0
data/media/background.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 33 KiB

0
data/media/logo.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

0
data/media/logo.svg Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

0
data/media/lutris.png Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 7.3 KiB

After

Width:  |  Height:  |  Size: 7.3 KiB

0
data/media/lutris.svg Executable file → Normal file
View file

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

53
debian/changelog vendored
View file

@ -1,53 +1,12 @@
lutris (0.2-public5) lucid; urgency=low
lutris (0.2.1) maverick; urgency=low
* New release.
* Cleaned some files to prepare for 0.33 release
* First attempt at the Lutris installer
* Many bugfixes
-- Mathieu Comandon <strycore@gmail.com> Thu, 13 May 2010 12:17:40 +0200
-- Mathieu Comandon <strycore@gmail.com> Tue, 31 Aug 2010 02:44:47 +0200
lutris (0.2-public4) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Thu, 13 May 2010 12:17:12 +0200
lutris (0.2-public3) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Thu, 13 May 2010 12:12:32 +0200
lutris (0.2-public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Thu, 13 May 2010 12:08:40 +0200
lutris (0.2-public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Thu, 13 May 2010 12:08:14 +0200
lutris (0.2~public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Tue, 02 Mar 2010 00:57:57 +0100
lutris (0.2~public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Tue, 02 Mar 2010 00:54:43 +0100
lutris (0.2~public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Sun, 31 Jan 2010 23:06:53 +0100
lutris (0.2~public1) lucid; urgency=low
lutris (0.2) lucid; urgency=low
* Initial Quickly release.

4
debian/control vendored
View file

@ -4,14 +4,14 @@ Priority: optional
Build-Depends: cdbs (>= 0.4.43), debhelper (>= 6), python,
python-support (>= 0.6.4), python-distutils-extra (>= 2.10)
Maintainer: Mathieu Comandon <strycore@gmail.com>
Standards-Version: 3.8.2
Standards-Version: 3.9.1
XS-Python-Version: current
Package: lutris
Architecture: all
XB-Python-Version: ${python:Versions}
Depends: ${misc:Depends}, ${python:Depends}, python-apport,
python-gobject, python-apt, python-gtk2, python-yaml
python-gobject, python-apt, python-gtk2, python-yaml, python-gconf, python-pyglet
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

View file

@ -1,8 +1,9 @@
[Desktop Entry]
Version=0.2.1
Name=Lutris
Comment=Lutris application
Categories=GNOME;Games;
Categories=Game;
Exec=lutris
Icon=/usr/local/share/lutris/media/lutris.svg
Icon=/usr/share/lutris/media/lutris.svg
Terminal=false
Type=Application

View file

@ -56,7 +56,7 @@ system_config_file = 'system' + config_extension
protocol_version = 1
system_config_full_path = os.path.join(lutris_config_path, system_config_file)
runner_config_path = os.path.join(lutris_config_path, 'runners"')
runner_config_path = os.path.join(lutris_config_path, 'runners')
game_config_path = os.path.join(lutris_config_path, 'games')
cover_path = os.path.join(lutris_config_path, 'covers')
tmp_path = os.path.join(lutris_config_path, 'tmp')

View file

@ -22,10 +22,9 @@
import os
import os.path
import subprocess
import logging
from lutris.gconfwrapper import GconfWrapper
#Dumb Debian Lenny,they don't even have python-gconf !
# Don't force to import gconf, some users might not have it.
try:
import gconf
gconf_capable = True
@ -141,7 +140,3 @@ class LutrisDesktopControl():
joysticks.append(device_name)
return joysticks
if __name__ == "__main__":
ldc = LutrisDesktopControl()
print ldc.check_joysticks()
#print ldc.get_resolutions()

View file

@ -14,11 +14,10 @@
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
import sys
import os
import gtk
import gtk.gdk
from lutris.lutrisconfig import getdatapath
import lutris.constants
class AboutLutrisDialog(gtk.AboutDialog):
@ -58,7 +57,7 @@ class AboutLutrisDialog(gtk.AboutDialog):
self.set_artists(lutris.constants.artists)
self.set_website(lutris.constants.website)
def NewAboutLutrisDialog():
def NewAboutLutrisDialog(data_path):
"""NewAboutLutrisDialog - returns a fully instantiated
AboutLutrisDialog object. Use this function rather than
creating a AboutLutrisDialog instance directly.
@ -66,18 +65,13 @@ def NewAboutLutrisDialog():
"""
#look for the ui file that describes the ui
ui_filename = os.path.join(getdatapath(), 'ui', 'AboutLutrisDialog.ui')
ui_filename = os.path.join(data_path, 'ui', 'AboutLutrisDialog.ui')
if not os.path.exists(ui_filename):
ui_filename = None
builder = gtk.Builder()
builder.add_from_file(ui_filename)
builder.add_from_file(ui_filename)
dialog = builder.get_object("about_lutris_dialog")
dialog.finish_initializing(builder)
return dialog
if __name__ == "__main__":
dialog = NewAboutLutrisDialog()
dialog.show()
gtk.main()

177
bin/lutris → lutris/gui/lutriswindow.py Executable file → Normal file
View file

@ -1,25 +1,23 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
### BEGIN LICENSE
# Copyright (C) 2010 Mathieu Comandon <strycore@gmail.com>
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License version 3, as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranties of
# MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR
# PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
### END LICENSE
import sys
import os
import gtk
import gobject
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
##
## Copyright (C) 2009 Mathieu Comandon strycore@gmail.com
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 3 of the License, or
## (at your option) any later version.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
try:
import LaunchpadIntegration
@ -27,26 +25,13 @@ try:
except ImportError:
LAUNCHPAD_AVAILABLE = False
# Check if we are working in the source tree or from the installed
# package and mangle the python path accordingly
if os.path.dirname(sys.argv[0]) != ".":
if sys.argv[0][0] == "/":
fullPath = os.path.dirname(sys.argv[0])
else:
fullPath = os.getcwd() + "/" + os.path.dirname(sys.argv[0])
else:
fullPath = os.getcwd()
sys.path.insert(0, os.path.dirname(fullPath))
import gtk
import os
import gobject
import lutris.runners
import lutris.constants
from lutris.game import LutrisGame
from lutris.config import LutrisConfig
from lutris.lutrisconfig import getdatapath
from lutris.installer import Installer
from lutris.desktop_control import LutrisDesktopControl
from lutris.gui.dictionary_grid import DictionaryGrid
from lutris.gui.ftpdialog import FtpDialog
from lutris.gui.runnersdialog import RunnersDialog
@ -56,26 +41,44 @@ from lutris.gui.installerdialog import InstallerDialog
from lutris.gui.systemconfigdialog import SystemConfigDialog
from lutris.gui.googleimagedialog import GoogleImageDialog
from lutris.gui.editgameconfigdialog import EditGameConfigDialog
from lutris.gui.aboutdialog import AboutLutrisDialog , NewAboutLutrisDialog
from lutris.gui.aboutdialog import NewAboutLutrisDialog
from lutris.desktop_control import LutrisDesktopControl
from lutris.coverflow.coverflow import coverflow
import lutris.coverflow.coverflow
class LutrisWindow(gtk.Window):
""" Main Lutris window """
__gtype_name__ = "LutrisWindow"
def __init__(self):
pass
super(LutrisWindow, self).__init__()
self.data_path = None
self.builder = None
# Load Lutris configuration
# TODO : this sould be useless soon (hint: remove() )
self.lutris_config = LutrisConfig()
# Widgets
self.status_label = None
self.menu = None
self.game_cover_image = None
self.toolbar = None
self.joystick_icons = []
def finish_initializing(self, builder):
def finish_initializing(self, builder, data_path):
""" Method used by gtkBuilder to instanciate the window. """
self.data_path = data_path
#get a reference to the builder and set up the signals
self.builder = builder
self.builder.connect_signals(self)
global LAUNCHPAD_AVAILABLE
if LAUNCHPAD_AVAILABLE:
# see https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding for more information
# about LaunchpadIntegration
self.set_title("Lutris")
# https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding
# for more information about LaunchpadIntegration
if LAUNCHPAD_AVAILABLE:
helpmenu = self.builder.get_object('menu3')
if helpmenu:
LaunchpadIntegration.set_sourcepackagename('lutris')
@ -83,15 +86,12 @@ class LutrisWindow(gtk.Window):
else:
LAUNCHPAD_AVAILABLE = False
# TODO: The game_cover_image will be moved inot it's own widget
self.game_cover_image = self.builder.get_object("game_cover_image")
print fullPath
self.game_cover_image.set_from_file(os.path.join(fullPath, "media/background.png"))
self.set_title("Lutris")
gtk.window_set_default_icon_name("softwarecenter")
#Load Lutris configuration
self.lutrisConfig = LutrisConfig()
self.game_cover_image.set_from_file(
os.path.join(data_path, "media/background.png")
)
#Context menu
game_rename = "Rename", self.edit_game_name
game_config = "Configure", self.edit_game_configuration
@ -109,9 +109,8 @@ class LutrisWindow(gtk.Window):
#Status bar
self.status_label = self.builder.get_object("status_label")
self.status_label.set_text("Game on!")
self.status_label.set_text("Ready to roll !")
self.joystick_icons = []
self.joystick_icons.append(self.builder.get_object("js0image"))
self.joystick_icons.append(self.builder.get_object("js1image"))
self.joystick_icons.append(self.builder.get_object("js2image"))
@ -175,8 +174,8 @@ class LutrisWindow(gtk.Window):
def about(self, widget, data=None):
"""about - display the about box for lutris """
about = NewAboutLutrisDialog()
response = about.run()
about = NewAboutLutrisDialog(self.data_path)
about.run()
about.destroy()
def quit(self, widget, data=None):
@ -204,7 +203,7 @@ class LutrisWindow(gtk.Window):
Note: this won't delete the actual game"""
if not self.gameName:
return
self.lutrisConfig.remove(self.gameName)
self.lutris_config.remove(self.gameName)
self.game_list_grid_view.remove_selected_rows()
self.status_label.set_text("Removed game")
@ -326,62 +325,4 @@ class LutrisWindow(gtk.Window):
self.game_cover_image.set_from_pixbuf(cover_pixbuf.scale_simple(int(dest_w), int(dest_h), gtk.gdk.INTERP_BILINEAR))
return
else:
self.game_cover_image.set_from_file("data/media/background.png")
def new_lutris_window():
"""new_lutris_window - returns a fully instantiated
LutrisWindow object. Use this function rather than
creating a LutrisWindow directly.
"""
#look for the ui file that describes the ui
ui_filename = os.path.join(getdatapath(), 'ui', 'LutrisWindow.ui')
if not os.path.exists(ui_filename):
ui_filename = None
builder = gtk.Builder()
builder.add_from_file(ui_filename)
window = builder.get_object("lutris_window")
window.finish_initializing(builder)
icon_file = os.path.join(getdatapath(), 'media', 'logo.png')
window.set_icon_from_file(icon_file)
return window
if __name__ == "__main__":
# Support for command line options.
import logging
import optparse
parser = optparse.OptionParser(version="%prog %ver")
parser.add_option("-v", "--verbose", action="store_true",
dest="verbose", help="Show debug messages")
(options, args) = parser.parse_args()
# Set the logging level to show debug messages.
if options.verbose:
logging.basicConfig(level=logging.DEBUG)
logging.debug('logging enabled')
# Run the application.
game = None
for arg in args:
if arg.startswith('lutris://'):
print 'Installing ' + arg[9:]
game = arg[9:]
break
if game:
installer = Installer(game)
success = installer.pre_install()
if success is False:
print "Unable to install game"
print installer.installer_errors
else:
print "Ready! Launching installer."
installer.install()
exit()
else:
lutris_window = new_lutris_window()
lutris_window.show()
gtk.gdk.threads_init()
gtk.gdk.threads_enter()
gtk.main()
gtk.gdk.threads_leave()
self.game_cover_image.set_from_file("data/media/background.png")

View file

@ -21,6 +21,7 @@
# where your project will head for your data (for instance, images and ui files)
# by default, this is ../data, relative your trunk layout
#__lutris_data_directory__ = '/usr/local/share/lutris/'
__lutris_data_directory__ = '.'
__license__ = 'GPL-3'

View file

@ -19,12 +19,12 @@
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
###############################################################################
from lutris.runners.runner import Runner
from lutris.desktop_control import LutrisDesktopControl
import os
import os.path
import logging
from lutris.runners.runner import Runner
from lutris.desktop_control import LutrisDesktopControl
class atari800(Runner):
'''Runner for intellivision games'''

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-08-31 01:35+0200\n"
"POT-Creation-Date: 2010-08-31 02:49+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"