no need to inherit StatusTable; thanks deluge for tb

This commit is contained in:
Nikos Kouremenos 2005-12-01 21:18:12 +00:00
parent 91d9f0604b
commit fbbb1f72c3
1 changed files with 24 additions and 25 deletions

View File

@ -123,17 +123,17 @@ class StatusTable:
def __init__(self): def __init__(self):
self.current_row = 1 self.current_row = 1
self.table = None self.table = None
self.text_lable = None self.text_label = None
self.spacer_label = ' ' self.spacer_label = ' '
def create_table(self): def create_table(self):
self.table = gtk.Table(3, 1) self.table = gtk.Table(3, 1)
self.table.set_property('column-spacing', 2) self.table.set_property('column-spacing', 2)
self.text_lable = gtk.Label() self.text_label = gtk.Label()
self.text_lable.set_line_wrap(True) self.text_label.set_line_wrap(True)
self.text_lable.set_alignment(0, 0) self.text_label.set_alignment(0, 0)
self.text_lable.set_selectable(False) self.text_label.set_selectable(False)
self.table.attach(self.text_lable, 1, 4, 1, 2) self.table.attach(self.text_label, 1, 4, 1, 2)
def get_status_info(self, resource, priority, show, status): def get_status_info(self, resource, priority, show, status):
str_status = resource + ' (' + unicode(priority) + ')' str_status = resource + ' (' + unicode(priority) + ')'
@ -161,14 +161,14 @@ class StatusTable:
image.set_from_file(file) image.set_from_file(file)
break break
spacer = gtk.Label(self.spacer_label) spacer = gtk.Label(self.spacer_label)
image.set_alignment(0., 1.) image.set_alignment(0, 1.)
self.table.attach(spacer, 1, 2, self.current_row, self.table.attach(spacer, 1, 2, self.current_row,
self.current_row + 1, 0, 0, 0, 0) self.current_row + 1, 0, 0, 0, 0)
self.table.attach(image, 2, 3, self.current_row, self.table.attach(image, 2, 3, self.current_row,
self.current_row + 1, 0, 0, 3, 0) self.current_row + 1, 0, 0, 3, 0)
status_label = gtk.Label() status_label = gtk.Label()
status_label.set_markup(str_status) status_label.set_markup(str_status)
status_label.set_alignment(0., 0.) status_label.set_alignment(0, 0)
self.table.attach(status_label, 3, 4, self.current_row, self.table.attach(status_label, 3, 4, self.current_row,
self.current_row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0) self.current_row + 1, gtk.EXPAND | gtk.FILL, 0, 0, 0)
@ -294,22 +294,21 @@ class NotificationAreaTooltip(BaseTooltip, StatusTable):
text = _('Gajim - %s') % message text = _('Gajim - %s') % message
else: else:
text = _('Gajim - %s') % helpers.get_uf_show('offline') text = _('Gajim - %s') % helpers.get_uf_show('offline')
self.text_lable.set_markup(text) self.text_label.set_markup(text)
self.hbox.add(self.table) self.hbox.add(self.table)
self.win.add(self.hbox) self.win.add(self.hbox)
class GCTooltip(BaseTooltip, StatusTable): class GCTooltip(BaseTooltip):
''' Tooltip that is shown in the GC treeview ''' ''' Tooltip that is shown in the GC treeview '''
def __init__(self): def __init__(self):
self.account = None self.account = None
self.text_lable = gtk.Label() self.text_label = gtk.Label()
self.text_lable.set_line_wrap(True) self.text_label.set_line_wrap(True)
self.text_lable.set_alignment(0., 0.) self.text_label.set_alignment(0, 0)
self.text_lable.set_selectable(False) self.text_label.set_selectable(False)
BaseTooltip.__init__(self) BaseTooltip.__init__(self)
StatusTable.__init__(self)
def populate(self, contact): def populate(self, contact):
if not contact: if not contact:
@ -342,8 +341,8 @@ class GCTooltip(BaseTooltip, StatusTable):
'</span>' + gtkgui_helpers.escape_for_pango_markup( '</span>' + gtkgui_helpers.escape_for_pango_markup(
contact.resource) contact.resource)
self.text_lable.set_markup(info) self.text_label.set_markup(info)
hbox.add(self.text_lable) hbox.add(self.text_label)
self.win.add(hbox) self.win.add(hbox)
class RosterTooltip(NotificationAreaTooltip): class RosterTooltip(NotificationAreaTooltip):
@ -351,7 +350,7 @@ class RosterTooltip(NotificationAreaTooltip):
def __init__(self): def __init__(self):
self.account = None self.account = None
self.image = gtk.Image() self.image = gtk.Image()
self.image.set_alignment(0., 0.) self.image.set_alignment(0, 0)
# padding is independent of the total length and better than alignment # padding is independent of the total length and better than alignment
self.image.set_padding(1, 2) self.image.set_padding(1, 2)
NotificationAreaTooltip.__init__(self) NotificationAreaTooltip.__init__(self)
@ -447,7 +446,7 @@ class RosterTooltip(NotificationAreaTooltip):
# escape markup entities. # escape markup entities.
info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status) info += ' - ' + gtkgui_helpers.escape_for_pango_markup(status)
self.text_lable.set_markup(info) self.text_label.set_markup(info)
self.hbox.pack_start(self.image, False, False) self.hbox.pack_start(self.image, False, False)
self.hbox.pack_start(self.table, True, True) self.hbox.pack_start(self.table, True, True)
self.win.add(self.hbox) self.win.add(self.hbox)
@ -455,10 +454,10 @@ class RosterTooltip(NotificationAreaTooltip):
class FileTransfersTooltip(BaseTooltip): class FileTransfersTooltip(BaseTooltip):
''' Tooltip that is shown in the notification area ''' ''' Tooltip that is shown in the notification area '''
def __init__(self): def __init__(self):
self.text_lable = gtk.Label() self.text_label = gtk.Label()
self.text_lable.set_line_wrap(True) self.text_label.set_line_wrap(True)
self.text_lable.set_alignment(0, 0) self.text_label.set_alignment(0, 0)
self.text_lable.set_selectable(False) self.text_label.set_selectable(False)
BaseTooltip.__init__(self) BaseTooltip.__init__(self)
def populate(self, file_props): def populate(self, file_props):
@ -527,8 +526,8 @@ class FileTransfersTooltip(BaseTooltip):
status = _('Not started') status = _('Not started')
text += status text += status
self.text_lable.set_markup(text) self.text_label.set_markup(text)
self.hbox.add(self.text_lable) self.hbox.add(self.text_label)
self.win.add(self.hbox) self.win.add(self.hbox)