comments to help code not become a beast; clean and adhere to coding style

This commit is contained in:
Nikos Kouremenos 2005-10-07 14:46:10 +00:00
parent 0de8924af8
commit 7ee643c02e
3 changed files with 23 additions and 18 deletions

View File

@ -1416,7 +1416,7 @@ class Connection:
if not self.connected: # We went offline during connecting process if not self.connected: # We went offline during connecting process
return None return None
if not con_type: if not con_type:
gajim.log.debug("Couldn't connect to %s" % self.name) gajim.log.debug('Could not connect to %s' % self.name)
if not self.retrycount: if not self.retrycount:
self.connected = 0 self.connected = 0
self.dispatch('STATUS', 'offline') self.dispatch('STATUS', 'offline')

View File

@ -862,12 +862,17 @@ class RosterWindow:
information_menuitem = childs[12] information_menuitem = childs[12]
history_menuitem = childs[13] history_menuitem = childs[13]
if not contact.resource:
send_file_menuitem.hide() if contact.resource:
send_file_menuitem.set_no_show_all(True)
else:
send_file_menuitem.connect('activate', send_file_menuitem.connect('activate',
self.on_send_file_menuitem_activate, account, contact) self.on_send_file_menuitem_activate, account, contact)
else: # if we do not have resource we cannot send file
send_file_menuitem.hide()
send_file_menuitem.set_no_show_all(True)
# FIXME: drag_unset() to clear DND stuff
# FIXME: and drag_set (see new_tab() in TC)
# for when we get resource for the first time
start_chat_menuitem.connect('activate', start_chat_menuitem.connect('activate',
self.on_roster_treeview_row_activated, path) self.on_roster_treeview_row_activated, path)
send_single_message_menuitem.connect('activate', send_single_message_menuitem.connect('activate',

View File

@ -42,7 +42,7 @@ gtk.glade.textdomain(APP)
GTKGUI_GLADE = 'gtkgui.glade' GTKGUI_GLADE = 'gtkgui.glade'
class TabbedChatWindow(chat.Chat): class TabbedChatWindow(chat.Chat):
"""Class for tabbed chat window""" '''Class for tabbed chat window'''
def __init__(self, contact, plugin, account): def __init__(self, contact, plugin, account):
# we check that on opening new windows # we check that on opening new windows
self.always_compact_view = gajim.config.get('always_compact_view_chat') self.always_compact_view = gajim.config.get('always_compact_view_chat')
@ -151,8 +151,8 @@ class TabbedChatWindow(chat.Chat):
self.bigger_avatar_window.hide() self.bigger_avatar_window.hide()
def draw_widgets(self, contact): def draw_widgets(self, contact):
"""draw the widgets in a tab (f.e. gpg togglebutton) '''draw the widgets in a tab (f.e. gpg togglebutton)
according to the the information in the contact variable""" according to the the information in the contact variable'''
jid = contact.jid jid = contact.jid
self.set_state_image(jid) self.set_state_image(jid)
tb = self.xmls[jid].get_widget('gpg_togglebutton') tb = self.xmls[jid].get_widget('gpg_togglebutton')
@ -335,7 +335,7 @@ class TabbedChatWindow(chat.Chat):
dialogs.AddNewContactWindow(self.plugin, self.account, jid) dialogs.AddNewContactWindow(self.plugin, self.account, jid)
def on_send_button_clicked(self, widget): def on_send_button_clicked(self, widget):
"""When send button is pressed: send the current message""" '''When send button is pressed: send the current message'''
jid = self.get_active_jid() jid = self.get_active_jid()
message_textview = self.xmls[jid].get_widget('message_textview') message_textview = self.xmls[jid].get_widget('message_textview')
message_buffer = message_textview.get_buffer() message_buffer = message_textview.get_buffer()
@ -505,9 +505,9 @@ class TabbedChatWindow(chat.Chat):
self.kbd_activity_in_last_30_secs = False self.kbd_activity_in_last_30_secs = False
def on_message_textview_key_press_event(self, widget, event): def on_message_textview_key_press_event(self, widget, event):
"""When a key is pressed: '''When a key is pressed:
if enter is pressed without the shift key, message (if not empty) is sent if enter is pressed without the shift key, message (if not empty) is sent
and printed in the conversation""" and printed in the conversation'''
jid = self.get_active_jid() jid = self.get_active_jid()
conversation_textview = self.xmls[jid].get_widget('conversation_textview') conversation_textview = self.xmls[jid].get_widget('conversation_textview')
@ -635,7 +635,7 @@ class TabbedChatWindow(chat.Chat):
self.reset_kbd_mouse_timeout_vars() self.reset_kbd_mouse_timeout_vars()
def send_message(self, message): def send_message(self, message):
"""Send the given message to the active tab""" '''Send the given message to the active tab'''
if not message: if not message:
return return
@ -717,7 +717,7 @@ class TabbedChatWindow(chat.Chat):
self.plugin.roster.on_info(widget, contact, self.account) self.plugin.roster.on_info(widget, contact, self.account)
def read_queue(self, jid): def read_queue(self, jid):
"""read queue and print messages containted in it""" '''read queue and print messages containted in it'''
l = gajim.awaiting_messages[self.account][jid] l = gajim.awaiting_messages[self.account][jid]
contact = self.contacts[jid] contact = self.contacts[jid]
# Is it a pm ? # Is it a pm ?
@ -764,11 +764,11 @@ class TabbedChatWindow(chat.Chat):
def print_conversation(self, text, jid, frm = '', tim = None, def print_conversation(self, text, jid, frm = '', tim = None,
encrypted = False, subject = None): encrypted = False, subject = None):
"""Print a line in the conversation: '''Print a line in the conversation:
if contact is set to status: it's a status message if contact is set to status: it's a status message
if contact is set to another value: it's an outgoing message if contact is set to another value: it's an outgoing message
if contact is set to print_queue: it is incomming from queue if contact is set to print_queue: it is incomming from queue
if contact is not set: it's an incomming message""" if contact is not set: it's an incomming message'''
contact = self.contacts[jid] contact = self.contacts[jid]
if frm == 'status': if frm == 'status':
kind = 'status' kind = 'status'