• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ui_utils.draw_single_mask函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中widget.ui_utils.draw_single_mask函数的典型用法代码示例。如果您正苦于以下问题:Python draw_single_mask函数的具体用法?Python draw_single_mask怎么用?Python draw_single_mask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了draw_single_mask函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: render_webcast_icon

 def render_webcast_icon(self, cr, rect):        
     # Draw select background.
     if self.is_select:
         draw_single_mask(cr, rect.x, rect.y, rect.w, rect.h, "simpleItemHighlight")
         
     draw_pixbuf(cr, self.webcast_icon, rect.x + self.side_padding, 
                 rect.y + (rect.height - self.webcast_icon.get_height()) / 2)
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:7,代码来源:discard_browser.py


示例2: render_text

 def render_text(self, cr, rect):
     if self.is_hover:
         # Draw background.
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemSelect")
         
         # Set font color.
         font_color = "#FFFFFF"
         
         # Don't highlight when select.
         # text = self.text
     else:
         # Set font color.
         font_color = app_theme.get_color("labelText").get_color()
         
         # Highilght match string.
         # (text_pre, text_post) = self.text.split(self.search_string)
         # text = "%s<span foreground=\"#00AAFF\">%s</span>%s" % (text_pre, self.search_string, text_post)
         
     draw_text(cr, 
               self.text,
               rect.x + self.padding_x, 
               rect.y,
               rect.width - self.padding_x * 2, 
               rect.height,
               text_color=font_color)
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:25,代码来源:completion_window.py


示例3: render_title

 def render_title(self, cr, rect):        
     # Draw select background.
         
     if self.is_select:    
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHighlight")
     elif self.is_hover:
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHover")
     
     if self.is_select:
         text_color = "#FFFFFF"
     else:    
         text_color = app_theme.get_color("labelText").get_color()
         
     if self.is_select:    
         icon_pixbuf = self.press_dpixbuf.get_pixbuf()
     else:    
         icon_pixbuf = self.normal_dpixbuf.get_pixbuf()
         
     rect.x += self.padding_x    
     rect.width -= self.padding_x * 2
     icon_y = rect.y + (rect.height - icon_pixbuf.get_height()) / 2
     draw_pixbuf(cr,icon_pixbuf, rect.x, icon_y)    
     rect.x += self.icon_width + self.padding_x
     rect.width -= self.icon_width
         
     draw_text(cr, self.title, rect.x,
               rect.y, rect.width,
               rect.height, text_size=10, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT)    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:30,代码来源:radio_item.py


示例4: render_stop

 def render_stop(self, cr, rect):    
     if self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
     
     icon_x = rect.x + (rect.width - self.stop_pixbuf.get_width()) / 2
     icon_y = rect.y + (rect.height - self.stop_pixbuf.get_height()) / 2
     draw_pixbuf(cr, self.stop_pixbuf, icon_x, icon_y)
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:7,代码来源:download_item.py


示例5: render_title

 def render_title(self, cr, rect):        
     # Draw select background.
         
     if self.is_select:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
     elif self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
     
     if self.is_select:
         text_color = "#FFFFFF"
     else:    
         text_color = app_theme.get_color("labelText").get_color()
         
     # draw arrow    
     if self.is_expand:    
         if self.is_select:
             arrow_pixbuf = self.down_press_dpixbuf.get_pixbuf()
         else:
             arrow_pixbuf = self.down_normal_dpixbuf.get_pixbuf()
     else:        
         if self.is_select:
             arrow_pixbuf = self.right_press_dpixbuf.get_pixbuf()
         else:
             arrow_pixbuf = self.right_normal_dpixbuf.get_pixbuf()
             
     arrow_x = rect.x + self.arrow_padding_x
     arrow_y = rect.y + (rect.height - arrow_pixbuf.get_height()) / 2
     draw_pixbuf(cr, arrow_pixbuf, arrow_x, arrow_y)
     draw_text(cr, self.title, rect.x + self.title_padding_x, rect.y, 
               rect.width - self.title_padding_x, rect.height, text_size=10, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT)    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:32,代码来源:prefer_item.py


示例6: render_content

    def render_content(self, cr, rect):
        if self.is_highlight:    
            if not self.is_double_click:
                draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemHighlight")
                text_color = "#FFFFFF"
            else:    
                text_color = app_theme.get_color("labelText").get_color()
                
        elif self.is_hover:
            text_color = app_theme.get_color("labelText").get_color()
            draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemHover")
        else:    
            text_color = app_theme.get_color("labelText").get_color()

            
        if not self.is_highlight:    
            self.entry_buffer.move_to_start()
            
        self.entry_buffer.set_text_color(text_color)
        width, height = self.entry_buffer.get_content_size()
        offset_y = (self.item_height - height) / 2
        # offset_x = (self.item_height - width) / 2
        rect.y += offset_y
        rect.x += 10
        # rect.x += offset_x
        
        if self.entry and self.entry.allocation.width == self.get_column_widths()[0]-4:
            self.entry.calculate()
            self.entry_buffer.set_text_color("#000000")
            self.entry_buffer.render(cr, rect, self.entry.im)
        else:
            self.entry_buffer.render(cr, rect)
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:32,代码来源:list_item.py


示例7: render_progressbar

 def render_progressbar(self, cr, rect):     
     if self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
    
     self.progress_buffer.render(cr, 
                                 gtk.gdk.Rectangle(rect.x + (rect.width - self.progressbar_width) / 2,
                                                   rect.y + (rect.height - self.progressbar_height)/ 2,
                                                   self.progressbar_width, self.progressbar_height))
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:8,代码来源:download_item.py


示例8: render_artist

 def render_artist(self, cr, rect):
     '''Render artist.'''
     if self.is_select:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
     elif self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
     
     rect.x += self.artist_padding_x
     rect.width -= self.artist_padding_x * 2
     render_item_text(cr, self.artist, rect, self.is_select, self.is_highlight)
开发者ID:electricface,项目名称:deepin-music-player,代码行数:10,代码来源:lyrics_search.py


示例9: expose_simple_item

 def expose_simple_item(self, widget, event):    
     
     # Init.
     cr = widget.window.cairo_create()
     rect = widget.allocation
     rect.x += 1
     rect.width -= 2
     font_color = app_theme.get_color("labelText").get_color()
     item_pixbuf = self.normal_dpixbuf.get_pixbuf()
     select_index = self.get_index()
     
     if widget.state == gtk.STATE_NORMAL:
         if select_index == self.index:
             select_status = BUTTON_PRESS
         else:    
             select_status = BUTTON_NORMAL
             
     elif widget.state == gtk.STATE_PRELIGHT:        
         if select_index == self.index: 
             select_status = BUTTON_PRESS
         else:    
             select_status = BUTTON_HOVER
             
     elif widget.state == gtk.STATE_ACTIVE:        
         select_status = BUTTON_PRESS
         
     if select_status == BUTTON_PRESS:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
         # font_color = app_theme.get_color("simpleSelectItem").get_color()
         font_color = "#FFFFFF"
         item_pixbuf = self.press_dpixbuf.get_pixbuf()
         
     elif select_status == BUTTON_HOVER:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
         
     # Draw pixbuf.    
     draw_pixbuf(cr, item_pixbuf, rect.x + self.padding_left, rect.y + (rect.height - item_pixbuf.get_height()) / 2)    
     
     
     # Draw content.
     draw_text(cr, self.content, 
               rect.x + self.padding_left + self.font_offset , 
               rect.y,
               rect.width - self.padding_left - self.font_offset - self.padding_right,
               rect.height, 
               self.font_size, font_color,
               alignment=self.x_align)
     
     propagate_expose(widget, event)
     
     return True
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:51,代码来源:outlookbar.py


示例10: render_info

    def render_info(self, cr, rect):
        if self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
        
        if self.icon_pixbuf is None:
            self.icon_pixbuf = CoverManager.get_pixbuf_from_song(self.song, 37, 38, try_web=False)
            
            
        icon_width = self.icon_pixbuf.get_width()
        icon_height = self.icon_pixbuf.get_height()
        icon_x = rect.x + self.info_padding_x
        icon_y = rect.y + (rect.height - icon_height) / 2
        
        # Draw shadow.
        drop_shadow_padding = 3
        drop_shadow_radious = 3
        draw_shadow(
            cr,
            icon_x,
            icon_y,
            icon_width + drop_shadow_padding,
            icon_height + drop_shadow_padding,
            drop_shadow_radious,
            app_theme.get_shadow_color("window_shadow")
            )

        outside_shadow_padding = 2
        outside_shadow_radious = 3
        draw_shadow(
            cr,
            icon_x - outside_shadow_padding,
            icon_y - outside_shadow_padding,
            icon_width + outside_shadow_padding * 2,
            icon_height + outside_shadow_padding * 2,
            outside_shadow_radious,
            app_theme.get_shadow_color("window_shadow")
            )
        
        # Draw wallpaper.
        
        draw_pixbuf(cr, self.icon_pixbuf, icon_x, icon_y)
        rect.x = icon_x + self.icon_pixbuf.get_width() + self.info_padding_x
        rect.width -= self.info_padding_x * 2 - self.icon_pixbuf.get_width()
        _width, _height = get_content_size("%s" % self.song.get_str("title"))
        draw_text(cr, "<b>%s</b>" % self.song.get_str("title"), rect.x, icon_y, rect.width, _height,
                  text_size=10)                   
        
        rect.y = icon_y + icon_width - _height
        _width, _height = get_content_size(self.status_text)
        draw_text(cr, self.status_text, rect.x, rect.y, rect.width, _height)
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:50,代码来源:download_item.py


示例11: render_enabled

 def render_enabled(self, cr, rect):
     if self.is_select:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
     elif self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
         
     if self.enabled:    
         pixbuf = self.enabled_press_dpixbuf.get_pixbuf()
     else:    
         pixbuf = self.enabled_normal_dpixbuf.get_pixbuf()
         
     icon_x = rect.x + (rect.width - pixbuf.get_width()) / 2
     icon_y = rect.y + (rect.height - pixbuf.get_height()) / 2
     draw_pixbuf(cr, pixbuf, icon_x, icon_y)
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:14,代码来源:plugins_view.py


示例12: render_version

 def render_version(self, cr, rect):    
     if self.is_select:    
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
     elif self.is_hover:
         draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")
     
     if self.is_select:
         text_color = "#FFFFFF"
     else:    
         text_color = app_theme.get_color("labelText").get_color()
         
     draw_text(cr, self.pluginfo["Version"], rect.x + self.draw_padding_x, 
               rect.y, rect.width - self.draw_padding_x * 2,
               rect.height, text_size=10, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT)    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:16,代码来源:plugins_view.py


示例13: render_title

 def render_title(self, cr, rect):
     if self.is_highlight:    
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 3, rect.height, "globalItemHighlight")
     elif self.is_hover:
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 3, rect.height, "globalItemHover")
     
     if self.is_highlight:
         text_color = "#FFFFFF"
     else:    
         text_color = app_theme.get_color("labelText").get_color()
         
     rect.x += self.text_padding    
     rect.width -= self.text_padding * 2
     
         
     draw_text(cr, self.title, rect.x, rect.y, rect.width, rect.height, text_size=9, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT)    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:18,代码来源:list_item.py


示例14: render_title

 def render_title(self, cr, rect):        
     # Draw select background.
     
     rect.y += self.padding_y + 2
     # draw separator.
     if self.has_separator:
         draw_separator(cr, rect.x, 
                        rect.y,
                        rect.width, 1
                        )
         rect.y += self.padding_y + self.separator_height - 2
         rect.height -= self.separator_height
                 
     if self.is_highlight:    
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHighlight")
     elif self.is_hover:
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width - 2, rect.height, "globalItemHover")
     
     rect.x += self.padding_x    
     rect.width -= self.padding_x * 2
         
     if self.is_highlight:
         pixbuf = self.press_pixbuf
     else:    
         pixbuf = self.normal_pixbuf
         
     if pixbuf:    
         icon_y = rect.y + (rect.height - self.normal_pixbuf.get_height()) / 2
         draw_pixbuf(cr, pixbuf, rect.x, icon_y)    
         rect.x += self.icon_width + self.padding_x
         rect.width -= self.icon_width - self.padding_x
         
     if self.is_highlight:
         text_color = "#FFFFFF"
     else:    
         text_color = app_theme.get_color("labelText").get_color()
         
     
     draw_text(cr, self.title, rect.x,
               rect.y, rect.width,
               rect.height, text_size=10, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT)    
开发者ID:WilliamRen,项目名称:dmusic-plugin-baidumusic,代码行数:43,代码来源:music_list_item.py


示例15: render_album

    def render_album(self, cr, rect):
        """Render album."""
        if self.is_highlight:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
        elif self.is_select:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
        elif self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")

        rect.width -= self.album_padding_x * 2
        render_item_text(cr, self.album, rect, self.is_select, self.is_highlight, error=self.song_error)
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:11,代码来源:netease_music_view.py


示例16: render_length

    def render_length(self, cr, rect):
        """Render length."""
        if self.is_highlight:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
        elif self.is_select:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
        elif self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")

        rect.width -= self.length_padding_x * 2
        rect.x += self.length_padding_x * 2
        render_item_text(cr, self.length, rect, self.is_select, self.is_highlight, error=self.song_error, font_size=8)
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:12,代码来源:netease_music_view.py


示例17: render_add_time

    def render_add_time(self, cr, rect):
        '''Render add_time.'''
        if self.is_highlight:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
        elif self.is_select:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
        elif self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")

        rect.width -= self.add_time_padding_x * 2
        render_item_text(cr, self.add_time, rect, self.is_select, self.is_highlight, align=ALIGN_START,
                         error=self.song_error, font_size=8)
开发者ID:C2python,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:12,代码来源:netease_music_view.py


示例18: render_creator

    def render_creator(self, cr, rect):
        '''Render length.'''
        if self.is_highlight:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
        elif self.is_select:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
        elif self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")


        rect.width -= self.creator_padding_x * 2
        rect.x += self.creator_padding_x * 2
        render_item_text(cr, self.creator, rect, self.is_select, self.is_highlight)
开发者ID:EightWarning,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:13,代码来源:netease_music_browser.py


示例19: render_artist

    def render_artist(self, cr, rect):
        """Render artist."""
        if self.is_highlight:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHighlight")
        elif self.is_select:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemSelect")
        elif self.is_hover:
            draw_single_mask(cr, rect.x, rect.y, rect.width, rect.height, "globalItemHover")

        rect.x += self.artist_padding_x
        rect.width -= self.artist_padding_x * 2
        render_item_text(
            cr, self.artist, rect, self.is_select, self.is_highlight, error=self.song_error, align=pango.ALIGN_RIGHT
        )
开发者ID:jinagko,项目名称:dmusic-plugin-NeteaseCloudMusic,代码行数:14,代码来源:netease_music_view.py


示例20: render_content

 def render_content(self, cr, rect):
     if self.is_highlight:    
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemHighlight")
     elif self.is_select:    
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemSelect")
     elif self.is_hover:
         draw_single_mask(cr, rect.x + 1, rect.y, rect.width, rect.height, "globalItemHover")
     
     if self.is_highlight:
         text_color = "#ffffff"
     else:    
         text_color = app_theme.get_color("labelText").get_color()
         
     icon_pixbuf = self.normal_pixbuf    
     icon_y = rect.y + (rect.height - self.icon_height) / 2    
     padding_x = 10
     padding_y = 10
     
     animation_rect = gtk.gdk.Rectangle(rect.x + padding_x,  icon_y, self.icon_width, self.icon_height)                
     cr.save()
     cr.arc(animation_rect.x + animation_rect.width / 2,
            animation_rect.y + animation_rect.height / 2,
            animation_rect.width / 2,
            0, 2 * math.pi)
     # cr.rectangle(animation_rect.x, animation_rect.y, animation_rect.width, animation_rect.height)
     cr.clip()
     # self.render_animation(cr, animation_rect)
     draw_pixbuf(cr, self.normal_pixbuf, rect.x + padding_x, icon_y)        
     cr.restore()
     
     draw_text(cr, self.channel_name, rect.x + icon_pixbuf.get_width() + padding_x * 2, 
               rect.y + padding_y, rect.width - icon_pixbuf.get_width() - padding_x * 3, self.name_h, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT, text_size=10)    
     
     if self.is_highlight:
         draw_text(cr, self.channel_intro, rect.x + icon_pixbuf.get_width() + padding_x * 2,
                   rect.y + padding_y  * 2 + self.name_h, 
                   rect.width - icon_pixbuf.get_width() - padding_x * 3,
                   self.intro_h,
                   text_color = text_color,
                   alignment=pango.ALIGN_LEFT, text_size=8)
     
     draw_text(cr, self.detail_info, rect.x + icon_pixbuf.get_width() + padding_x * 2, 
               rect.y + (rect.height - self.detail_h - padding_y), 
               rect.width - icon_pixbuf.get_width() - padding_x * 3, self.detail_h, 
               text_color = text_color,
               alignment=pango.ALIGN_LEFT, text_size=8)    
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:48,代码来源:radio_item.py



注:本文中的widget.ui_utils.draw_single_mask函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python ui_utils.switch_tab函数代码示例发布时间:2022-05-26
下一篇:
Python ui_utils.draw_alpha_mask函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap