mirror of
https://github.com/lutris/lutris
synced 2024-09-04 23:13:35 +00:00
quickly saved
This commit is contained in:
parent
d8bd7d00bf
commit
993a8673f3
1
.quickly
1
.quickly
|
@ -1,3 +1,4 @@
|
|||
project = lutris
|
||||
template = ubuntu-project
|
||||
format = 0.2.5
|
||||
lp_id = lutris
|
||||
|
|
24
bin/lutris
24
bin/lutris
|
@ -35,7 +35,9 @@ from lutris import AboutLutrisDialog
|
|||
from lutris.lutrisconfig import getdatapath
|
||||
from lutris.game import LutrisGame
|
||||
from lutris.config import LutrisConfig
|
||||
from lutris.add_game_dialog import AddGameDialog
|
||||
from lutris.edit_game_config_dialog import EditGameConfigDialog
|
||||
from lutris.runners_dialog import RunnersDialog
|
||||
from lutris.google_image_dialog import GoogleImageDialog
|
||||
from coverflow import coverflow
|
||||
from quidgets.widgets import dictionary_grid
|
||||
|
@ -204,28 +206,38 @@ class LutrisWindow(gtk.Window):
|
|||
running_game.play()
|
||||
|
||||
def reset(self,widget,data=None):
|
||||
logging.debug("Reset : Not implemented")
|
||||
if hasattr(self,"running_game"):
|
||||
self.running_game.quit_game()
|
||||
else:
|
||||
LutrisDesktopControl().reset_desktop()
|
||||
|
||||
def install_game(self,widget,data=None):
|
||||
logging.debug("Install game : Not implemented")
|
||||
|
||||
def add_game(self,widget,data=None):
|
||||
logging.debug("Add game : Not implemented")
|
||||
|
||||
AddGameDialog(self)
|
||||
|
||||
def import_cedega(self,widget,data=None):
|
||||
logging.debug("Import from cedega")
|
||||
cedega = runners.cedega.cedega()
|
||||
cedega.import_games()
|
||||
self.get_game_list()
|
||||
|
||||
|
||||
def import_steam(self,widget,data=None):
|
||||
logging.debug("Import from steam")
|
||||
|
||||
def import_scummvm(self,widget,data=None):
|
||||
logging.debug("Import from scummvm")
|
||||
scummvm = runners.scummvm.scummvm()
|
||||
scummvm.import_games()
|
||||
self.get_game_list()
|
||||
|
||||
def system_preferences(self,widget,data=None):
|
||||
logging.debug("Open system preferences")
|
||||
|
||||
def runner_preferences(self,widget,data=None):
|
||||
logging.debug("Open runner preferences")
|
||||
RunnersDialog()
|
||||
|
||||
def edit_game_name(self,button):
|
||||
"""Change game name"""
|
||||
|
@ -302,5 +314,9 @@ if __name__ == "__main__":
|
|||
#run the application
|
||||
window = NewLutrisWindow()
|
||||
window.show()
|
||||
gtk.gdk.threads_init()
|
||||
gtk.gdk.threads_enter()
|
||||
gtk.main()
|
||||
gtk.gdk.threads_leave()
|
||||
|
||||
|
||||
|
|
16
lutris/AptDialog.py
Normal file
16
lutris/AptDialog.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
import gtk, apt, apt.progress.gtk2
|
||||
class InstallerWindow(gtk.Window):
|
||||
def __init__(self,pkg_name):
|
||||
gtk.Window.__init__(self)
|
||||
self.set_decorated(False)
|
||||
self.progress = apt.progress.gtk2.GtkAptProgress()
|
||||
self.add(self.progress)
|
||||
self.show_all()
|
||||
cache = apt.cache.Cache(self.progress.open)
|
||||
if not cache[pkg_name].isInstalled:
|
||||
cache[pkg_name].markInstall()
|
||||
cache.commit(self.progress.fetch, self.progress.install)
|
||||
|
||||
if __name__ == "__main__":
|
||||
win = InstallerWindow("sdlmame")
|
||||
gtk.main()
|
|
@ -18,15 +18,16 @@
|
|||
## along with this program; if not, write to the Free Software
|
||||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
###############################################################################
|
||||
from gui.runner_config_vbox import RunnerConfigVBox
|
||||
from system_config_vbox import SystemConfigVBox
|
||||
|
||||
|
||||
|
||||
import gtk
|
||||
import runners
|
||||
import os
|
||||
from lutris.config import LutrisConfig
|
||||
from gui.game_config_vbox import GameConfigVBox
|
||||
from lutris.game_config_vbox import GameConfigVBox
|
||||
from lutris.runner_config_vbox import RunnerConfigVBox
|
||||
from lutris.system_config_vbox import SystemConfigVBox
|
||||
|
||||
class AddGameDialog(gtk.Dialog):
|
||||
def __init__(self,parent):
|
||||
|
@ -43,7 +44,6 @@ class AddGameDialog(gtk.Dialog):
|
|||
realname_hbox.pack_start(self.realname_entry)
|
||||
self.vbox.pack_start(realname_hbox,False,False,5)
|
||||
|
||||
|
||||
self.lutris_config = LutrisConfig()
|
||||
|
||||
#Runner
|
||||
|
|
|
@ -24,7 +24,7 @@ __date__ ="$28 nov. 2009 05:29:44$"
|
|||
from tool.url_tool import UrlTool
|
||||
from tool.re_tool import RE_tool
|
||||
import urllib2
|
||||
|
||||
import logging
|
||||
import os
|
||||
|
||||
class GoogleImage():
|
||||
|
@ -36,15 +36,13 @@ class GoogleImage():
|
|||
|
||||
def get_google_image_page(self,search_string):
|
||||
self.url_tool = UrlTool()
|
||||
self.url_tool.local = False
|
||||
#self.url_tool.set_local_file("/home/strider/result.html")
|
||||
|
||||
self.url_tool.local = False
|
||||
self.fetch_count = 0
|
||||
# "Everybody stand back"
|
||||
# "I know regular expressions"
|
||||
# Python ! *tap* *tap*
|
||||
# "Wait, forgot to escape a space." Wheeeeee[taptaptap]eeeeee.
|
||||
self.webpage = self.url_tool.read_html("http://images.google.fr/images?q="+urllib2.quote(search_string)+"&oe=utf-8&rls=com.ubuntu:fr:official&client=firefox-a&um=1&ie=UTF-8&sa=N&hl=en&tab=wi")
|
||||
#file("/home/strider/result.html","w").write(self.webpage)
|
||||
|
||||
def scan_for_images(self,dest):
|
||||
re_tool = RE_tool()
|
||||
|
@ -52,7 +50,8 @@ class GoogleImage():
|
|||
self.google_results = []
|
||||
index = 0
|
||||
for image in images:
|
||||
print "Fetching image %i / 21" % index
|
||||
self.fetch_count = index
|
||||
logging.debug("Fetching image %i / 21" % index)
|
||||
thumbnail = "http://"+image[6]+"?q=tbn:"+image[2]+image[0]
|
||||
url = image[0]
|
||||
size = image[4]
|
||||
|
@ -62,4 +61,4 @@ class GoogleImage():
|
|||
index = index + 1
|
||||
|
||||
def get_pic_at(self,index,dest):
|
||||
self.url_tool.save_to(dest+"."+self.google_results[index]["url"].split(".")[-1],self.google_results[index]["url"])
|
||||
self.url_tool.save_to(dest+"."+self.google_results[index]["url"].split(".")[-1],self.google_results[index]["url"])
|
||||
|
|
|
@ -18,83 +18,111 @@
|
|||
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
###############################################################################
|
||||
|
||||
__author__="strider"
|
||||
__date__ ="$28 nov. 2009 06:59:20$"
|
||||
|
||||
|
||||
import gtk
|
||||
import os
|
||||
|
||||
import gtk, gobject
|
||||
import os, threading
|
||||
import logging
|
||||
import lutris.constants
|
||||
from lutris.config import LutrisConfig
|
||||
from google_image import GoogleImage
|
||||
|
||||
class GoogleImageDialog(gtk.Dialog):
|
||||
def __init__(self,game):
|
||||
gtk.Dialog.__init__(self)
|
||||
self.game = game
|
||||
self.google_image = GoogleImage()
|
||||
lutris_config = LutrisConfig(game=game)
|
||||
|
||||
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)
|
||||
self.thumbnails_table = gtk.Table(rows=2,columns=21,homogeneous=False)
|
||||
self.thumbnails_scroll_window.add_with_viewport(self.thumbnails_table)
|
||||
|
||||
lutris_config = LutrisConfig(game=game)
|
||||
|
||||
self.progress_bar = None
|
||||
self.thumbnails_table = None
|
||||
|
||||
#Search Field
|
||||
self.search_entry = gtk.Entry()
|
||||
self.search_entry.set_text(lutris_config["realname"]+" cover")
|
||||
|
||||
search_button = gtk.Button("Search")
|
||||
cancel_button = gtk.Button(None, gtk.STOCK_CANCEL)
|
||||
add_button = gtk.Button(None, gtk.STOCK_ADD)
|
||||
self.search_entry.set_size_request(250,30)
|
||||
self.action_area.pack_start(self.search_entry)
|
||||
self.action_area.pack_start(search_button)
|
||||
self.action_area.pack_start(cancel_button)
|
||||
self.action_area.pack_start(add_button)
|
||||
#Search
|
||||
search_button = gtk.Button("Search")
|
||||
search_button.connect("clicked",self.search_images)
|
||||
self.action_area.pack_start(search_button)
|
||||
#Cancel
|
||||
cancel_button = gtk.Button(None, gtk.STOCK_CANCEL)
|
||||
cancel_button.connect("clicked", self.close)
|
||||
add_button.connect("clicked", self.add_cover)
|
||||
self.show_all()
|
||||
self.run()
|
||||
|
||||
self.action_area.pack_start(cancel_button)
|
||||
|
||||
self.show_all()
|
||||
|
||||
def close(self,widget=None):
|
||||
self.destroy()
|
||||
|
||||
def add_cover(self,widget=None):
|
||||
self.destroy()
|
||||
|
||||
def search_images(self,widget=None):
|
||||
thumbs_path = os.path.join(lutris.constants.lutris_config_path,"tmp")
|
||||
index = 0
|
||||
try:
|
||||
self.thumbnails_table.destroy()
|
||||
except AttributeError:
|
||||
pass
|
||||
finally:
|
||||
self.thumbnails_table = None
|
||||
self.progress_bar = gtk.ProgressBar()
|
||||
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.google_image.get_google_image_page(self.search_entry.get_text())
|
||||
self.google_image.scan_for_images(thumbs_path)
|
||||
for file in os.listdir(thumbs_path):
|
||||
google_fetcher = GoogleFetcher(self.google_image,self.thumbs_path)
|
||||
timer_id = gobject.timeout_add(25, self.refresh_status)
|
||||
google_fetcher.start()
|
||||
|
||||
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)
|
||||
index = 0
|
||||
for i in range(0,20):
|
||||
image = gtk.Image()
|
||||
image.set_from_file(os.path.join(thumbs_path,str(index)+".jpg"))
|
||||
image.set_from_file(os.path.join(self.thumbs_path,str(index)+".jpg"))
|
||||
image_button = gtk.Button()
|
||||
image_button.set_image(image)
|
||||
image_button.show()
|
||||
image_button.connect("clicked",self.select_cover,str(index)+".jpg")
|
||||
print index
|
||||
image_info = gtk.Label(self.google_image.google_results[index]["size"])
|
||||
image_info.show()
|
||||
image.show()
|
||||
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)
|
||||
if self.google_image.fetch_count < 20:
|
||||
return True
|
||||
else:
|
||||
self.show_images()
|
||||
return False
|
||||
|
||||
def select_cover(self,widget,file):
|
||||
print "grabbing %s" % file
|
||||
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)
|
||||
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()
|
||||
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
import runners
|
||||
#from runners import *
|
||||
import gtk
|
||||
from gui.runner_config_dialog import RunnerConfigDialog
|
||||
from lutris.runner_config_dialog import RunnerConfigDialog
|
||||
|
||||
class PlatformDialog(gtk.Dialog):
|
||||
class RunnersDialog(gtk.Dialog):
|
||||
"""Dialog class for the platform preferences"""
|
||||
|
||||
def __init__(self):
|
||||
|
@ -44,10 +43,9 @@ class PlatformDialog(gtk.Dialog):
|
|||
runner_instance = eval("runners."+runner+"."+runner+"()")
|
||||
runner_instance.install()
|
||||
|
||||
|
||||
def on_configure_clicked(self,widget,runner):
|
||||
RunnerConfigDialog(runner)
|
||||
|
||||
if __name__ == "__main__":
|
||||
dialog = PlatformDialog()
|
||||
dialog = RunnersDialog()
|
||||
gtk.main()
|
|
@ -49,6 +49,7 @@ class LutrisThread(threading.Thread):
|
|||
self.output = self.game_process.communicate()
|
||||
|
||||
def poke_process(self):
|
||||
|
||||
if not self.game_process:
|
||||
logging.debug("game not running")
|
||||
return True
|
||||
|
|
|
@ -8,10 +8,13 @@ class machine:
|
|||
|
||||
def load(self,game):
|
||||
self.game = game
|
||||
|
||||
def config(self):
|
||||
subprocess.Popen([self.configscript],stdout=subprocess.PIPE).communicate()[0]
|
||||
|
||||
def play(self):
|
||||
pass
|
||||
|
||||
def isInstalled(self):
|
||||
cmdline = "which " + self.executable
|
||||
cmdline = str.split(cmdline," ")
|
||||
|
@ -34,4 +37,3 @@ class machine:
|
|||
gameConfig = LutrisConfig()
|
||||
values = {"main":{ "path":path, "exe":exe, "realname" : name, "system":system }}
|
||||
gameConfig.write_game_config(id, values)
|
||||
|
Loading…
Reference in a new issue