tab_eventbox widget. do not grab focus

This commit is contained in:
Denis Fomin 2010-12-11 12:15:55 +03:00
parent 6b6e598c4d
commit e9eb73d21c
1 changed files with 21 additions and 16 deletions

View File

@ -219,9 +219,9 @@ class MessageWindow(object):
# destroy window
return False
dialogs.YesNoDialog(
_('You are going to close several tabs'),
_('Do you really want to close them all?'),
checktext=_('_Do not ask me again'), on_response_yes=on_yes1)
_('You are going to close several tabs'),
_('Do you really want to close them all?'),
checktext=_('_Do not ask me again'), on_response_yes=on_yes1)
return True
def on_yes(ctrl):
@ -292,8 +292,8 @@ _('Do you really want to close them all?'),
id_ = widget.connect('clicked', self._on_close_button_clicked, control)
control.handlers[id_] = widget
id_ = tab_label_box.connect('button-press-event', self.on_tab_eventbox_button_press_event,
control.widget)
id_ = tab_label_box.connect('button-press-event',
self.on_tab_eventbox_button_press_event, control.widget)
control.handlers[id_] = tab_label_box
self.notebook.append_page(control.widget, tab_label_box)
@ -317,6 +317,9 @@ _('Do you really want to close them all?'),
elif event.button == 2: # middle click
ctrl = self._widget_to_control(child)
self.remove_tab(ctrl, self.CLOSE_TAB_MIDDLE_CLICK)
else:
ctrl = self._widget_to_control(child)
gobject.idle_add(ctrl.msg_textview.grab_focus)
def _on_message_textview_mykeypress_event(self, widget, event_keyval,
event_keymod):
@ -591,7 +594,7 @@ _('Do you really want to close them all?'),
elif self.get_num_controls() == 1: # we are going from two tabs to one
window_mode = gajim.interface.msg_win_mgr.mode
show_tabs_if_one_tab = gajim.config.get('tabs_always_visible') or \
window_mode == MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER
window_mode == MessageWindowMgr.ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER
self.notebook.set_show_tabs(show_tabs_if_one_tab)
def redraw_tab(self, ctrl, chatstate = None):
@ -719,8 +722,8 @@ _('Do you really want to close them all?'),
ind = self.notebook.get_current_page()
current = ind
found = False
first_composing_ind = -1 # id of first composing ctrl to switch to
# if no others controls have awaiting events
first_composing_ind = -1 # id of first composing ctrl to switch to
# if no others controls have awaiting events
# loop until finding an unread tab or having done a complete cycle
while True:
if forward == True: # look for the first unread tab on the right
@ -735,7 +738,8 @@ _('Do you really want to close them all?'),
if ctrl.get_nb_unread() > 0:
found = True
break # found
elif gajim.config.get('ctrl_tab_go_to_next_composing') : # Search for a composing contact
elif gajim.config.get('ctrl_tab_go_to_next_composing') :
# Search for a composing contact
contact = ctrl.contact
if first_composing_ind == -1 and contact.chatstate == 'composing':
# If no composing contact found yet, check if this one is composing
@ -780,7 +784,8 @@ _('Do you really want to close them all?'),
control.msg_textview.grab_focus()
def _on_notebook_key_press(self, widget, event):
# when tab itself is selected, make sure <- and -> are allowed for navigating between tabs
# when tab itself is selected,
# make sure <- and -> are allowed for navigating between tabs
if event.keyval in (gtk.keysyms.Left, gtk.keysyms.Right):
return False
@ -888,11 +893,11 @@ class MessageWindowMgr(gobject.GObject):
def __init__(self, parent_window, parent_paned):
"""
A dictionary of windows; the key depends on the config:
ONE_MSG_WINDOW_NEVER: The key is the contact JID
ONE_MSG_WINDOW_ALWAYS: The key is MessageWindowMgr.MAIN_WIN
ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER: The key is MessageWindowMgr.MAIN_WIN
ONE_MSG_WINDOW_PERACCT: The key is the account name
ONE_MSG_WINDOW_PERTYPE: The key is a message type constant
ONE_MSG_WINDOW_NEVER: The key is the contact JID
ONE_MSG_WINDOW_ALWAYS: The key is MessageWindowMgr.MAIN_WIN
ONE_MSG_WINDOW_ALWAYS_WITH_ROSTER: The key is MessageWindowMgr.MAIN_WIN
ONE_MSG_WINDOW_PERACCT: The key is the account name
ONE_MSG_WINDOW_PERTYPE: The key is a message type constant
"""
gobject.GObject.__init__(self)
self._windows = {}
@ -939,7 +944,7 @@ class MessageWindowMgr(gobject.GObject):
def one_window_opened(self, contact=None, acct=None, type_=None):
try:
return \
self._windows[self._mode_to_key(contact, acct, type_)] is not None
self._windows[self._mode_to_key(contact, acct, type_)] is not None
except KeyError:
return False