trying to make mouse and kbd activity work as expected
This commit is contained in:
parent
308bc5c239
commit
334c2bdcf7
1 changed files with 15 additions and 6 deletions
|
@ -320,12 +320,17 @@ class TabbedChatWindow(chat.Chat):
|
||||||
current_state = self.chatstates[contact.jid]
|
current_state = self.chatstates[contact.jid]
|
||||||
if current_state == False: # he doesn't support chatstates
|
if current_state == False: # he doesn't support chatstates
|
||||||
return False # stop looping
|
return False # stop looping
|
||||||
|
print 'mouse', self.mouse_over_in_last_5_secs
|
||||||
|
print 'kbd', self.kbd_activity_in_last_5_secs
|
||||||
|
|
||||||
if self.mouse_over_in_last_5_secs:
|
if self.mouse_over_in_last_5_secs:
|
||||||
self.send_chatstate('active')
|
self.send_chatstate('active')
|
||||||
if self.kbd_activity_in_last_5_secs:
|
elif self.kbd_activity_in_last_5_secs:
|
||||||
self.send_chatstate('composing')
|
self.send_chatstate('composing')
|
||||||
else:
|
else:
|
||||||
self.send_chatstate('paused')
|
self.send_chatstate('paused')
|
||||||
|
|
||||||
|
# assume no activity and let the motion-notify or key_press make them True
|
||||||
self.mouse_over_in_last_5_secs = False
|
self.mouse_over_in_last_5_secs = False
|
||||||
self.kbd_activity_in_last_5_secs = False
|
self.kbd_activity_in_last_5_secs = False
|
||||||
|
|
||||||
|
@ -338,6 +343,7 @@ class TabbedChatWindow(chat.Chat):
|
||||||
current_state = self.chatstates[contact.jid]
|
current_state = self.chatstates[contact.jid]
|
||||||
if current_state == False: # he doesn't support chatstates
|
if current_state == False: # he doesn't support chatstates
|
||||||
return False # stop looping
|
return False # stop looping
|
||||||
|
|
||||||
if self.mouse_over_in_last_5_secs:
|
if self.mouse_over_in_last_5_secs:
|
||||||
self.send_chatstate('active')
|
self.send_chatstate('active')
|
||||||
elif self.kbd_activity_in_last_5_secs:
|
elif self.kbd_activity_in_last_5_secs:
|
||||||
|
@ -345,6 +351,10 @@ class TabbedChatWindow(chat.Chat):
|
||||||
else:
|
else:
|
||||||
self.send_chatstate('inactive')
|
self.send_chatstate('inactive')
|
||||||
|
|
||||||
|
# assume no activity and let the motion-notify or key_press make them True
|
||||||
|
self.mouse_over_in_last_5_secs = False
|
||||||
|
self.kbd_activity_in_last_5_secs = False
|
||||||
|
|
||||||
return True # loop forever
|
return True # loop forever
|
||||||
|
|
||||||
def on_message_textview_key_press_event(self, widget, event):
|
def on_message_textview_key_press_event(self, widget, event):
|
||||||
|
@ -417,7 +427,6 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
|
|
||||||
# print jid, self.chatstates[jid], state
|
|
||||||
if self.chatstates[jid] == False:
|
if self.chatstates[jid] == False:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -485,8 +494,8 @@ class TabbedChatWindow(chat.Chat):
|
||||||
|
|
||||||
def on_contact_button_clicked(self, widget):
|
def on_contact_button_clicked(self, widget):
|
||||||
jid = self.get_active_jid()
|
jid = self.get_active_jid()
|
||||||
user = self.users[jid]
|
contact = self.users[jid]
|
||||||
self.plugin.roster.on_info(widget, user, self.account)
|
self.plugin.roster.on_info(widget, contact, self.account)
|
||||||
|
|
||||||
def read_queue(self, jid):
|
def read_queue(self, jid):
|
||||||
"""read queue and print messages containted in it"""
|
"""read queue and print messages containted in it"""
|
||||||
|
|
Loading…
Add table
Reference in a new issue