we now use 32x32 in Tabbed Chat banner img for state; and can control the size between 32x32 and 16x16 in general [of course only for those iconsets that ship 32x32
This commit is contained in:
parent
062e1c5b2f
commit
f7ee0dffd9
3 changed files with 63 additions and 43 deletions
|
@ -118,7 +118,7 @@ class RosterWindow:
|
||||||
|
|
||||||
if self.regroup:
|
if self.regroup:
|
||||||
show = helpers.get_global_show()
|
show = helpers.get_global_show()
|
||||||
model.append(None, [self.jabber_state_images[show],
|
model.append(None, [self.jabber_state_images['16'][show],
|
||||||
_('Merged accounts'), 'account', '', 'all', False, None])
|
_('Merged accounts'), 'account', '', 'all', False, None])
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -132,7 +132,7 @@ class RosterWindow:
|
||||||
|
|
||||||
our_jid = gajim.get_jid_from_account(account)
|
our_jid = gajim.get_jid_from_account(account)
|
||||||
|
|
||||||
model.append(None, [self.jabber_state_images[show],
|
model.append(None, [self.jabber_state_images['16'][show],
|
||||||
gtkgui_helpers.escape_for_pango_markup(account),
|
gtkgui_helpers.escape_for_pango_markup(account),
|
||||||
'account', our_jid, account, False, tls_pixbuf])
|
'account', our_jid, account, False, tls_pixbuf])
|
||||||
|
|
||||||
|
@ -177,7 +177,8 @@ class RosterWindow:
|
||||||
iterG = self.get_group_iter(g, account)
|
iterG = self.get_group_iter(g, account)
|
||||||
if not iterG:
|
if not iterG:
|
||||||
IterAcct = self.get_account_iter(account)
|
IterAcct = self.get_account_iter(account)
|
||||||
iterG = model.append(IterAcct, [self.jabber_state_images['closed'],
|
iterG = model.append(IterAcct, [
|
||||||
|
self.jabber_state_images['16']['closed'],
|
||||||
gtkgui_helpers.escape_for_pango_markup(g), 'group', g, account,
|
gtkgui_helpers.escape_for_pango_markup(g), 'group', g, account,
|
||||||
False, None])
|
False, None])
|
||||||
if not gajim.groups[account].has_key(g): #It can probably never append
|
if not gajim.groups[account].has_key(g): #It can probably never append
|
||||||
|
@ -233,12 +234,13 @@ class RosterWindow:
|
||||||
if gajim.groups[account].has_key(group):
|
if gajim.groups[account].has_key(group):
|
||||||
del gajim.groups[account][group]
|
del gajim.groups[account][group]
|
||||||
|
|
||||||
def get_appropriate_state_images(self, jid):
|
def get_appropriate_state_images(self, jid, size = '16'):
|
||||||
'''check jid and return the appropriate state images dict'''
|
'''check jid and return the appropriate state images dict for
|
||||||
|
the demanded size'''
|
||||||
transport = gajim.get_transport_name_from_jid(jid)
|
transport = gajim.get_transport_name_from_jid(jid)
|
||||||
if transport:
|
if transport:
|
||||||
return self.transports_state_images[transport]
|
return self.transports_state_images[size][transport]
|
||||||
return self.jabber_state_images
|
return self.jabber_state_images[size]
|
||||||
|
|
||||||
def draw_contact(self, jid, account, selected = False, focus = False):
|
def draw_contact(self, jid, account, selected = False, focus = False):
|
||||||
'''draw the correct state image, name BUT not avatar'''
|
'''draw the correct state image, name BUT not avatar'''
|
||||||
|
@ -283,8 +285,10 @@ class RosterWindow:
|
||||||
name += '\n<span size="small" style="italic" foreground="%s">%s</span>'\
|
name += '\n<span size="small" style="italic" foreground="%s">%s</span>'\
|
||||||
% (colorstring, gtkgui_helpers.escape_for_pango_markup(status))
|
% (colorstring, gtkgui_helpers.escape_for_pango_markup(status))
|
||||||
|
|
||||||
state_images = self.get_appropriate_state_images(jid)
|
|
||||||
icon_name = helpers.get_icon_name_to_show(contact, account)
|
icon_name = helpers.get_icon_name_to_show(contact, account)
|
||||||
|
state_images = self.get_appropriate_state_images(jid, size = '16')
|
||||||
|
|
||||||
img = state_images[icon_name]
|
img = state_images[icon_name]
|
||||||
|
|
||||||
for iter in iters:
|
for iter in iters:
|
||||||
|
@ -1116,7 +1120,7 @@ class RosterWindow:
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
iconset = 'sun'
|
iconset = 'sun'
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
|
||||||
state_images = self.load_iconset(path)
|
state_images = self.load_iconset(path)
|
||||||
|
|
||||||
xml = gtk.glade.XML(GTKGUI_GLADE, 'account_context_menu', APP)
|
xml = gtk.glade.XML(GTKGUI_GLADE, 'account_context_menu', APP)
|
||||||
|
@ -1198,7 +1202,7 @@ class RosterWindow:
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
iconset = 'sun'
|
iconset = 'sun'
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
|
||||||
for account in gajim.connections:
|
for account in gajim.connections:
|
||||||
state_images = self.load_iconset(path)
|
state_images = self.load_iconset(path)
|
||||||
item = gtk.ImageMenuItem(account)
|
item = gtk.ImageMenuItem(account)
|
||||||
|
@ -1429,7 +1433,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
accountIter = self.get_account_iter(account)
|
accountIter = self.get_account_iter(account)
|
||||||
if accountIter:
|
if accountIter:
|
||||||
model[accountIter][0] = self.jabber_state_images['connecting']
|
model[accountIter][0] = self.jabber_state_images['16']['connecting']
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.change_status('connecting')
|
gajim.interface.systray.change_status('connecting')
|
||||||
|
|
||||||
|
@ -1450,7 +1454,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
passphrase, save = w.run()
|
passphrase, save = w.run()
|
||||||
if passphrase == -1:
|
if passphrase == -1:
|
||||||
if accountIter:
|
if accountIter:
|
||||||
model[accountIter][0] = self.jabber_state_images['offline']
|
model[accountIter][0] = self.jabber_state_images['16']['offline']
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
gajim.interface.systray.change_status('offline')
|
gajim.interface.systray.change_status('offline')
|
||||||
self.update_status_combobox()
|
self.update_status_combobox()
|
||||||
|
@ -1626,7 +1630,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
model = self.tree.get_model()
|
model = self.tree.get_model()
|
||||||
accountIter = self.get_account_iter(account)
|
accountIter = self.get_account_iter(account)
|
||||||
if accountIter:
|
if accountIter:
|
||||||
model[accountIter][0] = self.jabber_state_images[status]
|
model[accountIter][0] = self.jabber_state_images['16'][status]
|
||||||
if status == 'offline':
|
if status == 'offline':
|
||||||
if accountIter:
|
if accountIter:
|
||||||
model[accountIter][6] = None
|
model[accountIter][6] = None
|
||||||
|
@ -2023,7 +2027,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
|
accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
|
||||||
type = model[iter][C_TYPE]
|
type = model[iter][C_TYPE]
|
||||||
if type == 'group':
|
if type == 'group':
|
||||||
model.set_value(iter, 0, self.jabber_state_images['opened'])
|
model.set_value(iter, 0, self.jabber_state_images['16']['opened'])
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[iter][C_JID].decode('utf-8')
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if gajim.groups[account].has_key(jid): # This account has this group
|
if gajim.groups[account].has_key(jid): # This account has this group
|
||||||
|
@ -2050,7 +2054,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
|
accounts = [model[iter][C_ACCOUNT].decode('utf-8')]
|
||||||
type = model[iter][C_TYPE]
|
type = model[iter][C_TYPE]
|
||||||
if type == 'group':
|
if type == 'group':
|
||||||
model.set_value(iter, 0, self.jabber_state_images['closed'])
|
model.set_value(iter, 0, self.jabber_state_images['16']['closed'])
|
||||||
jid = model[iter][C_JID].decode('utf-8')
|
jid = model[iter][C_JID].decode('utf-8')
|
||||||
for account in accounts:
|
for account in accounts:
|
||||||
if gajim.groups[account].has_key(jid): # This account has this group
|
if gajim.groups[account].has_key(jid): # This account has this group
|
||||||
|
@ -2139,12 +2143,13 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
# Object will add itself to the window dict
|
# Object will add itself to the window dict
|
||||||
disco.ServiceDiscoveryWindow(account, address_entry=True)
|
disco.ServiceDiscoveryWindow(account, address_entry = True)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def load_iconset(self, path):
|
def load_iconset(self, path):
|
||||||
imgs = {}
|
imgs = {}
|
||||||
|
path += '/'
|
||||||
for state in ('connecting', 'online', 'chat', 'away', 'xa',
|
for state in ('connecting', 'online', 'chat', 'away', 'xa',
|
||||||
'dnd', 'invisible', 'offline', 'error', 'requested',
|
'dnd', 'invisible', 'offline', 'error', 'requested',
|
||||||
'message', 'opened', 'closed', 'not in the roster',
|
'message', 'opened', 'closed', 'not in the roster',
|
||||||
|
@ -2169,8 +2174,12 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
iconset = 'sun'
|
iconset = 'sun'
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
|
||||||
self.jabber_state_images = self.load_iconset(path)
|
if os.path.exists(path):
|
||||||
|
self.jabber_state_images['32'] = self.load_iconset(path)
|
||||||
|
|
||||||
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
|
||||||
|
self.jabber_state_images['16'] = self.load_iconset(path)
|
||||||
|
|
||||||
def reload_jabber_state_images(self):
|
def reload_jabber_state_images(self):
|
||||||
self.make_jabber_state_images()
|
self.make_jabber_state_images()
|
||||||
|
@ -2183,7 +2192,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
if model[iter][2] != '':
|
if model[iter][2] != '':
|
||||||
# If it's not change status message iter
|
# If it's not change status message iter
|
||||||
# eg. if it has show parameter not ''
|
# eg. if it has show parameter not ''
|
||||||
model[iter][1] = self.jabber_state_images[model[iter][2]]
|
model[iter][1] = self.jabber_state_images['16'][model[iter][2]]
|
||||||
iter = model.iter_next(iter)
|
iter = model.iter_next(iter)
|
||||||
# Update the systray
|
# Update the systray
|
||||||
if gajim.interface.systray_enabled:
|
if gajim.interface.systray_enabled:
|
||||||
|
@ -2545,7 +2554,10 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self._on_treeview_selection_changed)
|
self._on_treeview_selection_changed)
|
||||||
|
|
||||||
self._last_selected_contact = None # None or holds jid, account tupple
|
self._last_selected_contact = None # None or holds jid, account tupple
|
||||||
self.nb_unread = 0
|
self.jabber_state_images = {'16': {}, '32': {}}
|
||||||
|
self.transports_state_images = {'16': {}, '32': {}}
|
||||||
|
|
||||||
|
self.nb_unread = 0 # number of unread messages
|
||||||
self.last_save_dir = None
|
self.last_save_dir = None
|
||||||
self.editing_path = None # path of row with cell in edit mode
|
self.editing_path = None # path of row with cell in edit mode
|
||||||
self.add_new_contact_handler_id = False
|
self.add_new_contact_handler_id = False
|
||||||
|
@ -2575,21 +2587,16 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
self.tree.set_model(model)
|
self.tree.set_model(model)
|
||||||
self.make_jabber_state_images()
|
self.make_jabber_state_images()
|
||||||
|
|
||||||
#FIXME: why do we init this dict of dicts here?
|
|
||||||
#for loop below does it. maybe so we're sure we always have the keys?
|
|
||||||
#eventhough childs can be empty? I don't get it
|
|
||||||
self.transports_state_images = { 'aim': {}, 'gadugadu': {}, 'irc': {},
|
|
||||||
'icq': {}, 'msn': {}, 'sms': {}, 'tlen': {}, 'weather': {},
|
|
||||||
'yahoo': {} }
|
|
||||||
|
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', 'transports')
|
||||||
folders = os.listdir(path)
|
folders = os.listdir(path)
|
||||||
for transport in folders:
|
for transport in folders:
|
||||||
if transport == '.svn':
|
if transport == '.svn':
|
||||||
continue
|
continue
|
||||||
folder = os.path.join(path, transport)
|
folder = os.path.join(path, transport, '32x32')
|
||||||
self.transports_state_images[transport] = self.load_iconset(
|
if os.path.exists(folder):
|
||||||
folder + '/16x16/')
|
self.transports_state_images['32'][transport] = self.load_iconset( folder)
|
||||||
|
folder = os.path.join(path, transport, '16x16')
|
||||||
|
self.transports_state_images['16'][transport] = self.load_iconset( folder)
|
||||||
|
|
||||||
# uf_show, img, show, sensitive
|
# uf_show, img, show, sensitive
|
||||||
liststore = gtk.ListStore(str, gtk.Image, str, bool)
|
liststore = gtk.ListStore(str, gtk.Image, str, bool)
|
||||||
|
@ -2617,7 +2624,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
|
|
||||||
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
||||||
uf_show = helpers.get_uf_show(show)
|
uf_show = helpers.get_uf_show(show)
|
||||||
liststore.append([uf_show, self.jabber_state_images[show], show, True])
|
liststore.append([uf_show, self.jabber_state_images['16'][show], show, True])
|
||||||
# Add a Separator (self.iter_is_separator() checks on string SEPARATOR)
|
# Add a Separator (self.iter_is_separator() checks on string SEPARATOR)
|
||||||
liststore.append(['SEPARATOR', None, '', True])
|
liststore.append(['SEPARATOR', None, '', True])
|
||||||
|
|
||||||
|
@ -2631,7 +2638,7 @@ _('If "%s" accepts this request you will know his or her status.') %jid)
|
||||||
liststore.append(['SEPARATOR', None, '', True])
|
liststore.append(['SEPARATOR', None, '', True])
|
||||||
|
|
||||||
uf_show = helpers.get_uf_show('offline')
|
uf_show = helpers.get_uf_show('offline')
|
||||||
liststore.append([uf_show, self.jabber_state_images['offline'],
|
liststore.append([uf_show, self.jabber_state_images['16']['offline'],
|
||||||
'offline', True])
|
'offline', True])
|
||||||
|
|
||||||
status_combobox_items = ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
status_combobox_items = ['online', 'chat', 'away', 'xa', 'dnd', 'invisible',
|
||||||
|
|
|
@ -74,7 +74,7 @@ class Systray:
|
||||||
state = 'message'
|
state = 'message'
|
||||||
else:
|
else:
|
||||||
state = self.status
|
state = self.status
|
||||||
image = gajim.interface.roster.jabber_state_images[state]
|
image = gajim.interface.roster.jabber_state_images['16'][state]
|
||||||
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
self.img_tray.set_from_animation(image.get_animation())
|
self.img_tray.set_from_animation(image.get_animation())
|
||||||
elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
elif image.get_storage_type() == gtk.IMAGE_PIXBUF:
|
||||||
|
@ -134,8 +134,8 @@ class Systray:
|
||||||
# We need our own set of status icons, let's make 'em!
|
# We need our own set of status icons, let's make 'em!
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
iconset = 'sun'
|
iconset = 'dcraven'
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
|
||||||
state_images = gajim.interface.roster.load_iconset(path)
|
state_images = gajim.interface.roster.load_iconset(path)
|
||||||
|
|
||||||
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
for show in ('online', 'chat', 'away', 'xa', 'dnd', 'invisible'):
|
||||||
|
@ -235,7 +235,7 @@ class Systray:
|
||||||
iconset = gajim.config.get('iconset')
|
iconset = gajim.config.get('iconset')
|
||||||
if not iconset:
|
if not iconset:
|
||||||
iconset = 'sun'
|
iconset = 'sun'
|
||||||
path = os.path.join(gajim.DATA_DIR, 'iconsets/' + iconset + '/16x16/')
|
path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
|
||||||
state_images = gajim.interface.roster.load_iconset(path)
|
state_images = gajim.interface.roster.load_iconset(path)
|
||||||
|
|
||||||
groups_menu = gtk.Menu()
|
groups_menu = gtk.Menu()
|
||||||
|
|
|
@ -354,23 +354,36 @@ class TabbedChatWindow(chat.Chat):
|
||||||
child = self.childs[jid]
|
child = self.childs[jid]
|
||||||
hb = self.notebook.get_tab_label(child).get_children()[0]
|
hb = self.notebook.get_tab_label(child).get_children()[0]
|
||||||
status_image = hb.get_children()[0]
|
status_image = hb.get_children()[0]
|
||||||
state_images = gajim.interface.roster.get_appropriate_state_images(jid)
|
|
||||||
|
state_images_32 = gajim.interface.roster.get_appropriate_state_images(jid,
|
||||||
|
size = '32')
|
||||||
|
state_images_16 = gajim.interface.roster.get_appropriate_state_images(jid)
|
||||||
|
|
||||||
# Set banner image
|
# Set banner image
|
||||||
banner_image = state_images[show]
|
if state_images_32[show].get_pixbuf():
|
||||||
|
# we have 32x32! use it!
|
||||||
|
banner_image = state_images_32[show]
|
||||||
|
use_size_32 = True
|
||||||
|
else:
|
||||||
|
banner_image = state_images_16[show]
|
||||||
|
use_size_32 = False
|
||||||
|
|
||||||
banner_status_image = self.xmls[jid].get_widget('banner_status_image')
|
banner_status_image = self.xmls[jid].get_widget('banner_status_image')
|
||||||
if banner_image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if banner_image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
banner_status_image.set_from_animation(banner_image.get_animation())
|
banner_status_image.set_from_animation(banner_image.get_animation())
|
||||||
else:
|
else:
|
||||||
pix = banner_image.get_pixbuf()
|
pix = banner_image.get_pixbuf()
|
||||||
scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR)
|
if use_size_32:
|
||||||
banner_status_image.set_from_pixbuf(scaled_pix)
|
banner_status_image.set_from_pixbuf(pix)
|
||||||
|
else: # we need to scale 16x16 to 32x32
|
||||||
|
scaled_pix = pix.scale_simple(32, 32, gtk.gdk.INTERP_BILINEAR)
|
||||||
|
banner_status_image.set_from_pixbuf(scaled_pix)
|
||||||
|
|
||||||
# Set tab image; unread messages show the 'message' image
|
# Set tab image (always 16x16); unread messages show the 'message' image
|
||||||
if self.nb_unread[jid] and gajim.config.get('show_unread_tab_icon'):
|
if self.nb_unread[jid] and gajim.config.get('show_unread_tab_icon'):
|
||||||
tab_image = state_images['message']
|
tab_image = state_images_16['message']
|
||||||
else:
|
else:
|
||||||
tab_image = banner_image
|
tab_image = state_images_16[show]
|
||||||
if tab_image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
if tab_image.get_storage_type() == gtk.IMAGE_ANIMATION:
|
||||||
status_image.set_from_animation(tab_image.get_animation())
|
status_image.set_from_animation(tab_image.get_animation())
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Reference in a new issue