if not foo else becomes if foo else:
This commit is contained in:
parent
73f6e4d758
commit
2e668210c2
38
src/chat.py
38
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)
|
||||
|
||||
|
|
|
@ -7720,18 +7720,60 @@ Custom</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label141">
|
||||
<widget class="GtkHBox" id="groupchat_tab_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Group</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label250">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="close_button">
|
||||
<property name="width_request">20</property>
|
||||
<property name="height_request">20</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="relief">GTK_RELIEF_NONE</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_close_button_clicked" last_modification_time="Sat, 12 Mar 2005 00:12:43 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkImage" id="image504">
|
||||
<property name="visible">True</property>
|
||||
<property name="stock">gtk-close</property>
|
||||
<property name="icon_size">1</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">6</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
|
@ -8867,7 +8909,7 @@ Custom</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="tab_hbox">
|
||||
<widget class="GtkHBox" id="chat_tab_hbox">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue