Mercurial > libervia-web
changeset 77:975e6be24e11
media paths update
media now use global media location, obtained throught getConfig('', 'media_dir')
Tarot cards have been removed as they are now shared in this location
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 19 Jun 2011 00:48:43 +0200 |
parents | 8f097c1551f3 |
children | 12680e220b35 |
files | browser_side/card_game.py browser_side/register.py libervia.tac public/cards/.size public/cards/COPYING public/cards/README public/cards/atout_1.png public/cards/atout_10.png public/cards/atout_11.png public/cards/atout_12.png public/cards/atout_13.png public/cards/atout_14.png public/cards/atout_15.png public/cards/atout_16.png public/cards/atout_17.png public/cards/atout_18.png public/cards/atout_19.png public/cards/atout_2.png public/cards/atout_20.png public/cards/atout_21.png public/cards/atout_3.png public/cards/atout_4.png public/cards/atout_5.png public/cards/atout_6.png public/cards/atout_7.png public/cards/atout_8.png public/cards/atout_9.png public/cards/atout_excuse.png public/cards/carreau_1.png public/cards/carreau_10.png public/cards/carreau_2.png public/cards/carreau_3.png public/cards/carreau_4.png public/cards/carreau_5.png public/cards/carreau_6.png public/cards/carreau_7.png public/cards/carreau_8.png public/cards/carreau_9.png public/cards/carreau_cavalier.png public/cards/carreau_dame.png public/cards/carreau_roi.png public/cards/carreau_valet.png public/cards/coeur_1.png public/cards/coeur_10.png public/cards/coeur_2.png public/cards/coeur_3.png public/cards/coeur_4.png public/cards/coeur_5.png public/cards/coeur_6.png public/cards/coeur_7.png public/cards/coeur_8.png public/cards/coeur_9.png public/cards/coeur_cavalier.png public/cards/coeur_dame.png public/cards/coeur_roi.png public/cards/coeur_valet.png public/cards/pique_1.png public/cards/pique_10.png public/cards/pique_2.png public/cards/pique_3.png public/cards/pique_4.png public/cards/pique_5.png public/cards/pique_6.png public/cards/pique_7.png public/cards/pique_8.png public/cards/pique_9.png public/cards/pique_cavalier.png public/cards/pique_dame.png public/cards/pique_roi.png public/cards/pique_valet.png public/cards/trefle_1.png public/cards/trefle_10.png public/cards/trefle_2.png public/cards/trefle_3.png public/cards/trefle_4.png public/cards/trefle_5.png public/cards/trefle_6.png public/cards/trefle_7.png public/cards/trefle_8.png public/cards/trefle_9.png public/cards/trefle_cavalier.png public/cards/trefle_dame.png public/cards/trefle_roi.png public/cards/trefle_valet.png public/libervia.css |
diffstat | 85 files changed, 16 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/browser_side/card_game.py Sat Jun 18 15:47:21 2011 +0200 +++ b/browser_side/card_game.py Sun Jun 19 00:48:43 2011 +0200 @@ -215,12 +215,14 @@ self.addClickListener(self) - def loadCards(self, dir): - """Load all the cards in memory - @param dir: directory where the PNG files are""" + def loadCards(self): + """Load all the cards in memory""" def _getTarotCardsPathsCb(paths): + print "_getTarotCardsPathsCb" for file in paths: + print "path:", file card = CardWidget(self, file) + print "card:", card self.cards[(card.suit, card.value)]=card self.deck.append(card) self._parent.host.bridge.call('tarotGameReady', None, self.player_nick, self.referee)
--- a/browser_side/register.py Sat Jun 18 15:47:21 2011 +0200 +++ b/browser_side/register.py Sun Jun 19 00:48:43 2011 +0200 @@ -55,7 +55,7 @@ self.setMethod(FormPanel.METHOD_POST) main_panel = HorizontalPanel() main_panel.setStyleName('registerPanel_main') - left_side = Image("register_left.png") + left_side = Image("media/libervia/register_left.png") main_panel.add(left_side) ##TabPanel##
--- a/libervia.tac Sat Jun 18 15:47:21 2011 +0200 +++ b/libervia.tac Sun Jun 19 00:48:43 2011 +0200 @@ -52,7 +52,8 @@ TIMEOUT = 10 #Session's time out, after that the user will be disconnected LIBERVIA_DIR = "output/" -CARDS_DIR = "cards/" +MEDIA_DIR = "media/" +CARDS_DIR = "games/cards/tarot" class ISATSession(Interface): profile = Attribute("Sat profile") @@ -242,7 +243,9 @@ def jsonrpc_getTarotCardsPaths(self): """Give the path of all the tarot cards""" - return map(lambda x: x[len(LIBERVIA_DIR):],glob.glob(os.path.join(LIBERVIA_DIR,CARDS_DIR,'*_*.png'))); + _join = os.path.join + _media_dir = _join(self.sat_host.media_dir,'') + return map(lambda x: _join(MEDIA_DIR, x[len(_media_dir):]),glob.glob(_join(_media_dir,CARDS_DIR,'*_*.png'))); def jsonrpc_tarotGameReady(self, player, referee): """Tell to the server that we are ready to start the game""" @@ -602,11 +605,13 @@ 'tarotGameChooseContrat', 'tarotGameShowCards', 'tarotGameInvalidCards', 'tarotGameCardsPlayed', 'tarotGameYourTurn', 'tarotGameScore', 'subscribe', 'contactDeleted', 'newContact']: self.bridge.register(signal_name, self.signal_handler.getGenericCb(signal_name)) + self.media_dir = self.bridge.getConfig('','media_dir') root.putChild('json_signal_api', self.signal_handler) root.putChild('json_api', MethodHandler(self)) root.putChild('register_api', _register) root.putChild('blog', MicroBlog(self)) root.putChild('css', ProtectedFile("server_css/")) + root.putChild(os.path.dirname(MEDIA_DIR), ProtectedFile(self.media_dir)) self.site = server.Site(root) self.site.sessionFactory = LiberviaSession
--- a/public/cards/.size Sat Jun 18 15:47:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Biggest size: 74X136
--- a/public/cards/COPYING Sat Jun 18 15:47:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -The work in this directory is licensed under the Creative Commons BY-SA License. To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/; or, (b) send a letter to Creative Commons, 171 2nd Street, Suite 300, San Francisco, California, 94105, USA.
--- a/public/cards/README Sat Jun 18 15:47:21 2011 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -The Tarot cards pictures come from the deck found on wikicommons (the script used to cut them is available in SàT project @frontends/src/wix/images/split_card.sh), and available at http://upload.wikimedia.org/wikipedia/commons/8/8d/Tarotcards.jpg under Creative Commons BY-SA. The authors shown on the site are Piast and Svick. The splitted cards are, according to the license, available under the same conditions. -Notice that the Creative Common BY-SA apply only to this directory -
--- a/public/libervia.css Sat Jun 18 15:47:21 2011 +0200 +++ b/public/libervia.css Sun Jun 19 00:48:43 2011 +0200 @@ -396,7 +396,7 @@ font-family: Arial, Helvetica, sans-serif; border: 1px solid #bbb; color: #444; - background: #fff url('unibox.png') top right no-repeat; + background: #fff url('media/libervia/unibox.png') top right no-repeat; border-radius: 9px 9px 9px 9px; -webkit-border-radius: 9px 9px 9px 9px; -moz-border-radius: 9px 9px 9px 9px; @@ -446,7 +446,7 @@ } .registerPanel_right_side { - background: #111 url('popup_right.png'); + background: #111 url('media/libervia/register_right.png'); height: 100%; width: 100%; } @@ -483,7 +483,7 @@ .registerPanel_content .button, .registerPanel_content .button:visited { - background: #222 url('gradient.png') repeat-x; + background: #222 url('media/libervia/gradient.png') repeat-x; display: inline-block; text-decoration: none; -moz-border-radius: 6px;