clean up code; obey to coding standards
This commit is contained in:
parent
428d5996e5
commit
4d2a36707b
|
@ -828,7 +828,7 @@ class ChatControl(ChatControlBase):
|
||||||
def _on_window_motion_notify(self, widget, event):
|
def _on_window_motion_notify(self, widget, event):
|
||||||
'''it gets called no matter if it is the active window or not'''
|
'''it gets called no matter if it is the active window or not'''
|
||||||
if self.parent_win.get_active_jid() == self.contact.jid:
|
if self.parent_win.get_active_jid() == self.contact.jid:
|
||||||
# change chatstate only if window is the active one
|
# if window is the active one, change vars assisting chatstate
|
||||||
self.mouse_over_in_last_5_secs = True
|
self.mouse_over_in_last_5_secs = True
|
||||||
self.mouse_over_in_last_30_secs = True
|
self.mouse_over_in_last_30_secs = True
|
||||||
|
|
||||||
|
@ -951,7 +951,6 @@ class ChatControl(ChatControlBase):
|
||||||
# setup the label that holds name and jid
|
# setup the label that holds name and jid
|
||||||
banner_name_label.set_markup(label_text)
|
banner_name_label.set_markup(label_text)
|
||||||
|
|
||||||
|
|
||||||
def _update_gpg(self):
|
def _update_gpg(self):
|
||||||
tb = self.xml.get_widget('gpg_togglebutton')
|
tb = self.xml.get_widget('gpg_togglebutton')
|
||||||
if self.contact.keyID: # we can do gpg
|
if self.contact.keyID: # we can do gpg
|
||||||
|
@ -966,7 +965,7 @@ class ChatControl(ChatControlBase):
|
||||||
|
|
||||||
def send_message(self, message, keyID = '', chatstate = None):
|
def send_message(self, message, keyID = '', chatstate = None):
|
||||||
'''Send a message to contact'''
|
'''Send a message to contact'''
|
||||||
if not message or message == '\n' or self._process_command(message):
|
if message in ('', None, '\n') or self._process_command(message):
|
||||||
return
|
return
|
||||||
|
|
||||||
# refresh timers
|
# refresh timers
|
||||||
|
@ -1194,9 +1193,9 @@ class ChatControl(ChatControlBase):
|
||||||
# check if gpg capabitlies or else make gpg toggle insensitive
|
# check if gpg capabitlies or else make gpg toggle insensitive
|
||||||
gpg_btn = self.xml.get_widget('gpg_togglebutton')
|
gpg_btn = self.xml.get_widget('gpg_togglebutton')
|
||||||
isactive = gpg_btn.get_active()
|
isactive = gpg_btn.get_active()
|
||||||
issensitive = gpg_btn.get_property('sensitive')
|
is_sensitive = gpg_btn.get_property('sensitive')
|
||||||
toggle_gpg_menuitem.set_active(isactive)
|
toggle_gpg_menuitem.set_active(isactive)
|
||||||
toggle_gpg_menuitem.set_property('sensitive', issensitive)
|
toggle_gpg_menuitem.set_property('sensitive', is_sensitive)
|
||||||
|
|
||||||
# If we don't have resource, we can't do file transfer
|
# If we don't have resource, we can't do file transfer
|
||||||
if contact.resource:
|
if contact.resource:
|
||||||
|
@ -1315,13 +1314,12 @@ class ChatControl(ChatControlBase):
|
||||||
self.type_id)
|
self.type_id)
|
||||||
|
|
||||||
def allow_shutdown(self):
|
def allow_shutdown(self):
|
||||||
jid = self.contact.jid
|
|
||||||
if time.time() - gajim.last_message_time[self.account]\
|
if time.time() - gajim.last_message_time[self.account]\
|
||||||
[self.get_full_jid()] < 2:
|
[self.get_full_jid()] < 2:
|
||||||
# 2 seconds
|
# 2 seconds
|
||||||
dialog = dialogs.ConfirmationDialog(
|
dialog = dialogs.ConfirmationDialog(
|
||||||
#%s is being replaced in the code with JID
|
#%s is being replaced in the code with JID
|
||||||
_('You just received a new message from "%s"' % jid),
|
_('You just received a new message from "%s"' % self.contact.jid),
|
||||||
_('If you close this tab and you have history disabled, '\
|
_('If you close this tab and you have history disabled, '\
|
||||||
'this message will be lost.'))
|
'this message will be lost.'))
|
||||||
if dialog.get_response() != gtk.RESPONSE_OK:
|
if dialog.get_response() != gtk.RESPONSE_OK:
|
||||||
|
@ -1378,8 +1376,8 @@ class ChatControl(ChatControlBase):
|
||||||
image.set_from_pixbuf(scaled_pixbuf)
|
image.set_from_pixbuf(scaled_pixbuf)
|
||||||
image.show_all()
|
image.show_all()
|
||||||
|
|
||||||
def _on_drag_data_received(self, widget, context, x, y, selection, target_type,
|
def _on_drag_data_received(self, widget, context, x, y, selection,
|
||||||
timestamp):
|
target_type, timestamp):
|
||||||
# If not resource, we can't send file
|
# If not resource, we can't send file
|
||||||
if not self.contact.resource:
|
if not self.contact.resource:
|
||||||
return
|
return
|
||||||
|
@ -1448,10 +1446,10 @@ class ChatControl(ChatControlBase):
|
||||||
def read_queue(self):
|
def read_queue(self):
|
||||||
'''read queue and print messages containted in it'''
|
'''read queue and print messages containted in it'''
|
||||||
jid = self.contact.jid
|
jid = self.contact.jid
|
||||||
fjid = jid
|
jid_with_resource = jid
|
||||||
if self.resource:
|
if self.resource:
|
||||||
fjid += '/' + self.resource
|
jid_with_resource += '/' + self.resource
|
||||||
l = gajim.awaiting_events[self.account][fjid]
|
l = gajim.awaiting_events[self.account][jid_with_resource]
|
||||||
|
|
||||||
# Is it a pm ?
|
# Is it a pm ?
|
||||||
is_pm = False
|
is_pm = False
|
||||||
|
@ -1486,9 +1484,9 @@ class ChatControl(ChatControlBase):
|
||||||
gajim.interface.roster.show_title()
|
gajim.interface.roster.show_title()
|
||||||
# Keep only non-messages events
|
# Keep only non-messages events
|
||||||
if len(events_to_keep):
|
if len(events_to_keep):
|
||||||
gajim.awaiting_events[self.account][fjid] = events_to_keep
|
gajim.awaiting_events[self.account][jid_with_resource] = events_to_keep
|
||||||
else:
|
else:
|
||||||
del gajim.awaiting_events[self.account][fjid]
|
del gajim.awaiting_events[self.account][jid_with_resource]
|
||||||
typ = 'chat' # Is it a normal chat or a pm ?
|
typ = 'chat' # Is it a normal chat or a pm ?
|
||||||
# reset to status image in gc if it is a pm
|
# reset to status image in gc if it is a pm
|
||||||
if is_pm:
|
if is_pm:
|
||||||
|
@ -1499,7 +1497,7 @@ class ChatControl(ChatControlBase):
|
||||||
# Redraw parent too
|
# Redraw parent too
|
||||||
gajim.interface.roster.draw_parent_contact(jid, self.account)
|
gajim.interface.roster.draw_parent_contact(jid, self.account)
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.remove_jid(fjid, self.account, typ)
|
gajim.interface.systray.remove_jid(jid_with_resource, self.account, typ)
|
||||||
if (self.contact.show == 'offline' or self.contact.show == 'error'):
|
if (self.contact.show == 'offline' or self.contact.show == 'error'):
|
||||||
showOffline = gajim.config.get('showoffline')
|
showOffline = gajim.config.get('showoffline')
|
||||||
if not showOffline and typ == 'chat' and \
|
if not showOffline and typ == 'chat' and \
|
||||||
|
@ -1595,8 +1593,10 @@ class ChatControl(ChatControlBase):
|
||||||
gajim.interface.roster.on_info(widget, self.contact, self.account)
|
gajim.interface.roster.on_info(widget, self.contact, self.account)
|
||||||
|
|
||||||
def _on_toggle_gpg_menuitem_activate(self, widget):
|
def _on_toggle_gpg_menuitem_activate(self, widget):
|
||||||
tb = self.xml.get_widget('gpg_togglebutton')
|
# update the button
|
||||||
tb.set_active(not tb.get_active())
|
# this is reverse logic, as we are on 'activate' (before change happens)
|
||||||
|
is_active = self.xml.get_widget('gpg_togglebutton').get_active()
|
||||||
|
tb.set_active(not is_active)
|
||||||
|
|
||||||
def got_connected(self):
|
def got_connected(self):
|
||||||
ChatControlBase.got_connected(self)
|
ChatControlBase.got_connected(self)
|
||||||
|
|
|
@ -1,18 +1,8 @@
|
||||||
## roster_window.py
|
## roster_window.py
|
||||||
##
|
##
|
||||||
## Contributors for this file:
|
## Copyright (C) 2003-2006 Yann Le Boulanger <asterix@lagaule.org>
|
||||||
## - Yann Le Boulanger <asterix@lagaule.org>
|
## Copyright (C) 2005-2006 Nikos Kouremenos <kourem@gmail.com>
|
||||||
## - Nikos Kouremenos <kourem@gmail.com>
|
## Copyright (C) 2005-2006 Dimitur Kirov <dkirov@gmail.com>
|
||||||
## - Dimitur Kirov <dkirov@gmail.com>
|
|
||||||
##
|
|
||||||
## Copyright (C) 2003-2004 Yann Le Boulanger <asterix@lagaule.org>
|
|
||||||
## Vincent Hanquez <tab@snarc.org>
|
|
||||||
## Copyright (C) 2005 Yann Le Boulanger <asterix@lagaule.org>
|
|
||||||
## Vincent Hanquez <tab@snarc.org>
|
|
||||||
## Nikos Kouremenos <nkour@jabber.org>
|
|
||||||
## Dimitur Kirov <dkirov@gmail.com>
|
|
||||||
## Travis Shirk <travis@pobox.com>
|
|
||||||
## Norman Rasmussen <norman@rasmussen.co.za>
|
|
||||||
##
|
##
|
||||||
## This program is free software; you can redistribute it and/or modify
|
## This program is free software; you can redistribute it and/or modify
|
||||||
## it under the terms of the GNU General Public License as published
|
## it under the terms of the GNU General Public License as published
|
||||||
|
|
Loading…
Reference in New Issue