Philipp Hörist pushed to branch master at gajim / gajim

Commits:

12 changed files:

Changes:

  • gajim/chat_control_base.py
    ... ... @@ -497,7 +497,7 @@ class ChatControlBase(MessageControl, ChatCommandProcessor, CommandTools):
    497 497
             item = Gtk.SeparatorMenuItem.new()
    
    498 498
             menu.prepend(item)
    
    499 499
     
    
    500
    -        menu2 = self.prepare_context_menu()
    
    500
    +        menu2 = self.prepare_context_menu()  # pylint: disable=assignment-from-none
    
    501 501
             i = 0
    
    502 502
             for item in menu2:
    
    503 503
                 menu2.remove(item)
    

  • gajim/common/optparser.py
    ... ... @@ -113,14 +113,16 @@ class OptionsParser:
    113 113
                     app.config.foreach(self.write_line, file)
    
    114 114
             except IOError:
    
    115 115
                 log.exception('Failed to write config file')
    
    116
    -            return
    
    116
    +            return False
    
    117 117
     
    
    118 118
             try:
    
    119 119
                 temp_filepath.replace(config_path)
    
    120 120
             except Exception:
    
    121 121
                 log.exception('Failed to replace config file')
    
    122
    -        else:
    
    123
    -            log.info('Successful saved config file')
    
    122
    +            return False
    
    123
    +
    
    124
    +        log.info('Successful saved config file')
    
    125
    +        return True
    
    124 126
     
    
    125 127
         def update_config(self, old_version, new_version):
    
    126 128
             old_version_list = old_version.split('.') # convert '0.x.y' to (0, x, y)
    

  • gajim/common/protocol/bytestream.py
    ... ... @@ -563,7 +563,6 @@ class ConnectionSocks5Bytestream(ConnectionBytestream):
    563 563
             """
    
    564 564
             file_props = FilesProp.getFilePropBySid(sid)
    
    565 565
             file_props.hash_ = hash_id
    
    566
    -        return
    
    567 566
     
    
    568 567
         def _connect_error(self, sid, error, error_type, msg=None):
    
    569 568
             """
    

  • gajim/common/socks5.py
    ... ... @@ -1297,8 +1297,7 @@ class Socks5Client(Socks5):
    1297 1297
                         return
    
    1298 1298
                     if self.state < 5:
    
    1299 1299
                         self.idlequeue.set_read_timeout(self.fd, CONNECT_TIMEOUT)
    
    1300
    -                    result = self.main(0)
    
    1301
    -                    self.queue.process_result(result, self)
    
    1300
    +                    self.main(0)
    
    1302 1301
                     elif self.state == 5: # wait for proxy reply
    
    1303 1302
                         pass
    
    1304 1303
                     elif self.file_props.type_ == 'r':
    

  • gajim/common/zeroconf/zeroconf_avahi.py
    ... ... @@ -15,17 +15,25 @@
    15 15
     # along with Gajim.  If not, see <http://www.gnu.org/licenses/>.
    
    16 16
     
    
    17 17
     import logging
    
    18
    -log = logging.getLogger('gajim.c.z.zeroconf_avahi')
    
    19 18
     
    
    20
    -import gi
    
    21
    -gi.require_version('Avahi', '0.6')
    
    22 19
     from gi.repository import Avahi
    
    23 20
     from gi.repository import Gio
    
    24 21
     from gi.repository import GLib
    
    25 22
     
    
    26 23
     from gajim.common.i18n import _
    
    27 24
     from gajim.common.zeroconf.zeroconf import Constant, ConstantRI
    
    28
    -from gajim.common.zeroconf.zeroconf_avahi_const import *
    
    25
    +from gajim.common.zeroconf.zeroconf_avahi_const import DBUS_NAME
    
    26
    +from gajim.common.zeroconf.zeroconf_avahi_const import DBUS_INTERFACE_SERVER
    
    27
    +from gajim.common.zeroconf.zeroconf_avahi_const import DBUS_INTERFACE_ENTRY_GROUP
    
    28
    +from gajim.common.zeroconf.zeroconf_avahi_const import DBUS_INTERFACE_DOMAIN_BROWSER
    
    29
    +from gajim.common.zeroconf.zeroconf_avahi_const import ServerState
    
    30
    +from gajim.common.zeroconf.zeroconf_avahi_const import EntryGroup
    
    31
    +from gajim.common.zeroconf.zeroconf_avahi_const import DomainBrowser
    
    32
    +from gajim.common.zeroconf.zeroconf_avahi_const import Protocol
    
    33
    +from gajim.common.zeroconf.zeroconf_avahi_const import Interface
    
    34
    +
    
    35
    +log = logging.getLogger('gajim.c.z.zeroconf_avahi')
    
    36
    +
    
    29 37
     
    
    30 38
     class Zeroconf:
    
    31 39
         def __init__(self, new_serviceCB, remove_serviceCB, name_conflictCB,
    

  • gajim/common/zeroconf/zeroconf_avahi_const.py
    ... ... @@ -20,15 +20,8 @@ from enum import IntEnum
    20 20
     
    
    21 21
     DBUS_NAME = "org.freedesktop.Avahi"
    
    22 22
     DBUS_INTERFACE_SERVER = DBUS_NAME + ".Server"
    
    23
    -DBUS_PATH_SERVER = "/"
    
    24 23
     DBUS_INTERFACE_ENTRY_GROUP = DBUS_NAME + ".EntryGroup"
    
    25 24
     DBUS_INTERFACE_DOMAIN_BROWSER = DBUS_NAME + ".DomainBrowser"
    
    26
    -DBUS_INTERFACE_SERVICE_TYPE_BROWSER = DBUS_NAME + ".ServiceTypeBrowser"
    
    27
    -DBUS_INTERFACE_SERVICE_BROWSER = DBUS_NAME + ".ServiceBrowser"
    
    28
    -DBUS_INTERFACE_ADDRESS_RESOLVER = DBUS_NAME + ".AddressResolver"
    
    29
    -DBUS_INTERFACE_HOST_NAME_RESOLVER = DBUS_NAME + ".HostNameResolver"
    
    30
    -DBUS_INTERFACE_SERVICE_RESOLVER = DBUS_NAME + ".ServiceResolver"
    
    31
    -DBUS_INTERFACE_RECORD_BROWSER = DBUS_NAME + ".RecordBrowser"
    
    32 25
     
    
    33 26
     
    
    34 27
     class ServerState(IntEnum):
    

  • gajim/dialogs.py
    ... ... @@ -50,8 +50,10 @@ from gajim.common import i18n
    50 50
     from gajim.common.modules import dataforms
    
    51 51
     from gajim.common.exceptions import GajimGeneralException
    
    52 52
     
    
    53
    -# Compat with Gajim 1.0.3 for plugins
    
    54
    -from gajim.gtk.dialogs import *
    
    53
    +from gajim.gtk.dialogs import ErrorDialog
    
    54
    +from gajim.gtk.dialogs import ConfirmationDialog
    
    55
    +from gajim.gtk.dialogs import InputDialog
    
    56
    +from gajim.gtk.dialogs import InformationDialog
    
    55 57
     from gajim.gtk.util import get_icon_name
    
    56 58
     from gajim.gtk.util import resize_window
    
    57 59
     from gajim.gtk.util import get_builder
    
    ... ... @@ -1399,9 +1401,6 @@ class Dialog(Gtk.Dialog):
    1399 1401
         def just_destroy(self, widget):
    
    1400 1402
             self.destroy()
    
    1401 1403
     
    
    1402
    -    def get_button(self, index):
    
    1403
    -        buttons = self.get_action_area().get_children()
    
    1404
    -        return index < len(buttons) and buttons[index] or None
    
    1405 1404
     
    
    1406 1405
     class DataFormWindow(Dialog):
    
    1407 1406
         def __init__(self, form, on_response_ok):
    

  • gajim/gui_interface.py
    ... ... @@ -2038,15 +2038,12 @@ class Interface:
    2038 2038
     
    
    2039 2039
         @staticmethod
    
    2040 2040
         def save_config():
    
    2041
    -        err_str = parser.write()
    
    2042
    -        if err_str is not None:
    
    2043
    -            print(err_str, file=sys.stderr)
    
    2044
    -            # it is good to notify the user
    
    2045
    -            # in case he or she cannot see the output of the console
    
    2046
    -            error_dialog = ErrorDialog(_('Could not save your settings and '
    
    2047
    -                'preferences'), err_str)
    
    2048
    -            error_dialog.run()
    
    2049
    -            sys.exit()
    
    2041
    +        if parser.write():
    
    2042
    +            return
    
    2043
    +
    
    2044
    +        error_dialog = ErrorDialog(
    
    2045
    +            _('Could not save your settings and preferences'))
    
    2046
    +        error_dialog.run()
    
    2050 2047
     
    
    2051 2048
         @staticmethod
    
    2052 2049
         def update_avatar(account=None, jid=None, contact=None, room_avatar=False):
    

  • gajim/message_window.py
    ... ... @@ -890,15 +890,13 @@ class MessageWindow:
    890 890
                 tab = self.notebook.get_tab_label(page)
    
    891 891
                 tab_alloc = tab.get_allocation()
    
    892 892
                 if horiz:
    
    893
    -                if (x >= tab_alloc.x) and \
    
    894
    -                (x <= (tab_alloc.x + tab_alloc.width)):
    
    893
    +                if tab_alloc.x <= x <= (tab_alloc.x + tab_alloc.width):
    
    895 894
                         page_num = i
    
    896 895
                         if x >= tab_alloc.x + (tab_alloc.width / 2.0):
    
    897 896
                             to_right = True
    
    898 897
                         break
    
    899 898
                 else:
    
    900
    -                if (y >= tab_alloc.y) and \
    
    901
    -                (y <= (tab_alloc.y + tab_alloc.height)):
    
    899
    +                if tab_alloc.y <= y <= (tab_alloc.y + tab_alloc.height):
    
    902 900
                         page_num = i
    
    903 901
     
    
    904 902
                         if y > tab_alloc.y + (tab_alloc.height / 2.0):
    

  • gajim/roster_window.py
    ... ... @@ -3308,7 +3308,7 @@ class RosterWindow:
    3308 3308
                         not event.get_state() & Gdk.ModifierType.CONTROL_MASK):
    
    3309 3309
                     # Don't handle double click if we press icon of a metacontact
    
    3310 3310
                     titer = model.get_iter(path)
    
    3311
    -                if x > x_min and x < x_min + 27 and type_ == 'contact' and \
    
    3311
    +                if x_min < x < x_min + 27 and type_ == 'contact' and \
    
    3312 3312
                     model.iter_has_child(titer):
    
    3313 3313
                         if self.tree.row_expanded(path):
    
    3314 3314
                             self.tree.collapse_row(path)
    
    ... ... @@ -3328,7 +3328,7 @@ class RosterWindow:
    3328 3328
                     else:
    
    3329 3329
                         self.expand_group_row(path)
    
    3330 3330
     
    
    3331
    -            elif type_ == 'contact' and x > x_min and x < x_min + 27:
    
    3331
    +            elif type_ == 'contact' and x_min < x < x_min + 27:
    
    3332 3332
                     if self.tree.row_expanded(path):
    
    3333 3333
                         self.tree.collapse_row(path)
    
    3334 3334
                     else:
    
    ... ... @@ -4461,8 +4461,9 @@ class RosterWindow:
    4461 4461
                 return
    
    4462 4462
     
    
    4463 4463
             # Is the contact we drag a meta contact?
    
    4464
    -        accounts = (self.regroup and app.contacts.get_accounts()) or \
    
    4465
    -                account_source
    
    4464
    +        accounts = account_source
    
    4465
    +        if self.regroup:
    
    4466
    +            accounts = app.contacts.get_accounts() or account_source
    
    4466 4467
             is_big_brother = app.contacts.is_big_brother(account_source,
    
    4467 4468
                 jid_source, accounts)
    
    4468 4469
     
    

  • pylintrc
    ... ... @@ -50,7 +50,9 @@ confidence=
    50 50
     # --enable=similarities". If you want to run only the classes checker, but have
    
    51 51
     # no Warning level messages displayed, use"--disable=all --enable=classes
    
    52 52
     # --disable=W"
    
    53
    -disable=C0111,C0301,R1710,R0912,R0914,R0915,W0511,W0231,W0233
    
    53
    +# C0111 missing-docstring
    
    54
    +# W0511 fix-me
    
    55
    +disable=C0111,W0511
    
    54 56
     
    
    55 57
     # Enable the message, report, category or checker with the given id(s). You can
    
    56 58
     # either give multiple identifier separated by comma (,) or put this option
    
    ... ... @@ -220,7 +222,7 @@ indent-after-paren=4
    220 222
     indent-string='    '
    
    221 223
     
    
    222 224
     # Maximum number of characters on a single line.
    
    223
    -max-line-length=100
    
    225
    +max-line-length=80
    
    224 226
     
    
    225 227
     # Maximum number of lines in a module
    
    226 228
     max-module-lines=1000
    

  • scripts/dev/pylint-ci.sh
    1 1
     #!/bin/sh
    
    2 2
     PYLINT=${PYLINT:-pylint}
    
    3 3
     
    
    4
    -"$PYLINT" --disable=C0103,C0302,C0330,C0411,C0412,C0413,E0203,E0401,E0611,E0710,E0712,E1101,E1102,E1128,E1133,E1136,R0201,R0901,R0904,R0913,R0916,R1702,R1706,R1711,R1716,W0201,W0212,W0221,W0223,W0311,W0401,W0603,W0613,W0614 "$@"
    
    4
    +"$PYLINT" --disable=C0103,C0302,C0301,C0330,C0411,C0412,C0413,E0203,E0401,E0611,E0710,E0712,E1101,E1102,E1133,E1136,R0201,R0901,R0904,R0912,R0913,R0914,R0915,R0916,R1702,R1710,W0201,W0212,W0221,W0223,W0231,W0233,W0311,W0401,W0603,W0613 "$@"
    
    5 5
     
    
    6 6
     # C0103 invalid-name
    
    7
    +# C0301 line-too-long
    
    7 8
     # C0302 too-many-lines
    
    8 9
     # C0330 bad-continuation
    
    9 10
     # C0411 wrong-import-order
    
    ... ... @@ -16,24 +17,25 @@ PYLINT=${PYLINT:-pylint}
    16 17
     # E0712 catching-non-exception  - GLib.GError is not recognized
    
    17 18
     # E1101 no-member
    
    18 19
     # E1102 not-callable
    
    19
    -# E1128 assignment-from-none
    
    20 20
     # E1133 not-an-iterable
    
    21 21
     # E1136 unsubscriptable-object
    
    22 22
     # R0201 no-self-use
    
    23 23
     # R0901 too-many-ancestors
    
    24 24
     # R0904 too-many-public-methods
    
    25 25
     # R0913 too-many-arguments
    
    26
    +# R0912 too-many-branches
    
    27
    +# R0914 too-many-locals
    
    28
    +# R0915 too-many-statements
    
    26 29
     # R0916 too-many-boolean-expressions
    
    27
    -# R1702
    
    28
    -# R1706
    
    29
    -# R1711
    
    30
    -# R1716
    
    30
    +# R1702 too-many-nested-blocks
    
    31
    +# R1710 inconsistent-return-statements
    
    31 32
     # W0201 attribute-defined-outside-init
    
    32 33
     # W0212 protected-access
    
    33 34
     # W0221 arguments-differ
    
    34 35
     # W0223 abstract-method
    
    36
    +# W0231 super-init-not-called
    
    37
    +# W0233 non-parent-init-called
    
    35 38
     # W0311 bad-indentation
    
    36 39
     # W0401 wildcard-import
    
    37 40
     # W0603 global-statement
    
    38 41
     # W0613 unused-argument
    39
    -# W0614 unused-wildcard-import