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