Example #1
0
    def _paint_panel(self, canvas, allocated_size, horizontal):
        # Nothing to paint if the timer is stopped
        if self.pommodoro_timer.state == PommodoroTimer.STOPPED:
            return

        # Nothing to paint if the page is visible
        if not self.page or (self.page and self.page.is_visible()):
            return

        if self.screen.driver.get_bpp() == 1:
            if self.pommodoro_timer.state == PommodoroTimer.WAITING:
                size = g15cairo.paint_thumbnail_image(allocated_size,
                                                      self.waiting_image_1bpp,
                                                      canvas)
            elif self.pommodoro_timer.state == PommodoroTimer.RUNNING:
                size = g15cairo.paint_thumbnail_image(allocated_size,
                                                      self.running_image_1bpp,
                                                      canvas)
        else:
            if self.pommodoro_timer.state == PommodoroTimer.WAITING:
                size = g15cairo.paint_thumbnail_image(allocated_size,
                                                      self.waiting_image,
                                                      canvas)
            elif self.pommodoro_timer.state == PommodoroTimer.RUNNING:
                size = g15cairo.paint_thumbnail_image(allocated_size,
                                                      self.running_image,
                                                      canvas)

        return size
Example #2
0
    def _paint_panel(self, canvas, allocated_size, horizontal):
        # Nothing to paint if the timer is stopped
        if self.pommodoro_timer.state == PommodoroTimer.STOPPED:
            return

        # Nothing to paint if the page is visible
        if not self.page or (self.page and self.page.is_visible()):
            return

        if self.screen.driver.get_bpp() == 1:
            if self.pommodoro_timer.state == PommodoroTimer.WAITING:
                size = g15cairo.paint_thumbnail_image(allocated_size,
                                                      self.waiting_image_1bpp,
                                                      canvas)
            elif self.pommodoro_timer.state == PommodoroTimer.RUNNING:
                size = g15cairo.paint_thumbnail_image(allocated_size,
                                                      self.running_image_1bpp,
                                                      canvas)
        else:
            if self.pommodoro_timer.state == PommodoroTimer.WAITING:
                size = g15cairo.paint_thumbnail_image(allocated_size, self.waiting_image, canvas)
            elif self.pommodoro_timer.state == PommodoroTimer.RUNNING:
                size = g15cairo.paint_thumbnail_image(allocated_size, self.running_image, canvas)

        return size
Example #3
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     total_taken = 0 
     self._text.set_canvas(canvas)
     if self.screen.driver.get_bpp() == 1:
         if "mono_thumb_icon" in self._page_attributes:
             size = g15cairo.paint_thumbnail_image(allocated_size, self._page_attributes["mono_thumb_icon"], canvas)
             canvas.translate(size + 2, 0)
             total_taken += size + 2
         if "temp_short" in self._page_properties:
             self._text.set_attributes(self._page_properties["temp_short"], \
                                       font_desc = g15globals.fixed_size_font_name, \
                                       font_absolute_size =  6 * pango.SCALE / 2)
             x, y, width, height = self._text.measure()
             total_taken += width
             self._text.draw(x, y)
     else:
         rgb = self.screen.driver.get_color_as_ratios(g15driver.HINT_FOREGROUND, ( 0, 0, 0 ))
         canvas.set_source_rgb(rgb[0],rgb[1],rgb[2])
         if "icon" in self._page_attributes:
             size = g15cairo.paint_thumbnail_image(allocated_size, self._page_attributes["icon"], canvas)
             total_taken += size
         if "temp" in self._page_properties:
             if horizontal:
                 self._text.set_attributes(self._page_properties["temp"], font_desc = "Sans", font_absolute_size =  allocated_size * pango.SCALE / 2)
                 x, y, width, height = self._text.measure()
                 self._text.draw(total_taken, (allocated_size / 2) - height / 2)
                 total_taken += width + 4
             else:  
                 self._text.set_attributes(self._page_properties["temp"], font_desc = "Sans", font_absolute_size =  allocated_size * pango.SCALE / 4)
                 x, y, width, height = self._text.measure()
                 self._text.draw((allocated_size / 2) - width / 2, total_taken)
                 total_taken += height + 4     
     return total_taken
Example #4
0
 def _paint_panel(self, canvas, allocated_size, horizontal):
     if self.page != None:
         t = 0
         if self.thumb_icon != None and self._attention == 1:
             t += g15cairo.paint_thumbnail_image(allocated_size, self.thumb_icon, canvas)
         if self._status_icon != None:
             t += g15cairo.paint_thumbnail_image(allocated_size, self._status_icon, canvas)
         return t
Example #5
0
 def _paint_panel(self, canvas, allocated_size, horizontal):
     if self.page != None:
         t = 0
         if self.thumb_icon != None and self._attention == 1:
             t += g15cairo.paint_thumbnail_image(allocated_size,
                                                 self.thumb_icon, canvas)
         if self._status_icon != None:
             t += g15cairo.paint_thumbnail_image(allocated_size,
                                                 self._status_icon, canvas)
         return t
Example #6
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     total_taken = 0
     self._text.set_canvas(canvas)
     if self.screen.driver.get_bpp() == 1:
         if "mono_thumb_icon" in self._page_attributes:
             size = g15cairo.paint_thumbnail_image(
                 allocated_size, self._page_attributes["mono_thumb_icon"],
                 canvas)
             canvas.translate(size + 2, 0)
             total_taken += size + 2
         if "temp_short" in self._page_properties:
             self._text.set_attributes(
                 self._page_properties["temp_short"],
                 font_desc=g15globals.fixed_size_font_name,
                 font_absolute_size=6 * pango.SCALE / 2)
             x, y, width, height = self._text.measure()
             total_taken += width
             self._text.draw(x, y)
     else:
         rgb = self.screen.driver.get_color_as_ratios(
             g15driver.HINT_FOREGROUND, (0, 0, 0))
         canvas.set_source_rgb(rgb[0], rgb[1], rgb[2])
         if "icon" in self._page_attributes:
             size = g15cairo.paint_thumbnail_image(
                 allocated_size, self._page_attributes["icon"], canvas)
             total_taken += size
         if "temp" in self._page_properties:
             if horizontal:
                 self._text.set_attributes(
                     self._page_properties["temp"],
                     font_desc="Sans",
                     font_absolute_size=allocated_size * pango.SCALE / 2)
                 x, y, width, height = self._text.measure()
                 self._text.draw(total_taken,
                                 (allocated_size / 2) - height / 2)
                 total_taken += width + 4
             else:
                 self._text.set_attributes(
                     self._page_properties["temp"],
                     font_desc="Sans",
                     font_absolute_size=allocated_size * pango.SCALE / 4)
                 x, y, width, height = self._text.measure()
                 self._text.draw((allocated_size / 2) - width / 2,
                                 total_taken)
                 total_taken += height + 4
     return total_taken
Example #7
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self._surface != None and self._screen.driver.get_bpp() == 16:
         return g15cairo.paint_thumbnail_image(allocated_size,
                                               self._surface, canvas)
Example #8
0
 def paint_panel(self, canvas, allocated_size, horizontal):
     if self.page != None and self.thumb_image != None and self.status == "Playing":
         size = g15cairo.paint_thumbnail_image(allocated_size,
                                               self.thumb_image, canvas)
         return size
Example #9
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self._icon_surface:
         return g15cairo.paint_thumbnail_image(allocated_size,
                                               self._icon_surface, canvas)
Example #10
0
 def paint_panel(self, canvas, allocated_size, horizontal):
     if self.page != None and self.thumb_image != None and self.status == "Playing":
         size = g15cairo.paint_thumbnail_image(allocated_size, self.thumb_image, canvas)
         return size
Example #11
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self.page is not None:
         if self.thumb_icon is not None:
             size = g15cairo.paint_thumbnail_image(allocated_size,
                                                   self.thumb_icon, canvas)
             return size
Example #12
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self.page != None and self._thumb_icon != None and self.screen.driver.get_bpp() == 16:
         return g15cairo.paint_thumbnail_image(allocated_size, self._thumb_icon, canvas)
Example #13
0
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self._icon_surface:
         return g15cairo.paint_thumbnail_image(allocated_size, self._icon_surface, canvas)
Example #14
0
 def paint_thumbnail(self, canvas, allocated_size, horizontal):
     return g15cairo.paint_thumbnail_image(allocated_size, g15cairo.load_surface_from_file(self.icon), canvas)
Example #15
0
 def _paint_panel(self, canvas, allocated_size, horizontal):
     if self.page != None:
         if self.thumb_icon != None and self.attention:
             size = g15cairo.paint_thumbnail_image(allocated_size, self.thumb_icon, canvas)
             return size
Example #16
0
 def paint_thumbnail(self, canvas, allocated_size, horizontal):
     return g15cairo.paint_thumbnail_image(
         allocated_size, g15cairo.load_surface_from_file(self.icon), canvas)
Example #17
0
 def paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self.page != None and self.thumb_icon != None and self.screen.driver.get_bpp(
     ) == 16:
         return g15cairo.paint_thumbnail_image(allocated_size,
                                               self.thumb_icon, canvas)
Example #18
0
def paint_thumbnail_image(allocated_size, image, canvas):
    return g15cairo.paint_thumbnail_image(allocated_size, image, canvas)