coding standards

This commit is contained in:
Yann Leboulanger 2008-09-22 09:10:18 +00:00
parent b4a645e882
commit 35a9cf5d89
1 changed files with 11 additions and 11 deletions

View File

@ -57,7 +57,7 @@ try:
except: except:
USER_HAS_GROWL = False USER_HAS_GROWL = False
def get_show_in_roster(event, account, contact, session = None): def get_show_in_roster(event, account, contact, session=None):
'''Return True if this event must be shown in roster, else False''' '''Return True if this event must be shown in roster, else False'''
if event == 'gc_message_received': if event == 'gc_message_received':
return True return True
@ -134,7 +134,7 @@ def get_advanced_notification(event, account, contact):
num += 1 num += 1
notif = gajim.config.get_per('notifications', str(num)) notif = gajim.config.get_per('notifications', str(num))
def notify(event, jid, account, parameters, advanced_notif_num = None): def notify(event, jid, account, parameters, advanced_notif_num=None):
'''Check what type of notifications we want, depending on basic '''Check what type of notifications we want, depending on basic
and the advanced configuration of notifications and do these notifications; and the advanced configuration of notifications and do these notifications;
advanced_notif_num holds the number of the first (top most) advanced advanced_notif_num holds the number of the first (top most) advanced
@ -236,7 +236,7 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
if status_message: if status_message:
text = text + " : " + status_message text = text + " : " + status_message
popup(_('Contact Changed Status'), jid, account, popup(_('Contact Changed Status'), jid, account,
path_to_image = path, title = title, text = text) path_to_image=path, title=title, text=text)
elif event == 'contact_connected': elif event == 'contact_connected':
title = _('%(nickname)s Signed In') % \ title = _('%(nickname)s Signed In') % \
{'nickname': gajim.get_name_from_jid(account, jid)} {'nickname': gajim.get_name_from_jid(account, jid)}
@ -244,7 +244,7 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
if status_message: if status_message:
text = status_message text = status_message
popup(_('Contact Signed In'), jid, account, popup(_('Contact Signed In'), jid, account,
path_to_image = path, title = title, text = text) path_to_image=path, title=title, text=text)
elif event == 'contact_disconnected': elif event == 'contact_disconnected':
title = _('%(nickname)s Signed Out') % \ title = _('%(nickname)s Signed Out') % \
{'nickname': gajim.get_name_from_jid(account, jid)} {'nickname': gajim.get_name_from_jid(account, jid)}
@ -252,7 +252,7 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
if status_message: if status_message:
text = status_message text = status_message
popup(_('Contact Signed Out'), jid, account, popup(_('Contact Signed Out'), jid, account,
path_to_image = path, title = title, text = text) path_to_image=path, title=title, text=text)
elif event == 'new_message': elif event == 'new_message':
if message_type == 'normal': # single message if message_type == 'normal': # single message
event_type = _('New Single Message') event_type = _('New Single Message')
@ -282,7 +282,7 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
text = message text = message
path = gtkgui_helpers.get_path_to_generic_or_avatar(img) path = gtkgui_helpers.get_path_to_generic_or_avatar(img)
popup(event_type, jid, account, message_type, popup(event_type, jid, account, message_type,
path_to_image = path, title = title, text = text) path_to_image=path, title=title, text=text)
if do_sound: if do_sound:
snd_file = None snd_file = None
@ -316,8 +316,8 @@ def notify(event, jid, account, parameters, advanced_notif_num = None):
except: except:
pass pass
def popup(event_type, jid, account, msg_type = '', path_to_image = None, def popup(event_type, jid, account, msg_type='', path_to_image=None,
title = None, text = None): title=None, text=None):
'''Notifies a user of an event. It first tries to a valid implementation of '''Notifies a user of an event. It first tries to a valid implementation of
the Desktop Notification Specification. If that fails, then we fall back to the Desktop Notification Specification. If that fails, then we fall back to
the older style PopupNotificationWindow method.''' the older style PopupNotificationWindow method.'''
@ -413,7 +413,7 @@ class NotificationResponseManager:
if diff > 10: if diff > 10:
self.received.remove(rec) self.received.remove(rec)
def on_closed(self, id, reason = None): def on_closed(self, id, reason=None):
if self.pending.has_key(id): if self.pending.has_key(id):
del self.pending[id] del self.pending[id]
@ -437,8 +437,8 @@ notification_response_manager = NotificationResponseManager()
class DesktopNotification: class DesktopNotification:
'''A DesktopNotification that interfaces with D-Bus via the Desktop '''A DesktopNotification that interfaces with D-Bus via the Desktop
Notification specification''' Notification specification'''
def __init__(self, event_type, jid, account, msg_type = '', def __init__(self, event_type, jid, account, msg_type='',
path_to_image = None, title = None, text = None): path_to_image=None, title=None, text=None):
self.path_to_image = path_to_image self.path_to_image = path_to_image
self.event_type = event_type self.event_type = event_type
self.title = title self.title = title