wix: updated paths to use media_dir

This commit is contained in:
Goffi 2011-06-18 22:51:33 +02:00
commit 796eb4bd6a
5 changed files with 9 additions and 7 deletions

View file

@ -81,6 +81,7 @@ class QuickApp():
self.current_action_ids = set() self.current_action_ids = set()
self.current_action_ids_cb = {} self.current_action_ids_cb = {}
self.media_dir = self.bridge.getConfig('','media_dir')
def check_profile(self, profile): def check_profile(self, profile):
"""Tell if the profile is currently followed by the application""" """Tell if the profile is currently followed by the application"""

View file

@ -61,7 +61,7 @@ class CardPanel(QuickCardGame,wx.Panel):
QuickCardGame.__init__(self, parent, referee, players, player_nick) QuickCardGame.__init__(self, parent, referee, players, player_nick)
wx.Panel.__init__(self, parent) wx.Panel.__init__(self, parent)
self.SetMinSize(wx.Size(MIN_WIDTH, MIN_HEIGHT)) 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.mouse_over_card = None #contain the card to highlight
self.visible_size = CARD_WIDTH/2 #number of pixels visible for cards self.visible_size = CARD_WIDTH/2 #number of pixels visible for cards
self.hand = [] self.hand = []

View file

@ -6,7 +6,6 @@ wix_root = os.path.dirname(sat_frontends.wix.__file__)
__builtin__.__dict__['APP_NAME'] = "Wix" __builtin__.__dict__['APP_NAME'] = "Wix"
__builtin__.__dict__['LICENCE_PATH'] = os.path.join(wix_root,"COPYING") __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__['msgOFFLINE'] = _("offline")
__builtin__.__dict__['msgONLINE'] = _("online") __builtin__.__dict__['msgONLINE'] = _("online")

View file

@ -24,6 +24,7 @@ from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
from logging import debug, info, error from logging import debug, info, error
from cgi import escape from cgi import escape
from sat.tools.jid import JID from sat.tools.jid import JID
from os.path import join
class Group(unicode): class Group(unicode):
@ -48,6 +49,7 @@ class ContactList(wx.SimpleHtmlListBox, QuickContactList):
self.type = type self.type = type
self.__typeSwitch() self.__typeSwitch()
self.groups = {} #list contacts in each groups, key = group 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, self.onSelected)
self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated) self.Bind(wx.EVT_LISTBOX_DCLICK, self.onActivated)
@ -114,7 +116,7 @@ class ContactList(wx.SimpleHtmlListBox, QuickContactList):
#show[2]==color (or None) #show[2]==color (or None)
show_html = "<font color='%s'>[%s]</font>" % (show[2], show[1]) if show[2] else "" show_html = "<font color='%s'>[%s]</font>" % (show[2], show[1]) if show[2] else ""
status = self.CM.getAttr(jid,'status') or '' 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 #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. #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 #The case seems to happen when SimpleHtmlListBox parse the HTML with the <img> tag

View file

@ -62,6 +62,7 @@ class MainWindow(wx.Frame, QuickApp):
"""main app window""" """main app window"""
def __init__(self): def __init__(self):
QuickApp.__init__(self)
wx.Frame.__init__(self,None, title="SàT Wix", size=(300,500)) wx.Frame.__init__(self,None, title="SàT Wix", size=(300,500))
self.CM = QuickContactManagement() #FIXME: not the best place self.CM = QuickContactManagement() #FIXME: not the best place
@ -90,8 +91,10 @@ class MainWindow(wx.Frame, QuickApp):
self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt) self.Bind(wx.EVT_TEXT_ENTER, self.onStatusChange, self.statusTxt)
self.tools.Disable() self.tools.Disable()
#tray icon #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 = wx.TaskBarIcon()
self.tray_icon.SetIcon(ticon, _("Wix jabber client")) self.tray_icon.SetIcon(ticon, _("Wix jabber client"))
wx.EVT_TASKBAR_LEFT_UP(self.tray_icon, self.onTrayClick) wx.EVT_TASKBAR_LEFT_UP(self.tray_icon, self.onTrayClick)
@ -100,9 +103,6 @@ class MainWindow(wx.Frame, QuickApp):
#events #events
self.Bind(wx.EVT_CLOSE, self.onClose, self) self.Bind(wx.EVT_CLOSE, self.onClose, self)
QuickApp.__init__(self)
#menus #menus
self.createMenus() self.createMenus()
for i in range(self.menuBar.GetMenuCount()): for i in range(self.menuBar.GetMenuCount()):