/me works, room subject ellipses, and ui update fixes
This commit is contained in:
parent
2a794ba19e
commit
0da89c3996
|
@ -50,14 +50,11 @@ class ChatControlBase(MessageControl):
|
||||||
'''A base class containing a banner, ConversationTextview, MessageTextView
|
'''A base class containing a banner, ConversationTextview, MessageTextView
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def draw_widgets(self):
|
|
||||||
self.draw_banner()
|
|
||||||
# Derived types MUST implement this
|
|
||||||
def draw_banner(self):
|
def draw_banner(self):
|
||||||
self._paint_banner()
|
self._paint_banner()
|
||||||
self._update_banner_state_image()
|
self._update_banner_state_image()
|
||||||
# Derived types SHOULD implement this
|
# Derived types SHOULD implement this
|
||||||
def update_state(self):
|
def update_ui(self):
|
||||||
self.draw_banner()
|
self.draw_banner()
|
||||||
# Derived types SHOULD implement this
|
# Derived types SHOULD implement this
|
||||||
def repaint_themed_widgets(self):
|
def repaint_themed_widgets(self):
|
||||||
|
@ -66,7 +63,7 @@ class ChatControlBase(MessageControl):
|
||||||
def _update_banner_state_image(self):
|
def _update_banner_state_image(self):
|
||||||
pass # Derived types MAY implement this
|
pass # Derived types MAY implement this
|
||||||
|
|
||||||
def handle_message_textview_mykey_press(self):
|
def handle_message_textview_mykey_press(self, widget, event_keyval, event_keymod):
|
||||||
pass # Derived should implement this rather than connecting to the event itself.
|
pass # Derived should implement this rather than connecting to the event itself.
|
||||||
|
|
||||||
def __init__(self, type_id, parent_win, widget_name, display_name, contact, acct):
|
def __init__(self, type_id, parent_win, widget_name, display_name, contact, acct):
|
||||||
|
@ -684,7 +681,7 @@ class ChatControl(ChatControlBase):
|
||||||
if self.contact.jid in gajim.encrypted_chats[self.account]:
|
if self.contact.jid in gajim.encrypted_chats[self.account]:
|
||||||
self.xml.get_widget('gpg_togglebutton').set_active(True)
|
self.xml.get_widget('gpg_togglebutton').set_active(True)
|
||||||
|
|
||||||
self.draw_widgets()
|
self.update_ui()
|
||||||
# restore previous conversation
|
# restore previous conversation
|
||||||
self.restore_conversation()
|
self.restore_conversation()
|
||||||
|
|
||||||
|
@ -740,9 +737,9 @@ class ChatControl(ChatControlBase):
|
||||||
self.possible_inactive_timeout_id = gobject.timeout_add(30000,
|
self.possible_inactive_timeout_id = gobject.timeout_add(30000,
|
||||||
self.check_for_possible_inactive_chatstate, None)
|
self.check_for_possible_inactive_chatstate, None)
|
||||||
|
|
||||||
def draw_widgets(self):
|
def update_ui(self):
|
||||||
# The name banner is drawn here
|
# The name banner is drawn here
|
||||||
ChatControlBase.draw_widgets(self)
|
ChatControlBase.update_ui(self)
|
||||||
|
|
||||||
def _update_banner_state_image(self):
|
def _update_banner_state_image(self):
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(self.account,
|
contact = gajim.contacts.get_contact_with_highest_priority(self.account,
|
||||||
|
@ -1324,7 +1321,7 @@ class ChatControl(ChatControlBase):
|
||||||
typ = 'chat' # Is it a normal chat or a pm ?
|
typ = 'chat' # Is it a normal chat or a pm ?
|
||||||
# reset to status image in gc if it is a pm
|
# reset to status image in gc if it is a pm
|
||||||
if is_pm:
|
if is_pm:
|
||||||
control.draw_widgets()
|
control.update_ui()
|
||||||
typ = 'pm'
|
typ = 'pm'
|
||||||
|
|
||||||
gajim.interface.roster.draw_contact(jid, self.account)
|
gajim.interface.roster.draw_contact(jid, self.account)
|
||||||
|
|
|
@ -2217,6 +2217,7 @@ class Connection:
|
||||||
t.setTagData('password', password)
|
t.setTagData('password', password)
|
||||||
self.to_be_sent.append(p)
|
self.to_be_sent.append(p)
|
||||||
#last date/time in history to avoid duplicate
|
#last date/time in history to avoid duplicate
|
||||||
|
# FIXME: This JID needs to be normalized; see #1364
|
||||||
jid='%s@%s' % (room, server)
|
jid='%s@%s' % (room, server)
|
||||||
last_log = gajim.logger.get_last_date_that_has_logs(jid)
|
last_log = gajim.logger.get_last_date_that_has_logs(jid)
|
||||||
if last_log is None:
|
if last_log is None:
|
||||||
|
|
|
@ -483,7 +483,7 @@ class PreferencesWindow:
|
||||||
gajim.interface.roster.draw_roster()
|
gajim.interface.roster.draw_roster()
|
||||||
for ctl in gajim.interface.msg_win_mgr.controls():
|
for ctl in gajim.interface.msg_win_mgr.controls():
|
||||||
if ctl.type_id == message_control.TYPE_GC:
|
if ctl.type_id == message_control.TYPE_GC:
|
||||||
ctl.draw_widgets()
|
ctl.update_ui()
|
||||||
|
|
||||||
def on_show_avatars_in_roster_checkbutton_toggled(self, widget):
|
def on_show_avatars_in_roster_checkbutton_toggled(self, widget):
|
||||||
self.on_checkbutton_toggled(widget, 'show_avatars_in_roster')
|
self.on_checkbutton_toggled(widget, 'show_avatars_in_roster')
|
||||||
|
|
|
@ -691,7 +691,7 @@ class Interface:
|
||||||
contact = ctl.contact
|
contact = ctl.contact
|
||||||
contact.show = show
|
contact.show = show
|
||||||
contact.status = status
|
contact.status = status
|
||||||
ctl.update_state()
|
ctl.update_ui()
|
||||||
uf_show = helpers.get_uf_show(show)
|
uf_show = helpers.get_uf_show(show)
|
||||||
ctl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, status),
|
ctl.print_conversation(_('%s is now %s (%s)') % (nick, uf_show, status),
|
||||||
'status')
|
'status')
|
||||||
|
@ -966,7 +966,8 @@ class Interface:
|
||||||
# join already open groupchats
|
# join already open groupchats
|
||||||
for gc_control in gajim.interface.msg_win_mgr.get_controls(message_control.TYPE_GC):
|
for gc_control in gajim.interface.msg_win_mgr.get_controls(message_control.TYPE_GC):
|
||||||
room_jid = gc_control.room_jid
|
room_jid = gc_control.room_jid
|
||||||
if gajim.gc_connected[account][room_jid]:
|
if gajim.gc_connected[account].has_key(room_jid) and\
|
||||||
|
gajim.gc_connected[account][room_jid]:
|
||||||
continue
|
continue
|
||||||
room, server = gajim.get_room_name_and_server_from_room_jid(room_jid)
|
room, server = gajim.get_room_name_and_server_from_room_jid(room_jid)
|
||||||
nick = gc_control.nick
|
nick = gc_control.nick
|
||||||
|
|
|
@ -23,7 +23,6 @@ import message_control
|
||||||
import tooltips
|
import tooltips
|
||||||
import dialogs
|
import dialogs
|
||||||
import vcard
|
import vcard
|
||||||
import chat
|
|
||||||
import cell_renderer_image
|
import cell_renderer_image
|
||||||
import history_window
|
import history_window
|
||||||
import tooltips
|
import tooltips
|
||||||
|
@ -173,7 +172,7 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.set_subject('')
|
self.set_subject('')
|
||||||
self.got_disconnected() #init some variables
|
self.got_disconnected() #init some variables
|
||||||
|
|
||||||
self.draw_widgets()
|
self.update_ui()
|
||||||
self.conv_textview.grab_focus()
|
self.conv_textview.grab_focus()
|
||||||
self.widget.show_all()
|
self.widget.show_all()
|
||||||
|
|
||||||
|
@ -273,8 +272,8 @@ class GroupchatControl(ChatControlBase):
|
||||||
tab_image = img_16['muc_active']
|
tab_image = img_16['muc_active']
|
||||||
return tab_image
|
return tab_image
|
||||||
|
|
||||||
def update_state(self):
|
def update_ui(self):
|
||||||
ChatControlBase.update_state(self)
|
ChatControlBase.update_ui(self)
|
||||||
self.draw_roster()
|
self.draw_roster()
|
||||||
|
|
||||||
def prepare_context_menu(self):
|
def prepare_context_menu(self):
|
||||||
|
@ -507,20 +506,19 @@ class GroupchatControl(ChatControlBase):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def set_subject(self, subject):
|
def set_subject(self, subject):
|
||||||
self.subject= subject
|
self.subject = subject
|
||||||
full_subject = None
|
|
||||||
|
|
||||||
|
self.name_label.set_ellipsize(pango.ELLIPSIZE_END)
|
||||||
subject = gtkgui_helpers.reduce_chars_newlines(subject, 0, 2)
|
subject = gtkgui_helpers.reduce_chars_newlines(subject, 0, 2)
|
||||||
subject = gtkgui_helpers.escape_for_pango_markup(subject)
|
subject = gtkgui_helpers.escape_for_pango_markup(subject)
|
||||||
self.name_label.set_markup(
|
self.name_label.set_markup(
|
||||||
'<span weight="heavy" size="x-large">%s</span>\n%s' % (self.room_jid, subject))
|
'<span weight="heavy" size="x-large">%s</span>\n%s' % (self.room_jid, subject))
|
||||||
event_box = self.name_label.get_parent()
|
event_box = self.name_label.get_parent()
|
||||||
if subject == '':
|
if subject == '':
|
||||||
subject = _('This room has no subject')
|
self.subject = _('This room has no subject')
|
||||||
|
|
||||||
if full_subject is not None:
|
# tooltip must always hold ALL the subject
|
||||||
subject = full_subject # tooltip must always hold ALL the subject
|
self.subject_tooltip.set_tip(event_box, self.subject)
|
||||||
self.subject_tooltip.set_tip(event_box, subject)
|
|
||||||
|
|
||||||
def save_var(self):
|
def save_var(self):
|
||||||
return {
|
return {
|
||||||
|
@ -554,10 +552,6 @@ class GroupchatControl(ChatControlBase):
|
||||||
self.msg_textview.set_sensitive(False)
|
self.msg_textview.set_sensitive(False)
|
||||||
self.xml.get_widget('send_button').set_sensitive(False)
|
self.xml.get_widget('send_button').set_sensitive(False)
|
||||||
|
|
||||||
def draw_widgets(self):
|
|
||||||
ChatControlBase.draw_widgets(self)
|
|
||||||
self.draw_roster()
|
|
||||||
|
|
||||||
def draw_roster(self):
|
def draw_roster(self):
|
||||||
model = self.list_treeview.get_model()
|
model = self.list_treeview.get_model()
|
||||||
model.clear()
|
model.clear()
|
||||||
|
@ -765,6 +759,9 @@ class GroupchatControl(ChatControlBase):
|
||||||
command = message_array.pop(0).lower()
|
command = message_array.pop(0).lower()
|
||||||
if message_array == ['']:
|
if message_array == ['']:
|
||||||
message_array = []
|
message_array = []
|
||||||
|
|
||||||
|
if command == 'me':
|
||||||
|
return False # This is not really a command
|
||||||
|
|
||||||
if command == 'nick':
|
if command == 'nick':
|
||||||
# example: /nick foo
|
# example: /nick foo
|
||||||
|
|
|
@ -70,11 +70,9 @@ class MessageControl:
|
||||||
def shutdown(self):
|
def shutdown(self):
|
||||||
# NOTE: Derived classes MUST implement this
|
# NOTE: Derived classes MUST implement this
|
||||||
assert(False)
|
assert(False)
|
||||||
def draw_widgets(self):
|
|
||||||
pass # NOTE: Derived classes SHOULD implement this
|
|
||||||
def repaint_themed_widgets(self, theme):
|
def repaint_themed_widgets(self, theme):
|
||||||
pass # NOTE: Derived classes SHOULD implement this
|
pass # NOTE: Derived classes SHOULD implement this
|
||||||
def update_state(self):
|
def update_ui(self):
|
||||||
pass # NOTE: Derived classes SHOULD implement this
|
pass # NOTE: Derived classes SHOULD implement this
|
||||||
def toggle_emoticons(self):
|
def toggle_emoticons(self):
|
||||||
pass # NOTE: Derived classes MAY implement this
|
pass # NOTE: Derived classes MAY implement this
|
||||||
|
|
|
@ -138,7 +138,7 @@ class MessageWindow:
|
||||||
|
|
||||||
|
|
||||||
self.redraw_tab(control.contact)
|
self.redraw_tab(control.contact)
|
||||||
control.draw_widgets()
|
control.update_ui()
|
||||||
self.window.show_all()
|
self.window.show_all()
|
||||||
# NOTE: we do not call set_control_active(True) since we don't know whether
|
# NOTE: we do not call set_control_active(True) since we don't know whether
|
||||||
# the tab is the active one.
|
# the tab is the active one.
|
||||||
|
@ -236,7 +236,7 @@ class MessageWindow:
|
||||||
|
|
||||||
def redraw_tab(self, contact, chatstate = None):
|
def redraw_tab(self, contact, chatstate = None):
|
||||||
ctl = self._controls[contact.jid]
|
ctl = self._controls[contact.jid]
|
||||||
ctl.update_state()
|
ctl.update_ui()
|
||||||
|
|
||||||
hbox = self.notebook.get_tab_label(ctl.widget).get_children()[0]
|
hbox = self.notebook.get_tab_label(ctl.widget).get_children()[0]
|
||||||
status_img = hbox.get_children()[0]
|
status_img = hbox.get_children()[0]
|
||||||
|
|
|
@ -636,7 +636,7 @@ class RosterWindow:
|
||||||
# update gc's roster
|
# update gc's roster
|
||||||
for ctl in gajim.interface.msg_win_mgr.controls():
|
for ctl in gajim.interface.msg_win_mgr.controls():
|
||||||
if ctl.type_id == message_control.TYPE_GC:
|
if ctl.type_id == message_control.TYPE_GC:
|
||||||
ctl.draw_widgets()
|
ctl.update_ui()
|
||||||
|
|
||||||
def draw_roster(self):
|
def draw_roster(self):
|
||||||
'''Clear and draw roster'''
|
'''Clear and draw roster'''
|
||||||
|
@ -728,7 +728,7 @@ class RosterWindow:
|
||||||
jid = contact.jid
|
jid = contact.jid
|
||||||
win = gajim.interface.msg_win_mgr.get_window(contact.jid)
|
win = gajim.interface.msg_win_mgr.get_window(contact.jid)
|
||||||
ctl = win.get_control(jid)
|
ctl = win.get_control(jid)
|
||||||
ctl.update_state()
|
ctl.update_ui()
|
||||||
win.redraw_tab(contact)
|
win.redraw_tab(contact)
|
||||||
|
|
||||||
name = contact.name
|
name = contact.name
|
||||||
|
@ -920,7 +920,7 @@ class RosterWindow:
|
||||||
u.keyID = keyID[0]
|
u.keyID = keyID[0]
|
||||||
if gajim.interface.msg_win_mgr.has_window(contact.jid):
|
if gajim.interface.msg_win_mgr.has_window(contact.jid):
|
||||||
ctl = gajim.interface.msg_win_mgr.get_control(contact.jid)
|
ctl = gajim.interface.msg_win_mgr.get_control(contact.jid)
|
||||||
ctl.draw_widgets()
|
ctl.update_ui()
|
||||||
keys_str = ''
|
keys_str = ''
|
||||||
for jid in keys:
|
for jid in keys:
|
||||||
keys_str += jid + ' ' + keys[jid] + ' '
|
keys_str += jid + ' ' + keys[jid] + ' '
|
||||||
|
@ -2237,7 +2237,7 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
|
||||||
|
|
||||||
for win in gajim.interface.msg_win_mgr.windows():
|
for win in gajim.interface.msg_win_mgr.windows():
|
||||||
for ctl in gajim.interface.msg_win_mgr.controls():
|
for ctl in gajim.interface.msg_win_mgr.controls():
|
||||||
ctl.update_state()
|
ctl.update_ui()
|
||||||
win.redraw_tab(ctl.contact)
|
win.redraw_tab(ctl.contact)
|
||||||
|
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
|
|
Loading…
Reference in New Issue