comparison sat_frontends/primitivus/game_tarot.py @ 3028:ab2696e34d29

Python 3 port: /!\ this is a huge commit /!\ starting from this commit, SàT is needs Python 3.6+ /!\ SàT maybe be instable or some feature may not work anymore, this will improve with time This patch port backend, bridge and frontends to Python 3. Roughly this has been done this way: - 2to3 tools has been applied (with python 3.7) - all references to python2 have been replaced with python3 (notably shebangs) - fixed files not handled by 2to3 (notably the shell script) - several manual fixes - fixed issues reported by Python 3 that where not handled in Python 2 - replaced "async" with "async_" when needed (it's a reserved word from Python 3.7) - replaced zope's "implements" with @implementer decorator - temporary hack to handle data pickled in database, as str or bytes may be returned, to be checked later - fixed hash comparison for password - removed some code which is not needed anymore with Python 3 - deactivated some code which needs to be checked (notably certificate validation) - tested with jp, fixed reported issues until some basic commands worked - ported Primitivus (after porting dependencies like urwid satext) - more manual fixes
author Goffi <goffi@goffi.org>
date Tue, 13 Aug 2019 19:08:41 +0200
parents 003b8b4b56a7
children 9d0df638c8b4
comparison
equal deleted inserted replaced
3027:ff5bcb12ae60 3028:ab2696e34d29
152 suit = "c" 152 suit = "c"
153 else: 153 else:
154 suit = "A" 154 suit = "A"
155 color = "neutral" 155 color = "neutral"
156 elif self.suit == "pique": 156 elif self.suit == "pique":
157 suit = u"♠" 157 suit = "♠"
158 color = "black" 158 color = "black"
159 elif self.suit == "trefle": 159 elif self.suit == "trefle":
160 suit = u"♣" 160 suit = "♣"
161 color = "black" 161 color = "black"
162 elif self.suit == "coeur": 162 elif self.suit == "coeur":
163 suit = u"♥" 163 suit = "♥"
164 color = "red" 164 color = "red"
165 elif self.suit == "carreau": 165 elif self.suit == "carreau":
166 suit = u"♦" 166 suit = "♦"
167 color = "red" 167 color = "red"
168 if self.bout: 168 if self.bout:
169 color = "special" 169 color = "special"
170 return ("card_%s" % color, u"%s%s" % (value, suit)) 170 return ("card_%s" % color, "%s%s" % (value, suit))
171 171
172 def getWidget(self): 172 def getWidget(self):
173 """Return a widget representing the card""" 173 """Return a widget representing the card"""
174 return CardDisplayer(self) 174 return CardDisplayer(self)
175 175
254 ) 254 )
255 255
256 def loadCards(self): 256 def loadCards(self):
257 """Load all the cards in memory""" 257 """Load all the cards in memory"""
258 QuickTarotGame.loadCards(self) 258 QuickTarotGame.loadCards(self)
259 for value in map(str, range(1, 22)) + ["excuse"]: 259 for value in list(map(str, list(range(1, 22)))) + ["excuse"]:
260 card = Card("atout", value) 260 card = Card("atout", value)
261 self.cards[card.suit, card.value] = card 261 self.cards[card.suit, card.value] = card
262 self.deck.append(card) 262 self.deck.append(card)
263 for suit in ["pique", "coeur", "carreau", "trefle"]: 263 for suit in ["pique", "coeur", "carreau", "trefle"]:
264 for value in map(str, range(1, 11)) + ["valet", "cavalier", "dame", "roi"]: 264 for value in list(map(str, list(range(1, 11)))) + ["valet", "cavalier", "dame", "roi"]:
265 card = Card(suit, value) 265 card = Card(suit, value)
266 self.cards[card.suit, card.value] = card 266 self.cards[card.suit, card.value] = card
267 self.deck.append(card) 267 self.deck.append(card)
268 268
269 def tarotGameNewHandler(self, hand): 269 def tarotGameNewHandler(self, hand):