~ubuntu-branches/ubuntu/trusty/pitivi/trusty

« back to all changes in this revision

Viewing changes to pitivi/ui/viewer.py

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Bacher
  • Date: 2011-07-07 13:43:47 UTC
  • mto: (6.1.9 sid) (1.2.12)
  • mto: This revision was merged to the branch mainline in revision 32.
  • Revision ID: james.westby@ubuntu.com-20110707134347-cari9kxjiakzej9z
Tags: upstream-0.14.1
ImportĀ upstreamĀ versionĀ 0.14.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python
2
1
# PiTiVi , Non-linear video editor
3
2
#
4
3
#       ui/viewer.py
17
16
#
18
17
# You should have received a copy of the GNU Lesser General Public
19
18
# License along with this program; if not, write to the
20
 
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21
 
# Boston, MA 02111-1307, USA.
 
19
# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 
20
# Boston, MA 02110-1301, USA.
22
21
 
23
22
import platform
24
23
import gobject
60
59
    key="y-pos",
61
60
    default=0)
62
61
 
 
62
 
63
63
class ViewerError(Exception):
64
64
    pass
65
65
 
 
66
 
66
67
# TODO : Switch to using Pipeline and Action
67
 
 
68
68
class PitiviViewer(gtk.VBox, Loggable):
69
69
 
70
70
    __gtype_name__ = 'PitiviViewer'
71
71
    __gsignals__ = {
72
 
        "activate-playback-controls" : (gobject.SIGNAL_RUN_LAST,
 
72
        "activate-playback-controls": (gobject.SIGNAL_RUN_LAST,
73
73
            gobject.TYPE_NONE, (gobject.TYPE_BOOLEAN,)),
74
74
    }
75
75
 
215
215
        self.action = action
216
216
        # FIXME: fix this properly?
217
217
        self.internal.action = action
218
 
        dar = float(4/3)
 
218
        dar = float(4 / 3)
219
219
        try:
220
220
            producer = action.producers[0]
221
221
            self.debug("producer:%r", producer)
227
227
                    dar = stream.dar
228
228
                    continue
229
229
        except:
230
 
            dar = float(4/3)
 
230
            dar = float(4 / 3)
231
231
        self.setDisplayAspectRatio(dar)
232
232
        self.showControls()
233
233
 
261
261
    def _createUi(self):
262
262
        """ Creates the Viewer GUI """
263
263
        # drawing area
264
 
        self.aframe = gtk.AspectFrame(xalign=0.5, yalign=0.5, ratio=4.0/3.0,
 
264
        self.aframe = gtk.AspectFrame(xalign=0.5, yalign=0.5, ratio=4.0 / 3.0,
265
265
                                      obey_child=False)
266
266
        self.pack_start(self.aframe, expand=True)
267
267
        self.internal = ViewerWidget(self.action)
344
344
            width, height = bbox.size_request()
345
345
            width += 110
346
346
            height = int(width / self.aframe.props.ratio)
347
 
            self.aframe.set_size_request(width , height)
 
347
            self.aframe.set_size_request(width, height)
348
348
        self.show_all()
349
349
        self.buttons = boxalign
350
350
 
461
461
            self.posadjust.set_value(float(value))
462
462
        return False
463
463
 
464
 
 
465
464
    ## active Timeline calllbacks
466
 
 
467
465
    def _durationChangedCb(self, unused_pipeline, duration):
468
466
        self.debug("duration : %s", gst.TIME_ARGS(duration))
469
467
        position = self.posadjust.get_value()
621
619
    def __init__(self, action=None):
622
620
        gtk.DrawingArea.__init__(self)
623
621
        Loggable.__init__(self)
624
 
        self.action = action # FIXME : Check if it's a view action
 
622
        self.action = action  # FIXME : Check if it's a view action
625
623
        self.unset_flags(gtk.SENSITIVE)
626
624
        for state in range(gtk.STATE_INSENSITIVE + 1):
627
625
            self.modify_bg(state, self.style.black)
631
629
        if platform.system() == 'Windows':
632
630
            self.window_xid = self.window.handle
633
631
        else:
634
 
            self.window_xid  = self.window.xid
 
632
            self.window_xid = self.window.xid
 
633
 
635
634
 
636
635
class PlayPauseButton(gtk.Button, Loggable):
637
636
    """ Double state gtk.Button which displays play/pause """
638
637
 
639
638
    __gsignals__ = {
640
 
        "play" : ( gobject.SIGNAL_RUN_LAST,
 
639
        "play": (gobject.SIGNAL_RUN_LAST,
641
640
                   gobject.TYPE_NONE,
642
 
                   (gobject.TYPE_BOOLEAN, ))
 
641
                   (gobject.TYPE_BOOLEAN,))
643
642
        }
644
643
 
645
644
    def __init__(self):