示例#1
0
文件: timeline.py 项目: cmutti/pitivi
 def __init__(self, log):
     self.log = log
     self.clip_property_trackers = {}
     self.control_source_keyframe_trackers = {}
     self.children_props_tracker = TrackElementChildPropertyTracker(log)
     self._pipeline = None
     Loggable.__init__(self)
示例#2
0
    def __init__(self, instance, uimap):
        Loggable.__init__(self)
        Signallable.__init__(self)
        self.app = instance
        self.bt = {}
        self.settings = {}
        self.source = None
        self.created = False
        self.seeker = Seeker()

        #Drag attributes
        self._drag_events = []
        self._signals_connected = False

        self._createUI()
        self.textbuffer = Gtk.TextBuffer()
        self.pangobuffer = InteractivePangoBuffer()
        self.textarea.set_buffer(self.pangobuffer)

        self.textbuffer.connect("changed", self._updateSourceText)
        self.pangobuffer.connect("changed", self._updateSourceText)

        #Connect buttons
        self.pangobuffer.setup_widget_from_pango(self.bt["bold"], "<b>bold</b>")
        self.pangobuffer.setup_widget_from_pango(self.bt["italic"], "<i>italic</i>")
示例#3
0
文件: ruler.py 项目: GNOME/pitivi
    def __init__(self, timeline):
        Gtk.DrawingArea.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRuler")

        self.timeline = timeline
        self._pipeline = None
        hadj = timeline.timeline.hadj
        hadj.connect("value-changed", self._hadj_value_changed_cb)
        self.add_events(Gdk.EventMask.POINTER_MOTION_MASK |
                        Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK |
                        Gdk.EventMask.SCROLL_MASK)

        self.pixbuf = None

        # all values are in pixels
        self.pixbuf_offset = 0
        self.pixbuf_offset_painted = 0

        self.position = 0  # In nanoseconds
        self.frame_rate = Gst.Fraction(1 / 1)
        self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND

        self.scales = SCALES
示例#4
0
文件: widgets.py 项目: cymacs/pitivi
 def __init__(self):
     gtk.VBox.__init__(self)
     Loggable.__init__(self)
     self.element = None
     self.ignore = None
     self.properties = None
     self.buttons = {}
示例#5
0
    def __init__(self, app, undock_action=None):
        Gtk.VBox.__init__(self)
        self.set_border_width(SPACING)
        self.app = app
        self.settings = app.settings
        self.system = app.system

        Loggable.__init__(self)
        self.log("New ViewerContainer")

        self.pipeline = None
        self.docked = True
        self.seeker = Seeker()

        # Only used for restoring the pipeline position after a live clip trim preview:
        self._oldTimelinePos = None

        self._haveUI = False

        self._createUi()
        self.undock_action = undock_action
        if undock_action:
            self.undock_action.connect("activate", self._toggleDocked)

            if not self.settings.viewerDocked:
                self.undock()
示例#6
0
文件: ruler.py 项目: cymacs/pitivi
    def __init__(self, instance, hadj):
        gtk.DrawingArea.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRuler")
        self.app = instance
        self._seeker = Seeker()
        self.hadj = hadj
        hadj.connect("value-changed", self._hadjValueChangedCb)
        self.add_events(gtk.gdk.POINTER_MOTION_MASK |
            gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK)

        self.pixbuf = None
        # all values are in pixels
        self.pixbuf_offset = 0
        self.pixbuf_offset_painted = 0
        # This is the number of width we allocate for the pixbuf
        self.pixbuf_multiples = 4

        self.position = 0  # In nanoseconds
        self.pressed = False
        self.need_update = True
        self.min_frame_spacing = 5.0
        self.frame_height = 5.0
        self.frame_rate = gst.Fraction(1 / 1)
示例#7
0
    def __init__(self, settings=None, realizedCb=None):
        # Prevent black frames and flickering while resizing or changing focus:
        # The aspect ratio gets overridden by setDisplayAspectRatio.
        Gtk.AspectFrame.__init__(self, xalign=0.5, yalign=1.0,
                                 ratio=4.0 / 3.0, obey_child=False)
        Loggable.__init__(self)

        self.drawing_area = GtkClutter.Embed()
        self.drawing_area.set_double_buffered(False)
        # We keep the ViewerWidget hidden initially, or the desktop wallpaper
        # would show through the non-double-buffered widget!
        if realizedCb:
            self.drawing_area.connect("realize", realizedCb, self)
        self.add(self.drawing_area)

        layout_manager = Clutter.BinLayout(x_align=Clutter.BinAlignment.FILL, y_align=Clutter.BinAlignment.FILL)
        self.drawing_area.get_stage().set_layout_manager(layout_manager)
        self.texture = Clutter.Texture()
        # This is a trick to make the viewer appear darker at the start.
        self.texture.set_from_rgb_data(data=[0] * 3, has_alpha=False,
                width=1, height=1, rowstride=3, bpp=3,
                flags=Clutter.TextureFlags.NONE)
        self.drawing_area.get_stage().add_child(self.texture)
        self.drawing_area.show()

        self.seeker = Seeker()
        self.settings = settings
        self.box = None
        self.stored = False
        self.area = None
        self.zoom = 1.0
        self.sink = None
        self.pixbuf = None
        self.pipeline = None
        self.transformation_properties = None
示例#8
0
    def __init__(self, app):
        Gtk.Box.__init__(self)
        Loggable.__init__(self)
        self.app = app
        self.settings = app.settings
        self._project = None

        self.set_orientation(Gtk.Orientation.VERTICAL)

        self.infobar_box = Gtk.Box()
        self.infobar_box.set_orientation(Gtk.Orientation.VERTICAL)
        self.infobar_box.show()
        self.pack_start(self.infobar_box, False, False, 0)

        # Transformation boxed DISABLED
        # self.transformation_expander = TransformationProperties(instance, instance.action_log)
        # self.transformation_expander.set_vexpand(False)
        # vbox.pack_start(self.transformation_expander, False, False, 0)

        effects_properties_manager = EffectsPropertiesManager(app)
        self.effect_expander = EffectProperties(
            app, effects_properties_manager, self)
        self.effect_expander.set_vexpand(False)
        viewport = Gtk.ScrolledWindow()
        viewport.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        viewport.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        viewport.set_visible(True)
        viewport.add(self.effect_expander)
        self.pack_start(viewport, True, True, 0)
示例#9
0
    def __init__(self, app):
        Gtk.Expander.__init__(self)
        Loggable.__init__(self)
        self.app = app
        self._project = None
        self._selection = None
        self.source = None
        self._selected_clip = None
        self.spin_buttons = {}
        self.spin_buttons_handler_ids = {}
        self.set_label(_("Transformation"))

        self.builder = Gtk.Builder()
        self.builder.add_from_file(os.path.join(get_ui_dir(),
                                                "cliptransformation.ui"))
        self.__control_bindings = {}
        # Used to make sure self.__control_bindings_changed doesn't get called
        # when bindings are changed from this class
        self.__own_bindings_change = False
        self.add(self.builder.get_object("transform_box"))
        self._initButtons()
        self.show_all()
        self.hide()

        self.app.project_manager.connect_after(
            "new-project-loaded", self._newProjectLoadedCb)
        self.app.project_manager.connect_after(
            "project-closed", self.__project_closed_cb)
示例#10
0
    def __init__(self, bElement, timeline):
        Clutter.Actor.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        PreviewGenerator.__init__(self, GES.TrackType.AUDIO)
        self.pipeline = None
        self.discovered = False
        self.bElement = bElement
        self._uri = quote_uri(bElement.props.uri)  # Guard against malformed URIs
        self.timeline = timeline
        self.actors = []

        self.set_content_scaling_filters(Clutter.ScalingFilter.NEAREST, Clutter.ScalingFilter.NEAREST)
        self.canvas = Clutter.Canvas()
        self.set_content(self.canvas)
        self.width = 0
        self._num_failures = 0
        self.lastUpdate = datetime.now()

        self.interval = timedelta(microseconds=INTERVAL)

        self.current_geometry = (-1, -1)

        self.adapter = None
        self.surface = None
        self.timeline.connect("scrolled", self._scrolledCb)
        self.canvas.connect("draw", self._drawContentCb)
        self.canvas.invalidate()

        self._callback_id = 0
示例#11
0
文件: layer.py 项目: dz0ny/pitivi
    def __init__(self, ges_layer, timeline):
        Gtk.EventBox.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)

        self.ges_layer = ges_layer
        self.ges_layer.ui = self
        self.timeline = timeline
        self.app = timeline.app

        self.ges_layer.connect("clip-added", self._clipAddedCb)
        self.ges_layer.connect("clip-removed", self._clipRemovedCb)

        # FIXME Make the layer height user setable with 'Paned'
        self.props.height_request = ui.LAYER_HEIGHT / 2
        self.props.valign = Gtk.Align.START

        self._layout = LayerLayout(self.timeline)
        self._layout.connect("remove", self.__childWidgetRemovedCb)
        self.add(self._layout)

        self.media_types = GES.TrackType(0)
        for clip in ges_layer.get_clips():
            self._addClip(clip)

        self.before_sep = SpacedSeparator(Gtk.PositionType.TOP)
        self.after_sep = SpacedSeparator(Gtk.PositionType.BOTTOM)
示例#12
0
    def __init__(self, ges_elem, max_cpu_usage):
        Previewer.__init__(self, GES.TrackType.AUDIO, max_cpu_usage)
        Zoomable.__init__(self)
        Loggable.__init__(self)

        self.pipeline = None
        self._wavebin = None

        self.discovered = False
        self.ges_elem = ges_elem
        self.timeline = ges_elem.get_parent().get_timeline().ui

        asset = self.ges_elem.get_parent().get_asset()
        self.n_samples = asset.get_duration() / SAMPLE_DURATION
        self.samples = None
        self.peaks = None
        self._start = 0
        self._end = 0
        self._surface_x = 0

        # Guard against malformed URIs
        self.wavefile = None
        self._uri = quote_uri(get_proxy_target(ges_elem).props.id)

        self._num_failures = 0
        self.adapter = None
        self.surface = None

        self._force_redraw = True

        self.ges_elem.connect("notify::in-point", self._inpoint_changed_cb)
        self.connect("notify::height-request", self._height_changed_cb)
        self.becomeControlled()
示例#13
0
    def __init__(self, app):
        Gtk.ScrolledWindow.__init__(self)
        Loggable.__init__(self)
        self.app = app

        self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        viewport = Gtk.Viewport()
        viewport.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        viewport.show()
        self.add(viewport)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.show()
        viewport.add(vbox)

        self.infobar_box = Gtk.Box()
        self.infobar_box.set_orientation(Gtk.Orientation.VERTICAL)
        self.infobar_box.show()
        vbox.pack_start(self.infobar_box, False, False, 0)

        transformation_expander = TransformationProperties(app)
        transformation_expander.set_vexpand(False)
        vbox.pack_start(transformation_expander, False, False, 0)

        self.effect_expander = EffectProperties(app, self)
        self.effect_expander.set_vexpand(False)
        vbox.pack_start(self.effect_expander, False, False, 0)
示例#14
0
    def __init__(self):
        Loggable.__init__(self)

        # Init logging as early as possible so we can log startup code
        enable_color = not os.environ.get('PITIVI_DEBUG_NO_COLOR', '0') in ('', '1')
        # Let's show a human-readable pitivi debug output by default, and only
        # show a crazy unreadable mess when surrounded by gst debug statements.
        enable_crack_output = "GST_DEBUG" in os.environ
        log.init('PITIVI_DEBUG', enable_color, enable_crack_output)

        self.info('starting up')

        self.settings = GlobalSettings()
        self.threads = ThreadMaster()
        self.effects = EffectsHandler()
        self.system = getSystem()

        self.current_project = None
        self.projectManager = ProjectManager(self)
        self._connectToProjectManager(self.projectManager)

        self.action_log = UndoableActionLog()
        self.debug_action_log_observer = DebugActionLogObserver()
        self.debug_action_log_observer.startObserving(self.action_log)
        # TODO reimplement the observing after GES port
        #self.timelineLogObserver = TimelineLogObserver(self.action_log)
        self.projectLogObserver = ProjectLogObserver(self.action_log)

        self._version_information = {}
        self._checkVersion()
示例#15
0
文件: ruler.py 项目: dimart/pitivi
    def __init__(self, timeline, hadj):
        Gtk.DrawingArea.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRuler")

        self.timeline = timeline
        self._pipeline = None
        self.hadj = hadj
        hadj.connect("value-changed", self._hadjValueChangedCb)
        self.add_events(Gdk.EventMask.POINTER_MOTION_MASK |
                        Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK |
                        Gdk.EventMask.SCROLL_MASK)

        self.pixbuf = None

        # all values are in pixels
        self.pixbuf_offset = 0
        self.pixbuf_offset_painted = 0

        self.position = 0  # In nanoseconds
        self.frame_rate = Gst.Fraction(1 / 1)
        self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND

        self.playhead_pixbuf = GdkPixbuf.Pixbuf.new_from_file(
            os.path.join(configure.get_pixmap_dir(), "pitivi-playhead.svg"))

        self.scales = SCALES
示例#16
0
文件: prefs.py 项目: jubayed/pitivi
    def __init__(self, app):
        Loggable.__init__(self)

        self.app = app

        self.app.shortcuts.connect("accel-changed", self.__accel_changed_cb)

        self.settings = app.settings
        self.widgets = {}
        self.resets = {}
        self.original_values = {}
        self.action_ids = {}

        # Identify the widgets we'll need
        builder = Gtk.Builder()
        builder.add_from_file(os.path.join(get_ui_dir(), "preferences.ui"))
        builder.connect_signals(self)
        self.dialog = builder.get_object("dialog1")
        self.sidebar = builder.get_object("sidebar")
        self.stack = builder.get_object("stack")
        self.revert_button = builder.get_object("revertButton")
        self.factory_settings = builder.get_object("resetButton")
        self.restart_warning = builder.get_object("restartWarning")

        for section_id in self.settings_sections:
            self.add_settings_page(section_id)
        self.factory_settings.set_sensitive(self._canReset())

        self.__add_shortcuts_section()
        self.__add_plugin_manager_section()
        self.dialog.set_transient_for(app.gui)
示例#17
0
    def __init__(self, app):
        GObject.Object.__init__(self)
        Loggable.__init__(self)

        self.app = app
        self._total_time_to_transcode = 0
        self._total_transcoded_time = 0
        self._start_proxying_time = 0
        self._estimated_time = 0
        self.__running_transcoders = []
        self.__pending_transcoders = []

        self.__encoding_target_file = None
        self.proxyingUnsupported = False
        for encoding_format in [ENCODING_FORMAT_JPEG, ENCODING_FORMAT_PRORES]:
            self.__encoding_profile = self.__getEncodingProfile(encoding_format)
            if self.__encoding_profile:
                self.__encoding_target_file = encoding_format
                self.info("Using %s as proxying format", encoding_format)
                break

        if not self.__encoding_profile:
            self.proxyingUnsupported = True

            self.error("Not supporting any proxy formats!")
            return
示例#18
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.pitivi",
                                 flags=Gio.ApplicationFlags.HANDLES_OPEN)
        Loggable.__init__(self)

        self.settings = None
        self.threads = None
        self.effects = None
        self.system = None
        self.project_manager = ProjectManager(self)

        self.action_log = UndoableActionLog(self)
        self.timeline_log_observer = None
        self.project_log_observer = None
        self._last_action_time = Gst.util_get_timestamp()

        self.gui = None
        self.welcome_wizard = None

        self._version_information = {}

        self._scenario_file = None
        self._first_action = True

        Zoomable.app = self
        self.connect("startup", self._startupCb)
        self.connect("activate", self._activateCb)
        self.connect("open", self.openCb)
示例#19
0
    def __init__(self, pipeline):
        Loggable.__init__(self)
        Signallable.__init__(self)

        self._pipeline = pipeline
        self._bus = self._pipeline.get_bus()
        self._bus.add_signal_watch()
        self._bus.connect("message", self._busMessageCb)
        self._listening = False  # for the position handler
        self._listeningInterval = 300  # default 300ms
        self._listeningSigId = 0
        self._duration = Gst.CLOCK_TIME_NONE
        self.lastPosition = int(0 * Gst.SECOND)
        self.pendingRecovery = False
        self._attempted_recoveries = 0
        self._waiting_for_async_done = True
        self._next_seek = None
        self._timeout_async_id = 0

        # Create a cluttersink element used for display. Subclasses must connect
        # it to self._pipeline themselves
        self._clutter_sink = Gst.ElementFactory.make("cluttersink", None)
        if isinstance(pipeline, GES.Pipeline):
            self._pipeline.preview_set_video_sink(self._clutter_sink)
        else:
            self._pipeline.set_property("video_sink", self._clutter_sink)
示例#20
0
文件: viewer.py 项目: luisbg/PiTiVi
    def __init__(self, app, undock_action=None):
        Gtk.VBox.__init__(self)
        self.set_border_width(SPACING)
        self.app = app
        self.settings = app.settings
        self.system = app.system

        Loggable.__init__(self)
        self.log("New PitiviViewer")

        self.pipeline = None
        self._tmp_pipeline = None  # Used for displaying a preview when trimming

        self.sink = None
        self.docked = True

        # Only used for restoring the pipeline position after a live clip trim preview:
        self._oldTimelinePos = None

        self._haveUI = False

        self._createUi()
        self.target = self.internal
        self.undock_action = undock_action
        if undock_action:
            self.undock_action.connect("activate", self._toggleDocked)

            if not self.settings.viewerDocked:
                self.undock()
示例#21
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.pitivi",
                                 flags=Gio.ApplicationFlags.HANDLES_OPEN)
        Loggable.__init__(self)

        self.settings = None
        self.threads = None
        self.effects = None
        self.system = None
        self.project_manager = ProjectManager(self)

        self.action_log = None
        self.project_observer = None
        self._last_action_time = Gst.util_get_timestamp()

        self.gui = None
        self.__welcome_wizard = None

        self._version_information = {}

        self._scenario_file = None
        self._first_action = True

        Zoomable.app = self
        self.shortcuts = ShortcutsManager(self)
示例#22
0
文件: viewer.py 项目: cfoch/pitivi
 def __init__(self):
     Gtk.Button.__init__(self)
     Loggable.__init__(self)
     self.image = Gtk.Image()
     self.add(self.image)
     self.playing = False
     self.setPlay()
示例#23
0
文件: viewer.py 项目: cfoch/pitivi
    def __init__(self, app):
        Gtk.Box.__init__(self)
        self.set_border_width(SPACING)
        self.app = app
        self.settings = app.settings

        Loggable.__init__(self)
        self.log("New ViewerContainer")

        self.pipeline = None
        self.docked = True
        self.target = None
        self._compactMode = False

        # Only used for restoring the pipeline position after a live clip trim
        # preview:
        self._oldTimelinePos = None

        self._haveUI = False

        self._createUi()

        self.__owning_pipeline = False
        if not self.settings.viewerDocked:
            self.undock()
示例#24
0
    def __init__(self, app):
        gtksettings = Gtk.Settings.get_default()
        gtksettings.set_property("gtk-application-prefer-dark-theme", True)
        theme = gtksettings.get_property("gtk-theme-name")
        os.environ["GTK_THEME"] = theme + ":dark"

        # Pulseaudio "role"
        # (http://0pointer.de/blog/projects/tagging-audio.htm)
        os.environ["PULSE_PROP_media.role"] = "production"
        os.environ["PULSE_PROP_application.icon_name"] = "pitivi"

        Gtk.IconTheme.get_default().append_search_path(get_pixmap_dir())

        Gtk.ApplicationWindow.__init__(self)
        Loggable.__init__(self)

        self.log("Creating main window")

        self.app = app
        self.greeter = GreeterPerspective(app)
        self.editor = EditorPerspective(app)
        self.__perspective = None
        self.help_action = None
        self.about_action = None
        self.main_menu_action = None

        app.project_manager.connect("new-project-loading",
                                    self.__new_project_loading_cb)
        app.project_manager.connect("new-project-failed",
                                    self.__new_project_failed_cb)
        app.project_manager.connect("project-closed", self.__project_closed_cb)
示例#25
0
文件: viewer.py 项目: pitivi/pitivi
    def __init__(self, widget):
        # Prevent black frames and flickering while resizing or changing focus:
        # The aspect ratio gets overridden by setDisplayAspectRatio.
        Gtk.AspectFrame.__init__(self, xalign=0.5, yalign=0.5, ratio=4.0 / 3.0, obey_child=False)
        Loggable.__init__(self)

        self.add(widget)
示例#26
0
文件: preset.py 项目: GNOME/pitivi
    def __init__(self, default_path=None, user_path=None, system=None):
        GObject.Object.__init__(self)
        Loggable.__init__(self)

        self.default_path = default_path
        self.user_path = user_path

        self.presets = {}
        self.widget_map = {}
        self.ordered = Gtk.ListStore(str, object)

        def sortme(store, i1, i2, unused_udata):
            name1 = store[i1][0]
            name2 = store[i2][0]
            if name1 > name2:
                return 1

            return -1

        self.ordered.set_sort_func(0, sortme)
        self.ordered.set_sort_column_id(0, Gtk.SortType.ASCENDING)
        self.cur_preset = None
        # Whether to ignore the updateValue calls.
        self.ignore_update_requests = False
        self.system = system
示例#27
0
文件: ruler.py 项目: jojva/pitivi
    def __init__(self, instance, hadj):
        Gtk.DrawingArea.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRuler")
        self.app = instance
        self._seeker = Seeker()
        self.hadj = hadj
        hadj.connect("value-changed", self._hadjValueChangedCb)
        self.add_events(Gdk.EventMask.POINTER_MOTION_MASK |
            Gdk.EventMask.BUTTON_PRESS_MASK | Gdk.EventMask.BUTTON_RELEASE_MASK |
            Gdk.EventMask.SCROLL_MASK)

        self.pixbuf = None

        # all values are in pixels
        self.pixbuf_offset = 0
        self.pixbuf_offset_painted = 0
        # This is the number of width we allocate for the pixbuf
        self.pixbuf_multiples = 4

        self.position = 0  # In nanoseconds
        self.pressed = False
        self.min_frame_spacing = 5.0
        self.frame_height = 5.0
        self.frame_rate = Gst.Fraction(1 / 1)
        self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND
        self.connect('draw', self.drawCb)
        self.connect('configure-event', self.configureEventCb)
        self.callback_id = None
        self.callback_id_scroll = None
示例#28
0
文件: project.py 项目: cymacs/pitivi
    def __init__(self, name="", uri=None, **kwargs):
        """
        @param name: the name of the project
        @param uri: the uri of the project
        """
        Loggable.__init__(self)
        self.log("name:%s, uri:%s", name, uri)
        self.name = name
        self.author = ""
        self.year = ""
        self.settings = None
        self.description = ""
        self.uri = uri
        self.urichanged = False
        self.format = None
        self.medialibrary = MediaLibrary()

        self._dirty = False

        self.timeline = ges.timeline_new_audio_video()

        # We add a Selection to the timeline as there is currently
        # no such feature in GES
        self.timeline.selection = Selection()

        self.pipeline = Pipeline()
        self.pipeline.add_timeline(self.timeline)
        self.seeker = Seeker()

        self.settings = MultimediaSettings()
示例#29
0
文件: prefs.py 项目: dimart/pitivi
    def __init__(self, app):
        Loggable.__init__(self)

        self.settings = app.settings
        self.widgets = {}
        self.resets = {}
        self._current = None

        # Identify the widgets we'll need
        builder = Gtk.Builder()
        builder.add_from_file(os.path.join(get_ui_dir(), "preferences.ui"))
        builder.connect_signals(self)
        self.dialog = builder.get_object("dialog1")
        self.model = builder.get_object("liststore1")
        self.treeview = builder.get_object("treeview1")
        self.contents = builder.get_object("box1")
        self.revert_button = builder.get_object("revertButton")
        self.factory_settings = builder.get_object("resetButton")
        self.restart_warning = builder.get_object("restartWarning")

        self.sections = {}
        self.__fillContents()
        req = self.contents.get_preferred_size()[0]
        min_width = req.width
        min_height = req.height
        width = max(min_width, self.settings.prefsDialogWidth)
        height = max(min_height, self.settings.prefsDialogHeight)
        self.dialog.set_transient_for(app.gui)
        self.dialog.set_default_size(width, height)
示例#30
0
    def __init__(self, instance, uiman):
        Gtk.ScrolledWindow.__init__(self)
        Loggable.__init__(self)
        self.app = instance
        self.settings = instance.settings
        self._project = None

        self.infobar_box = Gtk.VBox()
        effect_properties_handling = EffectsPropertiesManager(instance)
        self.effect_expander = EffectProperties(instance, effect_properties_handling, self)
        self.effect_expander.set_vexpand(False)
        # Transformation boxed DISABLED
        #self.transformation_expander = TransformationProperties(instance, instance.action_log)
        #self.transformation_expander.set_vexpand(False)

        vbox = Gtk.VBox()
        vbox.set_spacing(SPACING)
        vbox.pack_start(self.infobar_box, False, True, 0)
        # Transformation boxed DISABLED
        #vbox.pack_start(self.transformation_expander, False, True, 0)
        vbox.pack_start(self.effect_expander, True, True, 0)

        viewport = Gtk.Viewport()
        viewport.add(vbox)
        self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)
        self.add(viewport)
        viewport.show()
        vbox.show()
        self.infobar_box.show()
示例#31
0
    def __init__(self, bin_desc):
        Gst.Bin.__init__(self)
        Loggable.__init__(self)

        self.internal_bin = Gst.parse_bin_from_description(bin_desc, True)
        self.add(self.internal_bin)
        sinkpad, = [pad for pad in self.internal_bin.iterate_sink_pads()]
        self.add_pad(Gst.GhostPad.new(None, sinkpad))
        srcpad, = [pad for pad in self.internal_bin.iterate_src_pads()]
        self.add_pad(Gst.GhostPad.new(None, srcpad))
示例#32
0
文件: render.py 项目: shakaran/pitivi
 def __new__(cls, *args, **kwargs):
     """Returns the singleton instance."""
     if not cls._instance:
         cls._instance = super(Encoders, cls).__new__(cls)
         # We have to initialize the instance here, otherwise
         # __init__ is called every time we use Encoders().
         Loggable.__init__(cls._instance)
         cls._instance._load_encoders()
         cls._instance._load_combinations()
     return cls._instance
示例#33
0
文件: layer.py 项目: shakaran/pitivi
    def __init__(self, timeline):
        Gtk.Layout.__init__(self)
        Loggable.__init__(self)

        self._children = []
        self._changed = False
        self.timeline = timeline

        self.props.hexpand = True
        self.get_style_context().add_class("LayerLayout")
示例#34
0
 def __init__(self, uri):
     Loggable.__init__(self)
     self._filehash = hash_file(Gst.uri_get_location(uri))
     thumbs_cache_dir = get_dir(os.path.join(xdg_cache_home(), "thumbs"))
     self._dbfile = os.path.join(thumbs_cache_dir, self._filehash)
     self._db = sqlite3.connect(self._dbfile)
     self._cur = self._db.cursor()  # Use this for normal db operations
     self._cur.execute("CREATE TABLE IF NOT EXISTS Thumbs\
                       (Time INTEGER NOT NULL PRIMARY KEY,\
                       Jpeg BLOB NOT NULL)")
示例#35
0
    def __init__(self, ges_layer, app):
        Gtk.EventBox.__init__(self)
        Loggable.__init__(self)

        self.ges_layer = ges_layer
        self.ges_timeline = self.ges_layer.get_timeline()
        self.app = app
        self.__icon = None

        hbox = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
        self.add(hbox)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        hbox.pack_start(vbox, True, True, 0)

        rightside_separator = Gtk.Separator.new(Gtk.Orientation.VERTICAL)
        hbox.pack_start(rightside_separator, False, False, 0)

        name_row = Gtk.Box()
        name_row.set_orientation(Gtk.Orientation.HORIZONTAL)
        name_row.props.spacing = PADDING
        name_row.props.margin_top = PADDING
        name_row.props.margin_left = PADDING
        name_row.props.margin_right = PADDING
        vbox.pack_start(name_row, False, False, 0)

        self.name_entry = Gtk.Entry()
        self.name_entry.get_style_context().add_class("LayerControlEntry")
        self.name_entry.props.valign = Gtk.Align.CENTER
        self.name_entry.connect("focus-out-event", self.__name_focus_out_cb)
        self.ges_layer.connect("notify-meta", self.__layer_rename_cb)
        self.__updateName()
        name_row.pack_start(self.name_entry, True, True, 0)

        self.menubutton = Gtk.MenuButton.new()
        self.menubutton.props.valign = Gtk.Align.CENTER
        self.menubutton.props.relief = Gtk.ReliefStyle.NONE
        model, action_group = self.__createMenuModel()
        popover = Gtk.Popover.new_from_model(self.menubutton, model)
        popover.insert_action_group("layer", action_group)
        popover.props.position = Gtk.PositionType.LEFT
        self.menubutton.set_popover(popover)
        name_row.pack_start(self.menubutton, False, False, 0)

        space = Gtk.Label()
        space.props.vexpand = True
        vbox.pack_start(space, False, False, 0)

        self.ges_layer.connect("notify::priority", self.__layerPriorityChangedCb)
        self.ges_timeline.connect("layer-added", self.__timelineLayerAddedCb)
        self.ges_timeline.connect("layer-removed", self.__timelineLayerRemovedCb)
        self.__updateActions()

        # When the window property is set, specify the mouse cursor.
        self.connect("notify::window", self.__windowSetCb)
示例#36
0
    def __init__(self, pipeline):
        Loggable.__init__(self)
        self.pipeline = pipeline
        self.bus = self.pipeline.get_bus()

        self.cpu_usage_tracker = CPUUsageTracker()
        self.rate = 1.0
        self.done = False
        self.ready = False
        self.lastPos = 0
        self._bus_cb_id = None
示例#37
0
    def __init__(self, app):
        Gtk.ScrolledWindow.__init__(self)
        Loggable.__init__(self)
        self.app = app

        self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.AUTOMATIC)

        viewport = Gtk.Viewport()
        viewport.set_shadow_type(Gtk.ShadowType.ETCHED_IN)
        viewport.show()
        self.add(viewport)

        vbox = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        vbox.show()
        viewport.add(vbox)

        self.clips_box = Gtk.Box()
        self.clips_box.set_orientation(Gtk.Orientation.VERTICAL)
        self.clips_box.show()
        vbox.pack_start(self.clips_box, False, False, 0)

        self.transformation_expander = TransformationProperties(app)
        self.transformation_expander.set_vexpand(False)
        vbox.pack_start(self.transformation_expander, False, False, 0)

        self.speed_expander = TimeProperties(app)
        self.speed_expander.set_vexpand(False)
        vbox.pack_start(self.speed_expander, False, False, 0)

        self.title_expander = TitleProperties(app)
        self.title_expander.set_vexpand(False)
        vbox.pack_start(self.title_expander, False, False, 0)

        self.color_expander = ColorProperties(app)
        self.color_expander.set_vexpand(False)
        vbox.pack_start(self.color_expander, False, False, 0)

        self.effect_expander = EffectProperties(app)
        self.effect_expander.set_vexpand(False)
        vbox.pack_start(self.effect_expander, False, False, 0)

        self.helper_box = self.create_helper_box()
        self.clips_box.pack_start(self.helper_box, False, False, 0)

        disable_scroll(vbox)

        self.transformation_expander.set_source(None)
        self.speed_expander.set_clip(None)
        self.title_expander.set_source(None)
        self.color_expander.set_source(None)
        self.effect_expander.set_clip(None)

        self._project = None
        self._selection = None
示例#38
0
    def __init__(self):
        GObject.Object.__init__(self)
        Loggable.__init__(self)
        self.log("new object %s", self)

        self._x11 = False
        try:
            from gi.repository import GdkX11
            self._x11 = True
        except ImportError:
            pass
示例#39
0
    def __init__(self, instance):
        Gtk.Box.__init__(self)
        Loggable.__init__(self)

        self.app = instance

        self._drag_icon = GdkPixbuf.Pixbuf.new_from_file_at_size(
            os.path.join(get_pixmap_dir(), "effects", "defaultthumbnail.svg"),
            ICON_WIDTH, ICON_HEIGHT)
        self._star_icon_regular = GdkPixbuf.Pixbuf.new_from_file_at_size(
            os.path.join(get_pixmap_dir(), "star-regular.svg"), 15, 15)
        self._star_icon_solid = GdkPixbuf.Pixbuf.new_from_file_at_size(
            os.path.join(get_pixmap_dir(), "star-solid.svg"), 15, 15)

        self.set_orientation(Gtk.Orientation.VERTICAL)
        builder = Gtk.Builder()
        builder.add_from_file(os.path.join(get_ui_dir(), "effectslibrary.ui"))
        builder.connect_signals(self)
        toolbar = builder.get_object("effectslibrary_toolbar")
        toolbar.get_style_context().add_class(Gtk.STYLE_CLASS_INLINE_TOOLBAR)
        self.search_entry = builder.get_object("search_entry")
        self.fav_view_toggle = builder.get_object("favourites_toggle")
        self.fav_view_toggle.set_image(Gtk.Image.new_from_pixbuf(self._star_icon_solid))

        self.main_view = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        self.category_view = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # Used for showing search results and favourites
        self.search_view = Gtk.ListBox(activate_on_single_click=False)
        self.search_view.connect("row-activated", self.effects_listbox_row_activated_cb)

        placeholder_text = Gtk.Label(_("No effects"))
        placeholder_text.props.visible = True
        self.search_view.set_placeholder(placeholder_text)

        self.main_view.pack_start(self.category_view, True, True, 0)
        self.main_view.pack_start(self.search_view, True, True, 0)

        scrollwin = Gtk.ScrolledWindow()
        scrollwin.props.hscrollbar_policy = Gtk.PolicyType.NEVER
        scrollwin.props.vscrollbar_policy = Gtk.PolicyType.AUTOMATIC
        scrollwin.add(self.main_view)

        self.pack_start(toolbar, False, False, 0)
        self.pack_start(scrollwin, True, True, 0)

        # Delay the loading of the available effects so the application
        # starts faster.
        GLib.idle_add(self._load_available_effects_cb)

        scrollwin.show_all()
        toolbar.show_all()
        self.search_view.hide()
示例#40
0
    def __init__(self, factory, stream_):
        """
        Create a new Extractor.

        @param factory: the factory with which to decode the stream
        @type factory: L{ObjectFactory}
        @param stream_: the stream to decode
        @type stream_: L{Stream}
        """
        Loggable.__init__(self)
        self.debug("Initialized with %s %s", factory, stream_)
示例#41
0
    def __init__(self, stack, source):
        Gtk.DrawingArea.__init__(self)
        Loggable.__init__(self)
        self._source = source
        self.click_source_position = None
        self.stack = stack

        project = stack.app.project_manager.current_project
        project.connect("video-size-changed", self._canvas_size_changed_cb)
        self.project_size = numpy.array(
            [project.videowidth, project.videoheight])
示例#42
0
    def __init__(self, app):
        Loggable.__init__(self)
        Gtk.Expander.__init__(self)
        self.set_label(_("Title"))
        self.set_expanded(True)
        self.app = app
        self.source = None
        self._setting_props = False
        self._children_props_handler = None

        self._create_ui()
示例#43
0
    def __init__(self, widget):
        # Prevent black frames and flickering while resizing or changing focus:
        # The aspect ratio gets overridden by setDisplayAspectRatio.
        Gtk.AspectFrame.__init__(self,
                                 xalign=0.5,
                                 yalign=0.5,
                                 ratio=4.0 / 3.0,
                                 obey_child=False)
        Loggable.__init__(self)

        self.add(widget)
示例#44
0
    def __init__(self):
        Loggable.__init__(self)

        # The current Previewer per GES.TrackType.
        self._current_previewers = {}
        # The queue of Previewers.
        self._previewers = {
            GES.TrackType.AUDIO: [],
            GES.TrackType.VIDEO: []
        }
        self._running = True
示例#45
0
文件: pipeline.py 项目: jojva/pitivi
 def __init__(self, pipeline, video_overlay):
     Loggable.__init__(self)
     Signallable.__init__(self)
     self._pipeline = pipeline
     self._bus = self._pipeline.get_bus()
     self._bus.add_signal_watch()
     self._bus.connect("message", self._busMessageCb)
     self._listening = False  # for the position handler
     self._listeningInterval = 300  # default 300ms
     self._listeningSigId = 0
     self._duration = Gst.CLOCK_TIME_NONE
     self.video_overlay = video_overlay
示例#46
0
    def __init__(self, app):
        Loggable.__init__(self)
        self.app = app
        self.settings = {}
        self.source = None
        self.seeker = Seeker()

        # Drag attributes
        self._drag_events = []
        self._signals_connected = False

        self._createUI()
示例#47
0
文件: pipeline.py 项目: jojva/pitivi
    def __init__(self, timeout=80):
        """
        @param timeout (optional): the amount of miliseconds for a seek attempt
        """
        Signallable.__init__(self)
        Loggable.__init__(self)

        self.timeout = timeout
        self.pending_seek_id = None
        self.position = None
        self.format = None
        self._time = None
示例#48
0
    def __init__(self, app):
        Gtk.Expander.__init__(self)
        Loggable.__init__(self)

        self.app = app
        self.source = None
        self._children_props_handler = None

        self.set_label(_("Color"))
        self.set_expanded(True)

        self._create_ui()
示例#49
0
    def __init__(self, app=None):
        GObject.Object.__init__(self)
        Loggable.__init__(self)

        if app is not None:
            self.app = weakref.proxy(app)
        else:
            self.app = None
        self.undo_stacks = []
        self.redo_stacks = []
        self.stacks = []
        self.running = False
        self._checkpoint = self._takeSnapshot()
示例#50
0
文件: viewer.py 项目: jojva/pitivi
 def __init__(self, settings=None):
     Gtk.DrawingArea.__init__(self)
     Loggable.__init__(self)
     self.seeker = Seeker()
     self.settings = settings
     self.box = None
     self.stored = False
     self.area = None
     self.zoom = 1.0
     self.sink = None
     self.pixbuf = None
     self.pipeline = None
     self.transformation_properties = None
示例#51
0
    def __init__(self, project_manager):
        Loggable.__init__(self)

        self.project_manager = project_manager
        self.conf_folder_path = xdg_config_home("editor_state")

        self.project = None
        self.conf_file_path = None
        self._editor_state = {}
        self.__state_saving_handle = 0

        self.project_manager.connect("new-project-loaded",
                                     self._new_project_loaded_cb)
示例#52
0
    def __init__(self, title, headline):
        Loggable.__init__(self)
        self.builder = Gtk.Builder()
        self.builder.add_from_file(os.path.join(get_ui_dir(),
            "filelisterrordialog.ui"))
        self.builder.connect_signals(self)

        self.window = self.builder.get_object("filelisterrordialog")
        self.window.set_modal(False)
        self.window.set_title(title)

        self.builder.get_object("headline").set_text(headline)
        self.errorvbox = self.builder.get_object("errorvbox")
示例#53
0
    def __init__(self, timeline, hadj):
        Gtk.DrawingArea.__init__(self)
        Zoomable.__init__(self)
        Loggable.__init__(self)
        self.log("Creating new ScaleRuler")

        # Allows stealing focus from other GTK widgets, prevent accidents:
        self.props.can_focus = True
        self.connect("focus-in-event", self._focusInCb)
        self.connect("focus-out-event", self._focusOutCb)

        self.timeline = timeline
        self._background_color = timeline.get_style_context().lookup_color(
            'theme_bg_color')[1]
        self._seeker = Seeker()
        self.hadj = hadj
        hadj.connect("value-changed", self._hadjValueChangedCb)
        self.add_events(Gdk.EventMask.POINTER_MOTION_MASK
                        | Gdk.EventMask.BUTTON_PRESS_MASK
                        | Gdk.EventMask.BUTTON_RELEASE_MASK
                        | Gdk.EventMask.SCROLL_MASK)

        self.pixbuf = None

        # all values are in pixels
        self.pixbuf_offset = 0
        self.pixbuf_offset_painted = 0
        # This is the number of width we allocate for the pixbuf
        self.pixbuf_multiples = 4

        self.position = 0  # In nanoseconds
        self.pressed = False
        self.frame_rate = Gst.Fraction(1 / 1)
        self.ns_per_frame = float(1 / self.frame_rate) * Gst.SECOND
        self.connect('draw', self.drawCb)
        self.connect('configure-event', self.configureEventCb)
        self.callback_id = None
        self.callback_id_scroll = None
        self.set_size_request(0, HEIGHT)

        style = self.get_style_context()
        color_normal = style.get_color(Gtk.StateFlags.NORMAL)
        color_insensitive = style.get_color(Gtk.StateFlags.INSENSITIVE)
        self._color_normal = color_normal
        self._color_dimmed = Gdk.RGBA(
            *[(x * 3 + y * 2) / 5
              for x, y in ((color_normal.red, color_insensitive.red),
                           (color_normal.green, color_insensitive.green),
                           (color_normal.blue, color_insensitive.blue))])

        self.scales = SCALES
示例#54
0
    def __init__(self, ges_marker_list, action_log):
        Loggable.__init__(self)

        self.action_log = action_log

        self.marker_observers = {}

        ges_marker_list.connect("marker-added", self._marker_added_cb)
        ges_marker_list.connect("marker-removed", self._marker_removed_cb)
        ges_marker_list.connect("marker-moved", self._marker_moved_cb)

        ges_markers = ges_marker_list.get_markers()
        for ges_marker in ges_markers:
            self._connect(ges_marker)
示例#55
0
    def __init__(self, default_path, user_path, system):
        GObject.Object.__init__(self)
        Loggable.__init__(self)

        self.default_path = default_path
        self.user_path = user_path

        self.presets = {}
        self.widget_map = {}
        self.ordered = Gtk.ListStore(str, object)
        self.cur_preset = None
        # Whether to ignore the updateValue calls.
        self.ignore_update_requests = False
        self.system = system
示例#56
0
    def __init__(self, app):
        Gtk.Expander.__init__(self)

        self.set_expanded(True)
        self.set_label(_("Effects"))
        Loggable.__init__(self)

        self.app = app
        self.clip = None

        self.effects_properties_manager = EffectsPropertiesManager(app)
        setup_custom_effect_widgets(self.effects_properties_manager)

        self.drag_lines_pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(
            os.path.join(get_pixmap_dir(), "grip-lines-solid.svg"), 15, 15)

        self.expander_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        self.effects_listbox = Gtk.ListBox()

        placeholder_label = Gtk.Label(
            _("To apply an effect to the clip, drag it from the Effect Library "
              "or use the button below."))
        placeholder_label.set_line_wrap(True)
        placeholder_label.show()
        self.effects_listbox.set_placeholder(placeholder_label)

        # Add effect popover button
        self.effect_popover = EffectsPopover(app)
        self.add_effect_button = Gtk.MenuButton(_("Add Effect"))
        self.add_effect_button.set_popover(self.effect_popover)
        self.add_effect_button.props.halign = Gtk.Align.CENTER

        self.drag_dest_set(Gtk.DestDefaults.DROP, [EFFECT_TARGET_ENTRY],
                           Gdk.DragAction.COPY)

        self.expander_box.pack_start(self.effects_listbox, False, False, 0)
        self.expander_box.pack_start(self.add_effect_button, False, False,
                                     PADDING)

        self.add(self.expander_box)

        # Connect all the widget signals
        self.connect("drag-motion", self._drag_motion_cb)
        self.connect("drag-leave", self._drag_leave_cb)
        self.connect("drag-data-received", self._drag_data_received_cb)

        self.add_effect_button.connect("toggled", self._add_effect_button_cb)

        self.show_all()
示例#57
0
    def __init__(self, ges_marker):
        Gtk.EventBox.__init__(self)
        Loggable.__init__(self)

        self.add_events(Gdk.EventMask.ENTER_NOTIFY_MASK |
                        Gdk.EventMask.LEAVE_NOTIFY_MASK)

        self.ges_marker = ges_marker
        self.ges_marker.ui = self
        self.position_ns = self.ges_marker.props.position

        self.get_style_context().add_class("Marker")
        self.ges_marker.connect("notify-meta", self._notify_meta_cb)

        self._selected = False
示例#58
0
 def __init__(self, uri):
     Loggable.__init__(self)
     # TODO: replace with utils.misc.hash_file
     self._filehash = hash_file(Gst.uri_get_location(uri))
     self._filename = os.path.basename(path_from_uri(uri))
     # TODO: replace with pitivi.settings.xdg_cache_home()
     cache_dir = get_dir(os.path.join(xdg_dirs.xdg_cache_home, "pitivi"),
                         autocreate)
     dbfile = os.path.join(get_dir(os.path.join(cache_dir, "thumbs")),
                           self._filehash)
     self._db = sqlite3.connect(dbfile)
     self._cur = self._db.cursor()  # Use this for normal db operations
     self._cur.execute("CREATE TABLE IF NOT EXISTS Thumbs\
                       (Time INTEGER NOT NULL PRIMARY KEY,\
                       Jpeg BLOB NOT NULL)")
示例#59
0
    def __init__(self, app):
        Loggable.__init__(self)
        self.app = app
        self.engine = Peas.Engine.get_default()
        # Many plugins need access to the main window. However, by the time a
        # plugin is loaded from settings (as soon Pitivi application starts),
        # the main window doesn't exist yet. So we load plugins from settings
        # after the main window is added.
        self.app.connect("window-added", self.__window_added_cb)

        for loader in self.DEFAULT_LOADERS:
            self.engine.enable_loader(loader)

        self._setup_plugins_dir()
        self._setup_extension_set()
示例#60
0
    def __init__(self, ges_timeline_element, action_log):
        Loggable.__init__(self)
        self.ges_timeline_element = ges_timeline_element
        self.action_log = action_log

        self._properties = {}
        for prop in ges_timeline_element.list_children_properties():
            if prop.name in PROPS_TO_IGNORE:
                continue

            prop_name = child_property_name(prop)
            res, value = ges_timeline_element.get_child_property(prop_name)
            assert res, prop_name
            self._properties[prop_name] = value

        ges_timeline_element.connect('deep-notify', self._property_changed_cb)