change callback, widget and variable names for group chat window in glade and in the code
This commit is contained in:
parent
f34437a7f7
commit
905449465a
|
@ -568,8 +568,8 @@ class join_groupchat_window:
|
|||
server = self.xml.get_widget('server_entry').get_text()
|
||||
password = self.xml.get_widget('password_entry').get_text()
|
||||
jid = '%s@%s' % (room, server)
|
||||
self.plugin.windows[self.account]['gc'][jid] = gtkgui.gc(jid, nickname,\
|
||||
self.plugin, self.account)
|
||||
self.plugin.windows[self.account]['gc'][jid] = \
|
||||
gtkgui.Groupchat_window(jid, nickname, self.plugin, self.account)
|
||||
#TODO: verify entries
|
||||
self.plugin.send('GC_JOIN', self.account, (nickname, room, server, \
|
||||
password))
|
||||
|
|
|
@ -6828,7 +6828,7 @@ Custom</property>
|
|||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="Gc">
|
||||
<widget class="GtkWindow" id="groupchat_window">
|
||||
<property name="border_width">4</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">Groupchat</property>
|
||||
|
@ -6844,8 +6844,8 @@ Custom</property>
|
|||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<signal name="destroy" handler="gtk_widget_destroy" last_modification_time="Tue, 03 Aug 2004 22:05:41 GMT"/>
|
||||
<signal name="focus_in_event" handler="on_focus" last_modification_time="Sun, 05 Sep 2004 09:15:16 GMT"/>
|
||||
<signal name="destroy" handler="on_groupchat_window_destroy" last_modification_time="Sat, 05 Mar 2005 00:34:45 GMT"/>
|
||||
<signal name="focus_in_event" handler="on_groupchat_window_focus_in_event" last_modification_time="Sat, 05 Mar 2005 00:34:51 GMT"/>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox27">
|
||||
|
@ -6901,7 +6901,20 @@ Custom</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<placeholder/>
|
||||
<widget class="GtkButton" id="set_button">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Set</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="on_set_button_clicked" last_modification_time="Sat, 05 Mar 2005 00:17:20 GMT"/>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
|
@ -6912,21 +6925,21 @@ Custom</property>
|
|||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVPaned" id="vpaned2">
|
||||
<widget class="GtkNotebook" id="notebook">
|
||||
<property name="border_width">4</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="position">280</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">True</property>
|
||||
<property name="enable_popup">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkNotebook" id="notebook">
|
||||
<property name="border_width">4</property>
|
||||
<widget class="GtkVPaned" id="vpaned4">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="show_tabs">True</property>
|
||||
<property name="show_border">True</property>
|
||||
<property name="tab_pos">GTK_POS_TOP</property>
|
||||
<property name="scrollable">True</property>
|
||||
<property name="enable_popup">False</property>
|
||||
<property name="position">225</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHPaned" id="hpaned">
|
||||
|
@ -6940,22 +6953,22 @@ Custom</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_NEVER</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="list">
|
||||
<widget class="GtkTreeView" id="list_treeview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">False</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">True</property>
|
||||
<property name="enable_search">False</property>
|
||||
<signal name="row_activated" handler="on_row_activated" last_modification_time="Mon, 20 Sep 2004 13:30:37 GMT"/>
|
||||
<signal name="row_collapsed" handler="on_row_collapsed" last_modification_time="Mon, 20 Sep 2004 13:30:45 GMT"/>
|
||||
<signal name="row_expanded" handler="on_row_expanded" last_modification_time="Mon, 20 Sep 2004 13:30:52 GMT"/>
|
||||
<signal name="button_press_event" handler="on_treeview_event" last_modification_time="Mon, 20 Sep 2004 16:22:47 GMT"/>
|
||||
<signal name="key_release_event" handler="on_treeview_event" last_modification_time="Mon, 20 Sep 2004 16:23:36 GMT"/>
|
||||
<signal name="row_activated" handler="on_list_treeview_row_activated" last_modification_time="Sat, 05 Mar 2005 00:31:45 GMT"/>
|
||||
<signal name="row_collapsed" handler="on_list_treeview_row_collapsed" last_modification_time="Sat, 05 Mar 2005 00:31:52 GMT"/>
|
||||
<signal name="row_expanded" handler="on_list_treeview_row_expanded" last_modification_time="Sat, 05 Mar 2005 00:31:57 GMT"/>
|
||||
<signal name="button_press_event" handler="on_list_treeview_button_press_event" last_modification_time="Sat, 05 Mar 2005 00:32:05 GMT"/>
|
||||
<signal name="key_release_event" handler="on_list_treeview_key_release_event" last_modification_time="Sat, 05 Mar 2005 00:32:15 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
@ -6971,11 +6984,11 @@ Custom</property>
|
|||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTextView" id="conversation">
|
||||
<widget class="GtkTextView" id="conversation_textview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">False</property>
|
||||
|
@ -7001,69 +7014,69 @@ Custom</property>
|
|||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label141">
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow19">
|
||||
<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="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTextView" id="message_textview">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="overwrite">False</property>
|
||||
<property name="accepts_tab">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="cursor_visible">True</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
<property name="pixels_inside_wrap">0</property>
|
||||
<property name="left_margin">0</property>
|
||||
<property name="right_margin">0</property>
|
||||
<property name="indent">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Sat, 05 Mar 2005 00:31:14 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">tab</property>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">False</property>
|
||||
<property name="tab_expand">False</property>
|
||||
<property name="tab_fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow19">
|
||||
<widget class="GtkLabel" id="label141">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="shadow_type">GTK_SHADOW_NONE</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTextView" id="message">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="editable">True</property>
|
||||
<property name="overwrite">False</property>
|
||||
<property name="accepts_tab">True</property>
|
||||
<property name="justification">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap_mode">GTK_WRAP_WORD</property>
|
||||
<property name="cursor_visible">True</property>
|
||||
<property name="pixels_above_lines">0</property>
|
||||
<property name="pixels_below_lines">0</property>
|
||||
<property name="pixels_inside_wrap">0</property>
|
||||
<property name="left_margin">0</property>
|
||||
<property name="right_margin">0</property>
|
||||
<property name="indent">0</property>
|
||||
<property name="text" translatable="yes"></property>
|
||||
<signal name="key_press_event" handler="on_msg_key_press_event" last_modification_time="Thu, 05 Aug 2004 15:29:07 GMT"/>
|
||||
</widget>
|
||||
</child>
|
||||
<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>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="shrink">True</property>
|
||||
<property name="resize">True</property>
|
||||
<property name="type">tab</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
|
|
|
@ -556,19 +556,15 @@ class tabbed_chat_window:
|
|||
self.redraw_tab(jid)
|
||||
self.show_title()
|
||||
|
||||
class gc:
|
||||
def delete_event(self, widget):
|
||||
class Groupchat_window:
|
||||
def on_groupchat_window_destroy(self, widget):
|
||||
"""close window"""
|
||||
self.plugin.send('GC_STATUS', self.account, (self.nick, self.jid,\
|
||||
'offline', 'offline'))
|
||||
del self.plugin.windows[self.account]['gc'][self.jid]
|
||||
|
||||
def on_close(self, widget):
|
||||
"""When Cancel button is clicked"""
|
||||
widget.get_toplevel().destroy()
|
||||
|
||||
def get_role_iter(self, name):
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
fin = False
|
||||
iter = model.get_iter_root()
|
||||
if not iter:
|
||||
|
@ -583,7 +579,7 @@ class gc:
|
|||
return None
|
||||
|
||||
def get_user_iter(self, jid):
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
fin = False
|
||||
role = model.get_iter_root()
|
||||
if not role:
|
||||
|
@ -605,7 +601,7 @@ class gc:
|
|||
return None
|
||||
|
||||
def get_user_list(self):
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
list = []
|
||||
fin = False
|
||||
role = model.get_iter_root()
|
||||
|
@ -629,7 +625,7 @@ class gc:
|
|||
|
||||
def remove_user(self, nick):
|
||||
"""Remove a user from the roster"""
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
iter = self.get_user_iter(nick)
|
||||
if not iter:
|
||||
return
|
||||
|
@ -639,18 +635,18 @@ class gc:
|
|||
model.remove(parent_iter)
|
||||
|
||||
def add_user_to_roster(self, nick, show, role, jid):
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
img = self.plugin.roster.pixbufs[show]
|
||||
role_iter = self.get_role_iter(role)
|
||||
if not role_iter:
|
||||
role_iter = model.append(None, (self.plugin.roster.pixbufs['closed']\
|
||||
, role, role))
|
||||
iter = model.append(role_iter, (img, nick, jid))
|
||||
self.tree.expand_row((model.get_path(role_iter)), False)
|
||||
self.list_treeview.expand_row((model.get_path(role_iter)), False)
|
||||
return iter
|
||||
|
||||
def get_role(self, jid_iter):
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
path = model.get_path(jid_iter)[0]
|
||||
iter = model.get_iter(path)
|
||||
return model.get_value(iter, 1)
|
||||
|
@ -658,7 +654,7 @@ class gc:
|
|||
def chg_user_status(self, nick, show, status, role, affiliation, jid, \
|
||||
reason, actor, statusCode, account):
|
||||
"""When a user change his status"""
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
if show == 'offline' or show == 'error':
|
||||
if statusCode == '307':
|
||||
self.print_conversation(_('%s has been kicked by %s: %s') % (nick, \
|
||||
|
@ -685,36 +681,40 @@ class gc:
|
|||
|
||||
def on_subject_entry_key_press_event(self, widget, event):
|
||||
if event.keyval == gtk.keysyms.Return:
|
||||
subject = self.xml.get_widget('subject_entry').get_text()
|
||||
subject = widget.get_text()
|
||||
self.plugin.send('GC_SUBJECT', self.account, (self.jid, subject))
|
||||
|
||||
def on_msg_key_press_event(self, widget, event):
|
||||
def on_set_button_clicked(self, widget):
|
||||
subject = self.xml.get_widget('subject_entry').get_text()
|
||||
self.plugin.send('GC_SUBJECT', self.account, (self.jid, subject))
|
||||
|
||||
def on_message_textview_key_press_event(self, widget, event):
|
||||
"""When a key is pressed :
|
||||
if enter is pressed without the shit key, message (if not empty) is sent
|
||||
and printed in the conversation"""
|
||||
if event.keyval == gtk.keysyms.Return:
|
||||
if (event.state & gtk.gdk.SHIFT_MASK):
|
||||
return 0
|
||||
txt_buffer = widget.get_buffer()
|
||||
start_iter = txt_buffer.get_start_iter()
|
||||
end_iter = txt_buffer.get_end_iter()
|
||||
txt = txt_buffer.get_text(start_iter, end_iter, 0)
|
||||
message_buffer = widget.get_buffer()
|
||||
start_iter = message_buffer.get_start_iter()
|
||||
end_iter = message_buffer.get_end_iter()
|
||||
txt = message_buffer.get_text(start_iter, end_iter, 0)
|
||||
if txt != '':
|
||||
self.plugin.send('GC_MSG', self.account, (self.jid, txt))
|
||||
txt_buffer.set_text('', -1)
|
||||
message_buffer.set_text('', -1)
|
||||
widget.grab_focus()
|
||||
return 1
|
||||
elif event.keyval == gtk.keysyms.Tab:
|
||||
list_nick = self.get_user_list()
|
||||
txt_buffer = widget.get_buffer()
|
||||
start_iter = txt_buffer.get_start_iter()
|
||||
cursor_position = txt_buffer.get_insert()
|
||||
end_iter = txt_buffer.get_iter_at_mark(cursor_position)
|
||||
txt = txt_buffer.get_text(start_iter, end_iter, 0)
|
||||
message_buffer = widget.get_buffer()
|
||||
start_iter = message_buffer.get_start_iter()
|
||||
cursor_position = message_buffer.get_insert()
|
||||
end_iter = message_buffer.get_iter_at_mark(cursor_position)
|
||||
txt = message_buffer.get_text(start_iter, end_iter, 0)
|
||||
begin = txt.split()[-1]
|
||||
for nick in list_nick:
|
||||
if nick.find(begin) == 0:
|
||||
txt_buffer.insert_at_cursor(nick[len(begin):] + ' ')
|
||||
message_buffer.insert_at_cursor(nick[len(begin):] + ' ')
|
||||
return 1
|
||||
return 0
|
||||
|
||||
|
@ -722,28 +722,29 @@ class gc:
|
|||
"""Print a line in the conversation :
|
||||
if contact is set : it's a message from someone
|
||||
if contact is not set : it's a message from the server"""
|
||||
conversation = self.xml.get_widget('conversation')
|
||||
buffer = conversation.get_buffer()
|
||||
conversation_textview = self.xml.get_widget('conversation_textview')
|
||||
conversation_buffer = conversation_textview.get_buffer()
|
||||
if not txt:
|
||||
txt = ""
|
||||
end_iter = buffer.get_end_iter()
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
if not tim:
|
||||
tim = time.localtime()
|
||||
tims = time.strftime('[%H:%M:%S]', tim)
|
||||
buffer.insert(end_iter, tims)
|
||||
conversation_buffer.insert(end_iter, tims)
|
||||
if contact:
|
||||
if contact == self.nick:
|
||||
buffer.insert_with_tags_by_name(end_iter, '<'+contact+'> ', \
|
||||
'outgoing')
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter, '<' + \
|
||||
contact + '> ', 'outgoing')
|
||||
else:
|
||||
buffer.insert_with_tags_by_name(end_iter, '<' + contact + '> ', \
|
||||
'incoming')
|
||||
buffer.insert(end_iter, txt+'\n')
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter, '<' + \
|
||||
contact + '> ', 'incoming')
|
||||
conversation_buffer.insert(end_iter, txt + '\n')
|
||||
else:
|
||||
buffer.insert_with_tags_by_name(end_iter, txt+'\n', \
|
||||
conversation_buffer.insert_with_tags_by_name(end_iter, txt + '\n', \
|
||||
'status')
|
||||
#scroll to the end of the textview
|
||||
conversation.scroll_to_mark(buffer.get_mark('end'), 0.1, 0, 0, 0)
|
||||
conversation_textview.scroll_to_mark(conversation_buffer.get_mark('end'),\
|
||||
0.1, 0, 0, 0)
|
||||
|
||||
def kick(self, widget, room_jid, nick):
|
||||
"""kick a user"""
|
||||
|
@ -811,7 +812,7 @@ class gc:
|
|||
|
||||
def mk_menu(self, event, iter):
|
||||
"""Make user's popup menu"""
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
nick = model.get_value(iter, 1)
|
||||
jid = model.get_value(iter, 2)
|
||||
|
||||
|
@ -873,57 +874,60 @@ class gc:
|
|||
menu.show_all()
|
||||
menu.reposition()
|
||||
|
||||
def on_focus(self, widget, event):
|
||||
def on_groupchat_window_focus_in_event(self, widget, event):
|
||||
"""When window get focus"""
|
||||
self.plugin.systray.remove_jid(self.jid, self.account)
|
||||
|
||||
def on_treeview_event(self, widget, event):
|
||||
def on_list_treeview_button_press_event(self, widget, event):
|
||||
"""popup user's group's or agent menu"""
|
||||
if event.type == gtk.gdk.BUTTON_PRESS:
|
||||
if event.button == 3:
|
||||
try:
|
||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x), \
|
||||
int(event.y))
|
||||
path, column, x, y = self.list_treeview.get_path_at_pos(\
|
||||
int(event.x), int(event.y))
|
||||
except TypeError:
|
||||
self.tree.get_selection().unselect_all()
|
||||
self.list_treeview.get_selection().unselect_all()
|
||||
return False
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
iter = model.get_iter(path)
|
||||
if len(path) == 2:
|
||||
self.mk_menu(event, iter)
|
||||
return True
|
||||
if event.button == 1:
|
||||
try:
|
||||
path, column, x, y = self.tree.get_path_at_pos(int(event.x), \
|
||||
int(event.y))
|
||||
path, column, x, y = self.list_treeview.get_path_at_pos(\
|
||||
int(event.x), int(event.y))
|
||||
except TypeError:
|
||||
self.tree.get_selection().unselect_all()
|
||||
if event.type == gtk.gdk.KEY_RELEASE:
|
||||
if event.keyval == gtk.keysyms.Escape:
|
||||
self.tree.get_selection().unselect_all()
|
||||
self.list_treeview.get_selection().unselect_all()
|
||||
return False
|
||||
|
||||
def on_row_activated(self, widget, path, col=0):
|
||||
def on_list_treeview_key_release_event(self, widget, event):
|
||||
if event.type == gtk.gdk.KEY_RELEASE:
|
||||
if event.keyval == gtk.keysyms.Escape:
|
||||
self.list_treeview.get_selection().unselect_all()
|
||||
return False
|
||||
|
||||
def on_list_treeview_row_activated(self, widget, path, col=0):
|
||||
"""When an iter is dubble clicked :
|
||||
open the chat window"""
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
iter = model.get_iter(path)
|
||||
if len(path) == 1:
|
||||
if (self.tree.row_expanded(path)):
|
||||
self.tree.collapse_row(path)
|
||||
if (self.list_treeview.row_expanded(path)):
|
||||
self.list_treeview.collapse_row(path)
|
||||
else:
|
||||
self.tree.expand_row(path, False)
|
||||
self.list_treeview.expand_row(path, False)
|
||||
|
||||
def on_row_expanded(self, widget, iter, path):
|
||||
def on_list_treeview_row_expanded(self, widget, iter, path):
|
||||
"""When a row is expanded :
|
||||
change the icon of the arrow"""
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
model.set_value(iter, 0, self.plugin.roster.pixbufs['opened'])
|
||||
|
||||
def on_row_collapsed(self, widget, iter, path):
|
||||
def on_list_treeview_row_collapsed(self, widget, iter, path):
|
||||
"""When a row is collapsed :
|
||||
change the icon of the arrow"""
|
||||
model = self.tree.get_model()
|
||||
model = self.list_treeview.get_model()
|
||||
model.set_value(iter, 0, self.plugin.roster.pixbufs['closed'])
|
||||
|
||||
def __init__(self, jid, nick, plugin, account):
|
||||
|
@ -931,9 +935,9 @@ class gc:
|
|||
self.nick = nick
|
||||
self.plugin = plugin
|
||||
self.account = account
|
||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'Gc', APP)
|
||||
self.window = self.xml.get_widget('Gc')
|
||||
self.tree = self.xml.get_widget('list')
|
||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, 'groupchat_window', APP)
|
||||
self.window = self.xml.get_widget('groupchat_window')
|
||||
self.list_treeview = self.xml.get_widget('list_treeview')
|
||||
#status_image, nickname, real_jid
|
||||
store = gtk.TreeStore(gtk.Image, str, str)
|
||||
column = gtk.TreeViewColumn('contacts')
|
||||
|
@ -944,38 +948,30 @@ class gc:
|
|||
column.pack_start(render_text, expand = True)
|
||||
column.add_attribute(render_text, 'text', 1)
|
||||
|
||||
self.tree.append_column(column)
|
||||
self.tree.set_model(store)
|
||||
self.list_treeview.append_column(column)
|
||||
self.list_treeview.set_model(store)
|
||||
|
||||
col = gtk.TreeViewColumn()
|
||||
render = gtk.CellRendererPixbuf()
|
||||
col.pack_start(render, expand = False)
|
||||
self.tree.append_column(col)
|
||||
self.list_treeview.append_column(col)
|
||||
col.set_visible(False)
|
||||
self.tree.set_expander_column(col)
|
||||
self.list_treeview.set_expander_column(col)
|
||||
|
||||
conversation = self.xml.get_widget('conversation')
|
||||
buffer = conversation.get_buffer()
|
||||
end_iter = buffer.get_end_iter()
|
||||
buffer.create_mark('end', end_iter, 0)
|
||||
self.tagIn = buffer.create_tag('incoming')
|
||||
conversation_textview = self.xml.get_widget('conversation_textview')
|
||||
conversation_buffer = conversation_textview.get_buffer()
|
||||
end_iter = conversation_buffer.get_end_iter()
|
||||
conversation_buffer.create_mark('end', end_iter, 0)
|
||||
self.tagIn = conversation_buffer.create_tag('incoming')
|
||||
color = self.plugin.config['inmsgcolor']
|
||||
self.tagIn.set_property('foreground', color)
|
||||
self.tagOut = buffer.create_tag('outgoing')
|
||||
self.tagOut = conversation_buffer.create_tag('outgoing')
|
||||
color = self.plugin.config['outmsgcolor']
|
||||
self.tagOut.set_property('foreground', color)
|
||||
self.tagStatus = buffer.create_tag('status')
|
||||
self.tagStatus = conversation_buffer.create_tag('status')
|
||||
color = self.plugin.config['statusmsgcolor']
|
||||
self.tagStatus.set_property('foreground', color)
|
||||
self.xml.signal_connect('gtk_widget_destroy', self.delete_event)
|
||||
self.xml.signal_connect('on_focus', self.on_focus)
|
||||
self.xml.signal_connect('on_msg_key_press_event', \
|
||||
self.on_msg_key_press_event)
|
||||
self.xml.signal_connect('on_treeview_event', self.on_treeview_event)
|
||||
self.xml.signal_connect('on_row_activated', self.on_row_activated)
|
||||
self.xml.signal_connect('on_row_expanded', self.on_row_expanded)
|
||||
self.xml.signal_connect('on_row_collapsed', self.on_row_collapsed)
|
||||
self.xml.signal_connect('on_subject_entry_key_press_event', self.on_subject_entry_key_press_event)
|
||||
self.xml.signal_autoconnect(self)
|
||||
|
||||
class history_window:
|
||||
"""Class for bowser agent window :
|
||||
|
|
Loading…
Reference in New Issue