コード例 #1
0
ファイル: mainwindow.py プロジェクト: feroze/pitivi
    def _projectManagerMissingUriCb(self, instance, formatter, uri, factory):
        dialog = gtk.Dialog(_("Locate missing file..."),
            self,
            gtk.DIALOG_MODAL,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
            gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        dialog.set_icon_name("pitivi")
        dialog.set_border_width(SPACING * 2)
        dialog.get_content_area().set_spacing(SPACING)
        dialog.set_transient_for(self)

        # TODO: display the filesize to help the user identify the file
        if not factory.duration or factory.duration == gst.CLOCK_TIME_NONE:
            # The file is probably an image, not video or audio.
            text = _('The following file has moved: "<b>%s</b>"'
                     '\nPlease specify its new location:'
                     % factory_name(factory))
        else:
            length = beautify_length(factory.duration)
            text = _('The following file has moved: "<b>%s</b>" (duration: %s)'
                     '\nPlease specify its new location:'
                     % (factory_name(factory), length))

        label = gtk.Label()
        label.set_markup(text)
        dialog.get_content_area().pack_start(label, False, False)
        label.show()

        chooser = gtk.FileChooserWidget(action=gtk.FILE_CHOOSER_ACTION_OPEN)
        chooser.set_select_multiple(False)
        pw = PreviewWidget(self.app)
        chooser.set_preview_widget(pw)
        chooser.set_use_preview_label(False)
        chooser.connect('update-preview', pw.add_preview_request)
        chooser.set_current_folder(self.settings.lastProjectFolder)
        dialog.get_content_area().pack_start(chooser, True, True)
        chooser.show()

        # If the window is too big, the window manager will resize it so that
        # it fits on the screen.
        dialog.set_default_size(1024, 1000)
        response = dialog.run()

        if response == gtk.RESPONSE_OK:
            self.log("User chose a new URI for the missing file")
            new = chooser.get_uri()
            if new:
                formatter.addMapping(uri, unquote(new))
                self._missingUriOnLoading = True
        else:
            self.log("User didn't choose a URI for the missing file")
            # FIXME: not calling addMapping doesn't keep the formatter from
            # re-emitting the same signal. How do we get out of this
            # situation?
            pass

        dialog.destroy()
コード例 #2
0
    def _projectManagerMissingUriCb(self, instance, formatter, uri, factory):
        dialog = gtk.Dialog(_("Locate missing file..."),
            self,
            gtk.DIALOG_MODAL,
            buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
            gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        dialog.set_icon_name("pitivi")
        dialog.set_border_width(SPACING * 2)
        dialog.get_content_area().set_spacing(SPACING)
        dialog.set_transient_for(self)

        # TODO: display the filesize to help the user identify the file
        if not factory.duration or factory.duration == gst.CLOCK_TIME_NONE:
            # The file is probably an image, not video or audio.
            text = _('The following file has moved: "<b>%s</b>"'
                     '\nPlease specify its new location:'
                     % factory_name(factory))
        else:
            length = beautify_length(factory.duration)
            text = _('The following file has moved: "<b>%s</b>" (duration: %s)'
                     '\nPlease specify its new location:'
                     % (factory_name(factory), length))

        label = gtk.Label()
        label.set_markup(text)
        dialog.get_content_area().pack_start(label, False, False)
        label.show()

        chooser = gtk.FileChooserWidget(action=gtk.FILE_CHOOSER_ACTION_OPEN)
        chooser.set_select_multiple(False)
        pw = PreviewWidget(self.app)
        chooser.set_preview_widget(pw)
        chooser.set_use_preview_label(False)
        chooser.connect('update-preview', pw.add_preview_request)
        chooser.set_current_folder(self.settings.lastProjectFolder)
        dialog.get_content_area().pack_start(chooser, True, True)
        chooser.show()

        # If the window is too big, the window manager will resize it so that
        # it fits on the screen.
        dialog.set_default_size(1024, 1000)
        response = dialog.run()

        if response == gtk.RESPONSE_OK:
            self.log("User chose a new URI for the missing file")
            new = chooser.get_uri()
            if new:
                formatter.addMapping(uri, unquote(new))
                self._missingUriOnLoading = True
        else:
            self.log("User didn't choose a URI for the missing file")
            # FIXME: not calling addMapping doesn't keep the formatter from
            # re-emitting the same signal. How do we get out of this
            # situation?
            pass

        dialog.destroy()
コード例 #3
0
ファイル: sourcelist.py プロジェクト: kyotobay/pitivi
    def _addFactory(self, factory):
        video = factory.getOutputStreams(VideoStream)
        if video and video[0].thumbnail:
            thumbnail_file = video[0].thumbnail
            try:
                self.debug("attempting to open thumbnail file '%s'",
                        thumbnail_file)
                pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail_file)
            except:
                self.error("Failure to create thumbnail from file '%s'",
                        thumbnail_file)
                thumbnail = self.videofilepixbuf
                thumbnail_large = self.videofilepixbuf
            else:
                desiredheight = int(64 / float(video[0].dar))
                thumbnail = pixbuf.scale_simple(64,
                        desiredheight, gtk.gdk.INTERP_BILINEAR)
                desiredheight = int(96 / float(video[0].dar))
                thumbnail_large = pixbuf.scale_simple(96,
                        desiredheight, gtk.gdk.INTERP_BILINEAR)
        else:
            if video:
                thumbnail = self.videofilepixbuf
                thumbnail_large = self.videofilepixbuf
            else:
                thumbnail = self.audiofilepixbuf
                thumbnail_large = self.audiofilepixbuf

        if not factory.duration or factory.duration == gst.CLOCK_TIME_NONE:
            duration = ''
        else:
            duration = beautify_length(factory.duration)

        short_text = None
        uni = unicode(factory_name(factory), 'utf-8')

        if len(uni) > 34:
            short_uni = uni[0:29]
            short_uni += unicode('...')
            short_text = short_uni.encode('utf-8')
        else:
            short_text = factory_name(factory)

        self.storemodel.append([thumbnail,
            thumbnail_large,
            beautify_factory(factory),
            factory,
            factory.uri,
            duration,
            factory_name(factory),
            short_text])
        self._displayClipView()
コード例 #4
0
ファイル: sourcelist.py プロジェクト: yiqideren/pitivi
    def _addFactory(self, factory):
        video = factory.getOutputStreams(VideoStream)
        if video and video[0].thumbnail:
            thumbnail_file = video[0].thumbnail
            try:
                self.debug("attempting to open thumbnail file '%s'",
                           thumbnail_file)
                pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail_file)
            except:
                self.error("Failure to create thumbnail from file '%s'",
                           thumbnail_file)
                thumbnail = self.videofilepixbuf
                thumbnail_large = self.videofilepixbuf
            else:
                desiredheight = int(64 / float(video[0].dar))
                thumbnail = pixbuf.scale_simple(64, desiredheight,
                                                gtk.gdk.INTERP_BILINEAR)
                desiredheight = int(96 / float(video[0].dar))
                thumbnail_large = pixbuf.scale_simple(96, desiredheight,
                                                      gtk.gdk.INTERP_BILINEAR)
        else:
            if video:
                thumbnail = self.videofilepixbuf
                thumbnail_large = self.videofilepixbuf
            else:
                thumbnail = self.audiofilepixbuf
                thumbnail_large = self.audiofilepixbuf

        if not factory.duration or factory.duration == gst.CLOCK_TIME_NONE:
            duration = ''
        else:
            duration = beautify_length(factory.duration)

        short_text = None
        uni = unicode(factory_name(factory), 'utf-8')

        if len(uni) > 34:
            short_uni = uni[0:29]
            short_uni += unicode('...')
            short_text = short_uni.encode('utf-8')
        else:
            short_text = factory_name(factory)

        self.storemodel.append([
            thumbnail, thumbnail_large,
            beautify_factory(factory), factory, factory.uri, duration,
            factory_name(factory), short_text
        ])
        self._displayClipView()
コード例 #5
0
    def _addFactory(self, factory):
        video = factory.getOutputStreams(VideoStream)
        if video and video[0].thumbnail:
            thumbnail_file = video[0].thumbnail
            try:
                self.debug("attempting to open thumbnail file '%s'",
                           thumbnail_file)
                pixbuf = gtk.gdk.pixbuf_new_from_file(thumbnail_file)
            except:
                self.error("Failure to create thumbnail from file '%s'",
                           thumbnail_file)
                thumbnail = self.videofilepixbuf
            else:
                desiredheight = int(64 / float(video[0].dar))
                thumbnail = pixbuf.scale_simple(64, desiredheight,
                                                gtk.gdk.INTERP_BILINEAR)
        else:
            if video:
                thumbnail = self.videofilepixbuf
            else:
                thumbnail = self.audiofilepixbuf

        if not factory.duration or factory.duration == gst.CLOCK_TIME_NONE:
            duration = ''
        else:
            duration = beautify_length(factory.duration)

        self.storemodel.append([
            thumbnail,
            beautify_factory(factory), factory, factory.uri, duration,
            factory_name(factory)
        ])
        self._displayTreeView()