Unverified Commit a28b9c44 authored by mathieui's avatar mathieui

Update poezio for the new tabs module

parent 7d9afc6a
......@@ -52,7 +52,7 @@ class CommandCore:
buff.extend(acc)
acc = []
buff.append('Tab-specific commands:')
tab_commands = self.core.current_tab().commands
tab_commands = self.core.tabs.current_tab.commands
for name, command in tab_commands.items():
if isinstance(command, Command):
acc.append(' \x19%s}%s\x19o - %s' % (color, name,
......@@ -67,7 +67,7 @@ class CommandCore:
else:
command = args[0].lstrip('/').strip()
tab_commands = self.core.current_tab().commands
tab_commands = self.core.tabs.current_tab.commands
if command in tab_commands:
tup = tab_commands[command]
elif command in self.core.commands:
......@@ -125,7 +125,7 @@ class CommandCore:
pres['type'] = show
self.core.events.trigger('send_normal_presence', pres)
pres.send()
current = self.core.current_tab()
current = self.core.tabs.current_tab
is_muctab = isinstance(current, tabs.MucTab)
if is_muctab and current.joined and show in ('away', 'xa'):
current.send_chat_state('inactive')
......@@ -148,8 +148,8 @@ class CommandCore:
return self.help('presence')
jid, ptype, status = args[0], args[1], args[2]
if jid == '.' and isinstance(self.core.current_tab(), tabs.ChatTab):
jid = self.core.current_tab().name
if jid == '.' and isinstance(self.core.tabs.current_tab, tabs.ChatTab):
jid = self.core.tabs.current_tab.name
if ptype == 'available':
ptype = None
try:
......@@ -162,7 +162,7 @@ class CommandCore:
log.debug(
'Could not send directed presence to %s', jid, exc_info=True)
return
tab = self.core.get_tab_by_name(jid)
tab = self.core.tabs.by_name_and_class(jid)
if tab:
if ptype in ('xa', 'away'):
tab.directed_presence = False
......@@ -170,13 +170,13 @@ class CommandCore:
else:
tab.directed_presence = True
chatstate = 'active'
if tab == self.core.current_tab():
if tab == self.core.tabs.current_tab:
tab.send_chat_state(chatstate, True)
if isinstance(tab, tabs.MucTab):
for private in tab.privates:
private.directed_presence = tab.directed_presence
if self.core.current_tab() in tab.privates:
self.core.current_tab().send_chat_state(chatstate, True)
if self.core.tabs.current_tab in tab.privates:
self.core.tabs.current_tab.send_chat_state(chatstate, True)
@command_args_parser.quoted(1)
def theme(self, args=None):
......@@ -199,33 +199,23 @@ class CommandCore:
except ValueError:
number = -1
name = name.lower()
if number != -1 and self.core.current_tab_nb == number:
if number != -1 and self.core.tabs.current_tab == number:
return
prev_nb = self.core.previous_tab_nb
self.core.previous_tab_nb = self.core.current_tab_nb
old_tab = self.core.current_tab()
self.core.previous_tab_nb = self.core.tabs.current_tab
old_tab = self.core.tabs.current_tab
if 0 <= number < len(self.core.tabs):
if not self.core.tabs[number]:
self.core.previous_tab_nb = prev_nb
return
self.core.current_tab_nb = number
self.core.tabs.set_current_index(number)
else:
match = None
target_tabs = self.core.tabs[self.core.current_tab_nb+1:] \
+ self.core.tabs[:self.core.current_tab_nb]
for tab in target_tabs:
for tab_name in tab.matching_names():
if tab_name[1] and name in tab_name[1].lower():
match = tab
break
if match:
break
match = self.core.tabs.find_match(name)
if match is None:
self.core.previous_tab_nb = prev_nb
return
self.core.current_tab_nb = match.nb
self.core.tabs.set_current_tab(match)
old_tab.on_lose_focus()
self.core.current_tab().on_gain_focus()
self.core.tabs.current_tab.on_gain_focus()
self.core.refresh_window()
@command_args_parser.quoted(2)
......@@ -236,7 +226,7 @@ class CommandCore:
if args is None:
return self.help('move_tab')
current_tab = self.core.current_tab()
current_tab = self.core.tabs.current_tab
if args[0] == '.':
args[0] = current_tab.nb
if args[1] == '.':
......@@ -266,8 +256,6 @@ class CommandCore:
result = self.core.insert_tab(old, new)
if not result:
self.core.information('Unable to move the tab.', 'Info')
else:
self.core.current_tab_nb = self.core.tabs.index(current_tab)
self.core.refresh_window()
@command_args_parser.quoted(0, 1)
......@@ -281,10 +269,10 @@ class CommandCore:
elif args:
jid = safeJID(args[0])
else:
if not isinstance(self.core.current_tab(), tabs.MucTab):
if not isinstance(self.core.tabs.current_tab, tabs.MucTab):
return self.core.information('Please provide a server',
'Error')
jid = safeJID(self.core.current_tab().name)
jid = safeJID(self.core.tabs.current_tab.name)
list_tab = tabs.MucListTab(self.core, jid)
self.core.add_tab(list_tab, True)
cb = list_tab.on_muc_list_item_received
......@@ -307,7 +295,7 @@ class CommandCore:
resource.jid, callback=self.core.handler.on_version_result)
def _empty_join(self):
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
if not isinstance(tab, (tabs.MucTab, tabs.PrivateTab)):
return (None, None)
room = safeJID(tab.name).bare
......@@ -331,7 +319,7 @@ class CommandCore:
# happens with /join /nickname, which is OK
if info.bare == '':
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
if not isinstance(tab, tabs.MucTab):
room, set_nick = (None, None)
else:
......@@ -344,7 +332,7 @@ class CommandCore:
# use the server of the current room if available
# check if the current room's name has a server
if room.find('@') == -1 and not server_root:
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
if isinstance(tab, tabs.MucTab):
if tab.name.find('@') != -1:
domain = safeJID(tab.name).domain
......@@ -376,13 +364,13 @@ class CommandCore:
if room in self.core.pending_invites:
del self.core.pending_invites[room]
tab = self.core.get_tab_by_name(room, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(room, tabs.MucTab)
# New tab
if tab is None:
tab = self.core.open_new_room(room, nick, password=password)
tab.join()
else:
self.core.focus_tab_named(tab.name)
self.core.focus_tab(tab)
if tab.own_nick == nick and tab.joined:
self.core.information('/join: Nothing to do.', 'Info')
else:
......@@ -396,7 +384,7 @@ class CommandCore:
'use_remote_bookmarks') else 'local'
self._add_bookmark('%s/%s' % (room, nick), True, password, method)
if tab == self.core.current_tab():
if tab == self.core.tabs.current_tab:
tab.refresh()
self.core.doupdate()
......@@ -405,7 +393,8 @@ class CommandCore:
"""
/bookmark_local [room][/nick] [password]
"""
if not args and not isinstance(self.core.current_tab(), tabs.MucTab):
if not args and not isinstance(self.core.tabs.current_tab,
tabs.MucTab):
return
password = args[1] if len(args) > 1 else None
jid = args[0] if args else None
......@@ -417,7 +406,8 @@ class CommandCore:
"""
/bookmark [room][/nick] [autojoin] [password]
"""
if not args and not isinstance(self.core.current_tab(), tabs.MucTab):
if not args and not isinstance(self.core.tabs.current_tab,
tabs.MucTab):
return
jid = args[0] if args else ''
password = args[2] if len(args) > 2 else None
......@@ -435,7 +425,7 @@ class CommandCore:
def _add_bookmark(self, jid, autojoin, password, method):
nick = None
if not jid:
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
roomname = tab.name
if tab.joined and tab.own_nick != self.core.own_nick:
nick = tab.own_nick
......@@ -447,7 +437,7 @@ class CommandCore:
info = safeJID(jid)
roomname, nick = info.bare, info.resource
if roomname == '':
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
if not isinstance(tab, tabs.MucTab):
return
roomname = tab.name
......@@ -498,14 +488,14 @@ class CommandCore:
@command_args_parser.ignored
def bookmarks(self):
"""/bookmarks"""
tab = self.core.get_tab_by_name('Bookmarks', tabs.BookmarksTab)
old_tab = self.core.current_tab()
tab = self.core.tabs.by_name_and_class('Bookmarks', tabs.BookmarksTab)
old_tab = self.core.tabs.current_tab
if tab:
self.core.current_tab_nb = tab.nb
self.core.tabs.set_current_tab(tab)
else:
tab = tabs.BookmarksTab(self.core, self.core.bookmarks)
self.core.tabs.append(tab)
self.core.current_tab_nb = tab.nb
self.core.tabs.set_current_tab(tab)
old_tab.on_lose_focus()
tab.on_gain_focus()
self.core.refresh_window()
......@@ -522,7 +512,7 @@ class CommandCore:
'Error')
if not args:
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
if isinstance(tab, tabs.MucTab) and self.core.bookmarks[tab.name]:
self.core.bookmarks.remove(tab.name)
self.core.bookmarks.save(self.core.xmpp, callback=cb)
......@@ -607,7 +597,7 @@ class CommandCore:
info = plugin_config.set_and_save(option, value, section)
else:
if args[0] == '.':
name = safeJID(self.core.current_tab().name).bare
name = safeJID(self.core.tabs.current_tab.name).bare
if not name:
self.core.information(
'Invalid tab to use the "." argument.', 'Error')
......@@ -661,7 +651,7 @@ class CommandCore:
Do a /cycle on each room of the given server.
If none, do it on the current tab
"""
tab = self.core.current_tab()
tab = self.core.tabs.current_tab
message = ""
if args:
domain = args[0]
......@@ -850,9 +840,10 @@ class CommandCore:
room = safeJID(args[0]).bare
if room:
muc.destroy_room(self.core.xmpp, room)
elif isinstance(self.core.current_tab(), tabs.MucTab) and not args[0]:
elif isinstance(self.core.tabs.current_tab,
tabs.MucTab) and not args[0]:
muc.destroy_room(self.core.xmpp,
self.core.current_tab().general_jid)
self.core.tabs.current_tab.general_jid)
else:
self.core.information('Invalid JID: "%s"' % args[0], 'Error')
......@@ -948,20 +939,21 @@ class CommandCore:
return self.core.information('Invalid JID.', 'Error')
tab = self.core.get_conversation_by_jid(
jid.full, False, fallback_barejid=False)
muc = self.core.get_tab_by_name(jid.bare, typ=tabs.MucTab)
muc = self.core.tabs.by_name_and_class(jid.bare, typ=tabs.MucTab)
if not tab and not muc:
tab = self.core.open_conversation_window(jid.full, focus=True)
elif muc:
if jid.resource:
tab = self.core.get_tab_by_name(jid.full, typ=tabs.PrivateTab)
tab = self.core.tabs.by_name_and_class(
jid.full, typ=tabs.PrivateTab)
if tab:
self.core.focus_tab_named(tab.name)
self.core.focus_tab(tab)
else:
tab = self.core.open_private_window(jid.bare, jid.resource)
else:
tab = muc
else:
self.core.focus_tab_named(tab.name)
self.core.focus_tab(tab)
if len(args) == 2:
tab.command_say(args[1])
......
......@@ -27,7 +27,7 @@ class CompletionCore:
def help(self, the_input):
"""Completion for /help."""
commands = sorted(self.core.commands.keys()) + sorted(
self.core.current_tab().commands.keys())
self.core.tabs.current_tab.commands.keys())
return Completion(the_input.new_completion, commands, 1, quotify=False)
def status(self, the_input):
......@@ -49,7 +49,8 @@ class CompletionCore:
if arg == 1:
to_suggest = []
for bookmark in self.core.bookmarks:
tab = self.core.get_tab_by_name(bookmark.jid, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(bookmark.jid,
tabs.MucTab)
if tab is not None and tab.joined:
to_suggest.append(bookmark.jid)
return Completion(
......@@ -119,7 +120,7 @@ class CompletionCore:
for elem in self.core.bookmarks]
to_suggest = []
for bookmark in bookmarks:
tab = self.core.get_tab_by_name(bookmark, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(bookmark, tabs.MucTab)
if not tab or (tab and not tab.joined):
to_suggest.append(bookmark)
relevant_rooms.extend(sorted(to_suggest))
......@@ -181,7 +182,7 @@ class CompletionCore:
"""
list_ = []
list_.extend(self.core.key_func.keys())
list_.extend(self.core.current_tab().key_func.keys())
list_.extend(self.core.tabs.current_tab.key_func.keys())
return Completion(the_input.new_completion, list_, 1, quotify=False)
def bookmark(self, the_input):
......@@ -200,7 +201,7 @@ class CompletionCore:
jid = safeJID(args[1])
if jid.server and (jid.resource or jid.full.endswith('/')):
tab = self.core.get_tab_by_name(jid.bare, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(jid.bare, tabs.MucTab)
nicks = [tab.own_nick] if tab else []
default = os.environ.get('USER') if os.environ.get(
'USER') else 'poezio'
......@@ -432,7 +433,7 @@ class CompletionCore:
jid = safeJID(args[1])
if jid.server and (jid.resource or jid.full.endswith('/')):
tab = self.core.get_tab_by_name(jid.bare, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(jid.bare, tabs.MucTab)
nicks = [tab.own_nick] if tab else []
default = os.environ.get('USER') if os.environ.get(
'USER') else 'poezio'
......
This diff is collapsed.
......@@ -85,7 +85,8 @@ class HandlerCore:
if not iq:
return
features = iq['disco_info']['features']
rostertab = self.core.get_tab_by_name('Roster', tabs.RosterInfoTab)
rostertab = self.core.tabs.by_name_and_class(
'Roster', tabs.RosterInfoTab)
rostertab.check_blocking(features)
rostertab.check_saslexternal(features)
if (config.get('enable_carbons')
......@@ -246,8 +247,8 @@ class HandlerCore:
self.core.room_error(message, jid_from.bare)
else:
text = self.core.get_error_message(message)
p_tab = self.core.get_tab_by_name(jid_from.full,
tabs.PrivateTab)
p_tab = self.core.tabs.by_name_and_class(
jid_from.full, tabs.PrivateTab)
if p_tab:
p_tab.add_error(text)
else:
......@@ -368,7 +369,7 @@ class HandlerCore:
if not own and 'private' in config.get('beep_on').split():
if not config.get_by_tabname('disable_beep', conv_jid.bare):
curses.beep()
if self.core.current_tab() is not conversation:
if self.core.tabs.current_tab is not conversation:
if not own:
conversation.state = 'private'
self.core.refresh_tab_win()
......@@ -655,7 +656,7 @@ class HandlerCore:
self.core.room_error(message, room_from)
return
tab = self.core.get_tab_by_name(room_from, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(room_from, tabs.MucTab)
if not tab:
self.core.information(
"message received for a non-existing room: %s" % (room_from))
......@@ -709,14 +710,14 @@ class HandlerCore:
if message['from'].resource == tab.own_nick:
tab.last_sent_message = message
if tab is self.core.current_tab():
if tab is self.core.tabs.current_tab:
tab.text_win.refresh()
tab.info_header.refresh(tab, tab.text_win, user=tab.own_user)
tab.input.refresh()
self.core.doupdate()
elif tab.state != old_state:
self.core.refresh_tab_win()
current = self.core.current_tab()
current = self.core.tabs.current_tab
if hasattr(current, 'input') and current.input:
current.input.refresh()
self.core.doupdate()
......@@ -747,7 +748,7 @@ class HandlerCore:
tmp_dir = get_image_cache()
body = xhtml.get_body_from_message_stanza(
message, use_xhtml=use_xhtml, extract_images_to=tmp_dir)
tab = self.core.get_tab_by_name(
tab = self.core.tabs.by_name_and_class(
jid.full,
tabs.PrivateTab) # get the tab with the private conversation
ignore = config.get_by_tabname('ignore_private', room_from)
......@@ -804,7 +805,7 @@ class HandlerCore:
if not sent and 'private' in config.get('beep_on').split():
if not config.get_by_tabname('disable_beep', jid.full):
curses.beep()
if tab is self.core.current_tab():
if tab is self.core.tabs.current_tab:
self.core.refresh_window()
else:
tab.state = 'normal' if sent else 'private'
......@@ -830,8 +831,8 @@ class HandlerCore:
def _on_chatstate(self, message, state):
if message['type'] == 'chat':
if not self._on_chatstate_normal_conversation(message, state):
tab = self.core.get_tab_by_name(message['from'].full,
tabs.PrivateTab)
tab = self.core.tabs.by_name_and_class(message['from'].full,
tabs.PrivateTab)
if not tab:
return
self._on_chatstate_private_conversation(message, state)
......@@ -846,7 +847,7 @@ class HandlerCore:
tab.chatstate = state
if state == 'gone' and isinstance(tab, tabs.DynamicConversationTab):
tab.unlock()
if tab == self.core.current_tab():
if tab == self.core.tabs.current_tab:
tab.refresh_info_header()
self.core.doupdate()
else:
......@@ -858,12 +859,13 @@ class HandlerCore:
"""
Chatstate received in a private conversation from a MUC
"""
tab = self.core.get_tab_by_name(message['from'].full, tabs.PrivateTab)
tab = self.core.tabs.by_name_and_class(message['from'].full,
tabs.PrivateTab)
if not tab:
return
self.core.events.trigger('private_chatstate', message, tab)
tab.chatstate = state
if tab == self.core.current_tab():
if tab == self.core.tabs.current_tab:
tab.refresh_info_header()
self.core.doupdate()
else:
......@@ -876,11 +878,11 @@ class HandlerCore:
"""
nick = message['mucnick']
room_from = message.get_mucroom()
tab = self.core.get_tab_by_name(room_from, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(room_from, tabs.MucTab)
if tab and tab.get_user_by_name(nick):
self.core.events.trigger('muc_chatstate', message, tab)
tab.get_user_by_name(nick).chatstate = state
if tab == self.core.current_tab():
if tab == self.core.tabs.current_tab:
if not self.core.size.tab_degrade_x:
tab.user_win.refresh(tab.users)
tab.input.refresh()
......@@ -927,7 +929,7 @@ class HandlerCore:
else:
roster.update_contact_groups(jid)
roster.update_size()
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
def on_subscription_request(self, presence):
......@@ -950,7 +952,7 @@ class HandlerCore:
'tab to accept or reject the query.' % jid, 'Roster')
self.core.get_tab_by_number(0).state = 'highlight'
roster.modified()
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
def on_subscription_authorized(self, presence):
......@@ -965,7 +967,7 @@ class HandlerCore:
roster.modified()
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
def on_subscription_remove(self, presence):
......@@ -978,7 +980,7 @@ class HandlerCore:
self.core.information(
'%s does not want to receive your status anymore.' % jid, 'Roster')
self.core.get_tab_by_number(0).state = 'highlight'
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
def on_subscription_removed(self, presence):
......@@ -997,7 +999,7 @@ class HandlerCore:
'%s does not want you to receive his/her/its status anymore.' %
jid, 'Roster')
self.core.get_tab_by_number(0).state = 'highlight'
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
### Presence-related handlers ###
......@@ -1024,9 +1026,9 @@ class HandlerCore:
if tab:
tab.update_status(
Status(show=presence['show'], message=presence['status']))
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
elif self.core.current_tab() == tab:
elif self.core.tabs.current_tab == tab:
tab.refresh()
self.core.doupdate()
......@@ -1037,8 +1039,7 @@ class HandlerCore:
return
roster.modified()
contact.error = presence['error']['type'] + ': ' + presence['error']['condition']
# reset chat states status on presence error
tab = self.core.get_tab_by_name(jid.full, tabs.ConversationTab)
# TODO: reset chat states status on presence error
def on_got_offline(self, presence):
"""
......@@ -1066,7 +1067,7 @@ class HandlerCore:
self.core.information('\x193}%s \x195}is \x191}offline' % name,
'Roster')
roster.modified()
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
def on_got_online(self, presence):
......@@ -1106,7 +1107,7 @@ class HandlerCore:
"\x193}%s \x195}is \x194}online\x195}" % name, "Roster")
self.core.add_information_message_to_conversation_tab(
jid.bare, '\x195}%s is \x194}online' % name)
if isinstance(self.core.current_tab(), tabs.RosterInfoTab):
if isinstance(self.core.tabs.current_tab, tabs.RosterInfoTab):
self.core.refresh_window()
def on_groupchat_presence(self, presence):
......@@ -1116,7 +1117,7 @@ class HandlerCore:
presence information of the concerned user
"""
from_room = presence['from'].bare
tab = self.core.get_tab_by_name(from_room, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(from_room, tabs.MucTab)
if tab:
self.core.events.trigger('muc_presence', presence, tab)
tab.handle_presence(presence)
......@@ -1227,7 +1228,7 @@ class HandlerCore:
Those are received when a room configuration change occurs.
"""
room_from = message['from']
tab = self.core.get_tab_by_name(room_from, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(room_from, tabs.MucTab)
status_codes = {
s.attrib['code']
for s in message.xml.findall('{%s}x/{%s}status' %
......@@ -1321,7 +1322,7 @@ class HandlerCore:
"""
nick_from = message['mucnick']
room_from = message.get_mucroom()
tab = self.core.get_tab_by_name(room_from, tabs.MucTab)
tab = self.core.tabs.by_name_and_class(room_from, tabs.MucTab)
subject = message['subject']
if subject is None or not tab:
return
......@@ -1363,8 +1364,8 @@ class HandlerCore:
typ=2)
tab.topic = subject
tab.topic_from = nick_from
if self.core.get_tab_by_name(room_from,
tabs.MucTab) is self.core.current_tab():
if self.core.tabs.by_name_and_class(
room_from, tabs.MucTab) is self.core.tabs.current_tab:
self.core.refresh_window()
def on_receipt(self, message):
......@@ -1376,8 +1377,9 @@ class HandlerCore:
if not msg_id:
return
conversation = self.core.get_tab_by_name(jid.full, tabs.OneToOneTab)
conversation = conversation or self.core.get_tab_by_name(
conversation = self.core.tabs.by_name_and_class(
jid.full, tabs.OneToOneTab)
conversation = conversation or self.core.tabs.by_name_and_class(
jid.bare, tabs.OneToOneTab)
if not conversation:
log.error("Received ack from non-existing chat tab: %s", jid)
......@@ -1437,8 +1439,8 @@ class HandlerCore:
except:
log.debug('', exc_info=True)
if isinstance(self.core.current_tab(), tabs.XMLTab):
self.core.current_tab().refresh()
if isinstance(self.core.tabs.current_tab, tabs.XMLTab):
self.core.tabs.current_tab.refresh()
self.core.doupdate()
def incoming_stanza(self, stanza):
......@@ -1464,8 +1466,8 @@ class HandlerCore:
nickname=get_theme().CHAR_XML_IN)
except:
log.debug('', exc_info=True)
if isinstance(self.core.current_tab(), tabs.XMLTab):