Lutris marathon day 4 : Asteroids

This commit is contained in:
Mathieu Comandon 2010-03-21 00:26:25 +01:00
parent b1cad4d335
commit e04644980c
17 changed files with 1294 additions and 115 deletions

View file

@ -18,6 +18,7 @@
import sys
import os
import gtk
import gobject
# Check if we are working in the source tree or from the installed
# package and mangle the python path accordingly
@ -48,8 +49,6 @@ from lutris.system_config_dialog import SystemConfigDialog
from lutris.gui.google_image_dialog import GoogleImageDialog
from lutris.gui.edit_game_config_dialog import EditGameConfigDialog
class LutrisWindow(gtk.Window):
__gtype_name__ = "LutrisWindow"
@ -129,7 +128,24 @@ class LutrisWindow(gtk.Window):
self.game_list_scrolledwindow = self.builder.get_object("game_list_scrolledwindow")
self.game_list_scrolledwindow.add_with_viewport(self.game_list_grid_view)
#Timer
self.timer_id = gobject.timeout_add(1000, self.refresh_status)
def refresh_status(self):
###FIXME !!
# if hasattr(self.running_game.game_process, "pid"):
# self.status_text = "Game is running (pid: %s)" % str(self.running_game.game_process.pid)
# self.status_bar.push(self.status_bar_context_id,self.status_text)
# else:
# self.status_bar.push(self.status_bar_context_id,"Welcome to Lutris")
for index in range(0,3):
if os.path.exists("/dev/input/js%d" % index):
self.joystick_icons[index].show()
else:
self.joystick_icons[index].hide()
return True
def get_game_list(self):
game_list = []
for file in os.listdir(constants.game_config_path):
@ -226,17 +242,15 @@ class LutrisWindow(gtk.Window):
def add_game(self,widget,data=None):
add_game_dialog = AddGameDialog(self)
logging.debug("opening dialog")
game_info = add_game_dialog.game_info
logging.debug(game_info)
self.game_list_grid_view.append_row(game_info)
if hasattr(add_game_dialog,"game_info"):
game_info = add_game_dialog.game_info
self.game_list_grid_view.append_row(game_info)
def import_cedega(self,widget,data=None):
cedega = runners.cedega.cedega()
cedega.import_games()
self.get_game_list()
def import_steam(self,widget,data=None):
logging.debug("Import from steam not yet implemented")
@ -277,8 +291,6 @@ class LutrisWindow(gtk.Window):
def set_game_cover(self):
if self.gameName:
logging.debug("Setting cover for :")
logging.debug(self.gameName)
extensions = ["png", "jpg", "jpeg"]
for extension in extensions:
coverFile = os.path.join(constants.cover_path, self.gameName + "." + extension)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 797 B

BIN
data/media/lutris.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

1102
data/media/lutris.svg Executable file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 58 KiB

View file

@ -5,7 +5,7 @@
<!-- interface-naming-policy project-wide -->
<object class="AddgameDialog" id="addgame_dialog">
<property name="border_width">5</property>
<property name="icon">../media/icon.png</property>
<property name="icon">../media/lutris.svg</property>
<property name="type_hint">normal</property>
<property name="has_separator">False</property>
<child internal-child="vbox">
@ -22,7 +22,7 @@
<property name="layout_style">end</property>
<child>
<object class="GtkButton" id="button2">
<property name="label" translatable="yes">gtk-cancel</property>
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
@ -37,7 +37,7 @@
</child>
<child>
<object class="GtkButton" id="button1">
<property name="label" translatable="yes">gtk-ok</property>
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>

View file

@ -8,7 +8,8 @@
<property name="width_request">650</property>
<property name="height_request">500</property>
<property name="title" translatable="yes">Lutris</property>
<property name="icon">../media/icon.png</property>
<property name="icon">../media/lutris.svg</property>
<property name="icon_name">lutris</property>
<signal name="destroy" handler="on_destroy"/>
<child>
<object class="GtkVBox" id="vbox1">
@ -271,23 +272,14 @@
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<child>
<object class="GtkLabel" id="status_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">5</property>
<property name="ypad">5</property>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="js0image">
<property name="visible">True</property>
<property name="icon_name">input-gaming</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
@ -297,6 +289,8 @@
<property name="icon_name">input-gaming</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
@ -306,6 +300,8 @@
<property name="icon_name">input-gaming</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
@ -315,9 +311,23 @@
<property name="icon_name">input-gaming</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="status_label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="xpad">5</property>
<property name="ypad">5</property>
</object>
<packing>
<property name="pack_type">end</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
@ -326,6 +336,7 @@
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>

12
debian/changelog vendored
View file

@ -1,3 +1,15 @@
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.

View file

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

View file

@ -159,13 +159,11 @@ class LutrisConfig():
def get_path(self,runner):
if self.config is None:
return os.path.expanduser("~")
if runner in self.config:
if "game_path" in self.config[runner]:
return self.config[runner]["game_path"]
if "game_path" in self.config:
return self.config["game_path"]
if "system" in self.config:
if "game_path" in self.config["system"]:
return self.config["system"]["game_path"]
logging.debug("Fail !")
logging.debug(self.config)
return os.path.expanduser("~")

View file

@ -173,6 +173,7 @@ class ConfigVBox(gtk.VBox):
file_chooser.set_size_request(200,30)
file_chooser.set_action(gtk.FILE_CHOOSER_ACTION_OPEN)
file_chooser.set_current_folder("/media/seagate300")
file_chooser.set_current_folder(self.lutris_config.get_path(self.runner_class))
file_chooser.connect("file-set",self.on_chooser_file_set,option_name)
if value:
@ -199,8 +200,6 @@ class ConfigVBox(gtk.VBox):
def on_chooser_file_set(self,filechooser_widget,option):
filename = filechooser_widget.get_filename()
logging.debug(self.save_in_key)
logging.debug(self.lutris_config.config)
self.real_config[self.save_in_key][option] = filename
def generate_multiple_file_chooser(self,option_name,label,value=None):

View file

@ -55,15 +55,15 @@ class LutrisGame():
self.runner_name = self.game_config["runner"]
except KeyError:
print "Error in %s config file : No runner" % self.name
return False
return False
try:
self.machine = eval(self.runner_name+"."+self.runner_name+"(self.game_config)")
except AttributeError,msg:
logging.error("Malformed configuration file : %s" % self.name)
logging.error("Malformed configuration file (Attribute Error) : %s" % self.name)
logging.error(msg)
return False
except KeyError,msg:
logging.error("Malformed configuration file : %s" % self.name)
logging.error("Malformed configuration file (Key Error) : %s" % self.name)
logging.error(msg)
return False
return True

View file

@ -21,7 +21,8 @@
import gtk
import sys
sys.path.append('/home/strider/Devel/lutris')
import logging
#sys.path.append('/home/strider/Devel/lutris')
from lutris.config import LutrisConfig
@ -29,71 +30,105 @@ class FtpDialog(gtk.Dialog):
def __init__(self):
gtk.Dialog.__init__(self)
self.set_title("FTP Manager")
self.set_size_request(600,500)
self.connect("destroy", self.destroy_cb)
self.main_hbox = gtk.HBox()
self.vbox.pack_start(self.main_hbox)
self.runner_list = gtk.Label("Runner list go here")
self.main_hbox.pack_start(self.runner_list)
self.ftp_vbox = gtk.VBox()
self.ftp_vbox.pack_start(gtk.Label("Ftp"),False,False,5)
destination_label = gtk.Label()
destination_label.set_markup("<b>Destination</b>")
destination_label = self.label("FTP settings",bold=True)
self.ftp_vbox.pack_start(destination_label,False,False,5)
label_width = 70
label_height = 20
#Server
server_hbox = gtk.HBox()
server_label = gtk.Label("Server")
server_label.set_size_request(label_width,label_width)
self.server_entry = gtk.Entry()
server_hbox.pack_start(server_label)
server_hbox.pack_start(self.server_entry)
self.ftp_vbox.pack_start(server_hbox,False,False,2)
host_hbox = gtk.HBox()
host_label = self.label("Server")
self.host_entry = gtk.Entry()
self.host_entry.connect("grab-focus",self.focus_entry)
host_hbox.pack_start(host_label,False,False,1)
host_hbox.pack_start(self.host_entry,False,False,1)
self.ftp_vbox.pack_start(host_hbox,False,False,2)
#login
login_hbox = gtk.HBox()
login_label = gtk.Label("login")
login_label.set_size_request(label_width,label_width)
login_label = self.label("Login")
self.login_entry = gtk.Entry()
login_hbox.pack_start(login_label)
login_hbox.pack_start(self.login_entry)
self.login_entry.connect("grab-focus",self.focus_entry)
login_hbox.pack_start(login_label,False,False,1)
login_hbox.pack_start(self.login_entry,False,False,1)
self.ftp_vbox.pack_start(login_hbox,False,False,2)
#password
password_hbox = gtk.HBox()
password_label = gtk.Label("password")
password_label.set_size_request(label_width,label_width)
password_label = self.label("Password")
self.password_entry = gtk.Entry()
password_hbox.pack_start(password_label)
password_hbox.pack_start(self.password_entry)
self.password_entry.set_visibility(False)
password_hbox.pack_start(password_label,False,False,1)
password_hbox.pack_start(self.password_entry,False,False,1)
self.ftp_vbox.pack_start(password_hbox,False,False,2)
#folder
folder_hbox = gtk.HBox()
folder_label = gtk.Label("folder")
folder_label.set_size_request(label_width,label_width)
folder_label = self.label("Folder")
self.folder_entry = gtk.Entry()
folder_hbox.pack_start(folder_label)
folder_hbox.pack_start(self.folder_entry)
folder_hbox.pack_start(folder_label,False,False,1)
folder_hbox.pack_start(self.folder_entry,False,False,1)
self.ftp_vbox.pack_start(folder_hbox,False,False,2)
#Runner list
runner_hbox = gtk.HBox()
runner_label = self.label("Runner")
runner_hbox.pack_start(runner_label,False,False,1)
self.ftp_vbox.pack_start(runner_hbox,False,False,2)
#Destination
self.destination_entry = gtk.Entry()
self.ftp_vbox.pack_start(self.destination_entry,False,False,5)
self.ftp_vbox.pack_start(self.destination_entry,False,False,2)
#Connect button
self.connect_button = gtk.Button("Connect")
self.connect_button.connect("clicked",self.connect_ftp)
self.ftp_vbox.pack_start(self.connect_button,False,False,2)
self.main_hbox.pack_start(self.ftp_vbox,False,False,2)
self.main_hbox.pack_start(self.ftp_vbox,False,False,5)
self.show_all()
self.load_runner_config()
def label(self,text,bold=False,x=70,y=20):
label = gtk.Label()
if bold:
label.set_markup("<b>%s</b>" % text)
else:
label.set_markup("%s" % text)
label.set_size_request(x,y)
label.set_alignment(0,0.5)
label.set_padding(5,5)
return label
def destroy_cb(self,widget):
self.destroy()
def focus_entry(self,widget,data=None):
widget.modify_base(gtk.STATE_NORMAL,gtk.gdk.Color("#FFFFFF"))
def connect_ftp(self,widget,data=None):
validate_widgets = [self.host_entry, self.login_entry]
valid = True
for val_widget in validate_widgets:
print val_widget
if not val_widget.get_text():
val_widget.modify_base(gtk.STATE_NORMAL,gtk.gdk.Color("#FF0000"))
valid = False
if valid == False:
return False
host = self.host_entry.get_text()
if not host:
pass
else:
logging.debug("Host : %s" % self.host_entry.get_text() )
self.host_entry.modify_base(gtk.STATE_NORMAL,gtk.gdk.Color("#FF0000"))
def load_runner_config(self,runner_name = "sdlmame"):
lutris_config = LutrisConfig(runner=runner_name)
@ -101,5 +136,4 @@ class FtpDialog(gtk.Dialog):
if __name__ == "__main__":
FtpDialog()
gtk.main()
gtk.main()

View file

@ -24,8 +24,8 @@ import runners
from lutris.config_vbox import ConfigVBox
class InstallerConfigVBox(ConfigVBox):
def __init__(self,lutris_config):
ConfigVBox.__init__(self,"game")
def __init__(self,lutris_config,caller):
ConfigVBox.__init__(self,"game",caller)
self.lutris_config = lutris_config
self.lutris_config.config_type = "game"
self.runner_class = self.lutris_config.runner

View file

@ -92,7 +92,7 @@ class InstallerDialog(gtk.Dialog):
self.notebook.append_page(self.runner_config_scrolled_window,gtk.Label("Runner configuration"))
#System configuration
self.system_config_vbox = SystemConfigVBox(self.lutris_config)
self.system_config_vbox = SystemConfigVBox(self.lutris_config,"game")
self.system_config_scrolled_window = gtk.ScrolledWindow()
self.system_config_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
self.system_config_scrolled_window.add_with_viewport(self.system_config_vbox)
@ -119,6 +119,7 @@ class InstallerDialog(gtk.Dialog):
#Run the installer
runner = eval("runners."+self.runner_class+"."+self.runner_class+"()")
self.lutris_config.update_global_config()
command = runner.get_install_command(self.lutris_config.config["game"]["installer"])
if command:
logging.debug("Running installer : %s" % command)
@ -131,7 +132,6 @@ class InstallerDialog(gtk.Dialog):
#self.game_info = {"Game Name": realname,"Runner": self.runner_class , "name": game_identifier}
self.destroy()
def on_runner_changed(self,widget):
selected_runner = widget.get_active()
scroll_windows_children = [self.installer_config_scrolled_window.get_children(),self.runner_config_scrolled_window.get_children(),self.system_config_scrolled_window.get_children()]
@ -148,17 +148,17 @@ class InstallerDialog(gtk.Dialog):
logging.debug("loading config before adding game : ")
logging.debug(self.lutris_config.config)
#Load game box
self.installer_config_vbox = InstallerConfigVBox(self.lutris_config)
self.installer_config_vbox = InstallerConfigVBox(self.lutris_config,"game")
self.installer_config_scrolled_window.add_with_viewport(self.installer_config_vbox)
self.installer_config_scrolled_window.show_all()
#Load runner box
self.runner_options_vbox = RunnerConfigVBox(self.lutris_config)
self.runner_options_vbox = RunnerConfigVBox(self.lutris_config,"game")
self.runner_config_scrolled_window.add_with_viewport(self.runner_options_vbox)
self.runner_config_scrolled_window.show_all()
#Load system box
self.system_config_vbox = SystemConfigVBox(self.lutris_config)
self.system_config_vbox = SystemConfigVBox(self.lutris_config,"game")
self.system_config_scrolled_window.add_with_viewport(self.system_config_vbox)
self.system_config_scrolled_window.show_all()

View file

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-02-21 00:42+0100\n"
"POT-Creation-Date: 2010-03-02 00:58+0100\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"
@ -37,69 +37,73 @@ msgid "Fullscreen"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:4
msgid "Global preferences"
msgid "Get games from FTP"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:5
msgid "Import"
msgid "Global preferences"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:6
msgid "Import games from ScummVM"
msgid "Import"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:7
msgid "Install and configure runners"
msgid "Import games from ScummVM"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:8
msgid "Install game"
msgid "Install and configure runners"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:9
msgid "Lutris"
msgid "Install game"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:10
msgid "Manage runners"
msgid "Lutris"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:11
msgid "Mount ISO"
msgid "Manage runners"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:12
msgid "Quit"
msgid "Mount ISO"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:13
msgid "Remove"
msgid "Quit"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:14
msgid "Reset"
msgid "Remove"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:15
msgid "ScummVM"
msgid "Reset"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:16
msgid "Steam"
msgid "ScummVM"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:17
msgid "_Help"
msgid "Steam"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:18
msgid "_Lutris"
msgid "_Help"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:19
msgid "_Tools"
msgid "_Lutris"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:20
msgid "_Tools"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:21
msgid "configure the default options"
msgstr ""

View file

@ -1,3 +1,4 @@
import os.path
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
@ -30,23 +31,29 @@ class sdlmame(Runner):
self.description = "Runs arcade games with SDLMame"
self.machine = "Arcade"
self.is_installable = False
self.game_options = [{"option": "file", "type":"single", "name":"rom", "label":"Rom file"}]
self.runner_options = []
self.fullscreen = True
self.game_options = [{"option": "rom", "type":"single","label":"Rom file"}]
self.runner_options = [{"option":"windowed","type":"bool","label":"Windowed"}]
if settings:
self.romdir = settings["path"]
self.rom = settings["rom"]
self.romdir = os.path.dirname(settings["game"]["rom"])
self.rom = os.path.basename(settings["game"]["rom"])
self.mameconfigdir = os.path.join(os.path.expanduser("~"),".mame")
if not os.path.exists(os.path.join(self.mameconfigdir,"mame.ini")):
try:
os.makedirs(self.mameconfigdir)
except OSError:
print "mame directory already exists"
os.chdir(self.mameconfigdir)
subprocess.Popen([self.executable,"-createconfig"],stdout=subprocess.PIPE).communicate()[0]
if "sdlmame" in settings.config:
if "windowed" in settings["sdlmame"]:
self.fullscreen = not settings["sdlmame"]["windowed"]
def play(self):
if not os.path.exists(os.path.join(self.mameconfigdir,"mame.ini")):
try:
os.makedirs(self.mameconfigdir)
except OSError:
pass
os.chdir(self.mameconfigdir)
subprocess.Popen([self.executable,"-createconfig"],stdout=subprocess.PIPE).communicate()[0]
os.chdir(self.romdir)
return [self.executable,"-inipath",self.mameconfigdir,"-skip_gameinfo","-rompath",self.romdir,self.rom]
arguments = []
if not self.fullscreen:
arguments = arguments + ["-window"]
return [self.executable,"-inipath",self.mameconfigdir,"-skip_gameinfo","-rompath",self.romdir,self.rom] + arguments

View file

@ -63,7 +63,7 @@ def update_desktop_file(datadir):
for line in fin:
if 'Icon=' in line:
line = "Icon=%s\n" % (datadir + 'media/icon.png')
line = "Icon=%s\n" % (datadir + 'media/lutris.svg')
fout.write(line)
fout.flush()
fout.close()