~osomon/moovida/upicek_language_option_screen

« back to all changes in this revision

Viewing changes to elisa-plugins/elisa/plugins/poblesec/player_slideshow.py

  • Committer: Philippe Normand
  • Date: 2008-10-13 15:35:14 UTC
  • mfrom: (789.1.6 elisa_opt_rotate)
  • Revision ID: philippe@fluendo.com-20081013153514-8bwwm2imn9xgb02e
Show the rotation ribbon control only when rotation is doable (e.g, for local files referenced in database)

Show diffs side-by-side

added added

removed removed

Lines of Context:
509
509
        ribbon.add_control(PlayPauseControl(self))
510
510
        ribbon.add_control(StopControl(self))
511
511
        ribbon.add_control(ShowNextControl(self))
512
 
        ribbon.add_control(RotationControl(self))
513
512
        # TODO: favorite, fit-screen
514
513
 
 
514
        self._rotation_control = RotationControl(self)
 
515
 
515
516
        self.music_player = None
516
517
 
517
518
        # placeholder for logo, optionally used by plugins
586
587
            orientation = image.ROTATED_0
587
588
        self.player.apply_pixbuf_orientation(uri, st.preview, orientation)
588
589
 
 
590
        # update ribbon
 
591
        self._update_ribbon(item)
 
592
 
589
593
        # update index display
590
594
        progress_bars = self.player_osd.status.status_display_details.progress_bars
591
595
        if not progress_bars.seeking_bar.seek_drag:
593
597
 
594
598
        self._update_logo()
595
599
 
 
600
    def _update_ribbon(self, model=None):
 
601
        ribbon = self.player_osd.control_ribbon
 
602
        store = common.application.store
 
603
 
 
604
        if self.player.playlist:
 
605
            if not model:
 
606
                try:
 
607
                    model = self.player.playlist[self.player.current_index]
 
608
                except IndexError:
 
609
                    # current_index not coherent with playlist length
 
610
                    # (like in Flickr plugin)
 
611
                    model = self.player.playlist[0]
 
612
 
 
613
            if model.can_rotate:
 
614
                if self._rotation_control not in ribbon.controls:
 
615
                    ribbon.add_control(self._rotation_control)
 
616
 
 
617
                # hide the new control if the ribbon is invisible
 
618
                if not ribbon.is_visible:
 
619
                    self._rotation_control.button.square.opacity = 0
 
620
            else:
 
621
                if self._rotation_control in ribbon.controls:
 
622
                    ribbon.remove_control(self._rotation_control)
 
623
 
596
624
    def _update_logo(self):
597
625
        # if there is no photo displayed or if the current photo does not have
598
626
        # a 'logo' attribute display nothing otherwise load the 'logo'
606
634
    def _player_playlist_changed(self, *args):
607
635
        self.player_osd.status.set_seeking_duration(len(self.player.playlist))
608
636
        self._update_logo()
 
637
        self._update_ribbon()
609
638
 
610
639
    def set_frontend(self, frontend):
611
640
        super(SlideshowController, self).set_frontend(frontend)