def draw_win(self,image=None): # Orb Top Screen change event self.cr = self.aux_window.window.cairo_create() self.cr.set_source_rgba(1.0, 1.0, 1.0, 0.0) # Transparent self.cr.set_operator(cairo.OPERATOR_SOURCE) # Draw the graphics if image== None: image = self.image try: cairo_drawing.draw_scaled_image(self.cr,0,0,image,int(self.w*self.scale),int(self.h*self.scale)) except:pass
def shape(self): #Standard shape setup of window print 'shaping window' w,h = self.window.get_size() if w==0: w = 100 if h==0: h = 100 self.w = w self.h = h self.pixmap = gtk.gdk.Pixmap (None, w, h, 1) ctx = self.pixmap.cairo_create() self.bgpb = gtk.gdk.pixbuf_new_from_file(Globals.ImageDirectory + Globals.StartMenuTemplate) if Globals.Settings['GtkColors'] == 1 and Globals.Has_Numpy: if not self.colorpb: bgcolor = Globals.GtkColorCode r = (bgcolor.red*255)/65535.0 g = (bgcolor.green*255)/65535.0 b = (bgcolor.blue*255)/65535.0 self.colorpb= self.bgpb.copy() for row in self.colorpb.get_pixels_array(): for pix in row: pix[0] = r pix[1] = g pix[2] = b self.bgpb.composite(self.colorpb, 0, 0, self.w, self.h, 0, 0, 1, 1, gtk.gdk.INTERP_BILINEAR, 70) self.bgpb = self.colorpb ctx.save() ctx.set_source_rgba(1, 1, 1,0) ctx.set_operator (cairo.OPERATOR_SOURCE) ctx.paint() ctx.restore() if Globals.MenuHasIcon==1: cairo_drawing.draw_image(ctx,Globals.UserIconFrameOffsetX,Globals.UserIconFrameOffsetY,Globals.UserImageFrame) w,h = utils.get_image_size(Globals.UserImageFrame) cairo_drawing.draw_scaled_image(ctx,Globals.IconInX +Globals.UserIconFrameOffsetX,Globals.UserIconFrameOffsetY+Globals.IconInY,Globals.UserImage,Globals.IconInW ,Globals.IconInH) cairo_drawing.draw_enhanced_image(ctx,0,0,Globals.ImageDirectory + Globals.StartMenuTemplate) if self.window.is_composited(): self.window.input_shape_combine_mask(self.pixmap,0,0) else: self.window.shape_combine_mask(self.pixmap, 0, 0)