Enhancement to ctrl+tab behaviour :
If no awaiting events, switch to composing contacts'tabs if any
This commit is contained in:
parent
6c6868a452
commit
4b604a6485
1 changed files with 12 additions and 3 deletions
|
@ -416,6 +416,8 @@ class MessageWindow:
|
||||||
ind = self.notebook.get_current_page()
|
ind = self.notebook.get_current_page()
|
||||||
current = ind
|
current = ind
|
||||||
found = False
|
found = False
|
||||||
|
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
|
# loop until finding an unread tab or having done a complete cycle
|
||||||
while True:
|
while True:
|
||||||
if forward == True: # look for the first unread tab on the right
|
if forward == True: # look for the first unread tab on the right
|
||||||
|
@ -426,15 +428,22 @@ class MessageWindow:
|
||||||
ind = ind - 1
|
ind = ind - 1
|
||||||
if ind < 0:
|
if ind < 0:
|
||||||
ind = self.notebook.get_n_pages() - 1
|
ind = self.notebook.get_n_pages() - 1
|
||||||
if ind == current:
|
|
||||||
break # a complete cycle without finding an unread tab
|
|
||||||
ctrl = self.get_control(ind, None)
|
ctrl = self.get_control(ind, None)
|
||||||
if ctrl.nb_unread > 0:
|
if ctrl.nb_unread > 0:
|
||||||
found = True
|
found = True
|
||||||
break # found
|
break # found
|
||||||
|
else: # 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
|
||||||
|
first_composing_ind = ind
|
||||||
|
if ind == current:
|
||||||
|
break # a complete cycle without finding an unread tab
|
||||||
if found:
|
if found:
|
||||||
self.notebook.set_current_page(ind)
|
self.notebook.set_current_page(ind)
|
||||||
else: # not found
|
elif first_composing_ind != -1:
|
||||||
|
self.notebook.set_current_page(first_composing_ind)
|
||||||
|
else: # not found and nobody composing
|
||||||
if forward: # CTRL + TAB
|
if forward: # CTRL + TAB
|
||||||
if current < (self.notebook.get_n_pages() - 1):
|
if current < (self.notebook.get_n_pages() - 1):
|
||||||
self.notebook.next_page()
|
self.notebook.next_page()
|
||||||
|
|
Loading…
Add table
Reference in a new issue