From 796eb4bd6a4763b38d70b2da149013a5bc27430e Mon Sep 17 00:00:00 2001 From: Goffi Date: Sat, 18 Jun 2011 22:51:33 +0200 Subject: [PATCH] wix: updated paths to use media_dir --- frontends/src/quick_frontend/quick_app.py | 1 + frontends/src/wix/card_game.py | 2 +- frontends/src/wix/constants.py | 1 - frontends/src/wix/contact_list.py | 4 +++- frontends/src/wix/main_window.py | 8 ++++---- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py index 04f3b115..556166cc 100644 --- a/frontends/src/quick_frontend/quick_app.py +++ b/frontends/src/quick_frontend/quick_app.py @@ -81,6 +81,7 @@ class QuickApp(): 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""" diff --git a/frontends/src/wix/card_game.py b/frontends/src/wix/card_game.py index ca950904..d35c2b16 100644 --- a/frontends/src/wix/card_game.py +++ b/frontends/src/wix/card_game.py @@ -61,7 +61,7 @@ class CardPanel(QuickCardGame,wx.Panel): 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 = [] diff --git a/frontends/src/wix/constants.py b/frontends/src/wix/constants.py index 90fcfb1b..e0cd5261 100644 --- a/frontends/src/wix/constants.py +++ b/frontends/src/wix/constants.py @@ -6,7 +6,6 @@ wix_root = os.path.dirname(sat_frontends.wix.__file__) __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") diff --git a/frontends/src/wix/contact_list.py b/frontends/src/wix/contact_list.py index 46583935..37f3d6e6 100644 --- a/frontends/src/wix/contact_list.py +++ b/frontends/src/wix/contact_list.py @@ -24,6 +24,7 @@ from sat_frontends.quick_frontend.quick_contact_list import QuickContactList 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 @@ class ContactList(wx.SimpleHtmlListBox, QuickContactList): 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 @@ class ContactList(wx.SimpleHtmlListBox, QuickContactList): #show[2]==color (or None) show_html = "[%s]" % (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 tag diff --git a/frontends/src/wix/main_window.py b/frontends/src/wix/main_window.py index 9fc652f3..5d58e487 100644 --- a/frontends/src/wix/main_window.py +++ b/frontends/src/wix/main_window.py @@ -62,6 +62,7 @@ class MainWindow(wx.Frame, QuickApp): """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 @@ class MainWindow(wx.Frame, QuickApp): 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 @@ class MainWindow(wx.Frame, QuickApp): #events self.Bind(wx.EVT_CLOSE, self.onClose, self) - - - QuickApp.__init__(self) #menus self.createMenus()