changeset 366:0806a65a5fa9

wix: updated paths to use media_dir
author Goffi <goffi@goffi.org>
date Sat, 18 Jun 2011 22:51:33 +0200
parents efbfccfed623
children fd9ba4eb0cdb
files frontends/src/quick_frontend/quick_app.py frontends/src/wix/card_game.py frontends/src/wix/constants.py frontends/src/wix/contact_list.py frontends/src/wix/main_window.py
diffstat 5 files changed, 9 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Sat Jun 18 17:56:59 2011 +0200
+++ b/frontends/src/quick_frontend/quick_app.py	Sat Jun 18 22:51:33 2011 +0200
@@ -81,6 +81,7 @@
         
         self.current_action_ids = set()
         self.current_action_ids_cb = {}
+        self.media_dir = self.bridge.getConfig('','media_dir')
     
     def check_profile(self, profile):
         """Tell if the profile is currently followed by the application"""
--- a/frontends/src/wix/card_game.py	Sat Jun 18 17:56:59 2011 +0200
+++ b/frontends/src/wix/card_game.py	Sat Jun 18 22:51:33 2011 +0200
@@ -61,7 +61,7 @@
         QuickCardGame.__init__(self, parent, referee, players, player_nick)
         wx.Panel.__init__(self, parent)
         self.SetMinSize(wx.Size(MIN_WIDTH, MIN_HEIGHT))
-        self.loadCards("images/cards/")
+        self.loadCards(os.path.join(self.parent.host.media_dir, 'games/cards/tarot'))
         self.mouse_over_card = None #contain the card to highlight
         self.visible_size = CARD_WIDTH/2 #number of pixels visible for cards
         self.hand = []
--- a/frontends/src/wix/constants.py	Sat Jun 18 17:56:59 2011 +0200
+++ b/frontends/src/wix/constants.py	Sat Jun 18 22:51:33 2011 +0200
@@ -6,7 +6,6 @@
 
 __builtin__.__dict__['APP_NAME'] = "Wix"
 __builtin__.__dict__['LICENCE_PATH'] = os.path.join(wix_root,"COPYING")
-__builtin__.__dict__['IMAGE_DIR'] = os.path.join(wix_root,'images')
 
 __builtin__.__dict__['msgOFFLINE']          = _("offline")
 __builtin__.__dict__['msgONLINE']           = _("online")
--- a/frontends/src/wix/contact_list.py	Sat Jun 18 17:56:59 2011 +0200
+++ b/frontends/src/wix/contact_list.py	Sat Jun 18 22:51:33 2011 +0200
@@ -24,6 +24,7 @@
 from logging import debug, info, error
 from cgi import escape
 from sat.tools.jid  import JID
+from os.path import join
 
 
 class Group(unicode):
@@ -48,6 +49,7 @@
         self.type = type
         self.__typeSwitch()
         self.groups = {}  #list contacts in each groups, key = group
+        self.empty_avatar = join(host.media_dir, 'misc/empty_avatar')
         self.Bind(wx.EVT_LISTBOX, self.onSelected)
         self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated)
     
@@ -114,7 +116,7 @@
         #show[2]==color (or None)
         show_html = "<font color='%s'>[%s]</font>" % (show[2], show[1]) if show[2] else ""
         status = self.CM.getAttr(jid,'status') or ''
-        avatar = self.CM.getAttr(jid,'avatar') or IMAGE_DIR+'/empty_avatar' #XXX: there is a weird bug here: if the image has an extension (i.e. empty_avatar.png),
+        avatar = self.CM.getAttr(jid,'avatar') or self.empty_avatar #XXX: there is a weird bug here: if the image has an extension (i.e. empty_avatar.png),
         #WxPython segfault, and it doesn't without nothing. I couldn't reproduce the case with a basic test script, so it need further investigation before reporting it
         #to WxPython dev. Anyway, the program crash with a segfault, not a python exception, so there is definitely something wrong with WxPython.
         #The case seems to happen when SimpleHtmlListBox parse the HTML with the <img> tag
--- a/frontends/src/wix/main_window.py	Sat Jun 18 17:56:59 2011 +0200
+++ b/frontends/src/wix/main_window.py	Sat Jun 18 22:51:33 2011 +0200
@@ -62,6 +62,7 @@
     """main app window"""
 
     def __init__(self):
+        QuickApp.__init__(self)
         wx.Frame.__init__(self,None, title="SàT Wix", size=(300,500))
         self.CM = QuickContactManagement() #FIXME: not the best place
 
@@ -89,9 +90,11 @@
         self.Bind(wx.EVT_COMBOBOX, self.onStatusChange, self.statusBox) 
         self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt)
         self.tools.Disable()
+
+        
         
         #tray icon
-        ticon = wx.Icon(IMAGE_DIR+'/crystal/tray_icon.xpm', wx.BITMAP_TYPE_XPM)
+        ticon = wx.Icon(os.path.join(self.media_dir, 'icons/crystal/tray_icon.xpm'), wx.BITMAP_TYPE_XPM)
         self.tray_icon = wx.TaskBarIcon()
         self.tray_icon.SetIcon(ticon, _("Wix jabber client"))
         wx.EVT_TASKBAR_LEFT_UP(self.tray_icon, self.onTrayClick)
@@ -99,9 +102,6 @@
 
         #events
         self.Bind(wx.EVT_CLOSE, self.onClose, self)
-
-        
-        QuickApp.__init__(self)
         
         #menus
         self.createMenus()