コード例 #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
コード例 #2
0
ファイル: pommodoro.py プロジェクト: FPar/gnome15
    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
コード例 #3
0
ファイル: weather.py プロジェクト: FPar/gnome15
 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
コード例 #4
0
ファイル: indicator-messages.py プロジェクト: FPar/gnome15
 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
コード例 #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
コード例 #6
0
ファイル: weather.py プロジェクト: AgenttiX/gnome15
 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
コード例 #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)
コード例 #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
コード例 #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)
コード例 #10
0
ファイル: mpris.py プロジェクト: FPar/gnome15
 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
コード例 #11
0
ファイル: lcdbiff.py プロジェクト: AgenttiX/gnome15
 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
コード例 #12
0
ファイル: sysmon.py プロジェクト: FPar/gnome15
 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)
コード例 #13
0
ファイル: tails.py プロジェクト: FPar/gnome15
 def _paint_thumbnail(self, canvas, allocated_size, horizontal):
     if self._icon_surface:
         return g15cairo.paint_thumbnail_image(allocated_size, self._icon_surface, canvas)
コード例 #14
0
ファイル: ppastats.py プロジェクト: FPar/gnome15
 def paint_thumbnail(self, canvas, allocated_size, horizontal):
     return g15cairo.paint_thumbnail_image(allocated_size, g15cairo.load_surface_from_file(self.icon), canvas)
コード例 #15
0
ファイル: lcdbiff.py プロジェクト: tanktarta/gnome15
 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
コード例 #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)
コード例 #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)
コード例 #18
0
def paint_thumbnail_image(allocated_size, image, canvas):
    return g15cairo.paint_thumbnail_image(allocated_size, image, canvas)