Exemplo n.º 1
0
    def _updateFromSource(self):
        if not self.source:
            # Nothing to update from.
            return

        self._setWidgetText()
        self.settings['xpos'].set_value(
            self.source.get_child_property("xpos")[1])
        self.settings['ypos'].set_value(
            self.source.get_child_property("ypos")[1])
        self.settings['valignment'].set_active_id(
            self.source.get_child_property("valignment")[1].value_name)
        self.settings['halignment'].set_active_id(
            self.source.get_child_property("halignment")[1].value_name)

        font_desc = Pango.FontDescription.from_string(
            self.source.get_child_property("font-desc")[1])
        self.font_button.set_font_desc(font_desc)

        color = argb_to_gdk_rgba(self.source.get_child_property("color")[1])
        self.foreground_color_button.set_rgba(color)

        color = argb_to_gdk_rgba(
            self.source.get_child_property("foreground-color")[1])
        self.background_color_button.set_rgba(color)
Exemplo n.º 2
0
    def _updateFromSource(self):
        if not self.source:
            # Nothing to update from.
            return

        source_text = self.source.get_text()
        if source_text is None:
            # FIXME: sometimes we get a TextOverlay/TitleSource
            # without a valid text property. This should not happen.
            source_text = ""
            self.warning('Source did not have a text property, setting it to "" to avoid pango choking up on None')
        self.log("Title text set to %s", source_text)
        self.textbuffer.set_text(source_text)

        self.settings['xpos'].set_value(self.source.get_xpos())
        self.settings['ypos'].set_value(self.source.get_ypos())
        self.settings['valignment'].set_active_id(self.source.get_valignment().value_name)
        self.settings['halignment'].set_active_id(self.source.get_halignment().value_name)

        font_desc = Pango.FontDescription.from_string(self.source.get_font_desc())
        self.font_button.set_font_desc(font_desc)

        color = argb_to_gdk_rgba(self.source.get_text_color())
        self.foreground_color_button.set_rgba(color)

        color = argb_to_gdk_rgba(self.source.get_background_color())
        self.background_color_button.set_rgba(color)
Exemplo n.º 3
0
    def _source_deep_notify_cb(self, source, unused_gstelement, pspec):
        """Handles updates in the TitleSource backing the current TitleClip."""
        if self._setting_props:
            self.app.project_manager.current_project.pipeline.commit_timeline()
            return

        control_binding = self.source.get_control_binding(pspec.name)
        if control_binding:
            self.debug("Not handling %s as it is being interpolated",
                       pspec.name)
            return

        if pspec.name == "text":
            res, escaped_text = self.source.get_child_property(pspec.name)
            assert res, pspec.name
            text = html.unescape(escaped_text)
            if self.textbuffer.props.text == text or "":
                return
            self.textbuffer.props.text = text
        elif pspec.name in ["x-absolute", "y-absolute"]:
            res, value = self.source.get_child_property(pspec.name)
            assert res, pspec.name
            if self.settings[pspec.name].get_value() == value:
                return
            self.settings[pspec.name].set_value(value)
        elif pspec.name in ["valignment", "halignment"]:
            res, value = self.source.get_child_property(pspec.name)
            assert res, pspec.name
            value = value.value_name
            if self.settings[pspec.name].get_active_id() == value:
                return
            self.settings[pspec.name].set_active_id(value)
        elif pspec.name == "font-desc":
            res, value = self.source.get_child_property(pspec.name)
            assert res, pspec.name
            if self.font_button.get_font_desc() == value:
                return
            font_desc = Pango.FontDescription.from_string(value)
            self.font_button.set_font_desc(font_desc)
        elif pspec.name == "color":
            res, value = self.source.get_child_property(pspec.name)
            assert res, pspec.name
            color = argb_to_gdk_rgba(value)
            if color == self.foreground_color_button.get_rgba():
                return
            self.foreground_color_button.set_rgba(color)
        elif pspec.name == "foreground-color":
            res, value = self.source.get_child_property(pspec.name)
            assert res, pspec.name
            color = argb_to_gdk_rgba(value)
            if color == self.background_color_button.get_rgba():
                return
            self.background_color_button.set_rgba(color)

        self.app.project_manager.current_project.pipeline.commit_timeline()
Exemplo n.º 4
0
    def _propertyChangedCb(self, source, unused_gstelement, pspec):
        if self._setting_initial_props:
            return

        if self._setting_props:
            self.seeker.flush()
            return

        flush = False
        if pspec.name == "text":
            if self._setWidgetText() is True:
                flush = True
        elif pspec.name in ["xpos", "ypos"]:
            value = self.source.get_child_property(pspec.name)[1]
            if self.settings[pspec.name].get_value() == value:
                return

            flush = True
            self.settings[pspec.name].set_value(value)
        elif pspec.name in ["valignment", "halignment"]:
            value = self.source.get_child_property(pspec.name)[1].value_name
            if self.settings[pspec.name].get_active_id() == value:
                return

            flush = True
            self.settings[pspec.name].set_active_id(value)
        elif pspec.name == "font-desc":
            value = self.source.get_child_property("font-desc")[1]
            if self.font_button.get_font_desc() == value:
                return

            flush = True
            font_desc = Pango.FontDescription.from_string(value)
            self.font_button.set_font_desc(font_desc)
        elif pspec.name == "color":
            color = argb_to_gdk_rgba(
                self.source.get_child_property("color")[1])
            if color == self.foreground_color_button.get_rgba():
                return

            flush = True
            self.foreground_color_button.set_rgba(color)
        elif pspec.name == "foreground-color":
            color = argb_to_gdk_rgba(
                self.source.get_child_property("foreground-color")[1])

            if color == self.background_color_button.get_rgba():
                return

            flush = True
            self.background_color_button.set_rgba(color)

        if flush is True:
            self.seeker.flush()
Exemplo n.º 5
0
    def _propertyChangedCb(self, source, unused_gstelement, pspec):
        if self._setting_initial_props:
            return

        if self._setting_props:
            self.seeker.flush()
            return

        flush = False
        if pspec.name == "text":
            if self._setWidgetText() is True:
                flush = True
        elif pspec.name in ["xpos", "ypos"]:
            value = self.source.get_child_property(pspec.name)[1]
            if self.settings[pspec.name].get_value() == value:
                return

            flush = True
            self.settings[pspec.name].set_value(value)
        elif pspec.name in ["valignment", "halignment"]:
            value = self.source.get_child_property(pspec.name)[1].value_name
            if self.settings[pspec.name].get_active_id() == value:
                return

            flush = True
            self.settings[pspec.name].set_active_id(value)
        elif pspec.name == "font-desc":
            value = self.source.get_child_property("font-desc")[1]
            if self.font_button.get_font_desc() == value:
                return

            flush = True
            font_desc = Pango.FontDescription.from_string(value)
            self.font_button.set_font_desc(font_desc)
        elif pspec.name == "color":
            color = argb_to_gdk_rgba(self.source.get_child_property("color")[1])
            if color == self.foreground_color_button.get_rgba():
                return

            flush = True
            self.foreground_color_button.set_rgba(color)
        elif pspec.name == "foreground-color":
            color = argb_to_gdk_rgba(self.source.get_child_property("foreground-color")[1])

            if color == self.background_color_button.get_rgba():
                return

            flush = True
            self.background_color_button.set_rgba(color)

        if flush is True:
            self.seeker.flush()
Exemplo n.º 6
0
 def _color_picker_value_changed_cb(self, widget, color_button,
                                    color_layer):
     argb = widget.calculate_argb()
     self.debug("Setting text %s to %x", color_layer, argb)
     self._set_child_property(color_layer, argb)
     rgba = argb_to_gdk_rgba(argb)
     color_button.set_rgba(rgba)
Exemplo n.º 7
0
    def _propertyChangedCb(self, source, unused_gstelement, pspec):
        if self._setting_props:
            self._project.pipeline.commit_timeline()
            return

        control_binding = self.source.get_control_binding(pspec.name)
        if control_binding:
            self.debug("Not handling %s as it is being interpollated",
                       pspec.name)
            return

        value = self.source.get_child_property(pspec.name)[1]
        if pspec.name == "text":
            value = value or ""
            if self.textbuffer.props.text == value:
                return
            self.textbuffer.props.text = value
        elif pspec.name in ["x-absolute", "y-absolute"]:
            if self.settings[pspec.name].get_value() == value:
                return
            self.settings[pspec.name].set_value(value)
        elif pspec.name in ["valignment", "halignment"]:
            value = value.value_name
            if self.settings[pspec.name].get_active_id() == value:
                return
            self.settings[pspec.name].set_active_id(value)
        elif pspec.name == "font-desc":
            if self.font_button.get_font_desc() == value:
                return
            font_desc = Pango.FontDescription.from_string(value)
            self.font_button.set_font_desc(font_desc)
        elif pspec.name == "color":
            color = argb_to_gdk_rgba(value)
            if color == self.foreground_color_button.get_rgba():
                return
            self.foreground_color_button.set_rgba(color)
        elif pspec.name == "foreground-color":
            color = argb_to_gdk_rgba(value)
            if color == self.background_color_button.get_rgba():
                return
            self.background_color_button.set_rgba(color)

        self._project.pipeline.commit_timeline()
Exemplo n.º 8
0
    def _updateFromSource(self, source):
        self.textbuffer.set_text(source.get_child_property("text")[1] or "")
        self.settings['x-absolute'].set_value(source.get_child_property("x-absolute")[1])
        self.settings['y-absolute'].set_value(source.get_child_property("y-absolute")[1])
        self.settings['valignment'].set_active_id(
            source.get_child_property("valignment")[1].value_name)
        self.settings['halignment'].set_active_id(
            source.get_child_property("halignment")[1].value_name)
        self._updateWidgetsVisibility()

        font_desc = Pango.FontDescription.from_string(
            source.get_child_property("font-desc")[1])
        self.font_button.set_font_desc(font_desc)

        color = argb_to_gdk_rgba(source.get_child_property("color")[1])
        self.foreground_color_button.set_rgba(color)

        color = argb_to_gdk_rgba(source.get_child_property("foreground-color")[1])
        self.background_color_button.set_rgba(color)
Exemplo n.º 9
0
 def _color_picker_value_changed_cb(self, widget, colorButton, colorLayer):
     argb = 0
     argb += (1 * 255) * 256**3
     argb += float(widget.color_r) * 256**2
     argb += float(widget.color_g) * 256**1
     argb += float(widget.color_b) * 256**0
     self.debug("Setting text %s to %x", colorLayer, argb)
     self._setChildProperty(colorLayer, argb)
     rgba = argb_to_gdk_rgba(argb)
     colorButton.set_rgba(rgba)
Exemplo n.º 10
0
    def _propertyChangedCb(self, source, unused_gstelement, pspec):
        if self._setting_props:
            self._project.pipeline.commit_timeline()
            return

        control_binding = self.source.get_control_binding(pspec.name)
        if control_binding:
            self.debug("Not handling %s as it is being interpollated",
                       pspec.name)
            return

        value = self.source.get_child_property(pspec.name)[1]
        if pspec.name == "text":
            value = value or ""
            if self.textbuffer.props.text == value:
                return
            self.textbuffer.props.text = value
        elif pspec.name in ["x-absolute", "y-absolute"]:
            if self.settings[pspec.name].get_value() == value:
                return
            self.settings[pspec.name].set_value(value)
        elif pspec.name in ["valignment", "halignment"]:
            value = value.value_name
            if self.settings[pspec.name].get_active_id() == value:
                return
            self.settings[pspec.name].set_active_id(value)
        elif pspec.name == "font-desc":
            if self.font_button.get_font_desc() == value:
                return
            font_desc = Pango.FontDescription.from_string(value)
            self.font_button.set_font_desc(font_desc)
        elif pspec.name == "color":
            color = argb_to_gdk_rgba(value)
            if color == self.foreground_color_button.get_rgba():
                return
            self.foreground_color_button.set_rgba(color)
        elif pspec.name == "foreground-color":
            color = argb_to_gdk_rgba(value)
            if color == self.background_color_button.get_rgba():
                return
            self.background_color_button.set_rgba(color)

        self._project.pipeline.commit_timeline()
Exemplo n.º 11
0
    def _updateFromSource(self, source):
        self.textbuffer.set_text(source.get_child_property("text")[1] or "")
        self.settings['x-absolute'].set_value(source.get_child_property("x-absolute")[1])
        self.settings['y-absolute'].set_value(source.get_child_property("y-absolute")[1])
        self.settings['valignment'].set_active_id(
            source.get_child_property("valignment")[1].value_name)
        self.settings['halignment'].set_active_id(
            source.get_child_property("halignment")[1].value_name)
        self._updateWidgetsVisibility()

        font_desc = Pango.FontDescription.from_string(
            source.get_child_property("font-desc")[1])
        self.font_button.set_font_desc(font_desc)

        color = argb_to_gdk_rgba(source.get_child_property("color")[1])
        self.foreground_color_button.set_rgba(color)

        color = argb_to_gdk_rgba(source.get_child_property("foreground-color")[1])
        self.background_color_button.set_rgba(color)
Exemplo n.º 12
0
 def _color_picker_value_changed_cb(self, widget, colorButton, colorLayer):
     argb = 0
     argb += (1 * 255) * 256 ** 3
     argb += float(widget.color_r) * 256 ** 2
     argb += float(widget.color_g) * 256 ** 1
     argb += float(widget.color_b) * 256 ** 0
     self.debug("Setting text %s to %x", colorLayer, argb)
     self._setChildProperty(colorLayer, argb)
     rgba = argb_to_gdk_rgba(argb)
     colorButton.set_rgba(rgba)
Exemplo n.º 13
0
    def _update_from_source(self, source):
        self.textbuffer.props.text = html.unescape(source.get_child_property("text")[1] or "")
        self.settings["x-absolute"].set_value(source.get_child_property("x-absolute")[1])
        self.settings["y-absolute"].set_value(source.get_child_property("y-absolute")[1])
        self.settings["valignment"].set_active_id(
            source.get_child_property("valignment")[1].value_name)
        self.settings["halignment"].set_active_id(
            source.get_child_property("halignment")[1].value_name)
        self._update_widgets_visibility()

        font_desc = Pango.FontDescription.from_string(
            source.get_child_property("font-desc")[1])
        self.font_button.set_font_desc(font_desc)

        color = argb_to_gdk_rgba(source.get_child_property("color")[1])
        self.foreground_color_button.set_rgba(color)

        color = argb_to_gdk_rgba(source.get_child_property("foreground-color")[1])
        self.background_color_button.set_rgba(color)
Exemplo n.º 14
0
    def _updateFromSource(self):
        if not self.source:
            # Nothing to update from.
            return

        self._setWidgetText()
        self.settings['xpos'].set_value(self.source.get_child_property("xpos")[1])
        self.settings['ypos'].set_value(self.source.get_child_property("ypos")[1])
        self.settings['valignment'].set_active_id(
            self.source.get_child_property("valignment")[1].value_name)
        self.settings['halignment'].set_active_id(
            self.source.get_child_property("halignment")[1].value_name)

        font_desc = Pango.FontDescription.from_string(
            self.source.get_child_property("font-desc")[1])
        self.font_button.set_font_desc(font_desc)

        color = argb_to_gdk_rgba(self.source.get_child_property("color")[1])
        self.foreground_color_button.set_rgba(color)

        color = argb_to_gdk_rgba(self.source.get_child_property("foreground-color")[1])
        self.background_color_button.set_rgba(color)
Exemplo n.º 15
0
    def _propertyChangedCb(self, source, unused_gstelement, pspec):
        if self._setting_props:
            self._project.pipeline.flushSeek()
            return

        value = self.source.get_child_property(pspec.name)[1]
        if pspec.name == "text":
            value = value or ""
            if self.textbuffer.props.text == value:
                return
            self.textbuffer.props.text = value
        elif pspec.name in ["xpos", "ypos"]:
            if self.settings[pspec.name].get_value() == value:
                return
            self.settings[pspec.name].set_value(value)
        elif pspec.name in ["valignment", "halignment"]:
            value = value.value_name
            if self.settings[pspec.name].get_active_id() == value:
                return
            self.settings[pspec.name].set_active_id(value)
        elif pspec.name == "font-desc":
            if self.font_button.get_font_desc() == value:
                return
            font_desc = Pango.FontDescription.from_string(value)
            self.font_button.set_font_desc(font_desc)
        elif pspec.name == "color":
            color = argb_to_gdk_rgba(value)
            if color == self.foreground_color_button.get_rgba():
                return
            self.foreground_color_button.set_rgba(color)
        elif pspec.name == "foreground-color":
            color = argb_to_gdk_rgba(value)
            if color == self.background_color_button.get_rgba():
                return
            self.background_color_button.set_rgba(color)

        self._project.pipeline.flushSeek()
Exemplo n.º 16
0
 def _update_color_button(self):
     res, argb = self.source.get_child_property("foreground-color")
     assert res
     color = argb_to_gdk_rgba(argb)
     self.color_button.set_rgba(color)