From e8e60df0189b7911c85079e02965452369c944d9 Mon Sep 17 00:00:00 2001 From: Simon Schampijer Date: Thu, 19 Jul 2007 17:38:07 +0000 Subject: Fixes in the model for the game global align parameter. --- diff --git a/cardtable.py b/cardtable.py index ed49852..6161fb8 100755 --- a/cardtable.py +++ b/cardtable.py @@ -84,10 +84,15 @@ class CardTable(gtk.EventBox): props = {} props['front_border'] = {'opacity':'1'} props['front_h_border'] ={'opacity':'1'} - if card['charalign'] == '3': - props['front_text']= {'card_text':'', 'card_line1':'', 'card_line2':'', 'card_line3':card.get('char', ''), 'card_line4':''} - else: - props['front_text']= {'card_text':card.get('char', ''), 'card_line1':'', 'card_line2':'', 'card_line3':'', 'card_line4':''} + if self.data['align'] == '1': + props['front_text']= {'card_text':card.get('char', ''), 'card_line1':'', 'card_line2':'', + 'card_line3':'', 'card_line4':''} + elif self.data['align'] == '2': + props['front_text']= {'card_text':'', 'card_line1':card.get('char', ''), 'card_line2':'', + 'card_line3':'', 'card_line4':''} + elif self.data['align'] == '3': + props['front_text']= {'card_text':'', 'card_line1':'', + 'card_line2':card.get('char', ''), 'card_line3':'', 'card_line4':''} if card['ab']== 'a': buffer_card = buffer_card_1 diff --git a/games/addition/addition.mem b/games/addition/addition.mem index 9a7e2fb..3c073f8 100644 --- a/games/addition/addition.mem +++ b/games/addition/addition.mem @@ -1,23 +1,23 @@ - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/games/capitals/capitals.mem b/games/capitals/capitals.mem index 2e15611..cb6c193 100755 --- a/games/capitals/capitals.mem +++ b/games/capitals/capitals.mem @@ -1,23 +1,23 @@ - + - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + diff --git a/memorize.dtd b/memorize.dtd index 05a4312..56ca6c6 100644 --- a/memorize.dtd +++ b/memorize.dtd @@ -9,6 +9,7 @@ face CDATA #IMPLIED face1 CDATA #IMPLIED face2 CDATA #IMPLIED + align CDATA #IMPLIED > @@ -20,6 +21,4 @@ bsnd CDATA #IMPLIED bchar CDATA #IMPLIED color CDATA #IMPLIED - acharalign CDATA #IMPLIED - bcharalign CDATA #IMPLIED > diff --git a/model.py b/model.py index 9f7cbab..f829ab4 100644 --- a/model.py +++ b/model.py @@ -30,18 +30,16 @@ class Pair(gobject.GObject): 'aimg' : (str, None, None, None, gobject.PARAM_READWRITE), 'asnd' : (str, None, None, None, gobject.PARAM_READWRITE), 'achar' : (str, None, None, None, gobject.PARAM_READWRITE), - 'acharalign' : (str, None, None, None, gobject.PARAM_READWRITE), 'bimg' : (str, None, None, None, gobject.PARAM_READWRITE), 'bsnd' : (str, None, None, None, gobject.PARAM_READWRITE), 'bchar' : (str, None, None, None, gobject.PARAM_READWRITE), - 'bcharalign': (str, None, None, None, gobject.PARAM_READWRITE), 'color': (gobject.TYPE_INT, 'Base', 'Base', 0, 10, 0, gobject.PARAM_READWRITE) } def __init__(self): gobject.GObject.__init__(self) - self._properties = {'aimg':None, 'asnd':None, 'achar':None, 'acharalign':'1', 'bimg':None, - 'bsnd':None, 'bchar':None, 'bcharalign':1, 'color':100} + self._properties = {'aimg':None, 'asnd':None, 'achar':None, 'bimg':None, + 'bsnd':None, 'bchar':None, 'color':100} def do_get_property(self, pspec): """Retrieve a particular property from our property dictionary @@ -52,16 +50,12 @@ class Pair(gobject.GObject): return self._properties["asnd"] elif pspec.name == "achar": return self._properties["achar"] - elif pspec.name == "acharalign": - return self._properties["acharalign"] elif pspec.name == "bimg": return self._properties["bimg"] elif pspec.name == "bsnd": return self._properties["bsnd"] elif pspec.name == "bchar": return self._properties["bchar"] - elif pspec.name == "bcharalign": - return self._properties["bcharalign"] elif pspec.name == "color": return self._properties["color"] @@ -72,16 +66,12 @@ class Pair(gobject.GObject): self._properties["asnd"] = value elif name == "achar": self._properties["achar"] = value - elif name == "acharalign": - self._properties["acharalign"] = int(value) elif name == "bimg": self._properties["bimg"] = value elif name == "bsnd": self._properties["bsnd"] = value elif name == "bchar": self._properties["bchar"] = value - elif name == "bcharalign": - self._properties["bcharalign"] = value elif name == "color": self._properties["color"] = value @@ -103,6 +93,7 @@ class Model(object): self._GAMES_PATH = gamespath self.data['face'] = '' + self.data['align'] = '1' try: self.dtd = libxml2.parseDTD(None, os.path.join(self.dtdpath, 'memorize.dtd')) @@ -167,7 +158,10 @@ class Model(object): elif(attribute.name == 'face1'): self.data['face1'] = attribute.content elif(attribute.name == 'face2'): - self.data['face2'] = attribute.content + self.data['face2'] = attribute.content + elif(attribute.name == 'align'): + self.data['align'] = attribute.content + xpa.xpathFreeContext() else: _logger.error('Read: Error in validation of the file') @@ -202,6 +196,8 @@ class Model(object): root.setProp("face1", self.data['face1']) if(self.data.get('face2', None) != None): root.setProp("face2", self.data['face2']) + if(self.data.get('align', None) != None): + root.setProp("align", self.data['align']) for key in self.pairs: elem = root.newChild(None, "pair", None) @@ -255,7 +251,6 @@ class Model(object): elem['pairkey'] = key elem['state'] = '0' elem['ab'] = 'a' - elem['charalign'] = '0' if self.pairs[key].props.aimg != None: elem['img'] = os.path.join(self.data['pathimg'], self.pairs[key].props.aimg) if self.pairs[key].props.asnd != None: @@ -263,14 +258,12 @@ class Model(object): elem['snd'] = os.path.join(self.data['pathsnd'], self.pairs[key].props.asnd) if self.pairs[key].props.achar != None: elem['char'] = self.pairs[key].props.achar - elem['charalign'] = self.pairs[key].props.acharalign temp1.append(elem) elem = {} elem['pairkey'] = key elem['state'] = '0' elem['ab'] = 'b' - elem['charalign'] = '0' if self.pairs[key].props.bimg != None: elem['img'] = os.path.join(self.data['pathimg'], self.pairs[key].props.bimg) if self.pairs[key].props.bsnd != None: @@ -278,7 +271,6 @@ class Model(object): elem['snd'] = os.path.join(self.data['pathsnd'], self.pairs[key].props.bsnd) if self.pairs[key].props.bchar != None: elem['char'] = self.pairs[key].props.bchar - elem['charalign'] = self.pairs[key].props.bcharalign temp2.append(elem) i+=1 else: -- cgit v0.9.1