changeset 5aea2f6f92fe in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=5aea2f6f92fe
description: fix line width and some warning from pylint

diffstat:

 scripts/dev/run-pylint.py |    2 +-
 src/gui_interface.py      |  879 +++++++++++++++++++++++++--------------------
 2 files changed, 492 insertions(+), 389 deletions(-)

diffs (truncated from 1884 to 300 lines):

diff -r cd82b570038f -r 5aea2f6f92fe scripts/dev/run-pylint.py
--- a/scripts/dev/run-pylint.py Wed Feb 10 14:00:28 2010 +0100
+++ b/scripts/dev/run-pylint.py Wed Feb 10 15:09:35 2010 +0100
@@ -7,5 +7,5 @@
 if os.getcwd().endswith('dev'):
     os.chdir('../../src/') # we were in scripts/dev
 
-os.system("pylint --additional-builtins='_' 
--disable-msg=C0111,C0103,C0111,C0112 --disable-checker=design " + 
"".join(sys.argv[1:]))
+os.system("pylint --include-ids=y --additional-builtins='_' 
--disable-msg=C0103,C0111,W0703,W0511,W0142 --disable-checker=design " + 
"".join(sys.argv[1:]))
 
diff -r cd82b570038f -r 5aea2f6f92fe src/gui_interface.py
--- a/src/gui_interface.py      Wed Feb 10 14:00:28 2010 +0100
+++ b/src/gui_interface.py      Wed Feb 10 15:09:35 2010 +0100
@@ -78,7 +78,6 @@
 from common import helpers
 from common import dataforms
 from common import passwords
-from common import pep
 from common import logging_helpers
 
 import roster_window
@@ -129,20 +128,19 @@
         room_jid = data[0]
         title = _('Unable to join group chat')
         prompt = _('Your desired nickname in group chat %s is in use or '
-                'registered by another occupant.\nPlease specify another 
nickname '
-                'below:') % room_jid
+            'registered by another occupant.\nPlease 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)
+                prompt)
         else:
             self.instances['change_nick_dialog'] = dialogs.ChangeNickDialog(
-                    account, room_jid, title, prompt)
+                account, room_jid, title, prompt)
 
     def handle_event_http_auth(self, account, data):
         #('HTTP_AUTH', account, (method, url, transaction_id, iq_obj, msg))
         def response(account, iq_obj, answer):
-            self.dialog.destroy()
             gajim.connections[account].build_http_auth_answer(iq_obj, answer)
 
         def on_yes(is_checked, account, iq_obj):
@@ -153,10 +151,10 @@
             sec_msg = _('Do you accept this request on account %s?') % account
         if data[4]:
             sec_msg = data[4] + '\n' + sec_msg
-        self.dialog = dialogs.YesNoDialog(_('HTTP (%(method)s) Authorization 
for '
-                '%(url)s (id: %(id)s)') % {'method': data[0], 'url': data[1],
-                'id': data[2]}, sec_msg, on_response_yes=(on_yes, account, 
data[3]),
-                on_response_no=(response, account, data[3], 'no'))
+        dialog = dialogs.YesNoDialog(_('HTTP (%(method)s) Authorization for '
+            '%(url)s (id: %(id)s)') % {'method': data[0], 'url': data[1],
+            'id': data[2]}, sec_msg, on_response_yes=(on_yes, account, 
data[3]),
+            on_response_no=(response, account, data[3], 'no'))
 
     def handle_event_error_answer(self, account, array):
         #('ERROR_ANSWER', account, (id, jid_from, errmsg, errcode))
@@ -213,8 +211,8 @@
         model = self.roster.status_combobox.get_model()
         if show in ('offline', 'error'):
             for name in self.instances[account]['online_dialog'].keys():
-                # .keys() is needed to not have a dictionary length changed 
during
-                # iteration error
+                # .keys() is needed to not have a dictionary length changed
+                # during iteration error
                 self.instances[account]['online_dialog'][name].destroy()
                 del self.instances[account]['online_dialog'][name]
             for request in self.gpg_passphrase.values():
@@ -232,7 +230,8 @@
             # we stop blocking notifications of any kind
             # this prevents from getting the roster items as 'just signed in'
             # contacts. 30 seconds should be enough time
-            gobject.timeout_add_seconds(30, 
self.unblock_signed_in_notifications, account)
+            gobject.timeout_add_seconds(30,
+                self.unblock_signed_in_notifications, account)
             # sensitivity for this menuitem
             model[self.roster.status_message_menuitem_iter][3] = True
 
@@ -335,11 +334,12 @@
                     contact1.contact_name = contact_nickname
                     self.roster.draw_contact(jid, account)
 
-                if old_show == new_show and contact1.status == status_message 
and \
-                contact1.priority == priority: # no change
+                if old_show == new_show and contact1.status == status_message \
+                and contact1.priority == priority: # no change
                     return
             else:
-                contact1 = gajim.contacts.get_first_contact_from_jid(account, 
ji)
+                contact1 = gajim.contacts.get_first_contact_from_jid(account,
+                    ji)
                 if not contact1:
                     # Presence of another resource of our
                     # jid
@@ -350,8 +350,8 @@
                     if new_show < 2:
                         return
                     contact1 = gajim.contacts.create_self_contact(jid=ji,
-                            account=account, show=array[1], 
status=status_message,
-                            priority=priority, keyID=keyID, resource=resource)
+                        account=account, show=array[1], status=status_message,
+                        priority=priority, keyID=keyID, resource=resource)
                     old_show = 0
                     gajim.contacts.add_contact(account, contact1)
                     lcontact.append(contact1)
@@ -374,20 +374,20 @@
                         gajim.newly_added[account].append(contact1.jid)
                     if contact1.jid in gajim.to_be_removed[account]:
                         gajim.to_be_removed[account].remove(contact1.jid)
-                    gobject.timeout_add_seconds(5, 
self.roster.remove_newly_added,
-                            contact1.jid, account)
+                    gobject.timeout_add_seconds(5,
+                        self.roster.remove_newly_added, contact1.jid, account)
                 elif old_show > 1 and new_show == 0 and conn.connected > 1:
                     if not contact1.jid in gajim.to_be_removed[account]:
                         gajim.to_be_removed[account].append(contact1.jid)
                     if contact1.jid in gajim.newly_added[account]:
                         gajim.newly_added[account].remove(contact1.jid)
                     self.roster.draw_contact(contact1.jid, account)
-                    gobject.timeout_add_seconds(5, 
self.roster.remove_to_be_removed,
-                            contact1.jid, account)
+                    gobject.timeout_add_seconds(5,
+                        self.roster.remove_to_be_removed, contact1.jid, 
account)
 
             # unset custom status
-            if (old_show == 0 and new_show > 1) or (old_show > 1 and new_show 
== 0\
-            and conn.connected > 1):
+            if (old_show == 0 and new_show > 1) or \
+            (old_show > 1 and new_show == 0 and conn.connected > 1):
                 if account in self.status_sent_to_users and \
                 jid in self.status_sent_to_users[account]:
                     del self.status_sent_to_users[account][jid]
@@ -468,9 +468,11 @@
                             array))
 
             elif old_show > 1 and new_show < 2:
-                notify.notify('contact_disconnected', jid, account, 
status_message)
+                notify.notify('contact_disconnected', jid, account,
+                    status_message)
                 if self.remote_ctrl:
-                    self.remote_ctrl.raise_signal('ContactAbsence', (account, 
array))
+                    self.remote_ctrl.raise_signal('ContactAbsence', (account,
+                        array))
                 # FIXME: stop non active file transfers
             # Status change (not connected/disconnected or
             # error (<1))
@@ -478,18 +480,20 @@
                 notify.notify('status_change', jid, account, [new_show,
                         status_message])
                 if self.remote_ctrl:
-                    self.remote_ctrl.raise_signal('ContactStatus', (account, 
array))
+                    self.remote_ctrl.raise_signal('ContactStatus', (account,
+                        array))
         else:
             # FIXME: MSN transport (CMSN1.2.1 and PyMSN) don't
             #        follow the XEP, still the case in 2008.
             #        It's maybe a GC_NOTIFY (specialy for MSN gc)
             self.handle_event_gc_notify(account, (jid, array[1], 
status_message,
-                    array[3], None, None, None, None, None, [], None, None))
+                array[3], None, None, None, None, None, [], None, None))
 
         highest = gajim.contacts.get_contact_with_highest_priority(account, 
jid)
         is_highest = (highest and highest.resource == resource)
 
-        # disconnect the session from the ctrl if the highest resource has 
changed
+        # disconnect the session from the ctrl if the highest resource has
+        # changed
         if (was_highest and not is_highest) or (not was_highest and 
is_highest):
             ctrl = self.msg_win_mgr.get_control(jid, account)
 
@@ -499,7 +503,8 @@
                 ctrl.contact = highest
 
     def handle_event_msgerror(self, account, array):
-        #'MSGERROR' (account, (jid, error_code, error_msg, msg, time[, 
session]))
+        #'MSGERROR' (account, (jid, error_code, error_msg, msg, time[,
+        # session]))
         full_jid_with_resource = array[0]
         jids = full_jid_with_resource.split('/', 1)
         jid = jids[0]
@@ -526,7 +531,8 @@
                 if session:
                     ctrl = session.control
                 else:
-                    ctrl = 
self.msg_win_mgr.get_control(full_jid_with_resource, account)
+                    ctrl = self.msg_win_mgr.get_control(full_jid_with_resource,
+                        account)
 
                 if not ctrl:
                     tv = gc_control.list_treeview
@@ -536,17 +542,18 @@
                         show = model[iter_][3]
                     else:
                         show = 'offline'
-                    gc_c = gajim.contacts.create_gc_contact(room_jid=jid, 
account=account,
-                            name=nick, show=show)
+                    gc_c = gajim.contacts.create_gc_contact(room_jid=jid,
+                        account=account, name=nick, show=show)
                     ctrl = self.new_private_chat(gc_c, account, session)
 
                 ctrl.print_conversation(_('Error %(code)s: %(msg)s') % {
-                        'code': array[1], 'msg': array[2]}, 'status')
+                    'code': array[1], 'msg': array[2]}, 'status')
                 return
 
             gc_control.print_conversation(_('Error %(code)s: %(msg)s') % {
-                    'code': array[1], 'msg': array[2]}, 'status')
-            if gc_control.parent_win and 
gc_control.parent_win.get_active_jid() == jid:
+                'code': array[1], 'msg': array[2]}, 'status')
+            if gc_control.parent_win and \
+            gc_control.parent_win.get_active_jid() == jid:
                 gc_control.set_subject(gc_control.subject)
             return
 
@@ -563,7 +570,8 @@
         #('MSGSENT', account, (jid, msg, keyID))
         msg = array[1]
         # do not play sound when standalone chatstate message (eg no msg)
-        if msg and gajim.config.get_per('soundevents', 'message_sent', 
'enabled'):
+        if msg and gajim.config.get_per('soundevents', 'message_sent',
+        'enabled'):
             helpers.play_sound('message_sent')
 
     def handle_event_msgnotsent(self, account, array):
@@ -571,7 +579,8 @@
         msg = _('error while sending %(message)s ( %(error)s )') % {
                 'message': array[2], 'error': array[1]}
         if not array[4]:
-            # No session. This can happen when sending a message from 
gajim-remote
+            # No session. This can happen when sending a message from
+            # gajim-remote
             log.warn(msg)
             return
         array[4].roster_message(array[0], msg, array[3], account,
@@ -592,10 +601,11 @@
         self.add_event(account, jid, 'subscription_request', (text, nick))
 
         if helpers.allow_showing_notification(account):
-            path = gtkgui_helpers.get_icon_path('gajim-subscription_request', 
48)
+            path = gtkgui_helpers.get_icon_path('gajim-subscription_request',
+                48)
             event_type = _('Subscription request')
             notify.popup(event_type, jid, account, 'subscription_request', 
path,
-                    event_type, jid)
+                event_type, jid)
 
     def handle_event_subscribed(self, account, array):
         #('SUBSCRIBED', account, (jid, resource))
@@ -604,24 +614,25 @@
             c = gajim.contacts.get_first_contact_from_jid(account, jid)
             c.resource = array[1]
             self.roster.remove_contact_from_groups(c.jid, account,
-                    [_('Not in Roster'), _('Observers')], update=False)
+                [_('Not in Roster'), _('Observers')], update=False)
         else:
             keyID = ''
             attached_keys = gajim.config.get_per('accounts', account,
-                    'attached_gpg_keys').split()
+                'attached_gpg_keys').split()
             if jid in attached_keys:
                 keyID = attached_keys[attached_keys.index(jid) + 1]
             name = jid.split('@', 1)[0]
             name = name.split('%', 1)[0]
             contact1 = gajim.contacts.create_contact(jid=jid, account=account,
-                    name=name, groups=[], show='online', status='online',
-                    ask='to', resource=array[1], keyID=keyID)
+                name=name, groups=[], show='online', status='online', ask='to',
+                resource=array[1], keyID=keyID)
             gajim.contacts.add_contact(account, contact1)
             self.roster.add_contact(jid, account)
         dialogs.InformationDialog(_('Authorization accepted'),
-                        _('The contact "%s" has authorized you to see his or 
her status.')
-                        % jid)
-        if not gajim.config.get_per('accounts', account, 
'dont_ack_subscription'):
+            _('The contact "%s" has authorized you to see his or her status.')
+            % jid)
+        if not gajim.config.get_per('accounts', account,
+        'dont_ack_subscription'):
             gajim.connections[account].ack_subscribed(jid)
         if self.remote_ctrl:
             self.remote_ctrl.raise_signal('Subscribed', (account, array))
@@ -811,7 +822,8 @@
 
     def handle_event_gc_notify(self, account, array):
         #'GC_NOTIFY' (account, (room_jid, show, status, nick,
-        # role, affiliation, jid, reason, actor, statusCode, newNick, 
avatar_sha))
+        # role, affiliation, jid, reason, actor, statusCode, newNick,
+        # avatar_sha))
         nick = array[3]
         if not nick:
             return
@@ -829,14 +841,15 @@
         room_jid in self.minimized_controls[account]:
             control = self.minimized_controls[account][room_jid]
 
-        if not control or (control and control.type_id != 
message_control.TYPE_GC):
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to