def renderContextButtons(self, obj): for item in self.contextButtons: self.remove(item) self.contextButtons = [] arc = getAppropriateARC(self, obj) for action in arc.getActions(): image = gtk.Image() image.set_from_pixbuf(action.getIcon()) item = gtk.ToolButton(image, action.getName()) item.connect("clicked", action.getCallback()) self.insert(item, -1) self.contextButtons.append(item) self.show_all()
def renderContextButtons(self, obj): for item in self.contextButtons: self.remove(item) self.contextButtons = [] arc = getAppropriateARC(self, obj) for action in arc.getActions(): image = gtk.Image() image.set_from_pixbuf(action.getIcon()) item = gtk.ToolButton(image,action.getName()) item.connect("clicked", action.getCallback()) self.insert(item,-1) self.contextButtons.append(item) self.show_all()
def popup(self, obj, button, time): for item in self.currentItems: self.remove(item) self.currentItems = [] arc = getAppropriateARC(self, obj) for action in arc.getActions(): image = gtk.Image() image.set_from_pixbuf(action.getIcon()) item = gtk.ImageMenuItem() item.set_image(image) gtk.MenuItem.__init__(item, action.getName()) item.connect("activate", action.getCallback()) self.currentItems.append(item) for item in self.currentItems: self.append(item) gtk.Menu.popup(self, None, None, None, button, time, None) self.show_all()
def popup(self,obj,button,time): for item in self.currentItems: self.remove(item) self.currentItems = [] arc = getAppropriateARC(self, obj) for action in arc.getActions(): image = gtk.Image() image.set_from_pixbuf(action.getIcon()) item = gtk.ImageMenuItem() item.set_image(image) gtk.MenuItem.__init__(item, action.getName()) item.connect("activate", action.getCallback()) self.currentItems.append(item) for item in self.currentItems: self.append(item) gtk.Menu.popup(self,None,None,None,button,time,None) self.show_all()