make sure we do not fail if path to iconset no longer exists. fixes #2444
This commit is contained in:
		
							parent
							
								
									65fc27e573
								
							
						
					
					
						commit
						5851230084
					
				
					 2 changed files with 10 additions and 4 deletions
				
			
		| 
						 | 
				
			
			@ -37,6 +37,8 @@ opt_bool = [ 'boolean', 0 ]
 | 
			
		|||
opt_color = [ 'color', '^(#[0-9a-fA-F]{6})|()$' ]
 | 
			
		||||
opt_one_window_types = ['never', 'always', 'peracct', 'pertype']
 | 
			
		||||
 | 
			
		||||
DEFAULT_ICONSET = 'dcraven'
 | 
			
		||||
 | 
			
		||||
class Config:
 | 
			
		||||
 | 
			
		||||
	__options = {
 | 
			
		||||
| 
						 | 
				
			
			@ -67,7 +69,7 @@ class Config:
 | 
			
		|||
		'last_status_msg_invisible': [ opt_str, '' ],
 | 
			
		||||
		'last_status_msg_offline': [ opt_str, '' ],
 | 
			
		||||
		'trayicon': [ opt_bool, True, '', True ],
 | 
			
		||||
		'iconset': [ opt_str, 'dcraven', '', True ],
 | 
			
		||||
		'iconset': [ opt_str, DEFAULT_ICONSET, '', True ],
 | 
			
		||||
		'use_transports_iconsets': [ opt_bool, True, '', True ],
 | 
			
		||||
		'inmsgcolor': [ opt_color, '#a34526', '', True ],
 | 
			
		||||
		'outmsgcolor': [ opt_color, '#164e6f', '', True ],
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3129,9 +3129,13 @@ _('If "%s" accepts this request you will know his or her status.') % jid)
 | 
			
		|||
	def make_jabber_state_images(self):
 | 
			
		||||
		'''initialise jabber_state_images dict'''
 | 
			
		||||
		iconset = gajim.config.get('iconset')
 | 
			
		||||
		if not iconset:
 | 
			
		||||
			iconset = 'dcraven'
 | 
			
		||||
		path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
 | 
			
		||||
		if iconset:
 | 
			
		||||
			path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '32x32')
 | 
			
		||||
			if not os.path.exists(path):
 | 
			
		||||
				iconset = DEFAULT_ICONSET
 | 
			
		||||
		else: 
 | 
			
		||||
			iconset = DEFAULT_ICONSET
 | 
			
		||||
 | 
			
		||||
		self.jabber_state_images['32'] = self.load_iconset(path)
 | 
			
		||||
 | 
			
		||||
		path = os.path.join(gajim.DATA_DIR, 'iconsets', iconset, '16x16')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue