~joshuascotton/entertainer/Bug-305597

« back to all changes in this revision

Viewing changes to entertainerlib/frontend/gui/screens/main_screen.py

  • Committer: Paul Hummer
  • Date: 2008-08-10 22:37:52 UTC
  • mfrom: (263.1.4 screen-clean)
  • Revision ID: paul@ubuntu.com-20080810223752-c6j1ibxw4x9liuvk
Continued refactoring of the configuration code

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
from entertainerlib.frontend.gui.screens.screen import Screen
19
19
from entertainerlib.frontend.gui.transitions.transition import Transition
20
20
 
 
21
from entertainerlib.utils.configuration import Configuration
21
22
from entertainerlib.utils.feed_utils import FeedEntryParser
22
23
from entertainerlib.utils.cd_utils import eject_cd
23
24
 
34
35
    PREVIEW_WIDTH = 830
35
36
    PREVIEW_HEIGHT = 580
36
37
 
37
 
    def __init__(self, ui, frontend):
38
 
        """
39
 
        Initialize home screen
40
 
        @param ui: UserInterface object
41
 
        @param frontend: FrontendClient object
42
 
        """
 
38
    def __init__(self, ui, theme, feed_library):
 
39
        """Create the layout of the screen"""
 
40
 
43
41
        self.group = clutter.Group()
 
42
        self.config = Configuration()
44
43
        Screen.__init__(self, ui.STAGE_WIDTH, ui.STAGE_HEIGHT)
45
44
 
46
45
        self.ui = ui
47
 
        self.frontend = frontend
48
 
        self.theme = frontend.getTheme()
 
46
        self.theme = theme
 
47
        self.feed_library = feed_library
49
48
 
50
49
        self.preview = clutter.Group() # Group that contains preview actors
51
50
        self.preview.set_position(self.ui.x(0.07), self.ui.y(0.1))
121
120
        item5.set_color(self.theme.getColor("menuitem_active"))
122
121
        self.menu.add(item5)
123
122
 
124
 
        if self.frontend.configuration.display_weather_in_frontend():
 
123
        if self.config.display_weather_in_frontend():
125
124
            item6 = clutter.Label()
126
125
            item6.set_font_name(self.theme.getFont() + ' 32px')
127
126
            item6.set_name("weather")
129
128
            item6.set_color(self.theme.getColor("menuitem_active"))
130
129
            self.menu.add(item6)
131
130
 
132
 
        if self.frontend.configuration.display_cd_eject_in_frontend():
 
131
        if self.config.display_cd_eject_in_frontend():
133
132
            item7 = clutter.Label()
134
133
            item7.set_font_name(self.theme.getFont() + ' 32px')
135
134
            item7.set_name("eject_cd")
218
217
    def show_rss_preview(self):
219
218
        """Rss preview"""
220
219
 
221
 
        if self.frontend.get_feed_library().is_empty() is False:
 
220
        if self.feed_library.is_empty() is False:
222
221
            # RSS Icon
223
222
            rss = gtk.gdk.pixbuf_new_from_file(self.theme.getImage("rss_icon"))
224
223
            icon = clutter.Texture()
237
236
            title.show()
238
237
            self.preview.add(title)
239
238
 
240
 
            menu = TextMenu(self.theme,
241
 
                            self.frontend.get_configuration().show_effects())
 
239
            menu = TextMenu(self.theme, self.config.show_effects())
242
240
            menu.set_row_count(1)
243
241
            menu.set_position(57, 100)
244
242
            menu.set_item_size(750, 60)
245
243
 
246
244
            # List of latest entries. pack = (Feed object, Entry object)
247
 
            entries = self.frontend.get_feed_library().get_latest_entries(8)
 
245
            entries = self.feed_library.get_latest_entries(8)
248
246
            for pack in entries:
249
247
                text = pack[0].get_title() + " - " + pack[1].get_title()
250
248
                item = TextMenuItem(750, 60, self.theme,