'nicks': []
}
else:
- self.nicklist[parent]['nicks'].append({'prefix': prefix,
- 'name': name,
- 'visible': visible})
+ self.nicklist[parent]['nicks'].append({
+ 'prefix': prefix,
+ 'name': name,
+ 'visible': visible,
+ })
def nicklist_remove_item(self, parent, group, name):
"""Remove a group/nick from nicklist."""
for group in sorted(self.nicklist):
for nick in sorted(self.nicklist[group]['nicks'],
key=lambda n: n['name']):
- prefix_color = {'': '', ' ': '', '+': 'yellow'}
+ prefix_color = {
+ '': '',
+ ' ': '',
+ '+': 'yellow',
+ }
color = prefix_color.get(nick['prefix'], 'green')
if color:
icon = QtGui.QIcon(
self.send_to_weechat('\n'.join(_PROTO_SYNC_CMDS))
def status_icon(self, status):
- icon = {self.status_disconnected: 'dialog-close.png',
- self.status_connecting: 'dialog-close.png',
- self.status_connected: 'dialog-ok-apply.png'}
+ """Return the name of icon for a given status."""
+ icon = {
+ self.status_disconnected: 'dialog-close.png',
+ self.status_connecting: 'dialog-close.png',
+ self.status_connected: 'dialog-ok-apply.png',
+ }
return icon.get(status, '')
def get_options(self):
- return {'server': self._server,
- 'port': self._port,
- 'ssl': 'on' if self._ssl else 'off',
- 'password': self._password,
- 'lines': str(self._lines)}
+ """Get connection options."""
+ return {
+ 'server': self._server,
+ 'port': self._port,
+ 'ssl': 'on' if self._ssl else 'off',
+ 'password': self._password,
+ 'lines': str(self._lines),
+ }
return ''
def _attrcode_to_char(self, code):
- codes = {'\x01': '*', '\x02': '!', '\x03': '/', '\x04': '_'}
+ codes = {
+ '\x01': '*',
+ '\x02': '!',
+ '\x03': '/',
+ '\x04': '_',
+ }
return codes.get(code, '')
def _convert_color(self, match):
return self._str_value(self.value)
def __str__(self):
- self._obj_cb = {'hda': self._str_value_hdata,
- 'inl': self._str_value_infolist,
- }
+ self._obj_cb = {
+ 'hda': self._str_value_hdata,
+ 'inl': self._str_value_infolist,
+ }
return '%s: %s' % (self.objtype,
self._obj_cb.get(self.objtype,
self._str_value_other)())
"""Decode binary message received from WeeChat/relay."""
def __init__(self):
- self._obj_cb = {'chr': self._obj_char,
- 'int': self._obj_int,
- 'lon': self._obj_long,
- 'str': self._obj_str,
- 'buf': self._obj_buffer,
- 'ptr': self._obj_ptr,
- 'tim': self._obj_time,
- 'htb': self._obj_hashtable,
- 'hda': self._obj_hdata,
- 'inf': self._obj_info,
- 'inl': self._obj_infolist,
- 'arr': self._obj_array,
- }
+ self._obj_cb = {
+ 'chr': self._obj_char,
+ 'int': self._obj_int,
+ 'lon': self._obj_long,
+ 'str': self._obj_str,
+ 'buf': self._obj_buffer,
+ 'ptr': self._obj_ptr,
+ 'tim': self._obj_time,
+ 'htb': self._obj_hashtable,
+ 'hda': self._obj_hdata,
+ 'inf': self._obj_info,
+ 'inl': self._obj_infolist,
+ 'arr': self._obj_array,
+ }
def _obj_type(self):
"""Read type in data (3 chars)."""
item[key] = self._obj_cb[objtype]()
item['__path'] = pointers
items.append(item)
- return {'path': list_path,
- 'keys': dict_keys,
- 'count': count,
- 'items': items,
- }
+ return {
+ 'path': list_path,
+ 'keys': dict_keys,
+ 'count': count,
+ 'items': items,
+ }
def _obj_info(self):
"""Read an info in data."""
var_value = self._obj_cb[var_type]()
variables[var_name] = var_value
items.append(variables)
- return {'name': name, 'items': items}
+ return {
+ 'name': name,
+ 'items': items
+ }
def _obj_array(self):
"""Read an array of values in data."""