[SCM] Installer for game data files branch, yaml, updated. 20ed34dd0bd423016cacc18bd442461cc02165a1

Jon Dowland jmtd at debian.org
Thu Sep 24 17:53:02 UTC 2009


The following commit has been merged in the yaml branch:
commit 48f891dbdf38cd13607f85f850978522023a2019
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