def newNotification(self, string, pos, scroll, pixmap = None, \ closePixmap = None, callback = None, params = None, \ userPixbuf = None, font = None, color = None): ''' create a new notification, pixmap is the background image (as a pixbuf), closepixmap is a pixbuf for the close button. callback is the method that will be called when the message in the Notification is clicked ''' if pixmap != None: width, height = pixmap.get_size() else: width = self.defaultWidth height = self.defaultHeight rgb = gtk.gdk.screen_get_default().get_rgb_colormap() gtk.widget_push_colormap(rgb) g = Notification(pos, scroll, self.offset, string, height, width, \ pixmap, closePixmap, callback, params, userPixbuf, font, color) g.show() gtk.widget_pop_colormap() self.offset = g.getOffset() self.list.append([g, int(time.time())]) if len(self.list) <= 1: self.animate = gobject.timeout_add(100, self.refresh)
def onModLoaded(self): """ Install the Status icon """ self.volume = 0 self.tooltip = consts.appName self.isPaused = False self.icoPause = None self.popupMenu = None self.isPlaying = False self.icoNormal = None self.mainWindow = prefs.getWidgetsTree().get_object('win-main') self.trackHasNext = False self.trackHasPrev = False self.emptyTracklist = True self.isMainWinVisible = True # The status icon does not support RGBA, so make sure to use the RGB color map when creating it gtk.widget_push_colormap(self.mainWindow.get_screen().get_rgb_colormap()) self.statusIcon = gtk.StatusIcon() gtk.widget_pop_colormap() # GTK+ handlers self.statusIcon.connect('activate', self.toggleWinVisibility) self.statusIcon.connect('popup-menu', self.onPopupMenu) self.statusIcon.connect('size-changed', self.renderIcons) self.statusIcon.connect('scroll-event', self.onScroll) self.statusIcon.connect('button-press-event', self.onButtonPressed) # Install everything self.statusIcon.set_tooltip(consts.appName) self.onNewTrack(None) self.statusIcon.set_visible(True)
def shaped_window_from_xpm(xpm): # Code adapted from evolution/widgets/table/e-table-header-item.c pixbuf = gtk.gdk.pixbuf_new_from_xpm_data(xpm) pixmap, bitmap = pixbuf.render_pixmap_and_mask() gtk.widget_push_colormap(gtk.gdk.rgb_get_colormap()) win = gtk.Window(gtk.WINDOW_POPUP) pix = gtk.Image() pix.set_from_pixmap(pixmap, bitmap) win.realize() win.add(pix) win.shape_combine_mask(bitmap, 0, 0) gtk.widget_pop_colormap() return win
def build_status_icon(): """ Sets up the status icon. """ if config.get_bool("tekka", "rgba"): gtk.widget_push_colormap( widgets.get_object("main_window")\ .get_screen().get_rgb_colormap() ) statusIcon = TekkaStatusIcon() widgets.add_object(statusIcon, "status_icon") if config.get_bool("tekka", "rgba"): gtk.widget_pop_colormap() statusIcon.set_visible(True)