Philipp Hörist pushed to branch master at gajim / gajim
Commits:
50e44543 by Philipp Hörist at 2018-09-15T23:19:09Z
Fix len-as-condition pylint error
- - - - -
1 changed file:
- gajim/gtk/add_contact.py
Changes:
=====================================
gajim/gtk/add_contact.py
=====================================
--- a/gajim/gtk/add_contact.py
+++ b/gajim/gtk/add_contact.py
@@ -358,7 +358,7 @@ class AddNewContactWindow(Gtk.ApplicationWindow):
type_ = model[iter_][2]
model = self.protocol_jid_combobox.get_model()
model.clear()
- if len(self.agents[type_]):
+ if self.agents[type_]:
for jid_ in self.agents[type_]:
model.append([jid_])
self.protocol_jid_combobox.set_active(0)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/50e44543f3d4254fa2952c22b2a1e51eca…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/50e44543f3d4254fa2952c22b2a1e51eca…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
49ca2382 by Philipp Hörist at 2018-09-15T23:10:04Z
Fix len-as-condition pylint errors
- - - - -
26 changed files:
- gajim/adhoc_commands.py
- gajim/atom_window.py
- gajim/chat_control.py
- gajim/chat_control_base.py
- gajim/common/app.py
- gajim/common/connection.py
- gajim/common/contacts.py
- gajim/common/helpers.py
- gajim/common/optparser.py
- gajim/common/socks5.py
- gajim/common/zeroconf/client_zeroconf.py
- gajim/dataforms_widget.py
- gajim/filetransfers_window.py
- gajim/gajim_remote.py
- gajim/groupchat_control.py
- gajim/gtk/dialogs.py
- gajim/gtk/preferences.py
- gajim/gtk/privacy_list.py
- gajim/gui_interface.py
- gajim/gui_menu_builder.py
- gajim/message_window.py
- gajim/music_track_listener.py
- gajim/roster_window.py
- gajim/search_window.py
- gajim/session.py
- gajim/statusicon.py
Changes:
=====================================
gajim/adhoc_commands.py
=====================================
--- a/gajim/adhoc_commands.py
+++ b/gajim/adhoc_commands.py
@@ -236,7 +236,7 @@ class CommandWindow:
# close old stage
self.stage_finish()
- assert len(self.commandlist)>0
+ assert self.commandlist
self.stages_notebook.set_current_page(
self.stages_notebook.page_num(self.command_list_stage_vbox))
=====================================
gajim/atom_window.py
=====================================
--- a/gajim/atom_window.py
+++ b/gajim/atom_window.py
@@ -48,7 +48,7 @@ class AtomWindow:
"""
Create new window... only if we have anything to show
"""
- assert len(self.__class__.entries)
+ assert self.__class__.entries
self.entry = None # the entry actually displayed
@@ -72,7 +72,7 @@ class AtomWindow:
"""
Get next entry from the queue and display it in the window
"""
- assert len(self.__class__.entries)>0
+ assert self.__class__.entries
newentry = self.__class__.entries.pop(0)
=====================================
gajim/chat_control.py
=====================================
--- a/gajim/chat_control.py
+++ b/gajim/chat_control.py
@@ -1377,7 +1377,7 @@ class ChatControl(ChatControlBase):
local_old_kind = None
else:
local_old_kind = kind
- if len(rows):
+ if rows:
self.conv_textview.print_empty_line()
def read_queue(self):
=====================================
gajim/chat_control_base.py
=====================================
--- a/gajim/chat_control_base.py
+++ b/gajim/chat_control_base.py
@@ -1222,7 +1222,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
else: # Not a GC
types_list = ['printed_' + type_, type_]
- if not len(app.events.get_events(self.account, jid, types_list)):
+ if not app.events.get_events(self.account, jid, types_list):
return
if not self.parent_win:
return
=====================================
gajim/common/app.py
=====================================
--- a/gajim/common/app.py
+++ b/gajim/common/app.py
@@ -481,7 +481,7 @@ def get_transport_name_from_jid(jid, use_config_setting = True):
# host is now f.e. icq.foo.org or just icq (sometimes on hacky transports)
host_splitted = host.split('.')
- if len(host_splitted) != 0:
+ if host_splitted:
# now we support both 'icq.' and 'icq' but not icqsucks.org
host = host_splitted[0]
=====================================
gajim/common/connection.py
=====================================
--- a/gajim/common/connection.py
+++ b/gajim/common/connection.py
@@ -1275,7 +1275,7 @@ class Connection(CommonConnection, ConnectionHandlers):
for mech in auth_mechs:
if mech not in nbxmpp.auth_nb.SASL_AUTHENTICATION_MECHANISMS | set(['XEP-0078']):
log.warning("Unknown authentication mechanisms %s" % mech)
- if len(auth_mechs) == 0:
+ if not auth_mechs:
auth_mechs = None
else:
auth_mechs = set(auth_mechs)
@@ -1453,7 +1453,7 @@ class Connection(CommonConnection, ConnectionHandlers):
self._on_stun_resolved)
def _on_stun_resolved(self, host, result_array):
- if len(result_array) != 0:
+ if result_array:
self._stun_servers = self._hosts = [i for i in result_array]
@helpers.call_counter
=====================================
gajim/common/contacts.py
=====================================
--- a/gajim/common/contacts.py
+++ b/gajim/common/contacts.py
@@ -156,7 +156,7 @@ class Contact(CommonContact):
return False
if self.sub in ('none', 'from') and self.ask == 'subscribe':
return False
- if self.sub in ('none', 'from') and (self.name or len(self.groups)):
+ if self.sub in ('none', 'from') and (self.name or self.groups):
return False
if _('Not in Roster') in self.groups:
return False
@@ -486,7 +486,7 @@ class Contacts():
return
if contact in self._contacts[contact.jid]:
self._contacts[contact.jid].remove(contact)
- if len(self._contacts[contact.jid]) == 0:
+ if not self._contacts[contact.jid]:
del self._contacts[contact.jid]
def remove_jid(self, jid):
@@ -626,7 +626,7 @@ class GC_Contacts():
return
del self._rooms[gc_contact.room_jid][gc_contact.name]
# It was the last nick in room ?
- if not len(self._rooms[gc_contact.room_jid]):
+ if not self._rooms[gc_contact.room_jid]:
del self._rooms[gc_contact.room_jid]
def remove_room(self, room_jid):
=====================================
gajim/common/helpers.py
=====================================
--- a/gajim/common/helpers.py
+++ b/gajim/common/helpers.py
@@ -214,7 +214,7 @@ def prep(user, server, resource):
if server is not None:
if server.endswith('.'): # RFC7622, 3.2
server = server[:-1]
- if len(server) < 1 or len(server.encode('utf-8')) > 1023:
+ if not server or len(server.encode('utf-8')) > 1023:
raise InvalidFormat(_('Server must be between 1 and 1023 bytes'))
try:
from nbxmpp.stringprepare import nameprep
@@ -225,7 +225,7 @@ def prep(user, server, resource):
raise InvalidFormat(_('Server address required.'))
if user is not None:
- if len(user) < 1 or len(user.encode('utf-8')) > 1023:
+ if not user or len(user.encode('utf-8')) > 1023:
raise InvalidFormat(_('Username must be between 1 and 1023 bytes'))
try:
if HAS_PRECIS_I18N:
@@ -239,7 +239,7 @@ def prep(user, server, resource):
user = None
if resource is not None:
- if len(resource) < 1 or len(resource.encode('utf-8')) > 1023:
+ if not resource or len(resource.encode('utf-8')) > 1023:
raise InvalidFormat(_('Resource must be between 1 and 1023 bytes'))
try:
if HAS_PRECIS_I18N:
@@ -1054,7 +1054,7 @@ def get_notification_icon_tooltip_text():
accounts = get_notification_icon_tooltip_dict()
- if len(accounts) == 0:
+ if not accounts:
# No configured account
return _('Gajim')
=====================================
gajim/common/optparser.py
=====================================
--- a/gajim/common/optparser.py
+++ b/gajim/common/optparser.py
@@ -126,11 +126,11 @@ class OptionsParser:
def update_config(self, old_version, new_version):
old_version_list = old_version.split('.') # convert '0.x.y' to (0, x, y)
old = []
- while len(old_version_list):
+ while old_version_list:
old.append(int(old_version_list.pop(0)))
new_version_list = new_version.split('.')
new = []
- while len(new_version_list):
+ while new_version_list:
new.append(int(new_version_list.pop(0)))
if old < [0, 14, 0, 1] and new >= [0, 14, 0, 1]:
=====================================
gajim/common/socks5.py
=====================================
--- a/gajim/common/socks5.py
+++ b/gajim/common/socks5.py
@@ -426,7 +426,7 @@ class SocksQueue:
self.remove_sender_by_key(key, do_disconnect=do_disconnect)
if not remove_all:
break
- if len(self.senders) == 0 and self.listener is not None:
+ if not self.senders and self.listener is not None:
self.listener.disconnect()
self.listener = None
self.connected -= 1
@@ -646,7 +646,7 @@ class Socks5(object):
except Exception:
add = b''
received += add
- if len(add) == 0:
+ if not add:
self.disconnect()
return add
@@ -676,7 +676,7 @@ class Socks5(object):
self.file_props.error = -7 # unable to read from file
return -1
buff = self.file.read(MAX_BUFF_LEN)
- if len(buff) > 0:
+ if buff:
lenn = 0
try:
lenn = self._send(buff)
@@ -765,7 +765,7 @@ class Socks5(object):
self.file_props.last_time
self.file_props.last_time = current_time
self.file_props.received_len += len(buff)
- if len(buff) == 0:
+ if not buff:
# Transfer stopped somehow:
# reset, paused or network error
self.rem_fd(fd)
=====================================
gajim/common/zeroconf/client_zeroconf.py
=====================================
--- a/gajim/common/zeroconf/client_zeroconf.py
+++ b/gajim/common/zeroconf/client_zeroconf.py
@@ -373,14 +373,16 @@ class P2PConnection(IdleObject, PlugIn):
except socket.gaierror as e:
log.info('Lookup failure for %s: %s[%s]', self.host, e[1],
repr(e[0]), exc_info=True)
- if len(self.addresses_) > 0: return self.get_next_addrinfo()
+ if self.addresses_:
+ return self.get_next_addrinfo()
else:
self.connect_to_next_ip()
def connect_to_next_ip(self):
- if len(self.ais) == 0:
+ if not self.ais:
log.error('Connection failure to %s', str(self.host), exc_info=True)
- if len(self.addresses_) > 0: return self.get_next_addrinfo()
+ if self.addresses_:
+ return self.get_next_addrinfo()
self.disconnect()
return
ai = self.ais.pop(0)
@@ -449,7 +451,7 @@ class P2PConnection(IdleObject, PlugIn):
def read_timeout(self):
ids = self.client.conn_holder.ids_of_awaiting_messages
- if self.fd in ids and len(ids[self.fd]) > 0:
+ if self.fd in ids and ids[self.fd]:
for (id_, thread_id) in ids[self.fd]:
if hasattr(self._owner, 'Dispatcher'):
self._owner.Dispatcher.Event('', DATA_ERROR, (
=====================================
gajim/dataforms_widget.py
=====================================
--- a/gajim/dataforms_widget.py
+++ b/gajim/dataforms_widget.py
@@ -265,7 +265,7 @@ class DataFormWidget(Gtk.Alignment, object):
self.up_button.set_sensitive(False)
self.down_button.set_sensitive(False)
- if len(model) == 0:
+ if not model:
self.clear_button.set_sensitive(False)
else:
self.clear_button.set_sensitive(True)
=====================================
gajim/filetransfers_window.py
=====================================
--- a/gajim/filetransfers_window.py
+++ b/gajim/filetransfers_window.py
@@ -532,7 +532,7 @@ class FileTransfersWindow:
return _('%(hours)02.d:%(minutes)02.d:%(seconds)02.d') % times
def _get_eta_and_speed(self, full_size, transfered_size, file_props):
- if len(file_props.transfered_size) == 0:
+ if not file_props.transfered_size:
return 0., 0.
elif len(file_props.transfered_size) == 1:
speed = round(float(transfered_size) / file_props.elapsed_time)
@@ -739,7 +739,7 @@ class FileTransfersWindow:
Check if there are transfer rows and set cleanup_button sensitive, or
insensitive if model is empty
"""
- if len(self.model) == 0:
+ if not self.model:
self.cleanup_button.set_sensitive(False)
else:
self.cleanup_button.set_sensitive(True)
=====================================
gajim/gajim_remote.py
=====================================
--- a/gajim/gajim_remote.py
+++ b/gajim/gajim_remote.py
@@ -369,7 +369,7 @@ class GajimRemote:
str_ = _('Usage: %(basename)s %(command)s %(arguments)s \n\t %(help)s')\
% {'basename': BASENAME, 'command': command,
'arguments': arguments_str, 'help': command_props[0]}
- if len(command_props[1]) > 0:
+ if command_props[1]:
str_ += '\n\n' + _('Arguments:') + '\n'
for argument in command_props[1]:
str_ += ' ' + argument[0] + ' - ' + argument[1] + '\n'
=====================================
gajim/groupchat_control.py
=====================================
--- a/gajim/groupchat_control.py
+++ b/gajim/groupchat_control.py
@@ -1702,8 +1702,7 @@ class GroupchatControl(ChatControlBase):
gc_contact = app.contacts.get_gc_contact(self.account, self.room_jid,
nick)
theme = Gtk.IconTheme.get_default()
- if len(app.events.get_events(self.account, self.room_jid + '/' + \
- nick)):
+ if app.events.get_events(self.account, self.room_jid + '/' + nick):
icon_name = gtkgui_helpers.get_iconset_name_for('event')
surface = theme.load_surface(icon_name, 16, self.scale_factor, None, 0)
else:
@@ -1914,8 +1913,8 @@ class GroupchatControl(ChatControlBase):
self.autorejoin = False
self.print_conversation(obj.reason, 'info', graphics=False)
- if len(app.events.get_events(self.account, jid=obj.fjid,
- types=['pm'])) == 0:
+ if not app.events.get_events(
+ self.account, jid=obj.fjid, types=['pm']):
self.remove_contact(obj.nick)
self.draw_all_roles()
else:
@@ -2471,7 +2470,7 @@ class GroupchatControl(ChatControlBase):
# nick completion
# check if tab is pressed with empty message
- if len(splitted_text): # if there are any words
+ if splitted_text: # if there are any words
begin = splitted_text[-1] # last word we typed
else:
begin = ''
@@ -2485,7 +2484,7 @@ class GroupchatControl(ChatControlBase):
gc_refer_to_nick_char + ' '):
with_refer_to_nick_char = True
after_nick_len = len(gc_refer_to_nick_char + ' ')
- if len(self.nick_hits) and self.last_key_tabs and \
+ if self.nick_hits and self.last_key_tabs and \
text[:-after_nick_len].endswith(self.nick_hits[0]):
# we should cycle
# Previous nick in list may had a space inside, so we check text
@@ -2512,7 +2511,7 @@ class GroupchatControl(ChatControlBase):
helpers.jid_is_blocked(self.account, fjid):
# the word is the beginning of a nick
self.nick_hits.append(nick)
- if len(self.nick_hits):
+ if self.nick_hits:
if len(splitted_text) < 2 or with_refer_to_nick_char:
# This is the 1st word of the line or no word or we are cycling
# at the beginning, possibly with a space in one nick
=====================================
gajim/gtk/dialogs.py
=====================================
--- a/gajim/gtk/dialogs.py
+++ b/gajim/gtk/dialogs.py
@@ -727,7 +727,7 @@ class ChangeNickDialog(InputDialogCheck):
app.config.get('gc_proposed_nick_char'))
def check_next(self):
- if len(self.room_queue) == 0:
+ if not self.room_queue:
self.cancel_handler = None
self.dialog.destroy()
if 'change_nick_dialog' in app.interface.instances:
=====================================
gajim/gtk/preferences.py
=====================================
--- a/gajim/gtk/preferences.py
+++ b/gajim/gtk/preferences.py
@@ -475,7 +475,7 @@ class Preferences(Gtk.ApplicationWindow):
Return the value of the option opt if it's the same in all accounts else
returns "mixed"
"""
- if len(app.connections) == 0:
+ if not app.connections:
# a non existent key return default value
return app.config.get_per('accounts', '__default__', opt)
val = None
=====================================
gajim/gtk/privacy_list.py
=====================================
--- a/gajim/gtk/privacy_list.py
+++ b/gajim/gtk/privacy_list.py
@@ -153,7 +153,7 @@ class PrivacyListWindow:
self.max_order = int(rule['order'])
self.global_rules[text_item] = rule
model.append([text_item])
- if len(rules) == 0:
+ if not rules:
self.title_hbox.set_sensitive(False)
self.list_of_rules_combobox.set_sensitive(False)
self.delete_rule_button.set_sensitive(False)
@@ -474,7 +474,7 @@ class PrivacyListsWindow:
self.draw_widgets()
def draw_widgets(self):
- if len(self.privacy_lists_save) == 0:
+ if not self.privacy_lists_save:
self.list_of_privacy_lists_combobox.set_sensitive(False)
self.open_privacy_list_button.set_sensitive(False)
self.delete_privacy_list_button.set_sensitive(False)
=====================================
gajim/gui_interface.py
=====================================
--- a/gajim/gui_interface.py
+++ b/gajim/gui_interface.py
@@ -1974,7 +1974,7 @@ class Interface:
if s.control:
session = s
break
- if not session and not len(sessions) == 0:
+ if not session and sessions:
# there are no sessions with chat controls, just take the first
# one
session = sessions[0]
@@ -2018,7 +2018,7 @@ class Interface:
mw.new_tab(chat_control)
- if len(app.events.get_events(account, fjid)):
+ if app.events.get_events(account, fjid):
# We call this here to avoid race conditions with widget validation
chat_control.read_queue()
@@ -2038,7 +2038,7 @@ class Interface:
if not ctrl:
ctrl = self.new_chat(contact, account,
resource=resource)
- if len(app.events.get_events(account, fjid)):
+ if app.events.get_events(account, fjid):
ctrl.read_queue()
if message:
@@ -2644,7 +2644,7 @@ class Interface:
# except Exception:
# pass
# add default status messages if there is not in the config file
- if len(app.config.get_per('statusmsg')) == 0:
+ if not app.config.get_per('statusmsg'):
default = app.config.statusmsg_default
for msg in default:
app.config.add_per('statusmsg', msg)
@@ -2662,7 +2662,7 @@ class Interface:
default[msg][5])
# Add Tor proxy if there is not in the config
- if len(app.config.get_per('proxies')) == 0:
+ if not app.config.get_per('proxies'):
default = app.config.proxies_default
for proxy in default:
app.config.add_per('proxies', proxy)
@@ -2807,7 +2807,7 @@ class PassphraseRequest:
self.callbacks.remove((acct, cb))
else:
self.callbacks = []
- if not len(self.callbacks):
+ if not self.callbacks:
self.dialog.window.destroy()
def run_callback(self, account, callback):
=====================================
gajim/gui_menu_builder.py
=====================================
--- a/gajim/gui_menu_builder.py
+++ b/gajim/gui_menu_builder.py
@@ -111,7 +111,7 @@ show_bookmarked=False, force_resource=False):
for (c, a) in list_:
if c.supports(NS_MUC):
list2.append((c, a))
- if len(list2) > 0:
+ if list2:
invite_to_new_room_menuitem.connect('activate',
roster.on_invite_to_new_room, list2, None)
else:
@@ -144,7 +144,7 @@ show_bookmarked=False, force_resource=False):
app.gc_connected[acct][room_jid] and \
contacts_transport in ['jabber', None]:
rooms.append((room_jid, acct))
- if len(rooms):
+ if rooms:
item = Gtk.SeparatorMenuItem.new() # separator
invite_to_submenu.append(item)
for (room_jid, account) in rooms:
=====================================
gajim/message_window.py
=====================================
--- a/gajim/message_window.py
+++ b/gajim/message_window.py
@@ -570,7 +570,7 @@ class MessageWindow(object):
del self._controls[ctrl.account][fjid]
- if len(self._controls[ctrl.account]) == 0:
+ if not self._controls[ctrl.account]:
del self._controls[ctrl.account]
self.check_tabs()
=====================================
gajim/music_track_listener.py
=====================================
--- a/gajim/music_track_listener.py
+++ b/gajim/music_track_listener.py
@@ -155,7 +155,7 @@ class MusicTrackListener(GObject.GObject):
info.title = meta.get('xesam:title')
info.album = meta.get('xesam:album')
artist = meta.get('xesam:artist')
- if artist is not None and len(artist):
+ if artist:
info.artist = artist[0]
else:
info.artist = None
=====================================
gajim/roster_window.py
=====================================
--- a/gajim/roster_window.py
+++ b/gajim/roster_window.py
@@ -388,7 +388,7 @@ class RosterWindow:
parent_iters = self._get_contact_iter(
big_brother_contact.jid, big_brother_account,
big_brother_contact, self.model)
- assert len(parent_iters) > 0, 'Big brother is not yet in roster!'
+ assert parent_iters, 'Big brother is not yet in roster!'
# Do not confuse get_contact_iter: Sync groups of family members
contact.groups = big_brother_contact.groups[:]
@@ -445,8 +445,7 @@ class RosterWindow:
if group not in app.groups[account]:
app.groups[account][group] = {'expand': is_expanded}
- assert len(added_iters), '%s has not been added to roster!' % \
- contact.jid
+ assert added_iters, '%s has not been added to roster!' % contact.jid
return added_iters
def _remove_entity(self, contact, account, groups=None):
@@ -530,8 +529,8 @@ class RosterWindow:
big_brother_contact = app.contacts.get_first_contact_from_jid(
big_brother_account, big_brother_jid)
- assert len(self._get_contact_iter(big_brother_jid,
- big_brother_account, big_brother_contact, self.model)) == 0, \
+ assert not self._get_contact_iter(big_brother_jid,
+ big_brother_account, big_brother_contact, self.model), \
'Big brother %s already in roster\n Family: %s' \
% (big_brother_jid, family)
self._add_entity(big_brother_contact, big_brother_account)
@@ -549,8 +548,8 @@ class RosterWindow:
# or brother already added
continue
- assert len(self._get_contact_iter(_jid, _account,
- _contact, self.model)) == 0, \
+ assert not self._get_contact_iter(_jid, _account,
+ _contact, self.model), \
"%s already in roster.\n Family: %s" % (_jid, nearby_family)
self._add_entity(_contact, _account,
big_brother_contact = big_brother_contact,
@@ -600,8 +599,8 @@ class RosterWindow:
ok = self._remove_entity(_contact, _account)
assert ok, '%s was not removed' % _jid
- assert len(self._get_contact_iter(_jid, _account, _contact,
- self.model)) == 0, '%s is removed but still in roster' % _jid
+ assert not self._get_contact_iter(_jid, _account, _contact,
+ self.model), '%s is removed but still in roster' % _jid
if not family_in_roster:
return False
@@ -610,15 +609,15 @@ class RosterWindow:
(nearby_family, family)
iters = self._get_contact_iter(old_big_jid, old_big_account,
old_big_contact, self.model)
- assert len(iters) > 0, 'Old Big Brother %s is not in roster anymore' % \
+ assert iters, 'Old Big Brother %s is not in roster anymore' % \
old_big_jid
assert not self.model.iter_children(iters[0]), \
'Old Big Brother %s still has children' % old_big_jid
ok = self._remove_entity(old_big_contact, old_big_account)
assert ok, "Old Big Brother %s not removed" % old_big_jid
- assert len(self._get_contact_iter(old_big_jid, old_big_account,
- old_big_contact, self.model)) == 0, \
+ assert not self._get_contact_iter(old_big_jid, old_big_account,
+ old_big_contact, self.model), \
'Old Big Brother %s is removed but still in roster' % old_big_jid
return True
@@ -683,8 +682,8 @@ class RosterWindow:
jid = app.get_jid_from_account(account)
contact = app.contacts.get_first_contact_from_jid(account, jid)
- assert len(self._get_contact_iter(jid, account, contact,
- self.model)) == 0, 'Self contact %s already in roster' % jid
+ assert not self._get_contact_iter(jid, account, contact,
+ self.model), 'Self contact %s already in roster' % jid
child_iterA = self._get_account_iter(account, self.model)
self._iters[account]['contacts'][jid] = [self.model.append(child_iterA,
@@ -716,7 +715,7 @@ class RosterWindow:
account -- the corresponding account.
"""
contact = app.contacts.get_contact_with_highest_priority(account, jid)
- if len(self._get_contact_iter(jid, account, contact, self.model)):
+ if self._get_contact_iter(jid, account, contact, self.model):
# If contact already in roster, do nothing
return
@@ -1152,8 +1151,8 @@ class RosterWindow:
to_hide = []
while(iterG):
parent = self.modelfilter.iter_parent(iterG)
- if (not self.modelfilter.iter_has_child(iterG)) or (len(to_hide) > \
- 0 and self.modelfilter.iter_n_children(iterG) == 1):
+ if (not self.modelfilter.iter_has_child(iterG)) or (to_hide \
+ and self.modelfilter.iter_n_children(iterG) == 1):
to_hide.append(iterG)
if not parent or self.modelfilter[parent][Column.TYPE] != \
'group':
@@ -1300,7 +1299,7 @@ class RosterWindow:
# a child has awaiting messages?
jidC = self.model[iterC][Column.JID]
accountC = self.model[iterC][Column.ACCOUNT]
- if len(app.events.get_events(accountC, jidC)):
+ if app.events.get_events(accountC, jidC):
icon_name = 'event'
break
iterC = self.model.iter_next(iterC)
@@ -2583,7 +2582,7 @@ class RosterWindow:
GLib.idle_add(ctrl.parent_win.set_active_tab, ctrl)
else:
ctrl = app.interface.new_chat(obj.contact, account)
- if len(app.events.get_events(account, obj.jid)):
+ if app.events.get_events(account, obj.jid):
ctrl.read_queue()
def _nec_gc_presence_received(self, obj):
@@ -2718,7 +2717,7 @@ class RosterWindow:
contact = app.contacts.get_contact(obj.conn.name, obj.jid)
obj.session.control = app.interface.new_chat(contact,
obj.conn.name, session=obj.session)
- if len(app.events.get_events(obj.conn.name, obj.fjid)):
+ if app.events.get_events(obj.conn.name, obj.fjid):
obj.session.control.read_queue()
if obj.show_in_roster:
@@ -3196,7 +3195,7 @@ class RosterWindow:
elif event.keyval == Gdk.KEY_Delete:
treeselection = self.tree.get_selection()
model, list_of_paths = treeselection.get_selected_rows()
- if not len(list_of_paths):
+ if not list_of_paths:
return
type_ = model[list_of_paths[0]][Column.TYPE]
account = model[list_of_paths[0]][Column.ACCOUNT]
@@ -3535,7 +3534,7 @@ class RosterWindow:
self.previous_status_combobox_active = active
return
accounts = list(app.connections.keys())
- if len(accounts) == 0:
+ if not accounts:
ErrorDialog(_('No account available'),
_('You must create an account before you can chat with other '
'contacts.'))
@@ -3697,7 +3696,7 @@ class RosterWindow:
# if a contact row is selected, update colors (eg. for status msg)
# because gtk engines may differ in bg when window is selected
# or not
- if len(self._last_selected_contact):
+ if self._last_selected_contact:
for (jid, account) in self._last_selected_contact:
self.draw_contact(jid, account, selected=True, focus=True)
@@ -3705,7 +3704,7 @@ class RosterWindow:
# if a contact row is selected, update colors (eg. for status msg)
# because gtk engines may differ in bg when window is selected
# or not
- if len(self._last_selected_contact):
+ if self._last_selected_contact:
for (jid, account) in self._last_selected_contact:
self.draw_contact(jid, account, selected=True, focus=False)
@@ -3720,7 +3719,7 @@ class RosterWindow:
# let message window close the tab
return
list_of_paths = self.tree.get_selection().get_selected_rows()[1]
- if not len(list_of_paths) and not app.config.get(
+ if not list_of_paths and not app.config.get(
'quit_on_roster_x_button') and ((app.interface.systray_enabled and\
app.config.get('trayicon') == 'always') or app.config.get(
'allow_hide_roster')):
@@ -4385,7 +4384,7 @@ class RosterWindow:
path = helpers.get_file_path_from_dnd_dropped_uri(a_uri)
if not os.path.isfile(path):
bad_uris.append(a_uri)
- if len(bad_uris):
+ if bad_uris:
ErrorDialog(_('Invalid file URI:'), '\n'.join(bad_uris))
return
def _on_send_files(account, jid, uris):
@@ -5523,7 +5522,7 @@ class RosterWindow:
except TypeError:
self.tree.get_selection().unselect_all()
return
- if not len(list_of_paths):
+ if not list_of_paths:
# no row is selected
return
if len(list_of_paths) > 1:
=====================================
gajim/search_window.py
=====================================
--- a/gajim/search_window.py
+++ b/gajim/search_window.py
@@ -209,7 +209,7 @@ class SearchWindow:
return
self.dataform = dataforms.extend_form(node=obj.data)
- if len(self.dataform.items) == 0:
+ if not self.dataform.items:
# No result
self.label.set_text(_('No result'))
self.label.show()
=====================================
gajim/session.py
=====================================
--- a/gajim/session.py
+++ b/gajim/session.py
@@ -404,7 +404,7 @@ class ChatControlSession(object):
self.control = app.interface.new_chat(contact,
self.conn.name, session=self)
- if len(app.events.get_events(self.conn.name, fjid)):
+ if app.events.get_events(self.conn.name, fjid):
self.control.read_queue()
else:
if no_queue: # We didn't have a queue: we change icons
=====================================
gajim/statusicon.py
=====================================
--- a/gajim/statusicon.py
+++ b/gajim/statusicon.py
@@ -371,7 +371,7 @@ class StatusIcon:
def on_left_click(self):
win = app.interface.roster.window
- if len(app.events.get_systray_events()) == 0:
+ if not app.events.get_systray_events():
# No pending events, so toggle visible/hidden for roster window
if win.get_property('visible') and (win.get_property(
'has-toplevel-focus') or os.name == 'nt'):
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/49ca2382520befee87a8fd4646534f1fff…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/49ca2382520befee87a8fd4646534f1fff…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
f7a139ea by Philipp Hörist at 2018-09-15T10:00:32Z
Zeroconf: Store time of outgoing messages
- - - - -
1 changed file:
- gajim/common/zeroconf/connection_zeroconf.py
Changes:
=====================================
gajim/common/zeroconf/connection_zeroconf.py
=====================================
--- a/gajim/common/zeroconf/connection_zeroconf.py
+++ b/gajim/common/zeroconf/connection_zeroconf.py
@@ -352,6 +352,7 @@ class ConnectionZeroconf(CommonConnection, ConnectionHandlersZeroconf):
# Dont propagate event
return True
+ obj.timestamp = time.time()
ret = self.connection.send(
obj.msg_iq, obj.message is not None,
on_ok=on_send_ok, on_not_ok=on_send_not_ok)
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/f7a139eac2839e068b6e994fc28fed623f…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/f7a139eac2839e068b6e994fc28fed623f…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
97ee8082 by Philipp Hörist at 2018-09-15T09:44:09Z
HistoryManager: Load css config in standalone
- - - - -
1 changed file:
- gajim/history_manager.py
Changes:
=====================================
gajim/history_manager.py
=====================================
--- a/gajim/history_manager.py
+++ b/gajim/history_manager.py
@@ -42,6 +42,7 @@ from gi.repository import Gdk
from gi.repository import GLib
from gi.repository import Gio
+from gajim.common import app
from gajim.common import i18n
from gajim.common import configpaths
from gajim.common.const import StyleAttr
@@ -77,8 +78,8 @@ if is_standalone():
configpaths.set_config_root(a)
configpaths.init()
+ app.load_css_config()
-from gajim.common import app
from gajim.common.i18n import _
from gajim.common.const import JIDConstant, KindConstant
from gajim.common import helpers
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/97ee8082fe40baad008f13096c359806ad…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/97ee8082fe40baad008f13096c359806ad…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
eca69e39 by Philipp Hörist at 2018-09-15T00:01:40Z
Fix Windows build
- Downgrade to glib2 2.56.2 because higher is broken on Windows 7
- Dont abort build if depchecker fails on some files
- - - - -
2 changed files:
- win/_base.sh
- win/misc/depcheck.py
Changes:
=====================================
win/_base.sh
=====================================
--- a/win/_base.sh
+++ b/win/_base.sh
@@ -70,10 +70,14 @@ function create_root {
}
function install_deps {
+ # Downgrade GLIB, resolver is broken on Windows 7
+ curl -o "${BUILD_ROOT}"/mingw-w64-x86_64-glib2-2.56.2-1-any.pkg.tar.xz \
+ https://gajim.org/downloads/snap/win/build/mingw-w64-x86_64-glib2-2.56.2-1-…
+ build_pacman --noconfirm -U "${BUILD_ROOT}"/mingw-w64-x86_64-glib2-2.56.2-1-any.pkg.tar.xz
+
build_pacman --noconfirm -S mingw-w64-"${ARCH}"-gtk3 mingw-w64-"${ARCH}"-"${PYTHON_ID}" \
mingw-w64-"${ARCH}"-"${PYTHON_ID}"-gobject \
mingw-w64-"${ARCH}"-"${PYTHON_ID}"-pip \
- mingw-w64-"${ARCH}"-gstreamer \
mingw-w64-"${ARCH}"-adwaita-icon-theme \
mingw-w64-"${ARCH}"-libwebp \
mingw-w64-"${ARCH}"-sqlite3 \
=====================================
win/misc/depcheck.py
=====================================
--- a/win/misc/depcheck.py
+++ b/win/misc/depcheck.py
@@ -46,7 +46,11 @@ SYSTEM_LIBS = ['advapi32.dll',
def get_dependencies(filename):
deps = []
- data = subprocess.check_output(["objdump", "-p", filename])
+ try:
+ data = subprocess.check_output(["objdump", "-p", filename])
+ except Exception as error:
+ print(error)
+ return deps
data = data.decode("utf-8")
for line in data.splitlines():
line = line.strip()
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/eca69e399bac1fc59ddb6563879c9e407e…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/eca69e399bac1fc59ddb6563879c9e407e…
You're receiving this email because of your account on dev.gajim.org.
Philipp Hörist pushed to branch master at gajim / gajim
Commits:
3b5b4574 by Philipp Hörist at 2018-09-14T21:35:38Z
Update .gitignore
- - - - -
1 changed file:
- .gitignore
Changes:
=====================================
.gitignore
=====================================
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ syntax: glob
*.pyc
*.pyo
*~
+*#
autom4te.cache
data/org.gajim.Gajim.appdata.xml
data/org.gajim.Gajim.desktop
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/3b5b4574bac42170047b844f075b9fbdf2…
--
View it on GitLab: https://dev.gajim.org/gajim/gajim/commit/3b5b4574bac42170047b844f075b9fbdf2…
You're receiving this email because of your account on dev.gajim.org.