def statusIconPopup(self, sicon, button, etime): menu = gtk.Menu() if os.sep == '\\': from scal3.ui_gtk.windows import setupMenuHideOnLeave setupMenuHideOnLeave(menu) items = self.getStatusIconPopupItems() # items.insert(0, self.getMainWinMenuItem())## FIXME geo = self.sicon.get_geometry() ## Returns None on windows, why??? if geo is None:## windows, taskbar is on buttom(below) items.reverse() get_pos_func = None else: #print(dir(geo)) y1 = geo.index(1) try: y = gtk.StatusIcon.position_menu(menu, self.sicon)[1] except TypeError: ## new gi versions y = gtk.StatusIcon.position_menu(menu, 0, 0, self.sicon)[1] if y<y1:## taskbar is on bottom items.reverse() get_pos_func = gtk.StatusIcon.position_menu for item in items: menu.add(item) menu.show_all() #print('statusIconPopup', button, etime) menu.popup(None, None, get_pos_func, self.sicon, button, etime) #self.sicon.do_popup_menu(self.sicon, button, etime) ui.updateFocusTime() self.sicon.menu = menu ## to prevent gurbage collected
def statusIconPopup(self, sicon, button, etime): menu = gtk.Menu() if os.sep == "\\": from scal3.ui_gtk.windows import setupMenuHideOnLeave setupMenuHideOnLeave(menu) items = self.getStatusIconPopupItems() # items.insert(0, self.getMainWinMenuItem())## FIXME get_pos_func = None y1 = 0 geo = self.sicon.get_geometry() ## Previously geo was None on windows, and on Linux it had `geo.index(1)` (not sure about the type) ## Now it's tuple on both Linux and windows if geo is None: items.reverse() elif isinstance(geo, tuple): # geo == (True, screen, area, orientation) y1 = geo[2].y else: y1 = geo.index(1) try: y = gtk.StatusIcon.position_menu(menu, self.sicon)[1] except TypeError: ## new gi versions y = gtk.StatusIcon.position_menu(menu, 0, 0, self.sicon)[1] if y1 > 0 and y < y1: # taskbar is on bottom items.reverse() get_pos_func = gtk.StatusIcon.position_menu for item in items: menu.add(item) menu.show_all() #print("statusIconPopup", button, etime) menu.popup(None, None, get_pos_func, self.sicon, button, etime) #self.sicon.do_popup_menu(self.sicon, button, etime) ui.updateFocusTime() self.sicon.menu = menu ## to prevent gurbage collected