def build_talk (self): stage = self._embed.get_stage() stage.set_color(clutter.Color(0, 0, 0, 255)) stage.show() current_talk = FosdemTalk() collection = current_talk.get_collection() model = current_talk.get_model() bg = gtk.gdk.pixbuf_new_from_file(join(talk.SHARED_DATA_DIR, 'background.jpg')) layout = TalkLayout(collection, bg) layout.connect('slide-next', self.on_slide_next) layout.connect('slide-prev', self.on_slide_prev) layout.connect('key-press-event', self.on_layout_key_press) self._tree_view.set_model(model) stage.add(layout) stage.set_key_focus(layout) layout.set_position(0, 0) layout.show() self._embed.show() self._embed.grab_focus()
def build_window(): stage = clutter.Stage() stage.set_size(800, 600) stage.set_color(clutter.Color(0, 0, 0, 255)) stage.connect('key-press-event', on_key_press) stage.show() collection = SlideCollection() title = TitleSlide(title='Test talk') collection.set_title_slide(title) items = [ \ 'first point', \ 'second point', \ '<b>third point (kinda important)</b>', \ '<i>fourth point (optional)</i>', \ ] slide = BulletSlide(bullets=items, header='test talk') collection.append_slide(slide) items.append('fifth point') slide = BulletSlide(bullets=items, header='test talk') collection.append_slide(slide) items.append('sixth point') slide = BulletSlide(bullets=items, header='test talk') collection.append_slide(slide) script = clutter.Script() slide_script = ''' { "type" : "TextSlide", "id" : "fifth-slide", "title" : "A script-based slide", "text" : "This slide is parsed straight from a ClutterScript" } ''' script.load_from_data(slide_script, -1) slide = script.get_object('fifth-slide') if slide: collection.append_slide(slide) slide_script = ''' { "type" : "TextSlide", "id" : "sixth-slide", "title" : "Another script-based slide", "children" : [ { "id" : "image", "type" : "ClutterTexture", "pixbuf" : "data/background.jpg", "width" : 400, "height" : 300, "x" : 200, "y" : 150, "visible" : true } ] } ''' script.load_from_data(slide_script, -1) slide = script.get_object('sixth-slide') if slide: collection.append_slide(slide) bg = gtk.gdk.pixbuf_new_from_file(join(talk.SHARED_DATA_DIR, 'background.jpg')) layout = TalkLayout(collection, bg) stage.set_key_focus(layout) stage.add(layout) layout.set_position(0, 0) layout.show()