summaryrefslogtreecommitdiff
path: root/poezio/tabs
diff options
context:
space:
mode:
authormathieui <mathieui@mathieui.net>2018-07-21 17:09:52 +0200
committermathieui <mathieui@mathieui.net>2018-07-21 17:09:52 +0200
commitea2d76864da2448152428a62fe5c7daaea6ab0d3 (patch)
tree7ac279bb9b1efbe6025a0435d4a121f11080fcb0 /poezio/tabs
parent3ec153a6a01faca5445bb7c21e0d427bb5096320 (diff)
downloadpoezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.tar.gz
poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.tar.bz2
poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.tar.xz
poezio-ea2d76864da2448152428a62fe5c7daaea6ab0d3.zip
yapf -rip
Diffstat (limited to 'poezio/tabs')
-rw-r--r--poezio/tabs/basetabs.py9
-rw-r--r--poezio/tabs/bookmarkstab.py8
-rw-r--r--poezio/tabs/confirmtab.py5
-rw-r--r--poezio/tabs/conversationtab.py5
-rw-r--r--poezio/tabs/listtab.py5
-rw-r--r--poezio/tabs/muctab.py55
-rw-r--r--poezio/tabs/privatetab.py5
-rw-r--r--poezio/tabs/rostertab.py22
-rw-r--r--poezio/tabs/xmltab.py10
9 files changed, 69 insertions, 55 deletions
diff --git a/poezio/tabs/basetabs.py b/poezio/tabs/basetabs.py
index 2865f443..9ba8e6e5 100644
--- a/poezio/tabs/basetabs.py
+++ b/poezio/tabs/basetabs.py
@@ -293,8 +293,8 @@ class Tab:
if self.missing_command_callback is not None:
error_handled = self.missing_command_callback(low)
if not error_handled:
- self.core.information("Unknown command (%s)" %
- (command), 'Error')
+ self.core.information(
+ "Unknown command (%s)" % (command), 'Error')
if command in ('correct', 'say'): # hack
arg = xhtml.convert_simple_to_full_colors(arg)
else:
@@ -685,8 +685,9 @@ class ChatTab(Tab):
'paused')
self.core.add_timed_event(new_event)
self.timed_event_paused = new_event
- new_event = timed_events.DelayedEvent(30, self.send_chat_state,
- 'inactive' if self.inactive else 'active')
+ new_event = timed_events.DelayedEvent(
+ 30, self.send_chat_state, 'inactive'
+ if self.inactive else 'active')
self.core.add_timed_event(new_event)
self.timed_event_not_paused = new_event
diff --git a/poezio/tabs/bookmarkstab.py b/poezio/tabs/bookmarkstab.py
index ceccc99d..1ee623c5 100644
--- a/poezio/tabs/bookmarkstab.py
+++ b/poezio/tabs/bookmarkstab.py
@@ -25,7 +25,8 @@ class BookmarksTab(Tab):
self.new_bookmarks = []
self.removed_bookmarks = []
self.header_win = windows.ColumnHeaderWin(
- ('name', 'room@server/nickname', 'password', 'autojoin', 'storage'))
+ ('name', 'room@server/nickname', 'password', 'autojoin',
+ 'storage'))
self.bookmarks_win = windows.BookmarksWin(
self.bookmarks, self.height - 4, self.width, 1, 0)
self.help_win = windows.HelpText('Ctrl+Y: save, Ctrl+G: cancel, '
@@ -77,8 +78,9 @@ class BookmarksTab(Tab):
if not self.bookmarks[bm.jid]:
self.bookmarks.append(bm)
else:
- self.core.information('Invalid JID for bookmark: %s/%s' %
- (bm.jid, bm.nick), 'Error')
+ self.core.information(
+ 'Invalid JID for bookmark: %s/%s' % (bm.jid, bm.nick),
+ 'Error')
return
for bm in self.removed_bookmarks:
diff --git a/poezio/tabs/confirmtab.py b/poezio/tabs/confirmtab.py
index 28c26122..545bb761 100644
--- a/poezio/tabs/confirmtab.py
+++ b/poezio/tabs/confirmtab.py
@@ -106,8 +106,9 @@ class ConfirmTab(Tab):
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height - 3:
return
- self.dialog.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(), self.width, 1, 0)
+ self.dialog.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width, 1, 0)
self.infowin_bottom.resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
diff --git a/poezio/tabs/conversationtab.py b/poezio/tabs/conversationtab.py
index a8a22b4a..e93fe1e3 100644
--- a/poezio/tabs/conversationtab.py
+++ b/poezio/tabs/conversationtab.py
@@ -376,8 +376,9 @@ class ConversationTab(OneToOneTab):
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height - 3:
return
- self.text_win.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(), self.width, 1, 0)
+ self.text_win.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width, 1, 0)
self.get_info_header().resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
diff --git a/poezio/tabs/listtab.py b/poezio/tabs/listtab.py
index 84dcc38b..1c96f778 100644
--- a/poezio/tabs/listtab.py
+++ b/poezio/tabs/listtab.py
@@ -173,8 +173,9 @@ class ListTab(Tab):
self.info_header.resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
- self.listview.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(), self.width, 1, 0)
+ self.listview.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width, 1, 0)
def on_lose_focus(self):
self.state = 'normal'
diff --git a/poezio/tabs/muctab.py b/poezio/tabs/muctab.py
index 70d66ffb..60d5a64b 100644
--- a/poezio/tabs/muctab.py
+++ b/poezio/tabs/muctab.py
@@ -193,9 +193,9 @@ class MucTab(ChatTab):
valid_affiliations = ('outcast', 'none', 'member', 'admin', 'owner')
if affiliation not in valid_affiliations:
- return self.core.information('The affiliation must be one of ' +
- ', '.join(valid_affiliations),
- 'Error')
+ return self.core.information(
+ 'The affiliation must be one of ' +
+ ', '.join(valid_affiliations), 'Error')
if nick_or_jid in [user.nick for user in self.users]:
muc.set_user_affiliation(
self.core.xmpp,
@@ -220,8 +220,9 @@ class MucTab(ChatTab):
def callback(iq):
if iq['type'] == 'error':
- self.core.information("Could not set role '%s' for '%s'." %
- (role, nick), "Warning")
+ self.core.information(
+ "Could not set role '%s' for '%s'." % (role, nick),
+ "Warning")
valid_roles = ('none', 'visitor', 'participant', 'moderator')
@@ -281,10 +282,8 @@ class MucTab(ChatTab):
user = self.get_user_by_name(self.topic_from)
if user:
user_text = dump_tuple(user.color)
- user_string = '\x19%s}(set by \x19%s}%s\x19%s})' % (info_text,
- user_text,
- user.nick,
- info_text)
+ user_string = '\x19%s}(set by \x19%s}%s\x19%s})' % (
+ info_text, user_text, user.nick, info_text)
else:
user_string = self.topic_from
else:
@@ -650,8 +649,8 @@ class MucTab(ChatTab):
self.core.on_user_rejoined_private_conversation(self.name, from_nick)
def on_user_nick_change(self, presence, user, from_nick, from_room):
- new_nick = presence.xml.find('{%s}x/{%s}item' %
- (NS_MUC_USER, NS_MUC_USER)).attrib['nick']
+ new_nick = presence.xml.find(
+ '{%s}x/{%s}item' % (NS_MUC_USER, NS_MUC_USER)).attrib['nick']
old_color = user.color
if user.nick == self.own_nick:
self.own_nick = new_nick
@@ -959,9 +958,8 @@ class MucTab(ChatTab):
role != user.role):
# display the message in the room
self._text_buffer.add_message(msg)
- self.core.on_user_changed_status_in_private('%s/%s' % (from_room,
- from_nick),
- Status(show, status))
+ self.core.on_user_changed_status_in_private(
+ '%s/%s' % (from_room, from_nick), Status(show, status))
self.users.remove(user)
# finally, effectively change the user status
user.update(affiliation, show, status, role)
@@ -1178,8 +1176,9 @@ class MucTab(ChatTab):
info_win_height = self.core.information_win_size
self.user_win.resize(
- self.height - 3 - info_win_height - tab_win_height, self.width -
- (self.width // 10) * 9 - 1, 1, (self.width // 10) * 9 + 1)
+ self.height - 3 - info_win_height - tab_win_height,
+ self.width - (self.width // 10) * 9 - 1, 1,
+ (self.width // 10) * 9 + 1)
self.v_separator.resize(
self.height - 3 - info_win_height - tab_win_height, 1, 1,
9 * (self.width // 10))
@@ -1223,15 +1222,16 @@ class MucTab(ChatTab):
text_width = self.width
else:
text_width = (self.width // 10) * 9
- self.user_win.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(),
- self.width - (self.width // 10) * 9 - 1, 1,
- (self.width // 10) * 9 + 1)
+ self.user_win.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width - (self.width // 10) * 9 - 1, 1,
+ (self.width // 10) * 9 + 1)
self.v_separator.resize(
self.height - 3 - self.core.information_win_size -
Tab.tab_win_height(), 1, 1, 9 * (self.width // 10))
- self.text_win.resize(self.height - 3 - self.core.information_win_size -
- Tab.tab_win_height(), text_width, 1, 0)
+ self.text_win.resize(
+ self.height - 3 - self.core.information_win_size -
+ Tab.tab_win_height(), text_width, 1, 0)
self.info_header.resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
@@ -1329,8 +1329,9 @@ class MucTab(ChatTab):
nick = args[0]
color = args[1].lower()
if nick == self.own_nick:
- return self.core.information("You cannot change the color of your"
- " own nick.", 'Error')
+ return self.core.information(
+ "You cannot change the color of your"
+ " own nick.", 'Error')
elif color not in xhtml.colors and color not in ('unset', 'random'):
return self.core.information("Unknown color: %s" % color, 'Error')
self.set_nick_color(nick, color)
@@ -1446,9 +1447,9 @@ class MucTab(ChatTab):
affiliation = aff.get(user.affiliation,
get_theme().CHAR_AFFILIATION_NONE)
color = colors.get(user.role, color_other)
- buff.append('\x19%s}%s\x19o\x19%s}%s\x19o' %
- (color, affiliation, dump_tuple(user.color),
- user.nick))
+ buff.append(
+ '\x19%s}%s\x19o\x19%s}%s\x19o' %
+ (color, affiliation, dump_tuple(user.color), user.nick))
buff.append('\n')
message = ' '.join(buff)
diff --git a/poezio/tabs/privatetab.py b/poezio/tabs/privatetab.py
index d0a12232..d2d2f5ac 100644
--- a/poezio/tabs/privatetab.py
+++ b/poezio/tabs/privatetab.py
@@ -307,8 +307,9 @@ class PrivateTab(OneToOneTab):
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height - 3:
return
- self.text_win.resize(self.height - 2 - self.core.information_win_size -
- Tab.tab_win_height(), self.width, 0, 0)
+ self.text_win.resize(
+ self.height - 2 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width, 0, 0)
self.info_header.resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)
diff --git a/poezio/tabs/rostertab.py b/poezio/tabs/rostertab.py
index d4c302a3..6aba2c15 100644
--- a/poezio/tabs/rostertab.py
+++ b/poezio/tabs/rostertab.py
@@ -272,8 +272,9 @@ class RosterInfoTab(Tab):
if not certs:
return self.core.information('No certificates found', 'Info')
msg = 'Certificates:\n'
- msg += '\n'.join(((' %s%s' % (item[0] + (': ' if item[1] else ''),
- item[1])) for item in certs))
+ msg += '\n'.join(
+ ((' %s%s' % (item[0] + (': ' if item[1] else ''), item[1]))
+ for item in certs))
self.core.information(msg, 'Info')
self.core.xmpp.plugin['xep_0257'].get_certs(callback=cb, timeout=3)
@@ -624,7 +625,9 @@ class RosterInfoTab(Tab):
names = list(dir_.iterdir())
except OSError:
names = []
- names_filtered = [name for name in names if str(name).startswith(base)]
+ names_filtered = [
+ name for name in names if str(name).startswith(base)
+ ]
if names_filtered:
names = names_filtered
if not names:
@@ -703,8 +706,8 @@ class RosterInfoTab(Tab):
return
jid = safeJID(safeJID(args[0]).bare)
if not str(jid):
- self.core.information('The provided JID (%s) is not valid' %
- (args[0], ), 'Error')
+ self.core.information(
+ 'The provided JID (%s) is not valid' % (args[0], ), 'Error')
return
if jid in roster and roster[jid].subscription in ('to', 'both'):
return self.core.information('Already subscribed.', 'Roster')
@@ -1267,8 +1270,9 @@ class RosterInfoTab(Tab):
acc.append('Contact: %s (%s)' % (cont.bare_jid, res.presence
if res else 'unavailable'))
if res:
- acc.append('%s connected resource%s' %
- (len(cont), '' if len(cont) == 1 else 's'))
+ acc.append(
+ '%s connected resource%s' % (len(cont), ''
+ if len(cont) == 1 else 's'))
acc.append('Current status: %s' % res.status)
if cont.tune:
acc.append('Tune: %s' % common.format_tune_string(cont.tune))
@@ -1277,8 +1281,8 @@ class RosterInfoTab(Tab):
if cont.activity:
acc.append('Activity: %s' % cont.activity)
if cont.gaming:
- acc.append('Game: %s' %
- (common.format_gaming_string(cont.gaming)))
+ acc.append(
+ 'Game: %s' % (common.format_gaming_string(cont.gaming)))
msg = '\n'.join(acc)
elif isinstance(selected_row, Resource):
res = selected_row
diff --git a/poezio/tabs/xmltab.py b/poezio/tabs/xmltab.py
index 26d5aef3..fc04f778 100644
--- a/poezio/tabs/xmltab.py
+++ b/poezio/tabs/xmltab.py
@@ -261,8 +261,9 @@ class XMLTab(Tab):
xml = self.filtered_buffer.messages[:]
else:
xml = self.core_buffer.messages[:]
- text = '\n'.join(('%s %s %s' % (msg.str_time, msg.nickname,
- clean_text(msg.txt)) for msg in xml))
+ text = '\n'.join(
+ ('%s %s %s' % (msg.str_time, msg.nickname, clean_text(msg.txt))
+ for msg in xml))
filename = os.path.expandvars(os.path.expanduser(args[0]))
try:
with open(filename, 'w') as fd:
@@ -375,8 +376,9 @@ class XMLTab(Tab):
def on_info_win_size_changed(self):
if self.core.information_win_size >= self.height - 3:
return
- self.text_win.resize(self.height - 2 - self.core.information_win_size -
- Tab.tab_win_height(), self.width, 0, 0)
+ self.text_win.resize(
+ self.height - 2 - self.core.information_win_size -
+ Tab.tab_win_height(), self.width, 0, 0)
self.info_header.resize(
1, self.width, self.height - 2 - self.core.information_win_size -
Tab.tab_win_height(), 0)