Fix unused-variable pylint errors
This commit is contained in:
parent
7c558d38a6
commit
cebd83d436
|
@ -612,13 +612,12 @@ class ChatControl(ChatControlBase):
|
|||
self.update_toolbar()
|
||||
|
||||
def _update_banner_state_image(self):
|
||||
contact = app.contacts.get_contact_with_highest_priority(self.account,
|
||||
self.contact.jid)
|
||||
contact = app.contacts.get_contact_with_highest_priority(
|
||||
self.account, self.contact.jid)
|
||||
if not contact or self.resource:
|
||||
# For transient contacts
|
||||
contact = self.contact
|
||||
show = contact.show
|
||||
jid = contact.jid
|
||||
|
||||
# Set banner image
|
||||
icon = gtkgui_helpers.get_iconset_name_for(show)
|
||||
|
@ -727,10 +726,6 @@ class ChatControl(ChatControlBase):
|
|||
getattr(self, 'update_' + jingle_type)()
|
||||
|
||||
def on_jingle_button_toggled(self, state, jingle_type):
|
||||
img_name = 'gajim-%s_%s' % ({'audio': 'mic', 'video': 'cam'}[jingle_type],
|
||||
{True: 'active', False: 'inactive'}[state])
|
||||
path_to_img = gtkgui_helpers.get_icon_path(img_name)
|
||||
|
||||
if state:
|
||||
if getattr(self, jingle_type + '_state') == \
|
||||
self.JINGLE_STATE_NULL:
|
||||
|
@ -768,8 +763,6 @@ class ChatControl(ChatControlBase):
|
|||
self.close_jingle_content(jingle_type)
|
||||
|
||||
def set_lock_image(self):
|
||||
loggable = self.session and self.session.is_loggable()
|
||||
|
||||
encryption_state = {'visible': self.encryption is not None,
|
||||
'enc_type': self.encryption,
|
||||
'authenticated': False}
|
||||
|
@ -797,7 +790,6 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
self.authentication_button.set_tooltip_text(tooltip)
|
||||
self.widget_set_visible(self.authentication_button, not visible)
|
||||
context = self.msg_scrolledwindow.get_style_context()
|
||||
self.lock_image.set_sensitive(visible)
|
||||
|
||||
def _on_authentication_button_clicked(self, widget):
|
||||
|
@ -903,9 +895,6 @@ class ChatControl(ChatControlBase):
|
|||
contact = self.contact
|
||||
keyID = contact.keyID
|
||||
|
||||
chatstates_on = app.config.get('outgoing_chat_state_notifications') != \
|
||||
'disabled'
|
||||
|
||||
chatstate_to_send = None
|
||||
if contact is not None:
|
||||
if contact.supports(NS_CHATSTATES):
|
||||
|
@ -1480,7 +1469,7 @@ class ChatControl(ChatControlBase):
|
|||
return
|
||||
if not self.info_bar_queue:
|
||||
return
|
||||
markup, buttons, args, type_ = self.info_bar_queue[0]
|
||||
markup, buttons, _args, type_ = self.info_bar_queue[0]
|
||||
self.info_bar_label.set_markup(markup)
|
||||
|
||||
# Remove old buttons
|
||||
|
|
|
@ -191,7 +191,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
lb.clear()
|
||||
i = 0
|
||||
sel = 0
|
||||
label_, labellist, default = event.catalog
|
||||
_label, labellist, default = event.catalog
|
||||
for label in labellist:
|
||||
lb.append([label])
|
||||
if label == default:
|
||||
|
@ -571,7 +571,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
|
||||
def _conv_textview_key_press_event(self, widget, event):
|
||||
# translate any layout to latin_layout
|
||||
valid, entries = self.keymap.get_entries_for_keyval(event.keyval)
|
||||
_valid, entries = self.keymap.get_entries_for_keyval(event.keyval)
|
||||
keycode = entries[0].keycode
|
||||
if (event.get_state() & Gdk.ModifierType.CONTROL_MASK and keycode in (
|
||||
self.keycode_c, self.keycode_ins)):
|
||||
|
@ -916,7 +916,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
|
|||
scroll = False if pos == size else True # are we scrolling?
|
||||
# we don't want size of the buffer to grow indefinitely
|
||||
max_size = app.config.get('key_up_lines')
|
||||
for i in range(size - max_size + 1):
|
||||
for _i in range(size - max_size + 1):
|
||||
if pos == 0:
|
||||
break
|
||||
history.pop(0)
|
||||
|
|
|
@ -65,7 +65,7 @@ def parse_arguments(arguments):
|
|||
"""
|
||||
Check if given span intersects with any of options.
|
||||
"""
|
||||
for key, value, (start, end) in opts:
|
||||
for _key, _value, (start, end) in opts:
|
||||
if given_start >= start and given_end <= end:
|
||||
return True
|
||||
return False
|
||||
|
@ -74,7 +74,7 @@ def parse_arguments(arguments):
|
|||
"""
|
||||
Check if given span intersects with any of arguments.
|
||||
"""
|
||||
for arg, (start, end) in args:
|
||||
for _arg, (start, end) in args:
|
||||
if given_start >= start and given_end <= end:
|
||||
return True
|
||||
return False
|
||||
|
@ -124,7 +124,7 @@ def adapt_arguments(command, arguments, args, opts):
|
|||
by an argument - then this argument will be treated just like a
|
||||
normal positional argument.
|
||||
"""
|
||||
spec_args, spec_kwargs, var_args, var_kwargs = command.extract_specification()
|
||||
spec_args, spec_kwargs, var_args, _var_kwargs = command.extract_specification()
|
||||
norm_kwargs = dict(spec_kwargs)
|
||||
|
||||
# Quite complex piece of neck-breaking logic to extract raw
|
||||
|
@ -159,7 +159,7 @@ def adapt_arguments(command, arguments, args, opts):
|
|||
|
||||
if spec_len > 1:
|
||||
try:
|
||||
stopper, (start, end) = args[spec_len - 2]
|
||||
_stopper, (start, end) = args[spec_len - 2]
|
||||
except IndexError:
|
||||
raise CommandError(_("Missing arguments"), command)
|
||||
|
||||
|
@ -206,7 +206,7 @@ def adapt_arguments(command, arguments, args, opts):
|
|||
# corresponding opt-in has been given.
|
||||
if command.expand:
|
||||
expanded = []
|
||||
for spec_key, spec_value in norm_kwargs.items():
|
||||
for spec_key in norm_kwargs.keys():
|
||||
letter = spec_key[0] if len(spec_key) > 1 else None
|
||||
if letter and letter not in expanded:
|
||||
for index, (key, value, position) in enumerate(opts):
|
||||
|
@ -255,7 +255,7 @@ def adapt_arguments(command, arguments, args, opts):
|
|||
if command.overlap:
|
||||
overlapped = args[spec_len:]
|
||||
args = args[:spec_len]
|
||||
for arg, (spec_key, spec_value) in zip(overlapped, spec_kwargs):
|
||||
for arg, spec_key, _spec_value in zip(overlapped, spec_kwargs):
|
||||
opts.append((spec_key, arg))
|
||||
else:
|
||||
raise CommandError(_("Too many arguments"), command)
|
||||
|
@ -288,7 +288,7 @@ def generate_usage(command, complete=True):
|
|||
# Remove some special positional arguments from the specification,
|
||||
# but store their names so they can be used for usage info
|
||||
# generation.
|
||||
sp_source = spec_args.pop(0) if command.source else None
|
||||
_sp_source = spec_args.pop(0) if command.source else None
|
||||
sp_extra = spec_args.pop() if command.extra else None
|
||||
|
||||
kwargs = []
|
||||
|
|
|
@ -82,8 +82,6 @@ gc_passwords = {} # list of the pass required to enter a room
|
|||
automatic_rooms = {} # list of rooms that must be automaticaly configured
|
||||
# and for which we have a list of invities
|
||||
#{account: {room_jid: {'invities': []}}}
|
||||
new_room_nick = None # if it's != None, use this nick instead of asking for
|
||||
# a new nickname when there is a conflict.
|
||||
|
||||
groups = {} # list of groups
|
||||
newly_added = {} # list of contacts that has just signed in
|
||||
|
@ -179,10 +177,10 @@ def detect_dependencies():
|
|||
# ZEROCONF
|
||||
try:
|
||||
if os.name == 'nt':
|
||||
import pybonjour
|
||||
import pybonjour # pylint: disable=unused-variable
|
||||
_dependencies['PYBONJOUR'] = True
|
||||
else:
|
||||
import dbus
|
||||
import dbus # pylint: disable=unused-variable
|
||||
_dependencies['PYTHON-DBUS'] = True
|
||||
except Exception:
|
||||
pass
|
||||
|
@ -238,7 +236,7 @@ def detect_dependencies():
|
|||
try:
|
||||
Gst.init(None)
|
||||
conference = Gst.ElementFactory.make('fsrtpconference', None)
|
||||
session = conference.new_session(Farstream.MediaType.AUDIO)
|
||||
conference.new_session(Farstream.MediaType.AUDIO)
|
||||
except Exception as error:
|
||||
log('gajim').info(error)
|
||||
_dependencies['FARSTREAM'] = True
|
||||
|
@ -248,7 +246,7 @@ def detect_dependencies():
|
|||
# GEOCLUE
|
||||
try:
|
||||
gi.require_version('Geoclue', '2.0')
|
||||
from gi.repository import Geoclue
|
||||
from gi.repository import Geoclue # pylint: disable=unused-variable
|
||||
_dependencies['GEOCLUE'] = True
|
||||
except (ImportError, ValueError):
|
||||
pass
|
||||
|
@ -257,14 +255,14 @@ def detect_dependencies():
|
|||
try:
|
||||
gi.require_version('GUPnPIgd', '1.0')
|
||||
from gi.repository import GUPnPIgd
|
||||
gupnp_igd = GUPnPIgd.SimpleIgd()
|
||||
GUPnPIgd.SimpleIgd()
|
||||
_dependencies['UPNP'] = True
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
# PYCURL
|
||||
try:
|
||||
import pycurl
|
||||
import pycurl # pylint: disable=unused-variable
|
||||
_dependencies['PYCURL'] = True
|
||||
except ImportError:
|
||||
pass
|
||||
|
|
|
@ -1835,7 +1835,7 @@ class Connection(CommonConnection, ConnectionHandlers):
|
|||
|
||||
def accept_insecure_password(self):
|
||||
if self.pasword_callback:
|
||||
callback, type_ = self.pasword_callback
|
||||
callback = self.pasword_callback[0]
|
||||
callback(self.password)
|
||||
self.pasword_callback = None
|
||||
|
||||
|
|
|
@ -496,8 +496,7 @@ class ConnectionHandlers(ConnectionSocks5Bytestream,
|
|||
else:
|
||||
self.awaiting_cids[cid] = [(callback, args, position)]
|
||||
iq = nbxmpp.Iq(to=to, typ='get')
|
||||
data = iq.addChild(name='data', attrs={'cid': cid},
|
||||
namespace=nbxmpp.NS_BOB)
|
||||
iq.addChild(name='data', attrs={'cid': cid}, namespace=nbxmpp.NS_BOB)
|
||||
self.connection.SendAndCallForResponse(iq, self._on_bob_received,
|
||||
{'cid': cid})
|
||||
|
||||
|
|
|
@ -22,10 +22,11 @@ Global Events Dispatcher module.
|
|||
:license: GPL
|
||||
'''
|
||||
|
||||
import logging
|
||||
import traceback
|
||||
|
||||
from nbxmpp import NodeProcessed
|
||||
import logging
|
||||
|
||||
log = logging.getLogger('gajim.c.ged')
|
||||
|
||||
PRECORE = 10
|
||||
|
@ -61,8 +62,8 @@ class GlobalEventsDispatcher:
|
|||
if event_name in self.handlers:
|
||||
handlers_list = self.handlers[event_name]
|
||||
i = 0
|
||||
for i, h in enumerate(handlers_list):
|
||||
if priority < h[0]:
|
||||
for i, handler_tuple in enumerate(handlers_list):
|
||||
if priority < handler_tuple[0]:
|
||||
break
|
||||
else:
|
||||
# no event with smaller prio found, put it at the end
|
||||
|
@ -86,7 +87,7 @@ class GlobalEventsDispatcher:
|
|||
log.debug('%s Args: %s', event_name, str(args))
|
||||
if event_name in self.handlers:
|
||||
node_processed = False
|
||||
for priority, handler in self.handlers[event_name]:
|
||||
for _priority, handler in self.handlers[event_name]:
|
||||
try:
|
||||
if handler(*args, **kwargs):
|
||||
return True
|
||||
|
|
|
@ -685,8 +685,6 @@ def launch_browser_mailer(kind, uri):
|
|||
|
||||
|
||||
def launch_file_manager(path_to_open):
|
||||
if not path_to_open.startswith('file://'):
|
||||
uri = 'file://' + path_to_open
|
||||
if os.name == 'nt':
|
||||
try:
|
||||
os.startfile(path_to_open) # if pywin32 is installed we open
|
||||
|
@ -778,7 +776,7 @@ def play_sound_file(path_to_soundfile):
|
|||
if app.config.get('soundplayer') == '':
|
||||
def _oss_play():
|
||||
sndfile = wave.open(path_to_soundfile, 'rb')
|
||||
(nc, sw, fr, nf, comptype, compname) = sndfile.getparams()
|
||||
nc, sw, fr, nf, _comptype, _compname = sndfile.getparams()
|
||||
dev = oss.open('/dev/dsp', 'w')
|
||||
dev.setparameters(sw * 8, nc, fr)
|
||||
dev.write(sndfile.readframes(nf))
|
||||
|
@ -1356,7 +1354,6 @@ def _get_img_direct(attrs):
|
|||
f = urllib.request.urlopen(req)
|
||||
except Exception as ex:
|
||||
log.debug('Error loading image %s ', attrs['src'] + str(ex))
|
||||
pixbuf = None
|
||||
alt = attrs.get('alt', 'Broken image')
|
||||
else:
|
||||
# Wait 2s between each byte
|
||||
|
@ -1404,7 +1401,7 @@ def _get_img_proxy(attrs, proxy):
|
|||
"""
|
||||
if not app.is_installed('PYCURL'):
|
||||
return '', _('PyCURL is not installed')
|
||||
mem, alt, max_size = '', '', 2*1024*1024
|
||||
alt, max_size = '', 2*1024*1024
|
||||
if 'max_size' in attrs:
|
||||
max_size = attrs['max_size']
|
||||
try:
|
||||
|
@ -1430,7 +1427,6 @@ def _get_img_proxy(attrs, proxy):
|
|||
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_HTTP)
|
||||
elif proxy['type'] == 'socks5':
|
||||
c.setopt(pycurl.PROXYTYPE, pycurl.PROXYTYPE_SOCKS5)
|
||||
x = c.perform()
|
||||
c.close()
|
||||
t = b.getvalue()
|
||||
return (t, attrs.get('alt', ''))
|
||||
|
@ -1446,7 +1442,6 @@ def _get_img_proxy(attrs, proxy):
|
|||
alt += _('Error loading image')
|
||||
except Exception as ex:
|
||||
log.debug('Error loading image %s ', attrs['src'] + str(ex))
|
||||
pixbuf = None
|
||||
alt = attrs.get('alt', 'Broken image')
|
||||
return ('', alt)
|
||||
|
||||
|
|
|
@ -211,7 +211,6 @@ class JingleFileTransfer(JingleContent):
|
|||
self.continue_session_accept(stanza)
|
||||
|
||||
def continue_session_accept(self, stanza):
|
||||
con = self.session.connection
|
||||
if self.state == State.TRANSPORT_REPLACE:
|
||||
# If we are requesting we don't have the file
|
||||
if self.session.werequest:
|
||||
|
@ -300,7 +299,6 @@ class JingleFileTransfer(JingleContent):
|
|||
app.socks5queue.listener.disconnect()
|
||||
if content.getTag('transport').getTag('activated'):
|
||||
self.state = State.TRANSFERING
|
||||
jid = app.get_jid_without_resource(self.session.ourjid)
|
||||
app.socks5queue.send_file(self.file_props,
|
||||
self.session.connection.name, 'client')
|
||||
return
|
||||
|
|
|
@ -213,7 +213,6 @@ class StateTransfering(JingleFileTransferStates):
|
|||
= self.jft.transport._on_proxy_auth_ok
|
||||
# TODO: add on failure
|
||||
else:
|
||||
jid = app.get_jid_without_resource(self.jft.session.ourjid)
|
||||
app.socks5queue.send_file(self.jft.file_props,
|
||||
self.jft.session.connection.name, mode)
|
||||
|
||||
|
|
|
@ -485,23 +485,22 @@ class JingleSession:
|
|||
session-accept)
|
||||
"""
|
||||
# check which contents are accepted
|
||||
for content in jingle.iterTags('content'):
|
||||
creator = content['creator']
|
||||
# TODO
|
||||
name = content['name']
|
||||
# for content in jingle.iterTags('content'):
|
||||
# creator = content['creator']
|
||||
# name = content['name']
|
||||
return
|
||||
|
||||
def __on_content_add(self, stanza, jingle, error, action):
|
||||
if self.state == JingleStates.ENDED:
|
||||
raise OutOfOrder
|
||||
parse_result = self.__parse_contents(jingle)
|
||||
contents = parse_result[0]
|
||||
rejected_contents = parse_result[1]
|
||||
# for name, creator in rejected_contents:
|
||||
# TODO
|
||||
# content = JingleContent()
|
||||
# self.add_content(name, content, creator)
|
||||
# self.__content_reject(content)
|
||||
# self.contents[(content.creator, content.name)].destroy()
|
||||
# rejected_contents = parse_result[1]
|
||||
# for name, creator in rejected_contents:
|
||||
# content = JingleContent()
|
||||
# self.add_content(name, content, creator)
|
||||
# self.__content_reject(content)
|
||||
# self.contents[(content.creator, content.name)].destroy()
|
||||
app.nec.push_incoming_event(JingleRequestReceivedEvent(None,
|
||||
conn=self.connection,
|
||||
jingle_session=self,
|
||||
|
@ -523,7 +522,7 @@ class JingleSession:
|
|||
# Jingle with unknown entities, it SHOULD return a <service-unavailable/>
|
||||
# error.
|
||||
# Lets check what kind of jingle session does the peer want
|
||||
contents, contents_rejected, reason_txt = self.__parse_contents(jingle)
|
||||
contents, _contents_rejected, reason_txt = self.__parse_contents(jingle)
|
||||
|
||||
# If there's no content we understand...
|
||||
if not contents:
|
||||
|
@ -626,7 +625,6 @@ class JingleSession:
|
|||
contents_rejected = []
|
||||
reasons = set()
|
||||
for element in jingle.iterTags('content'):
|
||||
senders = element.getAttr('senders')
|
||||
transport = get_jingle_transport(element.getTag('transport'))
|
||||
if transport:
|
||||
transport.ourjid = self.ourjid
|
||||
|
|
|
@ -116,13 +116,13 @@ def get_context(fingerprint, verify_cb=None, remote_jid=None):
|
|||
# First try user DH parameters, if this fails load the default DH parameters
|
||||
dh_params_name = os.path.join(configpaths.get('MY_CERT'), DH_PARAMS)
|
||||
try:
|
||||
with open(dh_params_name, "r") as dh_params_file:
|
||||
with open(dh_params_name, "r"):
|
||||
ctx.load_tmp_dh(dh_params_name.encode('utf-8'))
|
||||
except FileNotFoundError as err:
|
||||
default_dh_params_name = os.path.join(configpaths.get('DATA'),
|
||||
'other', DEFAULT_DH_PARAMS)
|
||||
try:
|
||||
with open(default_dh_params_name, "r") as default_dh_params_file:
|
||||
with open(default_dh_params_name, "r"):
|
||||
ctx.load_tmp_dh(default_dh_params_name.encode('utf-8'))
|
||||
except FileNotFoundError as err:
|
||||
log.error('Unable to load default DH parameter file: %s, %s',
|
||||
|
@ -193,7 +193,7 @@ def check_cert(jid, fingerprint):
|
|||
try:
|
||||
digest_algo = cert.get_signature_algorithm().decode('utf-8').\
|
||||
split('With')[0]
|
||||
except AttributeError as e:
|
||||
except AttributeError:
|
||||
# Old py-OpenSSL is missing get_signature_algorithm
|
||||
digest_algo = "sha256"
|
||||
if cert.digest(digest_algo) == fingerprint:
|
||||
|
|
|
@ -167,7 +167,7 @@ class Logger:
|
|||
|
||||
try:
|
||||
con.executescript(statement)
|
||||
except Exception as error:
|
||||
except Exception:
|
||||
log.exception('Error')
|
||||
con.close()
|
||||
os.remove(path)
|
||||
|
@ -287,7 +287,7 @@ class Logger:
|
|||
try:
|
||||
self._con.execute("ATTACH DATABASE '%s' AS cache" %
|
||||
self._cache_db_path.replace("'", "''"))
|
||||
except Exception as error:
|
||||
except Exception:
|
||||
log.exception('Error')
|
||||
self._con.close()
|
||||
sys.exit()
|
||||
|
@ -298,7 +298,7 @@ class Logger:
|
|||
self._con.execute("PRAGMA synchronous = NORMAL")
|
||||
else:
|
||||
self._con.execute("PRAGMA synchronous = OFF")
|
||||
except sqlite.Error as e:
|
||||
except sqlite.Error:
|
||||
log.exception('Error')
|
||||
|
||||
@staticmethod
|
||||
|
@ -877,21 +877,20 @@ class Logger:
|
|||
"""
|
||||
jids = self._get_family_jids(account, jid)
|
||||
|
||||
kinds = map(str, [KindConstant.STATUS,
|
||||
KindConstant.GCSTATUS])
|
||||
|
||||
delta = datetime.timedelta(
|
||||
hours=23, minutes=59, seconds=59, microseconds=999999)
|
||||
|
||||
start = date.timestamp()
|
||||
end = (date + delta).timestamp()
|
||||
|
||||
sql = '''
|
||||
SELECT time
|
||||
FROM logs NATURAL JOIN jids WHERE jid IN ({jids})
|
||||
AND time BETWEEN ? AND ?
|
||||
'''.format(jids=', '.join('?' * len(jids)))
|
||||
|
||||
return self._con.execute(sql, tuple(jids) +
|
||||
(date.timestamp(),
|
||||
(date + delta).timestamp())).fetchone()
|
||||
return self._con.execute(
|
||||
sql, tuple(jids) + (start, end)).fetchone()
|
||||
|
||||
def get_room_last_message_time(self, account, jid):
|
||||
"""
|
||||
|
|
|
@ -338,7 +338,6 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
|||
if file_props is None:
|
||||
return
|
||||
self.disconnect_transfer(file_props)
|
||||
sid = file_props.sid
|
||||
|
||||
def disconnect_transfer(self, file_props):
|
||||
if file_props is None:
|
||||
|
@ -434,7 +433,7 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
|
|||
# check if we are connected with an IPv4 address
|
||||
try:
|
||||
socket.inet_aton(my_ip)
|
||||
except socket.error as e:
|
||||
except socket.error:
|
||||
self.connection.send(iq)
|
||||
return
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ class Proxy65Manager:
|
|||
port = item.getAttr('port')
|
||||
try:
|
||||
port = int(port)
|
||||
except (ValueError, TypeError) as e:
|
||||
except (ValueError, TypeError):
|
||||
port = 1080
|
||||
if not host or not jid:
|
||||
self.proxies[proxy]._on_connect_failure()
|
||||
|
|
|
@ -133,7 +133,7 @@ else:
|
|||
"""
|
||||
self.pub.set_source(text, None)
|
||||
self.pub.set_destination(destination, destination_path)
|
||||
output = self.pub.publish(enable_exit_status=enable_exit_status)
|
||||
self.pub.publish(enable_exit_status=enable_exit_status)
|
||||
# kludge until we can get docutils to stop generating (rare)
|
||||
# entities
|
||||
return '\u00a0'.join(self.pub.writer.parts['fragment'].strip().split(
|
||||
|
|
|
@ -530,7 +530,7 @@ class Socks5:
|
|||
self._sock.connect(self._server)
|
||||
self._send=self._sock.send
|
||||
self._recv=self._sock.recv
|
||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError) as e:
|
||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError):
|
||||
pass
|
||||
except Exception as ee:
|
||||
errnum = ee.errno
|
||||
|
@ -1141,8 +1141,9 @@ class Socks5Server(Socks5):
|
|||
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
||||
result = self.start_transfer() # send
|
||||
self.queue.process_result(result, self)
|
||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError) as e:
|
||||
except (OpenSSL.SSL.WantReadError,
|
||||
OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError):
|
||||
log.info('caught SSL exception, ignored')
|
||||
else:
|
||||
self.disconnect()
|
||||
|
@ -1179,8 +1180,9 @@ class Socks5Server(Socks5):
|
|||
return
|
||||
else:
|
||||
self.disconnect()
|
||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError) as e:
|
||||
except (OpenSSL.SSL.WantReadError,
|
||||
OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError):
|
||||
log.info('caught SSL exception, ignored')
|
||||
return
|
||||
if self.state < 5:
|
||||
|
@ -1221,15 +1223,17 @@ class Socks5Client(Socks5):
|
|||
addrlen = 0
|
||||
if address_type == 0x03:
|
||||
addrlen = buff[4]
|
||||
address = struct.unpack('!%ds' % addrlen, buff[5:addrlen + 5])
|
||||
# address = struct.unpack('!%ds' % addrlen, buff[5:addrlen + 5])
|
||||
portlen = len(buff[addrlen + 5:])
|
||||
if portlen == 1:
|
||||
port, = struct.unpack('!B', buff[addrlen + 5])
|
||||
elif portlen == 2:
|
||||
port, = struct.unpack('!H', buff[addrlen + 5:])
|
||||
else: # Gaim bug :)
|
||||
port, = struct.unpack('!H', buff[addrlen + 5:addrlen + 7])
|
||||
# if portlen == 1:
|
||||
# port, = struct.unpack('!B', buff[addrlen + 5])
|
||||
# elif portlen == 2:
|
||||
# port, = struct.unpack('!H', buff[addrlen + 5:])
|
||||
# else: # Gaim bug :)
|
||||
# port, = struct.unpack('!H', buff[addrlen + 5:addrlen + 7])
|
||||
if portlen not in (1, 2):
|
||||
self.remaining_buff = buff[addrlen + 7:]
|
||||
|
||||
self.state = 5 # for senders: init file_props and send '\n'
|
||||
if self.queue.on_success:
|
||||
result = self.queue.send_success_reply(self.file_props,
|
||||
|
@ -1294,8 +1298,9 @@ class Socks5Client(Socks5):
|
|||
self.idlequeue.set_read_timeout(self.fd, STALLED_TIMEOUT)
|
||||
result = self.start_transfer() # receive
|
||||
self.queue.process_result(result, self)
|
||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError) as e:
|
||||
except (OpenSSL.SSL.WantReadError,
|
||||
OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError):
|
||||
log.info('caught SSL exception, ignored')
|
||||
return
|
||||
else:
|
||||
|
@ -1318,8 +1323,9 @@ class Socks5Client(Socks5):
|
|||
result = self.start_transfer() # send
|
||||
self.queue.process_result(result, self)
|
||||
return
|
||||
except (OpenSSL.SSL.WantReadError, OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError) as e:
|
||||
except (OpenSSL.SSL.WantReadError,
|
||||
OpenSSL.SSL.WantWriteError,
|
||||
OpenSSL.SSL.WantX509LookupError):
|
||||
log.info('caught SSL exception, ignored')
|
||||
return
|
||||
self.state += 1
|
||||
|
@ -1430,7 +1436,6 @@ class Socks5Listener(IdleObject):
|
|||
# will fail when port as busy, or we don't have rights to bind
|
||||
try:
|
||||
self._serv.bind(ai[4])
|
||||
f = ai[4]
|
||||
self.ai = ai
|
||||
break
|
||||
except Exception:
|
||||
|
|
|
@ -212,7 +212,7 @@ class P2PClient(IdleObject):
|
|||
return True
|
||||
|
||||
def on_message_sent(self, connection_id):
|
||||
id_, thread_id = \
|
||||
id_, _thread_id = \
|
||||
self.conn_holder.ids_of_awaiting_messages[connection_id].pop(0)
|
||||
if self.on_ok:
|
||||
self.on_ok(id_)
|
||||
|
@ -452,7 +452,7 @@ class P2PConnection(IdleObject, PlugIn):
|
|||
def read_timeout(self):
|
||||
ids = self.client.conn_holder.ids_of_awaiting_messages
|
||||
if self.fd in ids and ids[self.fd]:
|
||||
for (id_, thread_id) in ids[self.fd]:
|
||||
for (_id, thread_id) in ids[self.fd]:
|
||||
if hasattr(self._owner, 'Dispatcher'):
|
||||
self._owner.Dispatcher.Event('', DATA_ERROR, (
|
||||
self.client.to, thread_id))
|
||||
|
|
|
@ -35,14 +35,14 @@ class ConstantRI(IntEnum):
|
|||
|
||||
def test_avahi():
|
||||
try:
|
||||
import dbus
|
||||
import dbus # pylint: disable=unused-variable
|
||||
except ImportError:
|
||||
return False
|
||||
return True
|
||||
|
||||
def test_bonjour():
|
||||
try:
|
||||
import pybonjour
|
||||
import pybonjour # pylint: disable=unused-variable
|
||||
except ImportError:
|
||||
return False
|
||||
except WindowsError: # pylint: disable=undefined-variable
|
||||
|
|
|
@ -176,7 +176,7 @@ class Zeroconf:
|
|||
resolved_info = [(interface, protocol, host, aprotocol, address, int(port))]
|
||||
if name in self.contacts:
|
||||
# Decide whether to try to merge with existing resolved info:
|
||||
old_name, old_domain, old_resolved_info, old_bare_name, old_txt = self.contacts[name]
|
||||
old_name, old_domain, old_resolved_info, old_bare_name, _old_txt = self.contacts[name]
|
||||
if name == old_name and domain == old_domain and bare_name == old_bare_name:
|
||||
# Seems similar enough, try to merge resolved info:
|
||||
for i in range(len(old_resolved_info)):
|
||||
|
@ -210,7 +210,7 @@ class Zeroconf:
|
|||
domain, host, aprotocol, address, port, txt, flags):
|
||||
if not self.connected:
|
||||
return
|
||||
bare_name = name
|
||||
|
||||
if name.find('@') == -1:
|
||||
name = name + '@' + name
|
||||
# update TXT data only, as intended according to resolve_all comment
|
||||
|
|
|
@ -144,7 +144,7 @@ class Zeroconf:
|
|||
log.error('Error in query_record_callback: %s', str(errorCode))
|
||||
return
|
||||
|
||||
name, bare_name, protocol, domain = self._parse_name(hosttarget)
|
||||
name = self._parse_name(hosttarget)[0]
|
||||
|
||||
if name != self.name:
|
||||
# update TXT data only, as intended according to
|
||||
|
|
|
@ -696,9 +696,6 @@ class ConversationTextview(GObject.GObject):
|
|||
childs[6].hide() # join group chat
|
||||
childs[7].hide() # add to roster
|
||||
else: # It's a mail or a JID
|
||||
# load muc icon
|
||||
join_group_chat_menuitem = xml.get_object('join_group_chat_menuitem')
|
||||
|
||||
text = text.lower()
|
||||
if text.startswith('xmpp:'):
|
||||
text = text[5:]
|
||||
|
|
|
@ -1514,7 +1514,7 @@ class Dialog(Gtk.Dialog):
|
|||
self.set_resizable(False)
|
||||
|
||||
for stock, response in buttons:
|
||||
b = self.add_button(stock, response)
|
||||
self.add_button(stock, response)
|
||||
|
||||
if default is not None:
|
||||
self.set_default_response(default)
|
||||
|
@ -1661,7 +1661,6 @@ class VoIPCallReceivedDialog:
|
|||
if response == Gtk.ResponseType.YES:
|
||||
#TODO: Ensure that ctrl.contact.resource == resource
|
||||
jid = app.get_jid_without_resource(self.fjid)
|
||||
resource = app.get_resource_from_jid(self.fjid)
|
||||
ctrl = (app.interface.msg_win_mgr.get_control(self.fjid, self.account)
|
||||
or app.interface.msg_win_mgr.get_control(jid, self.account)
|
||||
or app.interface.new_chat_from_jid(self.account, jid))
|
||||
|
|
|
@ -852,9 +852,9 @@ class AgentBrowser:
|
|||
name = ''
|
||||
if len(identities) > 1:
|
||||
# Check if an identity with server category is present
|
||||
for i, _identity in enumerate(identities):
|
||||
if _identity['category'] == 'server' and 'name' in _identity:
|
||||
name = _identity['name']
|
||||
for _index, identity in enumerate(identities):
|
||||
if identity['category'] == 'server' and 'name' in identity:
|
||||
name = identity['name']
|
||||
break
|
||||
elif 'name' in identities[0]:
|
||||
name = identities[0]['name']
|
||||
|
|
|
@ -1092,7 +1092,6 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
self.authentication_button.set_tooltip_text(tooltip)
|
||||
self.widget_set_visible(self.authentication_button, not visible)
|
||||
context = self.msg_scrolledwindow.get_style_context()
|
||||
self.lock_image.set_sensitive(visible)
|
||||
|
||||
def _on_authentication_button_clicked(self, widget):
|
||||
|
@ -1360,7 +1359,7 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
if kind == 'incoming': # it's a message NOT from us
|
||||
# highlighting and sounds
|
||||
(highlight, sound) = self.highlighting_for_message(text, tim)
|
||||
highlight, _sound = self.highlighting_for_message(text, tim)
|
||||
if contact in self.gc_custom_colors:
|
||||
other_tags_for_name.append('gc_nickname_color_' + \
|
||||
str(self.gc_custom_colors[contact]))
|
||||
|
|
|
@ -329,7 +329,7 @@ class ManageBookmarksWindow:
|
|||
room_jid = room + '@' + server.strip()
|
||||
try:
|
||||
room_jid = helpers.parse_jid(room_jid)
|
||||
except helpers.InvalidFormat as e:
|
||||
except helpers.InvalidFormat:
|
||||
ErrorDialog(
|
||||
_('Invalid server'),
|
||||
_('Character not allowed'),
|
||||
|
|
|
@ -699,7 +699,7 @@ class ChangeNickDialog(InputDialogCheck):
|
|||
change_nick must be set to True when we are already occupant of the room
|
||||
and we are changing our nick
|
||||
"""
|
||||
InputDialogCheck.__init__(self, title, '', checktext=check_text,
|
||||
InputDialogCheck.__init__(self, title, '',
|
||||
input_str='', is_modal=True, ok_handler=None,
|
||||
cancel_handler=None,
|
||||
transient_for=transient_for)
|
||||
|
@ -735,13 +735,6 @@ class ChangeNickDialog(InputDialogCheck):
|
|||
self.account, self.room_jid, self.prompt, self.change_nick = \
|
||||
self.room_queue.pop(0)
|
||||
self.setup_dialog()
|
||||
|
||||
if app.new_room_nick is not None and not app.gc_connected[
|
||||
self.account][self.room_jid] and self.gc_control.nick != \
|
||||
app.new_room_nick:
|
||||
self.dialog.hide()
|
||||
self.on_ok(app.new_room_nick, True)
|
||||
else:
|
||||
self.dialog.show()
|
||||
|
||||
def on_okbutton_clicked(self, widget):
|
||||
|
@ -759,8 +752,6 @@ class ChangeNickDialog(InputDialogCheck):
|
|||
self.on_ok(nick, self.is_checked())
|
||||
|
||||
def on_ok(self, nick, is_checked):
|
||||
if is_checked:
|
||||
app.new_room_nick = nick
|
||||
app.connections[self.account].join_gc(nick, self.room_jid, None,
|
||||
change_nick=self.change_nick)
|
||||
if app.gc_connected[self.account][self.room_jid]:
|
||||
|
|
|
@ -159,7 +159,7 @@ class FeaturesDialog(Gtk.Dialog):
|
|||
return True
|
||||
try:
|
||||
gi.require_version('Secret', '1')
|
||||
from gi.repository import Secret
|
||||
from gi.repository import Secret # pylint: disable=unused-variable
|
||||
except (ValueError, ImportError):
|
||||
return False
|
||||
return True
|
||||
|
|
|
@ -299,7 +299,7 @@ class HistoryWindow:
|
|||
"""
|
||||
if jid_or_name and jid_or_name in self.completion_dict:
|
||||
# a full qualified jid or a contact name was entered
|
||||
info_jid, info_account, info_name, info_completion = self.completion_dict[jid_or_name]
|
||||
info_jid, info_account, _info_name, info_completion = self.completion_dict[jid_or_name]
|
||||
self.jids_to_search = [info_jid]
|
||||
self.jid = info_jid
|
||||
|
||||
|
@ -388,7 +388,7 @@ class HistoryWindow:
|
|||
"""
|
||||
if not self.jid:
|
||||
return
|
||||
year, month, day = widget.get_date() # integers
|
||||
year, month, _day = widget.get_date() # integers
|
||||
if year < 1900:
|
||||
widget.select_month(0, 1900)
|
||||
widget.select_day(1)
|
||||
|
@ -400,8 +400,8 @@ class HistoryWindow:
|
|||
try:
|
||||
log_days = app.logger.get_days_with_logs(
|
||||
self.account, self.jid, year, month)
|
||||
except exceptions.PysqliteOperationalError as e:
|
||||
ErrorDialog(_('Disk Error'), str(e))
|
||||
except exceptions.PysqliteOperationalError as error:
|
||||
ErrorDialog(_('Disk Error'), str(error))
|
||||
return
|
||||
|
||||
for date in log_days:
|
||||
|
|
|
@ -65,7 +65,7 @@ def get_icon_pixmap(icon_name, size=16, color=None, quiet=False):
|
|||
if not iconinfo:
|
||||
raise GLib.GError
|
||||
if color:
|
||||
pixbuf, was_symbolic = iconinfo.load_symbolic(*color)
|
||||
pixbuf, _was_symbolic = iconinfo.load_symbolic(*color)
|
||||
return pixbuf
|
||||
return iconinfo.load_icon()
|
||||
except GLib.GError as error:
|
||||
|
|
|
@ -174,10 +174,9 @@ class Interface:
|
|||
'<b>%s</b>\n'
|
||||
'is in use or registered by another occupant.\n'
|
||||
'Please specify another nickname below:') % room_jid
|
||||
check_text = _('Always use this nickname when there is a conflict')
|
||||
if 'change_nick_dialog' in self.instances:
|
||||
self.instances['change_nick_dialog'].add_room(account, room_jid,
|
||||
prompt)
|
||||
self.instances['change_nick_dialog'].add_room(
|
||||
account, room_jid, prompt)
|
||||
else:
|
||||
self.instances['change_nick_dialog'] = ChangeNickDialog(
|
||||
account, room_jid, title, prompt, transient_for=parent_win)
|
||||
|
@ -198,7 +197,7 @@ class Interface:
|
|||
sec_msg = _('Do you accept this request on account %s?') % account
|
||||
if obj.msg:
|
||||
sec_msg = obj.msg + '\n' + sec_msg
|
||||
dialog = YesNoDialog(_('HTTP (%(method)s) Authorization for '
|
||||
YesNoDialog(_('HTTP (%(method)s) Authorization for '
|
||||
'%(url)s (ID: %(id)s)') % {'method': obj.method, 'url': obj.url,
|
||||
'id': obj.iq_id}, sec_msg, on_response_yes=(on_yes, obj),
|
||||
on_response_no=(response, obj, 'no'))
|
||||
|
@ -207,7 +206,6 @@ class Interface:
|
|||
#('ERROR_ANSWER', account, (id_, fjid, errmsg, errcode))
|
||||
if str(obj.errcode) in ('400', '403', '406') and obj.id_:
|
||||
# show the error dialog
|
||||
ft = self.instances['file_transfers']
|
||||
sid = obj.id_
|
||||
if len(obj.id_) > 3 and obj.id_[2] == '_':
|
||||
sid = obj.id_[3:]
|
||||
|
@ -392,11 +390,6 @@ class Interface:
|
|||
# Contact changed show
|
||||
account = obj.conn.name
|
||||
jid = obj.jid
|
||||
show = obj.show
|
||||
status = obj.status
|
||||
resource = obj.resource or ''
|
||||
|
||||
jid_list = app.contacts.get_jid_list(account)
|
||||
|
||||
# unset custom status
|
||||
if (obj.old_show == 0 and obj.new_show > 1) or \
|
||||
|
@ -415,9 +408,6 @@ class Interface:
|
|||
GLib.timeout_add_seconds(30, self.unblock_signed_in_notifications,
|
||||
account_jid)
|
||||
|
||||
highest = app.contacts.get_contact_with_highest_priority(account, jid)
|
||||
is_highest = (highest and highest.resource == resource)
|
||||
|
||||
ctrl = self.msg_win_mgr.get_control(jid, account)
|
||||
if ctrl and ctrl.session and len(obj.contact_list) > 1:
|
||||
ctrl.remove_session(ctrl.session)
|
||||
|
@ -1188,7 +1178,7 @@ class Interface:
|
|||
def on_cancel():
|
||||
obj.conn.change_status('offline', '')
|
||||
|
||||
dlg = InputDialog(_('Username Conflict'),
|
||||
InputDialog(_('Username Conflict'),
|
||||
_('Please type a new username for your local account'),
|
||||
input_str=obj.alt_name, is_modal=True, ok_handler=on_ok,
|
||||
cancel_handler=on_cancel, transient_for=self.roster.window)
|
||||
|
@ -1212,7 +1202,7 @@ class Interface:
|
|||
return
|
||||
|
||||
proposed_resource += app.config.get('gc_proposed_nick_char')
|
||||
dlg = dialogs.ResourceConflictDialog(_('Resource Conflict'),
|
||||
dialogs.ResourceConflictDialog(_('Resource Conflict'),
|
||||
_('You are already connected to this account with the same '
|
||||
'resource. Please type a new one'), resource=proposed_resource,
|
||||
ok_handler=on_ok)
|
||||
|
@ -1618,7 +1608,7 @@ class Interface:
|
|||
# events.
|
||||
family = app.contacts.get_metacontacts_family(account, jid)
|
||||
if family:
|
||||
nearby_family, bb_jid, bb_account = \
|
||||
_nearby_family, bb_jid, bb_account = \
|
||||
app.contacts.get_nearby_family_and_big_brother(family,
|
||||
account)
|
||||
else:
|
||||
|
@ -1628,7 +1618,6 @@ class Interface:
|
|||
def handle_event(self, account, fjid, type_):
|
||||
w = None
|
||||
ctrl = None
|
||||
session = None
|
||||
|
||||
resource = app.get_resource_from_jid(fjid)
|
||||
jid = app.get_jid_without_resource(fjid)
|
||||
|
@ -2228,7 +2217,7 @@ class Interface:
|
|||
self.roster.send_status(a, show, message)
|
||||
self.roster.send_pep(a, pep_dict)
|
||||
for show in shows:
|
||||
message = self.roster.get_status_message(show, on_message)
|
||||
self.roster.get_status_message(show, on_message)
|
||||
return False
|
||||
|
||||
def show_systray(self):
|
||||
|
@ -2379,7 +2368,7 @@ class Interface:
|
|||
path, size, size, True)
|
||||
else:
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file(path)
|
||||
except GLib.GError as error:
|
||||
except GLib.GError:
|
||||
app.log('avatar').info(
|
||||
'loading avatar %s failed. Try to convert '
|
||||
'avatar image using pillow', filename)
|
||||
|
@ -2735,8 +2724,8 @@ class Interface:
|
|||
|
||||
# Handle screensaver
|
||||
if sys.platform == 'linux':
|
||||
from gajim import logind_listener
|
||||
from gajim import screensaver_listener
|
||||
from gajim import logind_listener # pylint: disable=unused-variable
|
||||
from gajim import screensaver_listener # pylint: disable=unused-variable
|
||||
|
||||
self.show_vcard_when_connect = []
|
||||
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Gajim. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
|
||||
from gi.repository import Gtk, Gio, GLib
|
||||
from nbxmpp.protocol import NS_COMMANDS, NS_FILE, NS_MUC
|
||||
from nbxmpp.protocol import NS_JINGLE_FILE_TRANSFER_5, NS_CONFERENCE
|
||||
|
@ -39,7 +37,6 @@ def build_resources_submenu(contacts, account, action, room_jid=None,
|
|||
iconset = app.config.get('iconset')
|
||||
if not iconset:
|
||||
iconset = app.config.DEFAULT_ICONSET
|
||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||
for c in contacts:
|
||||
item = Gtk.MenuItem.new_with_label(
|
||||
'%s (%s)' % (c.resource, str(c.priority)))
|
||||
|
@ -171,7 +168,7 @@ show_bookmarked=False, force_resource=False):
|
|||
for account in connected_accounts:
|
||||
con = app.connections[account]
|
||||
boomarks = con.get_module('Bookmarks').bookmarks
|
||||
for jid, bookmark in boomarks.items():
|
||||
for jid in boomarks.keys():
|
||||
if jid in r_jids:
|
||||
continue
|
||||
if jid not in app.gc_connected[account] or not \
|
||||
|
@ -222,8 +219,6 @@ control=None, gc_contact=None, is_anonymous=True):
|
|||
edit_groups_menuitem = xml.get_object('edit_groups_menuitem')
|
||||
send_file_menuitem = xml.get_object('send_file_menuitem')
|
||||
assign_openpgp_key_menuitem = xml.get_object('assign_openpgp_key_menuitem')
|
||||
add_special_notification_menuitem = xml.get_object(
|
||||
'add_special_notification_menuitem')
|
||||
information_menuitem = xml.get_object('information_menuitem')
|
||||
history_menuitem = xml.get_object('history_menuitem')
|
||||
send_custom_status_menuitem = xml.get_object('send_custom_status_menuitem')
|
||||
|
|
|
@ -530,7 +530,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
|||
'''Process a img tag.
|
||||
'''
|
||||
mem = ''
|
||||
update = False
|
||||
pixbuf = None
|
||||
replace_mark = None
|
||||
replace_tags = None
|
||||
|
@ -544,7 +543,6 @@ class HtmlHandler(xml.sax.handler.ContentHandler):
|
|||
img).encode('utf-8'))
|
||||
elif loaded is not None:
|
||||
(mem, alt, replace_mark, replace_tags) = loaded
|
||||
update = True
|
||||
else:
|
||||
if self.conv_textview:
|
||||
img_mark = self.textbuf.create_mark(None, self.iter, True)
|
||||
|
@ -929,9 +927,6 @@ class HtmlTextView(Gtk.TextView):
|
|||
childs[6].hide() # join group chat
|
||||
childs[7].hide() # add to roster
|
||||
else: # It's a mail or a JID
|
||||
# load muc icon
|
||||
join_group_chat_menuitem = ui.get_object('join_group_chat_menuitem')
|
||||
|
||||
text = text.lower()
|
||||
if text.startswith('xmpp:'):
|
||||
text = text[5:]
|
||||
|
@ -1125,14 +1120,11 @@ if __name__ == '__main__':
|
|||
if change_cursor:
|
||||
w.set_cursor(get_cursor('XTERM'))
|
||||
change_cursor = None
|
||||
tag_table = htmlview.tv.get_buffer().get_tag_table()
|
||||
for tag in tags:
|
||||
try:
|
||||
if tag.is_anchor:
|
||||
w.set_cursor(get_cursor('HAND2'))
|
||||
change_cursor = tag
|
||||
elif tag == tag_table.lookup('focus-out-line'):
|
||||
over_line = True
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
|
|
@ -59,28 +59,28 @@ class MessageTextView(Gtk.TextView):
|
|||
# needed to know if we undid something
|
||||
self.undo_pressed = False
|
||||
|
||||
_buffer = self.get_buffer()
|
||||
buffer_ = self.get_buffer()
|
||||
self.begin_tags = {}
|
||||
self.end_tags = {}
|
||||
self.color_tags = []
|
||||
self.fonts_tags = []
|
||||
self.other_tags = {}
|
||||
self.placeholder_tag = _buffer.create_tag('placeholder')
|
||||
self.placeholder_tag = buffer_.create_tag('placeholder')
|
||||
self.placeholder_tag.set_property('foreground_rgba',
|
||||
gtkgui_helpers.Color.GREY)
|
||||
self.other_tags['bold'] = _buffer.create_tag('bold')
|
||||
self.other_tags['bold'] = buffer_.create_tag('bold')
|
||||
self.other_tags['bold'].set_property('weight', Pango.Weight.BOLD)
|
||||
self.begin_tags['bold'] = '<strong>'
|
||||
self.end_tags['bold'] = '</strong>'
|
||||
self.other_tags['italic'] = _buffer.create_tag('italic')
|
||||
self.other_tags['italic'] = buffer_.create_tag('italic')
|
||||
self.other_tags['italic'].set_property('style', Pango.Style.ITALIC)
|
||||
self.begin_tags['italic'] = '<em>'
|
||||
self.end_tags['italic'] = '</em>'
|
||||
self.other_tags['underline'] = _buffer.create_tag('underline')
|
||||
self.other_tags['underline'] = buffer_.create_tag('underline')
|
||||
self.other_tags['underline'].set_property('underline', Pango.Underline.SINGLE)
|
||||
self.begin_tags['underline'] = '<span style="text-decoration: underline;">'
|
||||
self.end_tags['underline'] = '</span>'
|
||||
self.other_tags['strike'] = _buffer.create_tag('strike')
|
||||
self.other_tags['strike'] = buffer_.create_tag('strike')
|
||||
self.other_tags['strike'].set_property('strikethrough', True)
|
||||
self.begin_tags['strike'] = '<span style="text-decoration: line-through;">'
|
||||
self.end_tags['strike'] = '</span>'
|
||||
|
@ -90,8 +90,8 @@ class MessageTextView(Gtk.TextView):
|
|||
self.connect('focus-in-event', self._on_focus_in)
|
||||
self.connect('focus-out-event', self._on_focus_out)
|
||||
|
||||
start, end = _buffer.get_bounds()
|
||||
_buffer.insert_with_tags(
|
||||
start = buffer_.get_bounds()[0]
|
||||
buffer_.insert_with_tags(
|
||||
start, self.PLACEHOLDER, self.placeholder_tag)
|
||||
|
||||
def has_text(self):
|
||||
|
@ -178,7 +178,7 @@ class MessageTextView(Gtk.TextView):
|
|||
return new_text # the position after *last* special text
|
||||
|
||||
def get_active_tags(self):
|
||||
start, finish = self.get_active_iters()
|
||||
start = self.get_active_iters()[0]
|
||||
active_tags = []
|
||||
for tag in start.get_tags():
|
||||
active_tags.append(tag.get_property('name'))
|
||||
|
|
|
@ -253,7 +253,7 @@ class PluginsWindow:
|
|||
return
|
||||
model = self.installed_plugins_model
|
||||
|
||||
for i, row in enumerate(model):
|
||||
for _index, row in enumerate(model):
|
||||
if plugin == row[Column.PLUGIN]:
|
||||
model.remove(row.iter)
|
||||
break
|
||||
|
|
|
@ -314,7 +314,7 @@ class PluginManager(metaclass=Singleton):
|
|||
gui_extpoint_name]:
|
||||
try:
|
||||
handlers[0](*args)
|
||||
except Exception as e:
|
||||
except Exception:
|
||||
log.warning('Error executing %s',
|
||||
handlers[0], exc_info=True)
|
||||
|
||||
|
|
|
@ -511,15 +511,12 @@ class GajimRemote(Server):
|
|||
if not keyID:
|
||||
keyID = ''
|
||||
|
||||
connected_account, contact = self._get_account_and_contact(
|
||||
account, jid)
|
||||
connected_account = self._get_account_and_contact(account, jid)[0]
|
||||
if connected_account:
|
||||
connection = app.connections[connected_account]
|
||||
sessions = connection.get_sessions(jid)
|
||||
if sessions:
|
||||
session = sessions[0]
|
||||
else:
|
||||
session = connection.make_new_session(jid)
|
||||
if not sessions:
|
||||
connection.make_new_session(jid)
|
||||
ctrl = app.interface.msg_win_mgr.search_control(
|
||||
jid, connected_account)
|
||||
if ctrl:
|
||||
|
@ -563,7 +560,6 @@ class GajimRemote(Server):
|
|||
return False
|
||||
connected_account = self._get_account_for_groupchat(account, room_jid)
|
||||
if connected_account:
|
||||
connection = app.connections[connected_account]
|
||||
app.nec.push_outgoing_event(
|
||||
GcMessageOutgoingEvent(
|
||||
None,
|
||||
|
|
|
@ -2728,7 +2728,7 @@ class RosterWindow:
|
|||
family = app.contacts.get_metacontacts_family(obj.conn.name,
|
||||
obj.jid)
|
||||
if family:
|
||||
nearby_family, bb_jid, bb_account = \
|
||||
_nearby_family, bb_jid, bb_account = \
|
||||
app.contacts.get_nearby_family_and_big_brother(family,
|
||||
obj.conn.name)
|
||||
else:
|
||||
|
@ -3453,7 +3453,7 @@ class RosterWindow:
|
|||
# several contact to remove at the same time
|
||||
pritext = _('Contacts will be removed from your roster')
|
||||
jids = ''
|
||||
for (contact, account) in list_:
|
||||
for contact, _account in list_:
|
||||
jids += '\n ' + contact.get_shown_name() + ' (%s)' % \
|
||||
contact.jid + ','
|
||||
sectext = _('By removing these contacts:%s\nyou also remove '
|
||||
|
@ -4742,7 +4742,7 @@ class RosterWindow:
|
|||
type_ = model[titer][Column.TYPE]
|
||||
except TypeError:
|
||||
return
|
||||
theme = app.config.get('roster_theme')
|
||||
|
||||
if type_ == 'account':
|
||||
color = app.css_config.get_value('.gajim-account-row', StyleAttr.COLOR)
|
||||
renderer.set_property('foreground', color)
|
||||
|
@ -4875,12 +4875,10 @@ class RosterWindow:
|
|||
renderer.set_property('visible', False)
|
||||
|
||||
def _set_account_row_background_color(self, renderer):
|
||||
theme = app.config.get('roster_theme')
|
||||
color = app.css_config.get_value('.gajim-account-row', StyleAttr.BACKGROUND)
|
||||
renderer.set_property('cell-background', color)
|
||||
|
||||
def _set_contact_row_background_color(self, renderer, jid, account):
|
||||
theme = app.config.get('roster_theme')
|
||||
if jid in app.newly_added[account]:
|
||||
renderer.set_property('cell-background', app.css_config.get_value(
|
||||
'.gajim-roster-connected', StyleAttr.BACKGROUND))
|
||||
|
@ -4892,7 +4890,6 @@ class RosterWindow:
|
|||
renderer.set_property('cell-background', color)
|
||||
|
||||
def _set_group_row_background_color(self, renderer):
|
||||
theme = app.config.get('roster_theme')
|
||||
color = app.css_config.get_value('.gajim-group-row', 'background')
|
||||
renderer.set_property('cell-background', color)
|
||||
|
||||
|
@ -4904,9 +4901,6 @@ class RosterWindow:
|
|||
def build_account_menu(self, account):
|
||||
# we have to create our own set of icons for the menu
|
||||
# using self.jabber_status_images is poopoo
|
||||
iconset = app.config.get('iconset')
|
||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||
|
||||
if not app.config.get_per('accounts', account, 'is_zeroconf'):
|
||||
xml = gtkgui_helpers.get_gtk_builder('account_context_menu.ui')
|
||||
account_context_menu = xml.get_object('account_context_menu')
|
||||
|
@ -5063,8 +5057,6 @@ class RosterWindow:
|
|||
menu = self.build_account_menu(account)
|
||||
else:
|
||||
menu = Gtk.Menu()
|
||||
iconset = app.config.get('iconset')
|
||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||
accounts = [] # Put accounts in a list to sort them
|
||||
for account in app.connections:
|
||||
accounts.append(account)
|
||||
|
@ -5088,7 +5080,6 @@ class RosterWindow:
|
|||
Make group's popup menu
|
||||
"""
|
||||
model = self.modelfilter
|
||||
path = model.get_path(titer)
|
||||
group = model[titer][Column.JID]
|
||||
account = model[titer][Column.ACCOUNT]
|
||||
|
||||
|
@ -5155,8 +5146,6 @@ class RosterWindow:
|
|||
send_custom_status_menuitem.set_sensitive(False)
|
||||
status_menuitems = Gtk.Menu()
|
||||
send_custom_status_menuitem.set_submenu(status_menuitems)
|
||||
iconset = app.config.get('iconset')
|
||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||
for s in ('online', 'chat', 'away', 'xa', 'dnd', 'offline'):
|
||||
status_menuitem = Gtk.MenuItem.new_with_label(
|
||||
helpers.get_uf_show(s))
|
||||
|
@ -5343,7 +5332,6 @@ class RosterWindow:
|
|||
"""
|
||||
model = self.modelfilter
|
||||
jid = model[titer][Column.JID]
|
||||
path = model.get_path(titer)
|
||||
account = model[titer][Column.ACCOUNT]
|
||||
contact = app.contacts.get_contact_with_highest_priority(account, jid)
|
||||
menu = gui_menu_builder.get_transport_menu(contact, account)
|
||||
|
|
|
@ -171,14 +171,6 @@ class ChatControlSession:
|
|||
self.conn.name, obj.jid) and not pm:
|
||||
return True
|
||||
|
||||
highest_contact = app.contacts.get_contact_with_highest_priority(
|
||||
self.conn.name, obj.jid)
|
||||
|
||||
# does this resource have the highest priority of any available?
|
||||
is_highest = not highest_contact or not highest_contact.resource or \
|
||||
obj.resource == highest_contact.resource or highest_contact.show ==\
|
||||
'offline'
|
||||
|
||||
if not self.control:
|
||||
ctrl = app.interface.msg_win_mgr.search_control(obj.jid,
|
||||
obj.conn.name, obj.resource)
|
||||
|
@ -414,7 +406,7 @@ class ChatControlSession:
|
|||
# events.
|
||||
family = app.contacts.get_metacontacts_family(self.conn.name, jid)
|
||||
if family:
|
||||
nearby_family, bb_jid, bb_account = \
|
||||
_nearby_family, bb_jid, bb_account = \
|
||||
app.contacts.get_nearby_family_and_big_brother(family,
|
||||
self.conn.name)
|
||||
else:
|
||||
|
|
|
@ -195,10 +195,6 @@ class StatusIcon:
|
|||
gc_sub_menu = Gtk.Menu() # gc is always a submenu
|
||||
join_gc_menuitem.set_submenu(gc_sub_menu)
|
||||
|
||||
# We need our own set of status icons, let's make 'em!
|
||||
iconset = app.config.get('iconset')
|
||||
path = os.path.join(helpers.get_iconset_path(iconset), '16x16')
|
||||
|
||||
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
||||
uf_show = helpers.get_uf_show(show, use_mnemonic=True)
|
||||
item = Gtk.MenuItem.new_with_mnemonic(uf_show)
|
||||
|
|
Loading…
Reference in New Issue