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)
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() column_offset = self.column_offset * self.column_index draw_text(cr, self.title, rect.x + self.title_padding_x + column_offset, rect.y, rect.width - self.title_padding_x - column_offset, rect.height, text_size=10, text_color=text_color, alignment=pango.ALIGN_LEFT)
def render_block(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")
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)
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)
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)
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)
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)
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))
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)
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)
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
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)
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))
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
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)
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)
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)
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)
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)
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)
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)
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)
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)
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() column_offset = self.column_offset * self.column_index draw_text(cr, self.title, rect.x + self.title_padding_x + column_offset, rect.y, rect.width - self.title_padding_x - column_offset , rect.height, text_size=10, text_color = text_color, alignment=pango.ALIGN_LEFT)
def render_title(self, cr, rect): '''Render title.''' 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() rect.x += self.title_padding_x rect.width -= self.title_padding_x * 2 render_item_text(cr, self.title, rect, self.is_select, self.is_highlight, error=self.song_error)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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 )
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)
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)
def render_title(self, cr, rect): '''Render title.''' 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() rect.x += self.title_padding_x rect.width -= self.title_padding_x * 2 render_item_text(cr, self.title, rect, self.is_select, self.is_highlight, error=self.song_error)
def draw_item_highlight(self, cr, x, y, w, h): draw_single_mask(cr, x, y, w, h, "simpleItemHighlight")
def render_webcast_name(self, cr, rect): if self.is_select: draw_single_mask(cr, rect.x, rect.y, rect.w, rect.h, "simpleItemHighlight") draw_text(cr, self.name, rect.x, rect.y, rect.w, rect.h)
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)
def draw_item_hover(self, cr, x, y, w, h): draw_single_mask(cr, x, y, w, h, "simpleItemHover")
def draw_item_select(self, cr, x, y, w, h): draw_single_mask(cr, x, y, w, h, "simpleItemSelect")
def render_webcast_name(self, cr, rect): if self.is_select: draw_single_mask(cr, rect.x, rect.y, rect.w, rect.h, "simpleItemHighlight") draw_text(cr, self.name, rect.x, rect.y, rect.w, rect.h)
def draw_item_highlight(self, cr, x, y, w, h): draw_single_mask(cr, x + 1, y, w - 2, h, "globalItemHighlight")
def render_block(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")
def draw_item_select(self, cr, x, y, w, h): draw_single_mask(cr, x + 1, y, w - 2, h, "globalItemSelect")
def draw_item_hover(self, cr, x, y, w, h): draw_single_mask(cr, x + 1, y, w - 2, h, "globalItemHover")
def draw_item_hover(self, cr, x, y, w, h): draw_single_mask(cr, x + 1, y, w - 2, h, "globalItemHover")
def draw_item_select(self, cr, x, y, w, h): draw_single_mask(cr, x + 1, y, w - 2, h, "globalItemSelect")
def draw_item_highlight(self, cr, x, y, w, h): draw_single_mask(cr, x + 1, y, w - 2, h, "globalItemHighlight")