place roster tooltips correctly.
This commit is contained in:
		
							parent
							
								
									b8c90a2750
								
							
						
					
					
						commit
						f69ade130c
					
				
					 2 changed files with 32 additions and 24 deletions
				
			
		| 
						 | 
					@ -4114,7 +4114,7 @@ class RosterWindow:
 | 
				
			||||||
                self.tree.expand_row(path, False)
 | 
					                self.tree.expand_row(path, False)
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
        if self.rfilter_enabled:
 | 
					        if self.rfilter_enabled:
 | 
				
			||||||
            Gobject.idle_add(self.disable_rfilter)
 | 
					            GObject.idle_add(self.disable_rfilter)
 | 
				
			||||||
        jid = model[path][C_JID]
 | 
					        jid = model[path][C_JID]
 | 
				
			||||||
        resource = None
 | 
					        resource = None
 | 
				
			||||||
        contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
 | 
					        contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -73,6 +73,7 @@ class BaseTooltip:
 | 
				
			||||||
        self.cur_data = None
 | 
					        self.cur_data = None
 | 
				
			||||||
        self.check_last_time = None
 | 
					        self.check_last_time = None
 | 
				
			||||||
        self.shown = False
 | 
					        self.shown = False
 | 
				
			||||||
 | 
					        self.position_computed = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def populate(self, data):
 | 
					    def populate(self, data):
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
| 
						 | 
					@ -115,20 +116,24 @@ class BaseTooltip:
 | 
				
			||||||
        self.hide_tooltip()
 | 
					        self.hide_tooltip()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def on_size_allocate(self, widget, rect):
 | 
					    def on_size_allocate(self, widget, rect):
 | 
				
			||||||
 | 
					        if not self.position_computed:
 | 
				
			||||||
            half_width = rect.width / 2 + 1
 | 
					            half_width = rect.width / 2 + 1
 | 
				
			||||||
        if self.preferred_position[1] + rect.height > self.screen.get_height():
 | 
					            if self.preferred_position[1] + rect.height > \
 | 
				
			||||||
 | 
					            self.screen.get_height():
 | 
				
			||||||
                 # flip tooltip up
 | 
					                 # flip tooltip up
 | 
				
			||||||
            self.preferred_position[1] -= rect.height + self.widget_height + 8
 | 
					                self.preferred_position[1] -= rect.height + self.widget_height \
 | 
				
			||||||
 | 
					                    + 8
 | 
				
			||||||
                if self.preferred_position[1] < 0:
 | 
					                if self.preferred_position[1] < 0:
 | 
				
			||||||
                    self.preferred_position[1] = self.screen.get_height() - \
 | 
					                    self.preferred_position[1] = self.screen.get_height() - \
 | 
				
			||||||
                        rect.height - 2
 | 
					                        rect.height - 2
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                    if self.preferred_position[0] + rect.width + 7 < \
 | 
					                    if self.preferred_position[0] + rect.width + 7 < \
 | 
				
			||||||
                    self.screen.get_width():
 | 
					                    self.screen.get_width():
 | 
				
			||||||
                    self.preferred_position[0] = self.preferred_position[0] + 7
 | 
					                        self.preferred_position[0] = self.preferred_position[0]\
 | 
				
			||||||
 | 
					                            + 7
 | 
				
			||||||
                    else:
 | 
					                    else:
 | 
				
			||||||
                    self.preferred_position[0] = self.preferred_position[0] - \
 | 
					                        self.preferred_position[0] = self.preferred_position[0]\
 | 
				
			||||||
                        rect.width - 7
 | 
					                            - rect.width - 7
 | 
				
			||||||
                    self.win.move(self.preferred_position[0],
 | 
					                    self.win.move(self.preferred_position[0],
 | 
				
			||||||
                        self.preferred_position[1])
 | 
					                        self.preferred_position[1])
 | 
				
			||||||
                    return
 | 
					                    return
 | 
				
			||||||
| 
						 | 
					@ -136,9 +141,11 @@ class BaseTooltip:
 | 
				
			||||||
                self.preferred_position[0] = 0
 | 
					                self.preferred_position[0] = 0
 | 
				
			||||||
            elif self.preferred_position[0] + rect.width > \
 | 
					            elif self.preferred_position[0] + rect.width > \
 | 
				
			||||||
            self.screen.get_width() + half_width:
 | 
					            self.screen.get_width() + half_width:
 | 
				
			||||||
            self.preferred_position[0] = self.screen.get_width() - rect.width
 | 
					                self.preferred_position[0] = self.screen.get_width() - \
 | 
				
			||||||
 | 
					                    rect.width
 | 
				
			||||||
            elif not self.check_last_time:
 | 
					            elif not self.check_last_time:
 | 
				
			||||||
                self.preferred_position[0] -= half_width
 | 
					                self.preferred_position[0] -= half_width
 | 
				
			||||||
 | 
					            self.position_computed = True
 | 
				
			||||||
        self.win.move(self.preferred_position[0], self.preferred_position[1])
 | 
					        self.win.move(self.preferred_position[0], self.preferred_position[1])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def show_tooltip(self, data, widget_height, widget_y_position):
 | 
					    def show_tooltip(self, data, widget_height, widget_y_position):
 | 
				
			||||||
| 
						 | 
					@ -151,6 +158,7 @@ class BaseTooltip:
 | 
				
			||||||
        """
 | 
					        """
 | 
				
			||||||
        if self.shown:
 | 
					        if self.shown:
 | 
				
			||||||
            return
 | 
					            return
 | 
				
			||||||
 | 
					        self.position_computed = False
 | 
				
			||||||
        self.cur_data = data
 | 
					        self.cur_data = data
 | 
				
			||||||
        # set tooltip contents
 | 
					        # set tooltip contents
 | 
				
			||||||
        self.populate(data)
 | 
					        self.populate(data)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue