Remove a LOT of useless draw_banner()
(stop drawing it 5 times when joining muc, stop reloading banner state icon on ALL notifications, ...) roster.py one seems useless because ctrl.update_ui() did it already
This commit is contained in:
parent
0ac904c6be
commit
eea2e1c881
3 changed files with 21 additions and 24 deletions
|
@ -91,15 +91,22 @@ class ChatControlBase(MessageControl):
|
|||
type_]))
|
||||
|
||||
def draw_banner(self):
|
||||
self._paint_banner()
|
||||
'''Draw the fat line at the top of the window that
|
||||
houses the icon, jid, ...
|
||||
'''
|
||||
self.draw_banner_text()
|
||||
self._update_banner_state_image()
|
||||
# Derived types SHOULD implement this
|
||||
# Derived types MAY implement this
|
||||
|
||||
def draw_banner_text(self):
|
||||
pass # Derived types SHOULD implement this
|
||||
|
||||
def update_ui(self):
|
||||
self.draw_banner()
|
||||
# Derived types SHOULD implement this
|
||||
|
||||
def repaint_themed_widgets(self):
|
||||
self._paint_banner()
|
||||
self.draw_banner()
|
||||
# Derived classes MAY implement this
|
||||
|
||||
|
@ -208,6 +215,7 @@ class ChatControlBase(MessageControl):
|
|||
|
||||
self.style_event_id = 0
|
||||
self.conv_textview.tv.show()
|
||||
self._paint_banner()
|
||||
|
||||
# For JEP-0172
|
||||
self.user_nick = None
|
||||
|
@ -1011,14 +1019,10 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
self._update_gpg()
|
||||
|
||||
def draw_banner(self, chatstate = None):
|
||||
'''Draw the fat line at the top of the window that
|
||||
houses the status icon, name, jid. The chatstate arg should
|
||||
only be used if the control's chatstate member is NOT to be use, such as
|
||||
composing, paused, etc.
|
||||
def draw_banner_text(self):
|
||||
'''Draw the text in the fat line at the top of the window that
|
||||
houses the name, jid.
|
||||
'''
|
||||
ChatControlBase.draw_banner(self)
|
||||
|
||||
contact = self.contact
|
||||
jid = contact.jid
|
||||
|
||||
|
@ -1551,7 +1555,7 @@ class ChatControl(ChatControlBase):
|
|||
|
||||
def handle_incoming_chatstate(self):
|
||||
''' handle incoming chatstate that jid SENT TO us '''
|
||||
self.draw_banner()
|
||||
self.draw_banner_text()
|
||||
# update chatstate in tab for this chat
|
||||
self.parent_win.redraw_tab(self, self.contact.chatstate)
|
||||
|
||||
|
|
|
@ -301,8 +301,8 @@ class GroupchatControl(ChatControlBase):
|
|||
column.set_visible(False)
|
||||
self.list_treeview.set_expander_column(column)
|
||||
|
||||
self.draw_banner()
|
||||
self.got_disconnected() # init some variables
|
||||
gajim.gc_connected[self.account][self.room_jid] = False
|
||||
ChatControlBase.got_disconnected(self)
|
||||
|
||||
self.update_ui()
|
||||
self.conv_textview.tv.grab_focus()
|
||||
|
@ -451,12 +451,10 @@ class GroupchatControl(ChatControlBase):
|
|||
scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR)
|
||||
banner_status_img.set_from_pixbuf(scaled_pix)
|
||||
|
||||
def draw_banner(self):
|
||||
'''Draw the fat line at the top of the window that
|
||||
houses the muc icon, room jid, subject.
|
||||
def draw_banner_text(self):
|
||||
'''Draw the text in the fat line at the top of the window that
|
||||
houses the room jid, subject.
|
||||
'''
|
||||
ChatControlBase.draw_banner(self)
|
||||
|
||||
self.name_label.set_ellipsize(pango.ELLIPSIZE_END)
|
||||
font_attrs, font_attrs_small = self.get_font_attrs()
|
||||
text = '<span %s>%s</span>' % (font_attrs, self.room_jid)
|
||||
|
@ -725,7 +723,7 @@ class GroupchatControl(ChatControlBase):
|
|||
|
||||
def set_subject(self, subject):
|
||||
self.subject = subject
|
||||
self.draw_banner()
|
||||
self.draw_banner_text()
|
||||
|
||||
def got_connected(self):
|
||||
gajim.gc_connected[self.account][self.room_jid] = True
|
||||
|
@ -740,10 +738,8 @@ class GroupchatControl(ChatControlBase):
|
|||
nick)
|
||||
gajim.contacts.remove_gc_contact(self.account, gc_contact)
|
||||
gajim.gc_connected[self.account][self.room_jid] = False
|
||||
# Note, since this method is called during initialization it is NOT safe
|
||||
# to call self.parent_win.redraw_tab here
|
||||
ChatControlBase.got_disconnected(self)
|
||||
self.draw_banner()
|
||||
self._update_banner_state_image()
|
||||
|
||||
def draw_roster(self):
|
||||
self.list_treeview.get_model().clear()
|
||||
|
|
|
@ -1214,9 +1214,6 @@ class RosterWindow:
|
|||
else: # No status message
|
||||
ctrl.print_conversation(_('%s is now %s') % (name, uf_show),
|
||||
'status')
|
||||
if contact == gajim.contacts.get_contact_with_highest_priority(
|
||||
account, contact.jid):
|
||||
ctrl.draw_banner()
|
||||
|
||||
if not contact.groups:
|
||||
self.draw_group(_('General'), account)
|
||||
|
|
Loading…
Add table
Reference in a new issue