quickly saved

This commit is contained in:
Mathieu Comandon 2010-02-14 23:56:37 +01:00
parent 30cd39ecb2
commit ad6e8ab3f9
27 changed files with 3164 additions and 136 deletions

View file

@ -32,7 +32,7 @@ sys.path.insert(0, os.path.dirname(fullPath))
from coverflow import coverflow
from quidgets.widgets import dictionary_grid
import runners
from lutris import constants
from lutris import AboutLutrisDialog
from lutris.game import LutrisGame
@ -40,11 +40,14 @@ from lutris.config import LutrisConfig
from lutris.lutrisconfig import getdatapath
from lutris.runners_dialog import RunnersDialog
from lutris.add_game_dialog import AddGameDialog
from lutris.mount_iso_dialog import MountIsoDialog
from lutris.installer_dialog import InstallerDialog
from lutris.desktop_control import LutrisDesktopControl
from lutris.google_image_dialog import GoogleImageDialog
from lutris.system_config_dialog import SystemConfigDialog
from lutris.edit_game_config_dialog import EditGameConfigDialog
class LutrisWindow(gtk.Window):
__gtype_name__ = "LutrisWindow"
@ -193,6 +196,9 @@ class LutrisWindow(gtk.Window):
self.gameName = model.get_value(select_iter, 2)["name"]
self.set_game_cover()
def on_mount_iso_menuitem_activate(self,widget):
mount_iso_dialog = MountIsoDialog()
def on_fullscreen_clicked(self,widget):
game = coverflow.coverflow()
if game:
@ -214,7 +220,7 @@ class LutrisWindow(gtk.Window):
LutrisDesktopControl().reset_desktop()
def install_game(self,widget,data=None):
logging.debug("Install game : Not implemented")
installer_dialog = InstallerDialog(self)
def add_game(self,widget,data=None):
add_game_dialog = AddGameDialog(self)
@ -312,7 +318,6 @@ if __name__ == "__main__":
if options.verbose:
logging.basicConfig(level=logging.DEBUG)
logging.debug('logging enabled')
print("vxbw")
#run the application
window = NewLutrisWindow()
window.show()

2503
bin/winetricks Executable file

File diff suppressed because it is too large Load diff

View file

@ -183,6 +183,7 @@ def animate(start, end, startt=None, endt=None, dt=None, extend="constant", meth
try:
iter(start), iter(end)
except TypeError:
print "boo"
return InterpolatedAnimator(start, end, startt, endt, extend, method)
else:
return [InterpolatedAnimator(s, e, startt, endt, extend, method)
@ -211,7 +212,7 @@ if __name__ == "__main__":
add_time(0)
print o.x # prints out 0.0
#o.x.anim = animate("linear", start=5., end=10., dt=5) # this doesn't work
o.x = animate("linear", start=0, end=1, dt=5)
o.x = animate(start=0, end=1, dt=5,method="linear")
add_time(2.5)
print o.x # prints out 0.5
add_time(2.5)

View file

@ -98,6 +98,26 @@
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="Tools">
<property name="visible">True</property>
<property name="label" translatable="yes">_Tools</property>
<property name="use_underline">True</property>
<child type="submenu">
<object class="GtkMenu" id="menu1">
<property name="visible">True</property>
<child>
<object class="GtkMenuItem" id="mount_iso_menuitem">
<property name="visible">True</property>
<property name="label" translatable="yes">Mount ISO</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_mount_iso_menuitem_activate"/>
</object>
</child>
</object>
</child>
</object>
</child>
<child>
<object class="GtkMenuItem" id="help_menuitem">
<property name="visible">True</property>

12
debian/changelog vendored
View file

@ -1,3 +1,15 @@
lutris (0.2~public2) lucid; urgency=low
* New release.
-- Mathieu Comandon <strycore@gmail.com> Fri, 12 Feb 2010 13:28:16 +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~public2) lucid; urgency=low
* New release.

4
debian/control vendored
View file

@ -18,8 +18,6 @@ Depends: ${misc:Depends},
python-gobject,
python-apt,
python-gtk2,
python-yaml,
python-pyglet,
python-gconf
python-yaml
Description: UI for managing games
UNKNOWN

View file

@ -3,6 +3,6 @@ Name=Lutris
Comment=Lutris application
Categories=GNOME;Utility;
Exec=lutris
Icon=lutris
Icon=/usr/share/lutris/media/icon.png
Terminal=false
Type=Application

View file

@ -56,12 +56,12 @@ class AddGameDialog(gtk.Dialog):
if hasattr(runner,"description"):
description = runner.description
else:
print "Please fix "+runner_cls+" and add a description attribute"
logging.debug("Please fix %s and add a description attribute" % runner_cls)
description = ""
if hasattr(runner,"machine"):
machine = runner.machine
else:
print "Please fix "+runner_cls+" and add a machine attribute"
logging.debug("Please fix % and add a machine attribute" % runner_cls)
machine = ""
if runner.is_installed():
runner_liststore.append((machine+" ("+ description +")" ,runner_cls))
@ -77,7 +77,6 @@ class AddGameDialog(gtk.Dialog):
self.vbox.pack_start(self.notebook)
#Game configuration
#self.game_config_vbox = GameConfigVBox()
self.game_config_vbox = gtk.Label("Select a runner from the list")
self.game_config_scrolled_window = gtk.ScrolledWindow()
self.game_config_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
@ -85,7 +84,6 @@ class AddGameDialog(gtk.Dialog):
self.notebook.append_page(self.game_config_scrolled_window,gtk.Label("Game configuration"))
#Runner configuration
#self.runner_config_vbox = RunnerConfigVBox()
self.runner_config_vbox = gtk.Label("Select a runner from the list")
self.runner_config_scrolled_window = gtk.ScrolledWindow()
self.runner_config_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
@ -119,14 +117,12 @@ class AddGameDialog(gtk.Dialog):
self.lutris_config.config["runner"] = self.runner_class
if self.runner_class and realname:
print self.lutris_config.config
game_identifier = self.lutris_config.save(type="game")
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.game_config_scrolled_window.get_children(),self.runner_config_scrolled_window.get_children(),self.system_config_scrolled_window.get_children()]
for scroll_window_children in scroll_windows_children:
@ -139,7 +135,8 @@ class AddGameDialog(gtk.Dialog):
self.runner_class = widget.get_model()[selected_runner][1]
self.lutris_config = LutrisConfig(self.runner_class)
logging.debug("loading config before adding game : ")
logging.debug(self.lutris_config.config)
#Load game box
self.game_config_vbox = GameConfigVBox(self.lutris_config)
self.game_config_scrolled_window.add_with_viewport(self.game_config_vbox)

View file

@ -23,7 +23,8 @@
import yaml
import os
import logging
import lutris.constants as constants
import copy
import constants as constants
class LutrisConfig():
def __init__(self,runner=None,game=None):
@ -36,11 +37,19 @@ class LutrisConfig():
for config_path in config_paths:
if not os.path.exists(config_path):
os.mkdir(config_path)
#Initialize configuration
self.config = {}
self.game_config = {}
self.runner_config = {}
self.system_config = {}
self.game = None
self.runner = None
#By default config type is system, it can also be runner and game
#this means that when you call lutris_config_instance["key"] is will
#pick up the right configuration depending of config_type
self.config_type = "system"
if runner:
self.runner = runner
@ -49,63 +58,38 @@ class LutrisConfig():
self.game = game
self.config_type = "game"
#Check if system configuration file exists.
self.system_config = None
#Read system configuration
if os.path.exists(constants.system_config_full_path):
self.system_config = yaml.load(file(constants.system_config_full_path, 'r').read())
else:
#Create empty configuration file
logging.debug("Creating new system config file")
file(constants.system_config_full_path,"w+")
if not self.system_config:
self.system_config = {}
#Initialize configuration directory
self.config = {}
#A bit tricky here,if we have a game argument but no runner, we will
#still need to get the runner from the game configuration. We have to
#load runner info after the game config but have to merge the runner
#config before the game's. If you give both game and runner args, the
#runner arg will get ignored
self.game_identifier = None
if game:
self.game_identifier = game
game_config_full_path = os.path.join(constants.game_config_path,game+constants.config_extension)
if self.game:
game_config_full_path = os.path.join(constants.game_config_path,
self.game + constants.config_extension)
if os.path.exists(game_config_full_path):
try:
self.game_config = yaml.load(file(game_config_full_path,'r').read())
runner = self.game_config["runner"]
self.runner = self.game_config["runner"]
except yaml.scanner.ScannerError:
print "error parsing "+game_config_full_path
logging.debug("error parsing config file %s" % game_config_full_path)
except KeyError:
print "Runner key is mandatory !"
else:
self.game_config = {}
else:
self.game_config = {}
self.config.update(self.game_config)
if runner:
runner_config_full_path = os.path.join(constants.runner_config_path,runner+constants.config_extension)
if os.path.exists(runner_config_full_path):
self.lutris_config = yaml.load(file(runner_config_full_path,'r').read())
else:
self.lutris_config = {}
self.config.update(self.lutris_config)
if runner in self.game_config:
self.config[runner].update(self.game_config[runner])
if "system" in self.config:
if self.config["system"] is None:
self.config["system"] = {}
self.config["system"].update(self.config["system"])
logging.debug("Runner key is mandatory !")
if self.runner:
runner_config_full_path = os.path.join(constants.runner_config_path,
self.runner + constants.config_extension)
if os.path.exists(runner_config_full_path):
self.runner_config = yaml.load(file(runner_config_full_path,'r').read())
self.update_global_config()
def __getitem__(self,key):
"""Allows to access config data directly by keys"""
if self.config_type == "game":
value = self.game_config[key]
elif self.config_type == "runner":
value = self.lutris_config[key]
value = self.runner_config[key]
else:
value = self.system_config[key]
return value
@ -114,34 +98,19 @@ class LutrisConfig():
if self.config_type == "game":
self.game_config[key] = value
elif self.config_type == "runner":
self.config[self.runner][key] = value
else:
if self.config["system"] is None:
self.config["system"] = {}
print self.config
self.config["system"][key] = value
def has_key(self, key, create = False):
"""
Check is a key is present in the config, keys/can/be/given/in/paths/like/that
If create is set, the missing keys will be created and always return True
"""
logging.debug("I dont think this function is useful anymore")
keys = key.split("/")
past_keys = ""
for key in keys:
generate_key_pointer = "self.lutris_config"+past_keys+".has_key('" + key + "')"
logging.debug(generate_key_pointer)
if not eval(generate_key_pointer):
if not create:
return False
else:
create_key = "self.lutris_config"+past_keys+"['"+key+"'] = {}"
exec(create_key)
past_keys = past_keys + "['" + key + "']"
return True
self.runner_config[key] = value
elif self.config_type == "system":
self.system_config = value
self.update_global_config()
def update_global_config(self):
self.config.update(copy.deepcopy(self.system_config))
self.config.update(copy.deepcopy(self.runner_config))
self.config.update(copy.deepcopy(self.game_config))
if self.config_type == "game" and self.runner in self.game_config:
pass
#self.config[self.runner].update(self.game_config[self.runner])
def remove(self,game_name):
logging.debug("removing %s" % game_name)
os.remove(os.path.join(constants.game_config_path,game_name+constants.config_extension))
@ -153,7 +122,7 @@ class LutrisConfig():
if type is None:
type = self.config_type
yaml_config = yaml.dump(self.config,default_flow_style=False)
print "Saving config (type %s)" % type
logging.debug("Saving config (type %s)" % type)
print yaml_config
if type == "system":
file(constants.system_config_full_path,"w").write(yaml_config)
@ -161,11 +130,12 @@ class LutrisConfig():
runner_config_path = os.path.join(constants.runner_config_path,self.runner+constants.config_extension)
file(runner_config_path,"w").write(yaml_config)
elif type == "game":
if not self.game_identifier:
self.game_identifier = self.config["runner"] + "-" + self.config["realname"].replace(" ","_")
self.game_config_path = os.path.join(constants.game_config_path,self.game_identifier+constants.config_extension)
if not self.game:
self.game = self.config["runner"] + "-" + self.config["realname"].replace(" ","_")
self.game_config_path = os.path.join(constants.game_config_path,
self.game + constants.config_extension)
file(self.game_config_path,"w").write(yaml_config)
return self.game_identifier
return self.game
else:
print "Config type is %s or %s" % (self.config_type, type)
print "i don't know how to save this yet"
@ -178,3 +148,35 @@ class LutrisConfig():
if "game_path" in self.config:
return self.config["game_path"]
return os.path.expanduser("~")
if __name__ == "__main__":
logging.basicConfig(level=logging.DEBUG)
logging.debug('logging enabled')
lc = LutrisConfig(runner="wine")
print "system config : "
print lc.system_config
print "runner config : "
print lc.runner_config
print "global config"
print lc.config
print ("*****************")
print ("* testing games *")
print ("*****************")
lc = LutrisConfig(game="wine-Ghostbusters")
print "system config : "
print lc.system_config
print ("-----------------------")
print "runner config : "
print lc.runner_config
print ("-----------------------")
print "game config :"
print lc.game_config
print ("-----------------------")
print "global config"
print lc.config

View file

@ -27,7 +27,7 @@ class ConfigVBox(gtk.VBox):
def __init__(self,save_in_key):
gtk.VBox.__init__(self)
self.options = None
self.game_config = None # FIXME : remove this
#self.game_config = None # FIXME : remove this
#Section of the configuration file to save options in. Can be "game", "runner" or "system"
self.save_in_key= save_in_key
@ -97,9 +97,10 @@ class ConfigVBox(gtk.VBox):
combobox.add_attribute(cell, 'text', 0)
index = selected_index = -1
if value:
logging.debug(value)
for choice in choices:
if choice[1] == value:
selected_index = index
selected_index = index +1
index = index +1
combobox.set_active(selected_index)
combobox.connect('changed',self.on_combobox_change,option_name)
@ -214,25 +215,25 @@ class ConfigVBox(gtk.VBox):
self.pack_start(treeview_scroll,True,True)
def generate_file_widget(self,widget_config,file_value=None):
# FIXME : Remove me
print "OLD CRAPPY FUNCTION CALLED (generate_file_widget)"
widget_type = widget_config["type"]
self.key_name_for_file = widget_config["name"]
#lutris_config = LutrisConfig()
if widget_type == "single":
file_widget = gtk.HBox()
file_label = gtk.Label(widget_config["label"])
file_widget.pack_start(file_label,False,False,5)
self.file_chooser_button = gtk.FileChooserButton("Select a file")
self.file_chooser_button.connect("file-set",self.add_file_callback)
self.file_chooser_button.set_current_folder(self.lutris_config.get_path(self.runner_class))
if file_value:
self.file_chooser_button.set_filename(file_value)
#self.file_chooser_button.set_current_folder("/home/strider/Games/")
file_widget.pack_start(self.file_chooser_button,True,True,5)
self.pack_start(file_widget,False,False,10)
# def generate_file_widget(self,widget_config,file_value=None):
# # FIXME : Remove me
# print "OLD CRAPPY FUNCTION CALLED (generate_file_widget)"
# widget_type = widget_config["type"]
# self.key_name_for_file = widget_config["name"]
# #lutris_config = LutrisConfig()
# if widget_type == "single":
# file_widget = gtk.HBox()
# file_label = gtk.Label(widget_config["label"])
# file_widget.pack_start(file_label,False,False,5)
# self.file_chooser_button = gtk.FileChooserButton("Select a file")
# self.file_chooser_button.connect("file-set",self.add_file_callback)
# self.file_chooser_button.set_current_folder(self.lutris_config.get_path(self.runner_class))
# if file_value:
# self.file_chooser_button.set_filename(file_value)
# #self.file_chooser_button.set_current_folder("/home/strider/Games/")
# file_widget.pack_start(self.file_chooser_button,True,True,5)
#
# self.pack_start(file_widget,False,False,10)
def on_files_treeview_event(self,treeview,event):
key = event.keyval
@ -251,8 +252,8 @@ class ConfigVBox(gtk.VBox):
self.lutris_config.config[self.save_in_key][option] = self.files
self.files_chooser_dialog = None
def add_file_callback(self,widget,response=None):
# FIXME : Remove me
print "OLD CRAPPY FUNCTION CALLED (add_file_callback)"
self.file = widget.get_filename()
self.game_config["exe"] = self.file
# def add_file_callback(self,widget,response=None):
# # FIXME : Remove me
# print "OLD CRAPPY FUNCTION CALLED (add_file_callback)"
# self.file = widget.get_filename()
# self.game_config["exe"] = self.file

View file

@ -112,10 +112,21 @@ class LutrisDesktopControl():
return None
def reset_desktop(self):
#Restore panels
#FIXME : Restore only with panels where shown before starting game
self.hide_panels(False)
#Restore resolution
if self.default_resolution is None:
os.popen("xrandr -s 1")
os.popen("xrandr -s 0")
else:
os.popen("xrandr -s 1")
os.popen("xrandr -s %s" % self.default_resolution)
#Restore gamma
os.popen("xgamma -gamma 1.0")

View file

@ -1,3 +1,4 @@
import os
# -*- coding:Utf-8 -*-
###############################################################################
## Lutris
@ -24,6 +25,7 @@
import subprocess
import gobject
import logging
import os,time
from lutris.config import LutrisConfig
from lutris.thread import LutrisThread
from lutris.desktop_control import LutrisDesktopControl
@ -100,9 +102,8 @@ class LutrisGame():
command = oss_wrapper + " " + command
logging.debug(command)
if game_run_args:
self.timer_id = gobject.timeout_add(1000, self.poke_process)
self.timer_id = gobject.timeout_add(5000, self.poke_process)
self.game_thread = LutrisThread(command,path)
self.game_thread.start()
@ -111,14 +112,14 @@ class LutrisGame():
def poke_process(self):
if self.game_thread.pid:
pass
os.system("gnome-screensaver-command --poke")
else:
self.quit_game()
return False
return True
def quit_game(self):
logging.debug("game has quit at %s" % time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime() ) )
if self.game_thread is not None and self.game_thread.pid:
if self.game_thread.cedega:
for pid in self.game_thread.pid:
@ -127,5 +128,4 @@ class LutrisGame():
self.game_thread.game_process.terminate()
self.lutris_desktop_control.reset_desktop()
pathname = os.path.dirname(sys.argv[0])
logging.debug(pathname)
os.chdir(os.path.abspath(pathname))
os.chdir(os.path.abspath(pathname))

View file

@ -0,0 +1,48 @@
# -*- 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
###############################################################################
import gtk
import runners
from lutris.config_vbox import ConfigVBox
class InstallerConfigVBox(ConfigVBox):
def __init__(self,lutris_config):
ConfigVBox.__init__(self,"game")
self.lutris_config = lutris_config
self.lutris_config.config_type = "game"
self.runner_class = self.lutris_config.runner
runner = eval("runners."+self.runner_class+"."+self.runner_class+"()")
if hasattr(runner,"installer_options"):
self.options = runner.installer_options
else:
no_option_label = gtk.Label("No game options")
self.pack_start(no_option_label)
return
self.generate_widgets()

166
lutris/installer_dialog.py Normal file
View file

@ -0,0 +1,166 @@
# -*- 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
###############################################################################
import gtk
import runners
import os
import logging
from lutris.config import LutrisConfig
from lutris.installer_config_vbox import InstallerConfigVBox
from lutris.runner_config_vbox import RunnerConfigVBox
from lutris.system_config_vbox import SystemConfigVBox
class InstallerDialog(gtk.Dialog):
def __init__(self,parent):
gtk.Dialog.__init__(self)
self.parent_window = parent
self.set_title("Install a game")
self.set_size_request(600,500)
#Real name
realname_hbox = gtk.HBox()
self.realname_label = gtk.Label("Name")
realname_hbox.pack_start(self.realname_label,False,False,5)
self.realname_entry = gtk.Entry()
realname_hbox.pack_start(self.realname_entry)
self.vbox.pack_start(realname_hbox,False,False,5)
self.lutris_config = LutrisConfig()
#Runner
#get a list of available runners
runner_liststore = gtk.ListStore(str,str)
runner_liststore.append(("Choose a runner for the list",""))
for runner_cls in runners.__all__:
runner = eval("runners."+runner_cls+"."+runner_cls+"()")
if hasattr(runner,"description"):
description = runner.description
else:
logging.debug("Please fix %s and add a description attribute" % runner_cls)
description = ""
if hasattr(runner,"machine"):
machine = runner.machine
else:
logging.debug("Please fix % and add a machine attribute" % runner_cls)
machine = ""
if runner.is_installed():
runner_liststore.append((machine+" ("+ description +")" ,runner_cls))
self.runner_combobox = gtk.ComboBox(runner_liststore)
self.runner_combobox.connect("changed",self.on_runner_changed)
cell = gtk.CellRendererText()
self.runner_combobox.pack_start(cell, True)
self.runner_combobox.add_attribute(cell, 'text', 0)
self.vbox.pack_start(self.runner_combobox,False,True,5)
self.notebook = gtk.Notebook()
self.vbox.pack_start(self.notebook)
#Game configuration
self.installer_config_vbox = gtk.Label("Select a runner from the list")
self.installer_config_scrolled_window = gtk.ScrolledWindow()
self.installer_config_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
self.installer_config_scrolled_window.add_with_viewport(self.installer_config_vbox)
self.notebook.append_page(self.installer_config_scrolled_window,gtk.Label("Installer"))
#Runner configuration
self.runner_config_vbox = gtk.Label("Select a runner from the list")
self.runner_config_scrolled_window = gtk.ScrolledWindow()
self.runner_config_scrolled_window.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
self.runner_config_scrolled_window.add_with_viewport(self.runner_config_vbox)
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_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)
self.notebook.append_page(self.system_config_scrolled_window,gtk.Label("System configuration"))
#Action area
cancel_button = gtk.Button(None, gtk.STOCK_CANCEL)
install_button = gtk.Button(None, gtk.STOCK_ADD)
self.action_area.pack_start(cancel_button)
self.action_area.pack_start(install_button)
cancel_button.connect("clicked", self.close)
install_button.connect("clicked", self.install_game)
#Finish
self.show_all()
self.run()
def install_game(self, button):
"""OK button pressed in the Add Game Dialog"""
#Get name
realname = self.realname_entry.get_text()
#Get runner
self.lutris_config.config["realname"] = realname
self.lutris_config.config["runner"] = self.runner_class
if self.runner_class and realname:
game_identifier = self.lutris_config.save(type="game")
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()]
for scroll_window_children in scroll_windows_children:
for child in scroll_window_children:
child.destroy()
if selected_runner == 0:
self.no_runner_selected()
return
self.runner_class = widget.get_model()[selected_runner][1]
self.lutris_config = LutrisConfig(self.runner_class)
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_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_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_scrolled_window.add_with_viewport(self.system_config_vbox)
self.system_config_scrolled_window.show_all()
def close(self, widget=None, other=None):
self.destroy()
def no_runner_selected(self):
no_runner_label = gtk.Label("Choose a runner from the list")
no_runner_label.show()
self.runner_config_scrolled_window.add_with_viewport(no_runner_label)

View file

@ -0,0 +1,86 @@
# -*- 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
###############################################################################
import gtk
import subprocess
import logging
class MountIsoDialog(gtk.Dialog):
def __init__(self):
self.check_fuseiso()
gtk.Dialog.__init__(self)
self.set_title("Mount ISO image")
self.set_size_request(300,200)
self.iso_filechooserbutton = gtk.FileChooserButton("Open an ISO file", backend=None)
self.iso_label = gtk.Label("ISO file")
self.iso_label.set_size_request(90,20)
self.iso_hbox = gtk.HBox()
self.iso_hbox.pack_start(self.iso_label,False,False)
self.iso_hbox.pack_start(self.iso_filechooserbutton)
self.vbox.pack_start(self.iso_hbox,False,False,10)
self.mount_point_dialog = gtk.FileChooserDialog(title="Select mount point",
parent=self,
action=gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT,
gtk.STOCK_OK, gtk.RESPONSE_ACCEPT),
backend=None)
self.mount_point_filechooserbutton = gtk.FileChooserButton(self.mount_point_dialog)
self.mount_point_label = gtk.Label("Mount point")
self.mount_point_label.set_size_request(90,20)
self.mount_point_hbox = gtk.HBox()
self.mount_point_hbox.pack_start(self.mount_point_label,False,False)
self.mount_point_hbox.pack_start(self.mount_point_filechooserbutton)
self.vbox.pack_start(self.mount_point_hbox,False,False,10)
#Action buttons
cancel_button = gtk.Button(None, gtk.STOCK_CANCEL)
ok_button = gtk.Button(None, gtk.STOCK_OK)
self.action_area.pack_start(cancel_button)
self.action_area.pack_start(ok_button)
cancel_button.connect("clicked", self.close)
ok_button.connect("clicked", self.ok_clicked)
self.show_all()
self.run()
def check_fuseiso(self):
fuseiso_command = subprocess.Popen(["which","fuseiso"],stdout=subprocess.PIPE).stdout
fuseiso_is_installed = fuseiso_command.readline()
if "fuseiso" in fuseiso_is_installed:
logging.debug("fuseiso is installed")
else:
logging.debug("fuseiso not here, problems ahead")
def close(self,widget):
self.destroy()
def ok_clicked(self,wigdet):
#TODO: Check if file is valid
iso_file = self.iso_filechooserbutton.get_filename()
mount_point = self.mount_point_filechooserbutton.get_filename()
fuseiso_command = subprocess.Popen(["fuseiso",iso_file,mount_point],stdout=subprocess.PIPE,stderr=subprocess.STDOUT)
print "mount done!"
self.destroy()

View file

@ -35,7 +35,6 @@ class RunnerConfigVBox(ConfigVBox):
self.pack_start(warningLabel)
return
self.lutris_config = lutris_config
#self.lutris_config.config_type = "runner"
self.generate_widgets()

View file

@ -30,7 +30,6 @@ class SystemConfigVBox(ConfigVBox):
"""VBox init"""
ConfigVBox.__init__(self,"system")
self.lutris_config = lutris_config
self.lutris_config.config_type = "system"
#TODO : Move the list of window manager somewhere else, in lutris_desktop_control for example.
#TODO : Auto detect the installed WMs on the user's machine

View file

@ -46,8 +46,8 @@ class LutrisThread(threading.Thread):
if "cedega" in self.command:
self.cedega = True
logging.debug(self.command)
self.game_process = subprocess.Popen(self.command,shell = True,stdout=subprocess.PIPE,stderr=subprocess.PIPE,cwd=self.path)
self.output = self.game_process.communicate()
self.game_process = subprocess.Popen(self.command,shell = True,stdout=subprocess.PIPE,stderr=subprocess.STDOUT,cwd=self.path)
self.output = self.game_process.stdout
def poke_process(self):
if not self.game_process:
@ -64,13 +64,9 @@ class LutrisThread(threading.Thread):
self.return_code = self.game_process.poll()
if self.return_code is not None and not self.cedega:
logging.debug("Game quit")
if self.output[0]:
for stdout in self.output[0].split("\n"):
if self.output:
for stdout in self.output.split("\n"):
logging.debug(stdout)
if self.output[1]:
logging.debug("The game returned the following errors")
for stderr in self.output[1].split("\n"):
logging.debug(stderr)
self.pid = None
return False
return True

View file

@ -0,0 +1 @@
application.args=-v

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View file

@ -0,0 +1,12 @@
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.expand-tabs=true
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.indent-shift-width=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.spaces-per-tab=4
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.tab-size=8
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.project.text-limit-width=80
auxiliary.org-netbeans-modules-editor-indent.CodeStyle.usedProfile=project
auxiliary.org-netbeans-modules-editor-indent.text.x-python.CodeStyle.project.separateFromImps=true
java.lib.path=
lutris.dir=.
main.file=bin/lutris
platform.active=Python_2.6.4+
python.lib.path=

13
nbproject/project.xml Normal file
View file

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.python.project</type>
<configuration>
<data xmlns="http://nbpython.dev.java.net/ns/php-project/1">
<name>lutris</name>
<sources>
<root id="lutris.dir"/>
</sources>
<tests/>
</data>
</configuration>
</project>

105
po/lutris.pot Normal file
View file

@ -0,0 +1,105 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2010-02-12 13:28+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"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../data/ui/PreferencesLutrisDialog.ui.h:1 ../data/ui/AddgameDialog.ui.h:1
msgid "gtk-cancel"
msgstr ""
#: ../data/ui/PreferencesLutrisDialog.ui.h:2 ../data/ui/AddgameDialog.ui.h:2
msgid "gtk-ok"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:1
msgid "Add game"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:2
msgid "Cedega"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:3
msgid "Fullscreen"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:4
msgid "Global preferences"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:5
msgid "Import"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:6
msgid "Import games from ScummVM"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:7
msgid "Install and configure runners"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:8
msgid "Install game"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:9
msgid "Lutris"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:10
msgid "Manage runners"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:11
msgid "Mount ISO"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:12
msgid "Quit"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:13
msgid "Remove"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:14
msgid "Reset"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:15
msgid "ScummVM"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:16
msgid "Steam"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:17
msgid "_Help"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:18
msgid "_Lutris"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:19
msgid "_Tools"
msgstr ""
#: ../data/ui/LutrisWindow.ui.h:20
msgid "configure the default options"
msgstr ""

View file

@ -1,2 +1,4 @@
__all__ = ["linux","wine","sdlmame","mednafen","scummvm","cedega",
"snes9x", "steam","uae","nulldc","vavoom","openmsx","dosbox"]
__all__ = ["linux","wine","sdlmame","mednafen",\
"scummvm","cedega","snes9x", "steam",\
"uae","nulldc","vavoom","openmsx",\
"dosbox","pcsx"]

46
runners/pcsx.py Normal file
View file

@ -0,0 +1,46 @@
# -*- 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
###############################################################################
from runner import Runner
class pcsx(Runner):
def __init__(self,settings = None):
"""
pcsx-df is what seems the best candidate for a playstation emulator.
Sadly, it was removed from the Debian archives and thus Ubuntu because
of a small licensing issue :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=514446
The package also lacks a maintainer :
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=510530
"""
self.executable = "pcsx"
self.package = "pcsx-df"
self.description = "Runs PlayStation games"
self.machine = "Playstation"
self.game_options = [{"option":"iso","type":"single","label":"iso"}]
self.runner_options = []
#Load settings
if settings:
self.iso = settings["game"]["iso"]
def play(self):
return [self.executable," -nogui -cdfile \""+self.iso+"\""]

View file

@ -8,7 +8,7 @@ __date__ = "$Oct 6, 2009 12:23:49 PM$"
class steam(wine):
def __init__(self):
def __init__(self,settings = None):
self.executable = "Steam.exe"
self.description = "Runs Steam games with Wine"
self.machine = "Steam Platform"

View file

@ -9,6 +9,7 @@ class wine(Runner):
self.package = "wine"
self.machine = "Windows games"
self.description = "Run Windows games with Wine"
self.installer_options = [{"option": "exe","type": "single","label": "Executable"}]
self.game_options = [ {"option": "exe", "type":"single", "label":"Executable"},
{"option": "args", "type": "string", "label": "Arguments" }]