From 2e668210c226bc69c40b42b42943dd14d53591d6 Mon Sep 17 00:00:00 2001 From: Nikos Kouremenos Date: Wed, 4 May 2005 16:22:07 +0000 Subject: [PATCH] if not foo else becomes if foo else: --- src/chat.py | 38 ++++++++++++---------- src/gtkgui.glade | 66 ++++++++++++++++++++++++++++++++------- src/roster_window.py | 6 ++-- src/tabbed_chat_window.py | 27 ++++++++-------- 4 files changed, 92 insertions(+), 45 deletions(-) diff --git a/src/chat.py b/src/chat.py index 4e5cb1945..d87609c94 100644 --- a/src/chat.py +++ b/src/chat.py @@ -110,8 +110,11 @@ class Chat: start = '* ' child = self.childs[jid] - children = self.notebook.get_tab_label(child).get_children() - nickname = children[1] + if self.widget_name == 'tabbed_chat_window': + nickname = self.notebook.get_tab_label(child).get_children()[1] + elif self.widget_name == 'groupchat_window': + nickname = self.notebook.get_tab_label(child).get_children()[0] + nickname.set_text(start + self.names[jid]) def on_window_destroy(self, widget, kind): #kind is 'chats' or 'gc' @@ -179,12 +182,13 @@ class Chat: if self.plugin.systray_enabled: self.plugin.systray.remove_jid(new_jid, self.account) - nontabbed_status_image = self.xmls[jid].get_widget( - 'nontabbed_status_image') - if len(self.xmls) > 1: - nontabbed_status_image.hide() - else: - nontabbed_status_image.show() + if self.widget_name == 'tabbed_chat_window': + nontabbed_status_image = self.xmls[jid].get_widget( + 'nontabbed_status_image') + if len(self.xmls) > 1: + nontabbed_status_image.hide() + else: + nontabbed_status_image.show() conversation_textview.grab_focus() @@ -270,17 +274,19 @@ class Chat: child = self.childs[jid] self.notebook.append_page(child) - nontabbed_status_image = self.xmls[jid].get_widget( - 'nontabbed_status_image') + + if len(self.xmls) > 1: self.notebook.set_show_tabs(True) - nontabbed_status_image.hide() - else: - nontabbed_status_image.show() - xm = gtk.glade.XML(GTKGUI_GLADE, 'tab_hbox', APP) - tab_hbox = xm.get_widget('tab_hbox') - xm.signal_connect('on_close_button_clicked', \ + if self.widget_name == 'tabbed_chat_window': + xm = gtk.glade.XML(GTKGUI_GLADE, 'chat_tab_hbox', APP) + tab_hbox = xm.get_widget('chat_tab_hbox') + elif self.widget_name == 'groupchat_window': + xm = gtk.glade.XML(GTKGUI_GLADE, 'groupchat_tab_hbox', APP) + tab_hbox = xm.get_widget('groupchat_tab_hbox') + + xm.signal_connect('on_close_button_clicked', self.on_close_button_clicked, jid) self.notebook.set_tab_label(child, tab_hbox) diff --git a/src/gtkgui.glade b/src/gtkgui.glade index 05bfd2956..91793891a 100644 --- a/src/gtkgui.glade +++ b/src/gtkgui.glade @@ -7720,18 +7720,60 @@ Custom - + True - Group - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 + False + 5 + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + 20 + 20 + True + True + GTK_RELIEF_NONE + True + + + + + True + gtk-close + 1 + 0.5 + 0.5 + 0 + 6 + + + + + 0 + False + False + + tab @@ -8867,7 +8909,7 @@ Custom - + True False 5 diff --git a/src/roster_window.py b/src/roster_window.py index 29191c737..2a96d08d7 100644 --- a/src/roster_window.py +++ b/src/roster_window.py @@ -175,9 +175,7 @@ class Roster_window: def get_appropriate_state_images(self, jid): '''check jid and return the appropriate state images dict''' - if not jid: # we don't have the jid of the contact (in gc) - state_images = self.jabber_state_images - else: # it's not GC so we have the jid + if jid: if jid.find('@aim.') != -1: state_images = self.transports_state_images['aim'] elif jid.find('@gadugadu.') != -1: @@ -190,6 +188,8 @@ class Roster_window: state_images = self.transports_state_images['yahoo'] else: #jabber state_images = self.jabber_state_images + else: # in GC we don't have a jid + state_images = self.jabber_state_images return state_images diff --git a/src/tabbed_chat_window.py b/src/tabbed_chat_window.py index add56a70d..1ac0dc420 100644 --- a/src/tabbed_chat_window.py +++ b/src/tabbed_chat_window.py @@ -44,15 +44,15 @@ class Tabbed_chat_window(chat.Chat): self.users = {} self.new_user(user) self.show_title() - self.xml.signal_connect('on_tabbed_chat_window_destroy', \ + self.xml.signal_connect('on_tabbed_chat_window_destroy', self.on_tabbed_chat_window_destroy) - self.xml.signal_connect('on_tabbed_chat_window_delete_event', \ + self.xml.signal_connect('on_tabbed_chat_window_delete_event', self.on_tabbed_chat_window_delete_event) - self.xml.signal_connect('on_tabbed_chat_window_focus_in_event', \ + self.xml.signal_connect('on_tabbed_chat_window_focus_in_event', self.on_tabbed_chat_window_focus_in_event) - self.xml.signal_connect('on_chat_notebook_key_press_event', \ + self.xml.signal_connect('on_chat_notebook_key_press_event', self.on_chat_notebook_key_press_event) - self.xml.signal_connect('on_chat_notebook_switch_page', \ + self.xml.signal_connect('on_chat_notebook_switch_page', self.on_chat_notebook_switch_page) self.window.show_all() @@ -65,7 +65,7 @@ class Tabbed_chat_window(chat.Chat): def load_var(self, jid, var): if not self.xmls.has_key(jid): return - self.xmls[jid].get_widget('gpg_togglebutton').set_active(\ + self.xmls[jid].get_widget('gpg_togglebutton').set_active( var['gpg_enabled']) def draw_widgets(self, user): @@ -79,6 +79,13 @@ class Tabbed_chat_window(chat.Chat): if not user.keyID: self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False) + nontabbed_status_image = self.xmls[jid].get_widget( + 'nontabbed_status_image') + if len(self.xmls) > 1: + nontabbed_status_image.hide() + else: + nontabbed_status_image.show() + def set_state_image(self, jid): prio = 0 list_users = self.plugin.roster.contacts[self.account][jid] @@ -145,14 +152,6 @@ class Tabbed_chat_window(chat.Chat): chat.Chat.remove_tab(self, jid, 'chats') if len(self.xmls) > 0: del self.users[jid] - - jid = self.get_active_jid() # get the new active jid - nontabbed_status_image = self.xmls[jid].get_widget( - 'nontabbed_status_image') - if len(self.xmls) > 1: - nontabbed_status_image.hide() - else: - nontabbed_status_image.show() def new_user(self, user): self.names[user.jid] = user.name