# HG changeset patch # User Goffi # Date 1391536276 -3600 # Node ID 084b52afdcebf760d028381d5ee57f0f4424910c # Parent 1fe00f0c9a9185538936659bfd9552a7a37add98 frontends: fixed /me usage + renamed a couple of "type" parameters to type_ diff -r 1fe00f0c9a91 -r 084b52afdceb frontends/src/primitivus/chat.py --- a/frontends/src/primitivus/chat.py Tue Feb 04 18:32:49 2014 +0100 +++ b/frontends/src/primitivus/chat.py Tue Feb 04 18:51:16 2014 +0100 @@ -76,9 +76,9 @@ class Chat(urwid.WidgetWrap, QuickChat): - def __init__(self, target, host, type='one2one'): + def __init__(self, target, host, type_='one2one'): self.target = target - QuickChat.__init__(self, target, host, type) + QuickChat.__init__(self, target, host, type_) self.content = urwid.SimpleListWalker([]) self.text_list = urwid.ListBox(self.content) self.chat_widget = urwid.Frame(self.text_list) @@ -86,7 +86,7 @@ self.chat_colums = urwid.Columns([('weight', 8, self.chat_widget)]) self.pile = urwid.Pile([self.chat_colums]) urwid.WidgetWrap.__init__(self, self.__getDecoration(self.pile)) - self.setType(type) + self.setType(type_) self.day_change = time.strptime(time.strftime("%a %b %d 00:00:00 %Y")) #struct_time of day changing time self.show_timestamp = True self.show_short_nick = False @@ -139,11 +139,11 @@ menu.addMenu(_("Action"), _("Send file"), self.onSendFileRequest) return menu - def setType(self, type): - QuickChat.setType(self, type) - if type == 'one2one': + def setType(self, type_): + QuickChat.setType(self, type_) + if type_ == 'one2one': self.historyPrint(profile=self.host.profile) - elif type == 'group': + elif type_ == 'group': if len(self.chat_colums.contents) == 1: present_widget = self.__buildPresentList() self.present_panel = sat_widgets.VerticalSeparator(present_widget) @@ -293,7 +293,7 @@ def printInfo(self, msg, type_='normal', timestamp=""): """Print general info @param msg: message to print - @type: one of: + @type_: one of: normal: general info like "toto has joined the room" me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" """ diff -r 1fe00f0c9a91 -r 084b52afdceb frontends/src/primitivus/contact_list.py --- a/frontends/src/primitivus/contact_list.py Tue Feb 04 18:32:49 2014 +0100 +++ b/frontends/src/primitivus/contact_list.py Tue Feb 04 18:51:16 2014 +0100 @@ -270,8 +270,8 @@ def setSpecial(self, special_jid, special_type, show=False): """Set entity as a special - @param jid: jid of the entity - @param _type: special type (e.g.: "MUC") + @param special_jid: jid of the entity + @param special_type: special type (e.g.: "MUC") @param show: True to display the dialog to chat with this entity """ QuickContactList.setSpecial(self, special_jid, special_type, show) diff -r 1fe00f0c9a91 -r 084b52afdceb frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Tue Feb 04 18:32:49 2014 +0100 +++ b/frontends/src/primitivus/primitivus Tue Feb 04 18:51:16 2014 +0100 @@ -406,18 +406,18 @@ answer_cb(False, *answer_data) - def showDialog(self, message, title="", type="info", answer_cb = None, answer_data = None): - if type == 'info': + def showDialog(self, message, title="", type_="info", answer_cb = None, answer_data = None): + if type_ == 'info': popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore - elif type == 'error': + elif type_ == 'error': popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore - elif type == 'yes/no': + elif type_ == 'yes/no': popup = sat_widgets.ConfirmDialog(unicode(message), yes_cb=self._dialogOkCb, yes_value = (answer_cb, answer_data), no_cb=self._dialogCancelCb, no_value = (answer_cb, answer_data)) else: popup = sat_widgets.Alert(unicode(title), unicode(message), ok_cb=answer_cb or self.removePopUp) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore - error(_('unmanaged dialog type: %s'), type) + error(_('unmanaged dialog type: %s'), type_) self.showPopUp(popup) def onNotification(self, notBar): @@ -493,7 +493,7 @@ pop_up_widget = sat_widgets.ConfirmDialog(data["message"], no_cb=refuse_cb, yes_cb=accept_cb) self.showPopUp(pop_up_widget) - def actionResult(self, type, id, data, profile): + def actionResult(self, type_, id, data, profile): # FIXME: to be removed if not self.check_profile(profile): return @@ -501,9 +501,9 @@ if not id in self.current_action_ids: debug (_('unknown id, ignoring')) return - if type == "SUPPRESS": + if type_ == "SUPPRESS": self.current_action_ids.remove(id) - elif type == "XMLUI": + elif type_ == "XMLUI": self.current_action_ids.remove(id) debug (_("XML user interface received")) misc = {} @@ -518,23 +518,23 @@ ui.show('popup') else: ui.show('window') - elif type == "ERROR": + elif type_ == "ERROR": self.current_action_ids.remove(id) self.showPopUp(sat_widgets.Alert(_("Error"), unicode(data["message"]), ok_cb=self.removePopUp)) #FIXME: remove unicode here when DBus Bridge will no return dbus.String anymore - elif type == "RESULT": + elif type_ == "RESULT": self.current_action_ids.remove(id) if self.current_action_ids_cb.has_key(id): callback = self.current_action_ids_cb[id] del self.current_action_ids_cb[id] callback(data) - elif type == "DICT_DICT": + elif type_ == "DICT_DICT": self.current_action_ids.remove(id) if self.current_action_ids_cb.has_key(id): callback = self.current_action_ids_cb[id] del self.current_action_ids_cb[id] callback(data) else: - error (_("FIXME FIXME FIXME: type [%s] not implemented") % type) + error (_("FIXME FIXME FIXME: type [%s] not implemented") % type_) raise NotImplementedError ##DIALOGS CALLBACKS## diff -r 1fe00f0c9a91 -r 084b52afdceb frontends/src/quick_frontend/quick_chat.py --- a/frontends/src/quick_frontend/quick_chat.py Tue Feb 04 18:32:49 2014 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Tue Feb 04 18:51:16 2014 +0100 @@ -26,19 +26,19 @@ class QuickChat(object): - def __init__(self, target, host, type='one2one'): + def __init__(self, target, host, type_='one2one'): self.target = target self.host = host - self.type = type + self.type = type_ self.id = "" self.nick = None self.occupants = set() - def setType(self, type): + def setType(self, type_): """Set the type of the chat @param type: can be 'one2one' for single conversation or 'group' for chat à la IRC """ - self.type = type + self.type = type_ def setPresents(self, nicks): """Set the users presents in the contact list for a group chat @@ -130,14 +130,14 @@ nick = self._get_nick(jid) mymess = (jid.resource == self.nick) if self.type == "group" else (jid.bare == self.host.profiles[profile]['whoami'].bare) #mymess = True if message comes from local user if msg.startswith('/me '): - self.printInfo('* %s %s' % (nick, msg[4:]),type='me', timestamp=timestamp) + self.printInfo('* %s %s' % (nick, msg[4:]), type_='me', timestamp=timestamp) return return jid, nick, mymess - def printInfo(self, msg, type='normal'): + def printInfo(self, msg, type_='normal'): """Print general info @param msg: message to print - @type: one of: + @type_: one of: normal: general info like "toto has joined the room" me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" """ diff -r 1fe00f0c9a91 -r 084b52afdceb frontends/src/wix/chat.py --- a/frontends/src/wix/chat.py Tue Feb 04 18:32:49 2014 +0100 +++ b/frontends/src/wix/chat.py Tue Feb 04 18:51:16 2014 +0100 @@ -38,9 +38,9 @@ class Chat(wx.Frame, QuickChat): """The chat Window for one to one conversations""" - def __init__(self, target, host, type='one2one'): + def __init__(self, target, host, type_='one2one'): wx.Frame.__init__(self, None, title=target, pos=(0,0), size=(400,200)) - QuickChat.__init__(self, target, host, type) + QuickChat.__init__(self, target, host, type_) self.sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(self.sizer) @@ -80,21 +80,21 @@ """Create a list of present people in a group chat""" self.present_panel = wx.Panel(self.splitter) self.present_panel.sizer = wx.BoxSizer(wx.VERTICAL) - self.present_panel.presents = ContactList(self.present_panel, self.host, type='nicks') + self.present_panel.presents = ContactList(self.present_panel, self.host, type_='nicks') self.present_panel.presents.SetMinSize(wx.Size(80,20)) self.present_panel.sizer.Add(self.present_panel.presents, 1, wx.EXPAND) self.present_panel.SetSizer(self.present_panel.sizer) self.splitter.SplitVertically(self.present_panel, self.conv_panel, 80) - def setType(self, type): - QuickChat.setType(self, type) - if type is 'group' and not self.splitter.IsSplit(): + def setType(self, type_): + QuickChat.setType(self, type_) + if type_ is 'group' and not self.splitter.IsSplit(): self.__createPresents() self.subjectBox.Show() self.__eraseMenus() self.__createMenus_group() self.sizer.Layout() - elif type is 'one2one' and self.splitter.IsSplit(): + elif type_ is 'one2one' and self.splitter.IsSplit(): self.splitter.Unsplit(self.present_panel) del self.present_panel self.GetMenuBar().Show() @@ -236,18 +236,18 @@ if not mymess: self.__blink() - def printInfo(self, msg, type='normal'): + def printInfo(self, msg, type_='normal'): """Print general info @param msg: message to print - @type: one of: + @type_: one of: normal: general info like "toto has joined the room" me: "/me" information like "/me clenches his fist" ==> "toto clenches his fist" """ _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) - self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_bold if type == 'normal' else _font_normal)) + self.chatWindow.SetDefaultStyle(wx.TextAttr("BLACK", font=_font_bold if type_ == 'normal' else _font_normal)) self.chatWindow.AppendText("%s\n" % msg) - if type=="me": + if type_=="me": self.__blink() ### events ### diff -r 1fe00f0c9a91 -r 084b52afdceb frontends/src/wix/contact_list.py --- a/frontends/src/wix/contact_list.py Tue Feb 04 18:32:49 2014 +0100 +++ b/frontends/src/wix/contact_list.py Tue Feb 04 18:51:16 2014 +0100 @@ -36,17 +36,17 @@ class ContactList(wx.SimpleHtmlListBox, QuickContactList): """Customized control to manage contacts.""" - def __init__(self, parent, host, type="JID"): + def __init__(self, parent, host, type_="JID"): """init the contact list @param parent: WxWidgets parent of the widget @param host: wix main app class - @param type: type of contact list: "JID" for the usual big jid contact list + @param type_: type of contact list: "JID" for the usual big jid contact list "CUSTOM" for a customized contact list (self.__presentItem must then be overrided) """ wx.SimpleHtmlListBox.__init__(self, parent, -1) QuickContactList.__init__(self) self.host = host - self.type = type + self.type = type_ self.__typeSwitch() self.groups = {} #list contacts in each groups, key = group self.empty_avatar = join(host.media_dir, 'misc/empty_avatar') @@ -59,7 +59,7 @@ def __typeSwitch(self): if self.type == "JID": self.__presentItem = self.__presentItemJID - elif type != "CUSTOM": + elif type_ != "CUSTOM": self.__presentItem = self.__presentItemDefault def __find_idx(self, entity):