~mvo/software-center/tos-dialog

« back to all changes in this revision

Viewing changes to softwarecenter/ui/gtk3/widgets/sections.py

  • Committer: Michael Vogt
  • Date: 2012-03-09 07:55:12 UTC
  • mfrom: (2837.1.1 pep8-test)
  • Revision ID: michael.vogt@ubuntu.com-20120309075512-6eodgfmrq79lj564
  lp:~elachuni/software-center/pep8-test-part3,
  lp:~elachuni/software-center/pep8-test-part4:

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#from gi.repository import Gtk
2
2
 
3
 
import cairo, os
 
3
import cairo
 
4
import os
4
5
 
5
6
from softwarecenter.enums import ViewPages
6
7
from softwarecenter.paths import datadir
7
8
from mkit import floats_from_string
8
9
 
 
10
 
9
11
class SectionPainter(object):
10
 
    
11
 
    # specify background overlay image and color mappings for available and installed view ids
12
 
    BACKGROUND_IMAGES = {ViewPages.AVAILABLE : cairo.ImageSurface.create_from_png(
13
 
                                                 os.path.join(datadir, 'images/clouds.png')),
14
 
                         ViewPages.INSTALLED : cairo.ImageSurface.create_from_png(
15
 
                                                 os.path.join(datadir, 'images/arrows.png')),
 
12
 
 
13
    # specify background overlay image and color mappings for available and
 
14
    # installed view ids
 
15
    BACKGROUND_IMAGES = {
 
16
        ViewPages.AVAILABLE: cairo.ImageSurface.create_from_png(
 
17
            os.path.join(datadir, 'images/clouds.png')),
 
18
        ViewPages.INSTALLED: cairo.ImageSurface.create_from_png(
 
19
            os.path.join(datadir, 'images/arrows.png')),
16
20
                        }
17
 
    BACKGROUND_COLORS = {ViewPages.AVAILABLE : floats_from_string('#0769BC'),
18
 
                         ViewPages.INSTALLED : floats_from_string('#aea79f'),
 
21
    BACKGROUND_COLORS = {ViewPages.AVAILABLE: floats_from_string('#0769BC'),
 
22
                         ViewPages.INSTALLED: floats_from_string('#aea79f'),
19
23
                        }
20
24
 
21
25
    def __init__(self):
22
26
        self._view_id = None
23
 
        return
24
 
        
 
27
 
25
28
    def set_view_id(self, id):
26
29
        self._view_id = id
27
 
        return
28
30
 
29
31
    def draw(self, widget, cr):
30
32
        # sky
43
45
        #    cr.set_source_surface(s, a.x, 0)
44
46
 
45
47
        #cr.paint()
46
 
        return
 
48
        pass
47
49
 
48
50
    def get_background_color(self):
49
51
        return self.BACKGROUND_COLORS[self._view_id]