fix leftovers from nicfit's [3690]
This commit is contained in:
parent
8259d027c9
commit
905230341a
28
src/chat.py
28
src/chat.py
|
@ -43,7 +43,7 @@ gtk.glade.textdomain(APP)
|
||||||
GTKGUI_GLADE = 'gtkgui.glade'
|
GTKGUI_GLADE = 'gtkgui.glade'
|
||||||
|
|
||||||
class Chat:
|
class Chat:
|
||||||
"""Class for chat/groupchat windows"""
|
'''Class for chat/groupchat windows'''
|
||||||
def __init__(self, plugin, account, widget_name):
|
def __init__(self, plugin, account, widget_name):
|
||||||
self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
|
self.xml = gtk.glade.XML(GTKGUI_GLADE, widget_name, APP)
|
||||||
self.window = self.xml.get_widget(widget_name)
|
self.window = self.xml.get_widget(widget_name)
|
||||||
|
@ -62,7 +62,6 @@ class Chat:
|
||||||
self.print_time_timeout_id = {}
|
self.print_time_timeout_id = {}
|
||||||
self.names = {} # what is printed in the tab (eg. user.name)
|
self.names = {} # what is printed in the tab (eg. user.name)
|
||||||
self.childs = {} # holds the contents for every tab (VBox)
|
self.childs = {} # holds the contents for every tab (VBox)
|
||||||
self.popup_is_shown = False # is a context menu shown or not?
|
|
||||||
|
|
||||||
# the following vars are used to keep history of user's messages
|
# the following vars are used to keep history of user's messages
|
||||||
self.sent_history = {}
|
self.sent_history = {}
|
||||||
|
@ -128,7 +127,7 @@ class Chat:
|
||||||
jid)
|
jid)
|
||||||
|
|
||||||
def show_title(self, urgent = True):
|
def show_title(self, urgent = True):
|
||||||
"""redraw the window's title"""
|
'''redraw the window's title'''
|
||||||
unread = 0
|
unread = 0
|
||||||
for jid in self.nb_unread:
|
for jid in self.nb_unread:
|
||||||
unread += self.nb_unread[jid]
|
unread += self.nb_unread[jid]
|
||||||
|
@ -300,11 +299,11 @@ class Chat:
|
||||||
return active_jid
|
return active_jid
|
||||||
|
|
||||||
def on_close_button_clicked(self, button, jid):
|
def on_close_button_clicked(self, button, jid):
|
||||||
"""When close button is pressed: close a tab"""
|
'''When close button is pressed: close a tab'''
|
||||||
self.remove_tab(jid)
|
self.remove_tab(jid)
|
||||||
|
|
||||||
def on_history_menuitem_clicked(self, widget = None, jid = None):
|
def on_history_menuitem_clicked(self, widget = None, jid = None):
|
||||||
"""When history menuitem is pressed: call history window"""
|
'''When history menuitem is pressed: call history window'''
|
||||||
if jid is None:
|
if jid is None:
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
if self.plugin.windows['logs'].has_key(jid):
|
if self.plugin.windows['logs'].has_key(jid):
|
||||||
|
@ -314,7 +313,7 @@ class Chat:
|
||||||
self.plugin, jid, self.account)
|
self.plugin, jid, self.account)
|
||||||
|
|
||||||
def on_chat_window_focus_in_event(self, widget, event):
|
def on_chat_window_focus_in_event(self, widget, event):
|
||||||
"""When window gets focus"""
|
'''When window gets focus'''
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
|
|
||||||
textview = self.xmls[jid].get_widget('conversation_textview')
|
textview = self.xmls[jid].get_widget('conversation_textview')
|
||||||
|
@ -355,7 +354,6 @@ class Chat:
|
||||||
self.actions_button = widget
|
self.actions_button = widget
|
||||||
|
|
||||||
menu = self.prepare_context_menu()
|
menu = self.prepare_context_menu()
|
||||||
self.popup_is_shown = True
|
|
||||||
menu.connect('deactivate', self.on_popup_deactivate)
|
menu.connect('deactivate', self.on_popup_deactivate)
|
||||||
menu.popup(None, None, self.position_actions_menu, 1, 0)
|
menu.popup(None, None, self.position_actions_menu, 1, 0)
|
||||||
menu.show_all()
|
menu.show_all()
|
||||||
|
@ -427,7 +425,6 @@ class Chat:
|
||||||
return menu
|
return menu
|
||||||
|
|
||||||
def popup_menu(self, event):
|
def popup_menu(self, event):
|
||||||
self.popup_is_shown = True
|
|
||||||
menu = self.prepare_context_menu()
|
menu = self.prepare_context_menu()
|
||||||
menu.connect('deactivate', self.on_popup_deactivate)
|
menu.connect('deactivate', self.on_popup_deactivate)
|
||||||
# common menuitems (tab switches)
|
# common menuitems (tab switches)
|
||||||
|
@ -452,9 +449,6 @@ class Chat:
|
||||||
if event.button == 3: # right click
|
if event.button == 3: # right click
|
||||||
self.popup_menu(event)
|
self.popup_menu(event)
|
||||||
|
|
||||||
def on_popup_deactivate(self, widget):
|
|
||||||
self.popup_is_shown = False
|
|
||||||
|
|
||||||
def on_chat_notebook_switch_page(self, notebook, page, page_num):
|
def on_chat_notebook_switch_page(self, notebook, page, page_num):
|
||||||
# get the index of the page and then the page that we're leaving
|
# get the index of the page and then the page that we're leaving
|
||||||
old_no = notebook.get_current_page()
|
old_no = notebook.get_current_page()
|
||||||
|
@ -734,7 +728,7 @@ class Chat:
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
|
||||||
def on_conversation_textview_key_press_event(self, widget, event):
|
def on_conversation_textview_key_press_event(self, widget, event):
|
||||||
"""Do not block these events and send them to the notebook"""
|
'''Do not block these events and send them to the notebook'''
|
||||||
if event.state & gtk.gdk.CONTROL_MASK:
|
if event.state & gtk.gdk.CONTROL_MASK:
|
||||||
if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
|
if event.keyval == gtk.keysyms.Tab: # CTRL + TAB
|
||||||
self.notebook.emit('key_press_event', event)
|
self.notebook.emit('key_press_event', event)
|
||||||
|
@ -881,16 +875,10 @@ class Chat:
|
||||||
'''basically it filters out the widget instance'''
|
'''basically it filters out the widget instance'''
|
||||||
helpers.launch_browser_mailer('url', link)
|
helpers.launch_browser_mailer('url', link)
|
||||||
|
|
||||||
def on_message_textview_populate_popup(self, textview, menu):
|
|
||||||
self.popup_is_shown = True
|
|
||||||
menu.connect('deactivate', self.on_popup_deactivate)
|
|
||||||
|
|
||||||
def on_conversation_textview_populate_popup(self, textview, menu):
|
def on_conversation_textview_populate_popup(self, textview, menu):
|
||||||
'''we override the default context menu and we prepend Clear
|
'''we override the default context menu and we prepend Clear
|
||||||
and if we have sth selected we show a submenu with actions on the phrase
|
and if we have sth selected we show a submenu with actions on the phrase
|
||||||
(see on_conversation_textview_button_press_event)'''
|
(see on_conversation_textview_button_press_event)'''
|
||||||
self.popup_is_shown = True
|
|
||||||
menu.connect('deactivate', self.on_popup_deactivate)
|
|
||||||
item = gtk.SeparatorMenuItem()
|
item = gtk.SeparatorMenuItem()
|
||||||
menu.prepend(item)
|
menu.prepend(item)
|
||||||
item = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
|
item = gtk.ImageMenuItem(gtk.STOCK_CLEAR)
|
||||||
|
@ -1037,8 +1025,6 @@ class Chat:
|
||||||
def make_link_menu(self, event, kind, text):
|
def make_link_menu(self, event, kind, text):
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'chat_context_menu', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'chat_context_menu', APP)
|
||||||
menu = xml.get_widget('chat_context_menu')
|
menu = xml.get_widget('chat_context_menu')
|
||||||
self.popup_is_shown = True
|
|
||||||
menu.connect('deactivate', self.on_popup_deactivate)
|
|
||||||
childs = menu.get_children()
|
childs = menu.get_children()
|
||||||
if kind == 'url':
|
if kind == 'url':
|
||||||
childs[0].connect('activate', self.on_copy_link_activate, text)
|
childs[0].connect('activate', self.on_copy_link_activate, text)
|
||||||
|
@ -1383,7 +1369,7 @@ class Chat:
|
||||||
banner_name_label.modify_fg(gtk.STATE_NORMAL, None)
|
banner_name_label.modify_fg(gtk.STATE_NORMAL, None)
|
||||||
|
|
||||||
def repaint_colored_widgets(self):
|
def repaint_colored_widgets(self):
|
||||||
"""Repaint widgets (banner) in the window/tab with theme color"""
|
'''Repaint widgets (banner) in the window/tab with theme color'''
|
||||||
# iterate through tabs/windows and repaint
|
# iterate through tabs/windows and repaint
|
||||||
for jid in self.xmls:
|
for jid in self.xmls:
|
||||||
self.paint_banner(jid)
|
self.paint_banner(jid)
|
||||||
|
|
|
@ -10941,7 +10941,6 @@ Status message</property>
|
||||||
<property name="indent">0</property>
|
<property name="indent">0</property>
|
||||||
<property name="text" translatable="yes"></property>
|
<property name="text" translatable="yes"></property>
|
||||||
<signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Wed, 02 Mar 2005 21:05:35 GMT"/>
|
<signal name="key_press_event" handler="on_message_textview_key_press_event" last_modification_time="Wed, 02 Mar 2005 21:05:35 GMT"/>
|
||||||
<signal name="populate_popup" handler="on_message_textview_populate_popup" last_modification_time="Sun, 07 Aug 2005 14:10:24 GMT"/>
|
|
||||||
</widget>
|
</widget>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -322,13 +322,6 @@ timestamp, contact):
|
||||||
# on focus in, send 'active' chatstate to current tab
|
# on focus in, send 'active' chatstate to current tab
|
||||||
self.send_chatstate('active')
|
self.send_chatstate('active')
|
||||||
|
|
||||||
def on_tabbed_chat_window_focus_out_event(self, widget, event):
|
|
||||||
'''catch focus out and minimized and send inactive chatstate;
|
|
||||||
minimize action also focuses out first so it's catched here'''
|
|
||||||
window_state = widget.window.get_state()
|
|
||||||
if window_state is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
def on_chat_notebook_key_press_event(self, widget, event):
|
def on_chat_notebook_key_press_event(self, widget, event):
|
||||||
chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
|
chat.Chat.on_chat_notebook_key_press_event(self, widget, event)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue