Mercurial > libervia-backend
diff frontends/src/wix/chat.py @ 1011:5a6354ff468c
wix: use of new logging system
author | Goffi <goffi@goffi.org> |
---|---|
date | Mon, 05 May 2014 20:12:21 +0200 |
parents | cd02f5ef30df |
children | 11e2bb20e896 |
line wrap: on
line diff
--- a/frontends/src/wix/chat.py Mon May 05 20:12:19 2014 +0200 +++ b/frontends/src/wix/chat.py Mon May 05 20:12:21 2014 +0200 @@ -18,23 +18,22 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. - from sat.core.i18n import _ import wx import os.path import time -import pdb -from logging import debug, info, error, warning +from sat.core.log import getLogger +log = getLogger(__name__) from sat.tools.jid import JID from sat_frontends.quick_frontend.quick_chat import QuickChat from sat_frontends.wix.contact_list import ContactList from sat_frontends.wix.card_game import CardPanel from sat_frontends.wix.quiz_game import QuizPanel - idSEND = 1 idTAROT = 2 + class Chat(wx.Frame, QuickChat): """The chat Window for one to one conversations""" @@ -111,14 +110,14 @@ def startGame(self, game_type, referee, players): """Configure the chat window to start a game""" if game_type=="Tarot": - debug (_("configure chat window for Tarot game")) + log.debug (_("configure chat window for Tarot game")) self.tarot_panel = CardPanel(self, referee, players, self.nick) self.sizer.Prepend(self.tarot_panel, 0, flag=wx.EXPAND) self.sizer.Layout() self.Fit() self.splitter.UpdateSize() elif game_type=="Quiz": - debug (_("configure chat window for Quiz game")) + log.debug (_("configure chat window for Quiz game")) self.quiz_panel = QuizPanel(self, referee, players, self.nick) self.sizer.Prepend(self.quiz_panel, 0, flag=wx.EXPAND) self.sizer.Layout() @@ -143,9 +142,9 @@ def replaceUser(self, nick, show_info=True): """Add user if it is not in the group list""" - debug (_("Replacing user %s") % nick) + log.debug (_("Replacing user %s") % nick) if self.type != "group": - error (_("[INTERNAL] trying to replace user for a non group chat window")) + log.error (_("[INTERNAL] trying to replace user for a non group chat window")) return QuickChat.replaceUser(self, nick, show_info) self.present_panel.presents.replace(nick) @@ -168,7 +167,7 @@ def __createMenus_O2O(self): """create menu bar for one 2 one chat""" - info("Creating menus") + log.info("Creating menus") self.__eraseMenus() menuBar = self.GetMenuBar() actionMenu = wx.Menu() @@ -180,7 +179,7 @@ def __createMenus_group(self): """create menu bar for group chat""" - info("Creating menus") + log.info("Creating menus") self.__eraseMenus() menuBar = self.GetMenuBar() actionMenu = wx.Menu() @@ -221,7 +220,7 @@ jid,nick,mymess = QuickChat.printMessage(self, from_jid, msg, profile, timestamp) except TypeError: return - print "printMessage, jid=",jid,"type=",self.type + log.debug("printMessage, jid = %s type = %s" % (jid, self.type)) _font_bold = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.BOLD) _font_normal = wx.Font(self.font["points"], self.font["family"], wx.NORMAL, wx.NORMAL) _font_italic = wx.Font(self.font["points"], self.font["family"], wx.ITALIC if mymess else wx.NORMAL, wx.NORMAL) @@ -253,10 +252,10 @@ ### events ### def onSendFile(self, e): - debug(_("Send File")) + log.debug(_("Send File")) filename = wx.FileSelector(_("Choose a file to send"), flags = wx.FD_FILE_MUST_EXIST) if filename: - debug(_("filename: %s"),filename) + log.debug(_("filename: %s"),filename) #FIXME: check last_resource: what if self.target.resource exists ? last_resource = self.host.bridge.getLastResource(unicode(self.target.bare), self.host.profile) if last_resource: @@ -267,8 +266,8 @@ self.host.waitProgress(id, _("File Transfer"), _("Copying %s") % os.path.basename(filename), self.host.profile) def onStartTarot(self, e): - debug(_("Starting Tarot game")) - warning(_("FIXME: temporary menu, must be changed")) + log.debug(_("Starting Tarot game")) + log.warning(_("FIXME: temporary menu, must be changed")) if len(self.occupants) != 4: err_dlg = wx.MessageDialog(self, _("You need to be exactly 4 peoples in the room to start a Tarot game"), _("Can't start game"), style = wx.OK | wx.ICON_ERROR) #FIXME: gof: temporary only, need to choose the people with who the game has to be started err_dlg.ShowModal()