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 = '* '
|
start = '* '
|
||||||
|
|
||||||
child = self.childs[jid]
|
child = self.childs[jid]
|
||||||
children = self.notebook.get_tab_label(child).get_children()
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
nickname = children[1]
|
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])
|
nickname.set_text(start + self.names[jid])
|
||||||
|
|
||||||
def on_window_destroy(self, widget, kind): #kind is 'chats' or 'gc'
|
def on_window_destroy(self, widget, kind): #kind is 'chats' or 'gc'
|
||||||
|
@ -179,12 +182,13 @@ class Chat:
|
||||||
if self.plugin.systray_enabled:
|
if self.plugin.systray_enabled:
|
||||||
self.plugin.systray.remove_jid(new_jid, self.account)
|
self.plugin.systray.remove_jid(new_jid, self.account)
|
||||||
|
|
||||||
nontabbed_status_image = self.xmls[jid].get_widget(
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
'nontabbed_status_image')
|
nontabbed_status_image = self.xmls[jid].get_widget(
|
||||||
if len(self.xmls) > 1:
|
'nontabbed_status_image')
|
||||||
nontabbed_status_image.hide()
|
if len(self.xmls) > 1:
|
||||||
else:
|
nontabbed_status_image.hide()
|
||||||
nontabbed_status_image.show()
|
else:
|
||||||
|
nontabbed_status_image.show()
|
||||||
|
|
||||||
conversation_textview.grab_focus()
|
conversation_textview.grab_focus()
|
||||||
|
|
||||||
|
@ -270,17 +274,19 @@ class Chat:
|
||||||
|
|
||||||
child = self.childs[jid]
|
child = self.childs[jid]
|
||||||
self.notebook.append_page(child)
|
self.notebook.append_page(child)
|
||||||
nontabbed_status_image = self.xmls[jid].get_widget(
|
|
||||||
'nontabbed_status_image')
|
|
||||||
if len(self.xmls) > 1:
|
if len(self.xmls) > 1:
|
||||||
self.notebook.set_show_tabs(True)
|
self.notebook.set_show_tabs(True)
|
||||||
nontabbed_status_image.hide()
|
|
||||||
else:
|
|
||||||
nontabbed_status_image.show()
|
|
||||||
|
|
||||||
xm = gtk.glade.XML(GTKGUI_GLADE, 'tab_hbox', APP)
|
if self.widget_name == 'tabbed_chat_window':
|
||||||
tab_hbox = xm.get_widget('tab_hbox')
|
xm = gtk.glade.XML(GTKGUI_GLADE, 'chat_tab_hbox', APP)
|
||||||
xm.signal_connect('on_close_button_clicked', \
|
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.on_close_button_clicked, jid)
|
||||||
self.notebook.set_tab_label(child, tab_hbox)
|
self.notebook.set_tab_label(child, tab_hbox)
|
||||||
|
|
||||||
|
|
|
@ -7720,18 +7720,60 @@ Custom</property>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkLabel" id="label141">
|
<widget class="GtkHBox" id="groupchat_tab_hbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="label" translatable="yes">Group</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="use_underline">False</property>
|
<property name="spacing">5</property>
|
||||||
<property name="use_markup">False</property>
|
|
||||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
<child>
|
||||||
<property name="wrap">False</property>
|
<widget class="GtkLabel" id="label250">
|
||||||
<property name="selectable">False</property>
|
<property name="visible">True</property>
|
||||||
<property name="xalign">0.5</property>
|
<property name="label" translatable="yes"></property>
|
||||||
<property name="yalign">0.5</property>
|
<property name="use_underline">False</property>
|
||||||
<property name="xpad">0</property>
|
<property name="use_markup">False</property>
|
||||||
<property name="ypad">0</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>
|
</widget>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="type">tab</property>
|
<property name="type">tab</property>
|
||||||
|
@ -8867,7 +8909,7 @@ Custom</property>
|
||||||
</child>
|
</child>
|
||||||
|
|
||||||
<child>
|
<child>
|
||||||
<widget class="GtkHBox" id="tab_hbox">
|
<widget class="GtkHBox" id="chat_tab_hbox">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="homogeneous">False</property>
|
<property name="homogeneous">False</property>
|
||||||
<property name="spacing">5</property>
|
<property name="spacing">5</property>
|
||||||
|
|
|
@ -175,9 +175,7 @@ class Roster_window:
|
||||||
|
|
||||||
def get_appropriate_state_images(self, jid):
|
def get_appropriate_state_images(self, jid):
|
||||||
'''check jid and return the appropriate state images dict'''
|
'''check jid and return the appropriate state images dict'''
|
||||||
if not jid: # we don't have the jid of the contact (in gc)
|
if jid:
|
||||||
state_images = self.jabber_state_images
|
|
||||||
else: # it's not GC so we have the jid
|
|
||||||
if jid.find('@aim.') != -1:
|
if jid.find('@aim.') != -1:
|
||||||
state_images = self.transports_state_images['aim']
|
state_images = self.transports_state_images['aim']
|
||||||
elif jid.find('@gadugadu.') != -1:
|
elif jid.find('@gadugadu.') != -1:
|
||||||
|
@ -190,6 +188,8 @@ class Roster_window:
|
||||||
state_images = self.transports_state_images['yahoo']
|
state_images = self.transports_state_images['yahoo']
|
||||||
else: #jabber
|
else: #jabber
|
||||||
state_images = self.jabber_state_images
|
state_images = self.jabber_state_images
|
||||||
|
else: # in GC we don't have a jid
|
||||||
|
state_images = self.jabber_state_images
|
||||||
|
|
||||||
return state_images
|
return state_images
|
||||||
|
|
||||||
|
|
|
@ -44,15 +44,15 @@ class Tabbed_chat_window(chat.Chat):
|
||||||
self.users = {}
|
self.users = {}
|
||||||
self.new_user(user)
|
self.new_user(user)
|
||||||
self.show_title()
|
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.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.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.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.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.on_chat_notebook_switch_page)
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ class Tabbed_chat_window(chat.Chat):
|
||||||
def load_var(self, jid, var):
|
def load_var(self, jid, var):
|
||||||
if not self.xmls.has_key(jid):
|
if not self.xmls.has_key(jid):
|
||||||
return
|
return
|
||||||
self.xmls[jid].get_widget('gpg_togglebutton').set_active(\
|
self.xmls[jid].get_widget('gpg_togglebutton').set_active(
|
||||||
var['gpg_enabled'])
|
var['gpg_enabled'])
|
||||||
|
|
||||||
def draw_widgets(self, user):
|
def draw_widgets(self, user):
|
||||||
|
@ -79,6 +79,13 @@ class Tabbed_chat_window(chat.Chat):
|
||||||
if not user.keyID:
|
if not user.keyID:
|
||||||
self.xmls[jid].get_widget('gpg_togglebutton').set_sensitive(False)
|
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):
|
def set_state_image(self, jid):
|
||||||
prio = 0
|
prio = 0
|
||||||
list_users = self.plugin.roster.contacts[self.account][jid]
|
list_users = self.plugin.roster.contacts[self.account][jid]
|
||||||
|
@ -146,14 +153,6 @@ class Tabbed_chat_window(chat.Chat):
|
||||||
if len(self.xmls) > 0:
|
if len(self.xmls) > 0:
|
||||||
del self.users[jid]
|
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):
|
def new_user(self, user):
|
||||||
self.names[user.jid] = user.name
|
self.names[user.jid] = user.name
|
||||||
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chats_vbox', APP)
|
self.xmls[user.jid] = gtk.glade.XML(GTKGUI_GLADE, 'chats_vbox', APP)
|
||||||
|
|
Loading…
Reference in New Issue