示例#1
0
 def searchbtn_expose_event(self, widget, event):
     cr = widget.window.cairo_create()
     rect = widget.allocation
     #
     if widget.state == gtk.STATE_NORMAL:
         pixbuf = self.normal_pixbuf
     elif widget.state == gtk.STATE_PRELIGHT:
         pixbuf = self.hover_pixbuf
     elif widget.state == gtk.STATE_ACTIVE:
         pixbuf = self.press_pixbuf
     # draw state pixbuf.
     draw_pixbuf(cr, pixbuf, rect.x, rect.y)    
     return True
示例#2
0
 def draw_down_state(self, cr, rect, state, x=0, y=0):    
     state_pixbuf = None
     if state == "error": # 错误
         state_pixbuf = self.error_pixbuf
     elif state == "success": # 下载完成
         state_pixbuf = self.success_pixbuf
     elif state == "wait":   # 等待
         state_pixbuf = self.wait_pixbuf
     elif state == "working": # 正在下载
         state_pixbuf = self.working_pixbuf
     #    
     if state_pixbuf:    
         draw_pixbuf(cr, state_pixbuf, rect.x + x, rect.y + y)
     else:    
         draw_text(cr, rect.x + x, rect.y + y, str(state), ("#000000", 1), 10)
示例#3
0
 def progressbar_expose_event(self, widget, event):    
     cr = widget.window.cairo_create()
     rect = widget.allocation
     #
     frame_pixbuf = self.frame_pixbuf.scale_simple(self.pb_w, self.pb_h, 
                                                   gtk.gdk.INTERP_BILINEAR)
     #
     draw_pixbuf(cr, frame_pixbuf, rect.x, rect.y)
     if self.value > 0:
         fg_pixbuf = self.fg_pixbuf.scale_simple(int(self.value * self.fg_w / 100), 
                                             self.fg_h,
                                             gtk.gdk.INTERP_BILINEAR)
         draw_pixbuf(cr, fg_pixbuf, rect.x + 4, rect.y + 3)
     # text show.    
     color = ("#FFFFFF", 0.5)
     font_size =  9
     draw_text(cr, rect.x + self.pb_w/2, rect.y + self.pb_h/2 - 1, str(self.value) + "%", color, font_size)
     return True
示例#4
0
 def draw_progressbar(self, cr, rect, value, x=0, y=0):
     '''画进度条'''
     frame_pixbuf = self.frame_pixbuf.scale_simple(self.pb_w, self.pb_h, 
                                                   gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, frame_pixbuf, rect.x + x, rect.y + y)
     #
     if self.value > 0:
         fg_pixbuf = self.fg_pixbuf.scale_simple(int(value * self.fg_w / 100), 
                                                 self.fg_h,
                                                 gtk.gdk.INTERP_BILINEAR)
         draw_pixbuf(cr, fg_pixbuf, 
                     rect.x + 4 + x, rect.y + 3 + y)
     # text show.    
     color = ("#FFFFFF", 0.5)
     font_size =  9
     draw_text(cr, 
               rect.x + self.pb_w/2 + x, 
               rect.y + self.pb_h/2 - 1 + y, 
               str(value) + "%", color, font_size)
示例#5
0
 def draw_titles(self, cr, rect):                    
     '''画litview标题'''
     # draw file name.
     name_pixbuf = self.titles_pixbuf.scale_simple(180, self.selectt_height, gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, name_pixbuf, rect.x - 10, rect.y)
     draw_text(cr, rect.x + 80, rect.y + 13, "文件名", ("#FFFFFF", 1.0), 10)
     # draw size.
     size_pixbuf = self.titles_pixbuf.scale_simple(120, self.selectt_height, gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, size_pixbuf, rect.x + name_pixbuf.get_width() - 18, rect.y)
     draw_text(cr, rect.x + name_pixbuf.get_width() + 45, rect.y + 13, "文件大小", ("#FFFFFF", 1.0), 10)
     # draw down progressbar.
     pb_pixbuf = self.titles_pixbuf.scale_simple(380, self.selectt_height, gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, pb_pixbuf, rect.x + name_pixbuf.get_width() + size_pixbuf.get_width() - 30, rect.y)
     draw_text(cr, rect.x + name_pixbuf.get_width() + size_pixbuf.get_width() + 155, rect.y + 13, "下载进度", ("#FFFFFF", 1.0), 10)        
     # draw down state.
     state_pixbuf = self.titles_pixbuf.scale_simple(rect.width, self.selectt_height, gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, state_pixbuf, rect.x + 618, rect.y)        
     draw_text(cr, rect.x + name_pixbuf.get_width() + size_pixbuf.get_width() + 400, rect.y + 13, "状态", ("#FFFFFF", 1.0), 10) 
示例#6
0
 def win_expose_event(widget, event):
     cr = widget.window.cairo_create()
     rect = widget.allocation
     pixbuf = gtk.gdk.pixbuf_new_from_file("theme/progressbar/bg.png").scale_simple(rect.width, rect.height, gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, pixbuf, rect.x, rect.y)
示例#7
0
 def draw_background(self, cr, rect):
     bg_pixbuf = self.bg_pixbuf.scale_simple(rect.width, rect.height, gtk.gdk.INTERP_BILINEAR)
     draw_pixbuf(cr, bg_pixbuf, rect.x, rect.y)