[SCM] Installer for game data files branch, gui, updated. 9092133f0b2589fd66ef16e6348f2c3989f9aa4c

Jon Dowland jmtd at debian.org
Fri Sep 25 17:28:46 UTC 2009


The following commit has been merged in the gui branch:
commit 670fe95aa0208b6916c3dee0c9918656e9a821de
Author: Jon Dowland <jmtd at debian.org>
Date:   Thu Sep 24 18:25:04 2009 +0100

    detect selected game

diff --git a/gdp.py b/gdp.py
index 44d1e24..9ba873a 100755
--- a/gdp.py
+++ b/gdp.py
@@ -1,6 +1,13 @@
 import os
 import yaml
 
+class Model(list):
+	def __init__(self):
+		self.active_item = -1
+
+	def set_active_item(self,item):
+		self.active_item = item
+
 class Controller:
 	def __init__(self):
 		pass
@@ -9,7 +16,7 @@ class Controller:
 		self.view = v
 
 	def get_model(self):
-		m = []
+		self.m = m = Model()
 		for game in [ x for x in os.listdir("supported") \
 			if len(x) >= 5 and x[-5:] == ".yaml"]:
 				y = yaml.load(open("supported/%s"%game,"r").read())
@@ -17,6 +24,9 @@ class Controller:
 				self.view.supported_game_added(y)
 		return m
 
+	def set_game(self, game):
+		self.m.set_active_item(game)
+
 	def go(self):
 			self.view.go()
 
@@ -62,7 +72,7 @@ class View:
 		if 0 == current_page:
 			treeview = self.builder.get_object("treeview1")
 			path,col = treeview.get_cursor()
-			print "selected game is %d" % path[0]
+			self.controller.set_game(path[0])
 		return current_page + 1
 
 	def setup_filechooser_page(self):

-- 
Installer for game data files



More information about the Pkg-games-commits mailing list