Пример #1
0
 def paint(self, painter, rect, _index, votes=0):
     lpad = "      "  # we pad it to move it closer to the center
     draw_text(painter,
               rect,
               lpad + format_votes(1.0),
               color=self.rating_colors["BACKGROUND"],
               font=self.font)
     draw_text(painter,
               rect,
               lpad + format_votes(votes),
               color=self.rating_colors["FOREGROUND"],
               font=self.font)
Пример #2
0
    def update_subscribe_button(self, remote_response=None):
        # A safeguard against race condition that happens when the user changed
        # the channel view before the response came in
        if self.isHidden():
            return
        if remote_response and "subscribed" in remote_response:
            self.contents_widget.model.channel_info[
                "subscribed"] = remote_response["subscribed"]

        color = '#FE6D01' if int(
            self.contents_widget.model.channel_info["subscribed"]) else '#fff'
        self.subscribe_button.setStyleSheet('border:none; color: %s' % color)
        self.subscribe_button.setText(
            format_votes(self.contents_widget.model.channel_info['votes']))
Пример #3
0
 def paint_hover(self, painter, rect, _index, votes=0, subscribed=False):
     color = self.rating_colors[
         "SUBSCRIBED_HOVER" if subscribed else "UNSUBSCRIBED_HOVER"]
     draw_text(painter, rect, format_votes(votes), color=color)
Пример #4
0
 def paint(self, painter, rect, _index, votes=0):
     draw_text(painter, rect, format_votes(1.0), color=self.rating_colors["BACKGROUND"], font=self.font)
     draw_text(painter, rect, format_votes(votes), color=self.rating_colors["FOREGROUND"], font=self.font)