fix 80 char width
This commit is contained in:
parent
86acbd398c
commit
6b36b6729d
|
@ -141,8 +141,8 @@ def get_advanced_notification(event, account, contact):
|
|||
tab_opened_ok = True
|
||||
else:
|
||||
chat_control = helpers.get_chat_control(account, contact)
|
||||
if (chat_control and tab_opened == 'yes') or (not chat_control and \
|
||||
tab_opened == 'no'):
|
||||
if (chat_control and tab_opened == 'yes') or (not chat_control \
|
||||
and tab_opened == 'no'):
|
||||
tab_opened_ok = True
|
||||
if tab_opened_ok:
|
||||
return num
|
||||
|
@ -152,9 +152,10 @@ def get_advanced_notification(event, account, contact):
|
|||
|
||||
def notify(event, jid, account, parameters, advanced_notif_num=None):
|
||||
"""
|
||||
Check what type of notifications we want, depending on basic and the advanced
|
||||
configuration of notifications and do these notifications; advanced_notif_num
|
||||
holds the number of the first (top most) advanced notification
|
||||
Check what type of notifications we want, depending on basic and the
|
||||
advanced configuration of notifications and do these notifications;
|
||||
advanced_notif_num holds the number of the first (top most) advanced
|
||||
notification
|
||||
"""
|
||||
# First, find what notifications we want
|
||||
do_popup = False
|
||||
|
@ -174,7 +175,8 @@ def notify(event, jid, account, parameters, advanced_notif_num=None):
|
|||
gajim.block_signed_in_notifications[account_server]:
|
||||
block_transport = True
|
||||
if helpers.allow_showing_notification(account, 'notify_on_signin') and \
|
||||
not gajim.block_signed_in_notifications[account] and not block_transport:
|
||||
not gajim.block_signed_in_notifications[account] and \
|
||||
not block_transport:
|
||||
do_popup = True
|
||||
if gajim.config.get_per('soundevents', 'contact_connected',
|
||||
'enabled') and not gajim.block_signed_in_notifications[account] and \
|
||||
|
@ -206,8 +208,8 @@ def notify(event, jid, account, parameters, advanced_notif_num=None):
|
|||
'first_message_received', advanced_notif_num):
|
||||
do_sound = True
|
||||
elif not is_first_message and focused and \
|
||||
helpers.allow_sound_notification(account, 'next_message_received_focused',
|
||||
advanced_notif_num):
|
||||
helpers.allow_sound_notification(account,
|
||||
'next_message_received_focused', advanced_notif_num):
|
||||
do_sound = True
|
||||
elif not is_first_message and not focused and \
|
||||
helpers.allow_sound_notification(account,
|
||||
|
@ -227,7 +229,7 @@ def notify(event, jid, account, parameters, advanced_notif_num=None):
|
|||
if event == 'contact_disconnected':
|
||||
show_image = 'offline.png'
|
||||
suffix = '_notif_size_bw'
|
||||
else: #Status Change or Connected
|
||||
else: # Status Change or Connected
|
||||
# FIXME: for status change,
|
||||
# we don't always 'online.png', but we
|
||||
# first need 48x48 for all status
|
||||
|
@ -236,14 +238,14 @@ def notify(event, jid, account, parameters, advanced_notif_num=None):
|
|||
transport_name = gajim.get_transport_name_from_jid(jid)
|
||||
img_path = None
|
||||
if transport_name:
|
||||
img_path = os.path.join(helpers.get_transport_path(transport_name),
|
||||
'48x48', show_image)
|
||||
img_path = os.path.join(helpers.get_transport_path(
|
||||
transport_name), '48x48', show_image)
|
||||
if not img_path or not os.path.isfile(img_path):
|
||||
iconset = gajim.config.get('iconset')
|
||||
img_path = os.path.join(helpers.get_iconset_path(iconset), '48x48',
|
||||
show_image)
|
||||
path = gtkgui_helpers.get_path_to_generic_or_avatar(img_path, jid=jid,
|
||||
suffix=suffix)
|
||||
img_path = os.path.join(helpers.get_iconset_path(iconset),
|
||||
'48x48', show_image)
|
||||
path = gtkgui_helpers.get_path_to_generic_or_avatar(img_path,
|
||||
jid=jid, suffix=suffix)
|
||||
if event == 'status_change':
|
||||
title = _('%(nick)s Changed Status') % \
|
||||
{'nick': gajim.get_name_from_jid(account, jid)}
|
||||
|
@ -283,10 +285,11 @@ def notify(event, jid, account, parameters, advanced_notif_num=None):
|
|||
img_name = 'gajim-priv_msg_recv'
|
||||
title = _('New Private Message from group chat %s') % room_name
|
||||
if message:
|
||||
text = _('%(nickname)s: %(message)s') % {'nickname': nickname,
|
||||
'message': message}
|
||||
text = _('%(nickname)s: %(message)s') % \
|
||||
{'nickname': nickname, 'message': message}
|
||||
else:
|
||||
text = _('Messaged by %(nickname)s') % {'nickname': nickname}
|
||||
text = _('Messaged by %(nickname)s') % \
|
||||
{'nickname': nickname}
|
||||
|
||||
else: # chat message
|
||||
event_type = _('New Message')
|
||||
|
@ -331,7 +334,7 @@ def notify(event, jid, account, parameters, advanced_notif_num=None):
|
|||
pass
|
||||
|
||||
def popup(event_type, jid, account, msg_type='', path_to_image=None, title=None,
|
||||
text=None):
|
||||
text=None):
|
||||
"""
|
||||
Notify 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
|
||||
|
@ -431,7 +434,8 @@ class NotificationResponseManager:
|
|||
if self.interface is not None:
|
||||
return
|
||||
self.interface = dbus_support.get_notifications_interface()
|
||||
self.interface.connect_to_signal('ActionInvoked', self.on_action_invoked)
|
||||
self.interface.connect_to_signal('ActionInvoked',
|
||||
self.on_action_invoked)
|
||||
self.interface.connect_to_signal('NotificationClosed', self.on_closed)
|
||||
|
||||
def on_action_invoked(self, id_, reason):
|
||||
|
@ -470,8 +474,8 @@ notification_response_manager = NotificationResponseManager()
|
|||
|
||||
class DesktopNotification:
|
||||
"""
|
||||
A DesktopNotification that interfaces with D-Bus via the Desktop Notification
|
||||
specification
|
||||
A DesktopNotification that interfaces with D-Bus via the Desktop
|
||||
Notification Specification
|
||||
"""
|
||||
|
||||
def __init__(self, event_type, jid, account, msg_type='',
|
||||
|
@ -586,7 +590,8 @@ class DesktopNotification:
|
|||
reply_handler=self.attach_by_id,
|
||||
error_handler=self.notify_another_way)
|
||||
except AttributeError:
|
||||
version = [0, 3, 1] # we're actually dealing with the newer version
|
||||
# we're actually dealing with the newer version
|
||||
version = [0, 3, 1]
|
||||
if version > [0, 3]:
|
||||
if gajim.interface.systray_enabled and \
|
||||
gajim.config.get('attach_notifications_to_systray'):
|
||||
|
@ -607,7 +612,8 @@ class DesktopNotification:
|
|||
text = ' '
|
||||
actions = ()
|
||||
if 'actions' in self.capabilities:
|
||||
actions = (dbus.String('default'), dbus.String(self.event_type))
|
||||
actions = (dbus.String('default'), dbus.String(
|
||||
self.event_type))
|
||||
self.notif.Notify(
|
||||
dbus.String(_('Gajim')),
|
||||
dbus.UInt32(0), # this notification does not replace other
|
||||
|
@ -672,7 +678,8 @@ class DesktopNotification:
|
|||
error_handler=self.version_error_handler_2_x_try)
|
||||
|
||||
def version_error_handler_2_x_try(self, e):
|
||||
self.notif.GetServerInformation(reply_handler=self.version_reply_handler,
|
||||
self.notif.GetServerInformation(
|
||||
reply_handler=self.version_reply_handler,
|
||||
error_handler=self.version_error_handler_3_x_try)
|
||||
|
||||
def version_error_handler_3_x_try(self, e):
|
||||
|
|
Loading…
Reference in New Issue