color of tabs are now well handeled: when we receive a chat state we modify both gtk.STATE_NORMAL and gtk.STATE_ACTIVE color, so when we change the active tab, color is ok
This commit is contained in:
		
							parent
							
								
									a7300534f8
								
							
						
					
					
						commit
						adcdcbc411
					
				
					 1 changed files with 11 additions and 14 deletions
				
			
		
							
								
								
									
										25
									
								
								src/chat.py
									
										
									
									
									
								
							
							
						
						
									
										25
									
								
								src/chat.py
									
										
									
									
									
								
							| 
						 | 
					@ -208,20 +208,17 @@ class Chat:
 | 
				
			||||||
								     'state_active_color')
 | 
													     'state_active_color')
 | 
				
			||||||
			if color:
 | 
								if color:
 | 
				
			||||||
				color = gtk.gdk.colormap_get_system().alloc_color(color)
 | 
									color = gtk.gdk.colormap_get_system().alloc_color(color)
 | 
				
			||||||
				# The widget state depend on whether this tab is the "current" tab
 | 
									# We set the color for when it's the current tab or not
 | 
				
			||||||
				if self.notebook.page_num(child) == self.notebook.get_current_page():
 | 
									nickname.modify_fg(gtk.STATE_NORMAL, color)
 | 
				
			||||||
					widget_state = gtk.STATE_NORMAL 
 | 
									if chatstate in ['inactive', 'gone']:
 | 
				
			||||||
				else:
 | 
										# Adjust color to be lighter against the darker inactive
 | 
				
			||||||
					widget_state = gtk.STATE_ACTIVE 
 | 
										# background
 | 
				
			||||||
					if chatstate in ['inactive', 'gone']:
 | 
										p = 0.4
 | 
				
			||||||
						# Adjust color to be lighter against the darker inactive
 | 
										mask = 0
 | 
				
			||||||
						# background
 | 
										color.red = int((color.red * p) + (mask * (1 - p)))
 | 
				
			||||||
						p = 0.4
 | 
										color.green = int((color.green * p) + (mask * (1 - p)))
 | 
				
			||||||
						mask = 0
 | 
										color.blue = int((color.blue * p) + (mask * (1 - p)))
 | 
				
			||||||
						color.red = int((color.red * p) + (mask * (1 - p)))
 | 
									nickname.modify_fg(gtk.STATE_ACTIVE, color)
 | 
				
			||||||
						color.green = int((color.green * p) + (mask * (1 - p)))
 | 
					 | 
				
			||||||
						color.blue = int((color.blue * p) + (mask * (1 - p)))
 | 
					 | 
				
			||||||
				nickname.modify_fg(widget_state, color)
 | 
					 | 
				
			||||||
		elif self.widget_name == 'groupchat_window':
 | 
							elif self.widget_name == 'groupchat_window':
 | 
				
			||||||
			nickname = hb.get_children()[0]
 | 
								nickname = hb.get_children()[0]
 | 
				
			||||||
			close_button = hb.get_children()[1]
 | 
								close_button = hb.get_children()[1]
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue