Commit 82966026 authored by Alexandru Băluț's avatar Alexandru Băluț

render: Make clear which muxers and encoders are unsupported

The unsupported muxers and encoders appear under an "Unsupported"
element at the bottom of the comboboxes's model.

Fixes https://phabricator.freedesktop.org/T7496Reviewed-by: Thibault Saunier's avatarThibault Saunier <tsaunier@gnome.org>
Differential Revision: https://phabricator.freedesktop.org/D1217
parent 7af98ca4
......@@ -23,28 +23,6 @@
<property name="step_increment">1</property>
<property name="page_increment">10</property>
</object>
<object class="GtkListStore" id="model1">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Standard (4:3)</col>
</row>
</data>
</object>
<object class="GtkListStore" id="model2">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">Standard PAL</col>
</row>
</data>
</object>
<object class="GtkDialog" id="project-settings-dialog">
<property name="can_focus">False</property>
<property name="border_width">5</property>
......@@ -353,7 +331,6 @@
<object class="GtkComboBox" id="dar_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">model1</property>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
<attributes>
......@@ -370,7 +347,6 @@
<object class="GtkComboBox" id="par_combo">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="model">model2</property>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
<attributes>
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.19.0 -->
<!-- Generated with glade 3.20.0 -->
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkAdjustment" id="adjustment1">
......@@ -14,64 +14,6 @@
<property name="can_focus">False</property>
<property name="icon_name">help-contents</property>
</object>
<object class="GtkListStore" id="model1">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">MP4</col>
</row>
</data>
</object>
<object class="GtkListStore" id="model2">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">H.264</col>
</row>
</data>
</object>
<object class="GtkListStore" id="model3">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">29.97 fps</col>
</row>
</data>
</object>
<object class="GtkListStore" id="model4">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">AC-3</col>
</row>
<row>
<col id="0" translatable="yes">AAC</col>
</row>
</data>
</object>
<object class="GtkListStore" id="model5">
<columns>
<!-- column-name gchararray -->
<column type="gchararray"/>
</columns>
<data>
<row>
<col id="0" translatable="yes">6 channels (5.1)</col>
</row>
</data>
</object>
<object class="GtkDialog" id="render-dialog">
<property name="can_focus">False</property>
<property name="border_width">12</property>
......@@ -230,8 +172,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="model">model1</property>
<property name="active">0</property>
<signal name="changed" handler="_muxerComboChangedCb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer1"/>
......@@ -476,7 +416,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="model">model2</property>
<signal name="changed" handler="_videoEncoderComboChangedCb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer2"/>
......@@ -514,7 +453,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="model">model3</property>
<signal name="changed" handler="_frameRateComboChangedCb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer3"/>
......@@ -613,7 +551,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="model">model5</property>
<signal name="changed" handler="_channelsComboChangedCb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer5"/>
......@@ -650,7 +587,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="model">model4</property>
<signal name="changed" handler="_audioEncoderChangedComboCb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer4"/>
......@@ -688,7 +624,6 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="model">model5</property>
<signal name="changed" handler="_sampleRateComboChangedCb" swapped="no"/>
<child>
<object class="GtkCellRendererText" id="renderer6"/>
......@@ -823,5 +758,8 @@ This option is a good trade-off between quality of the rendered video and stabil
<action-widget response="0">closebutton</action-widget>
<action-widget response="0">render_button</action-widget>
</action-widgets>
<child>
<placeholder/>
</child>
</object>
</interface>
......@@ -482,22 +482,22 @@ class AudioPresetManager(PresetManager):
class RenderPresetManager(PresetManager):
def __init__(self, system):
def __init__(self, system, encoders):
default_path = get_renderpresets_dir()
user_path = os.path.join(xdg_data_home(), 'render_presets')
PresetManager.__init__(self, default_path, user_path, system)
self.encoders = encoders
def _deserializePreset(self, parser):
container = parser["container"]
acodec = parser["acodec"]
vcodec = parser["vcodec"]
from pitivi.render import Encoders
if acodec not in [fact.get_name() for fact in Encoders().aencoders]:
if acodec not in [fact.get_name() for fact in self.encoders.aencoders]:
raise DeserializeException("Audio codec not available: %s" % acodec)
if vcodec not in [fact.get_name() for fact in Encoders().vencoders]:
if vcodec not in [fact.get_name() for fact in self.encoders.vencoders]:
raise DeserializeException("Video codec not available: %s" % vcodec)
if container not in [fact.get_name() for fact in Encoders().muxers]:
if container not in [fact.get_name() for fact in self.encoders.muxers]:
raise DeserializeException("Container not available: %s" % vcodec)
try:
......
This diff is collapsed.
......@@ -459,18 +459,21 @@ def model(columns, data):
return ret
def set_combo_value(combo, value, default_index=-1):
model = combo.props.model
for i, row in enumerate(model):
if row[1] == value:
combo.set_active(i)
return
combo.set_active(default_index)
def set_combo_value(combo, value):
def select_specific_row(model, unused_path, iter_, unused_data):
if value == model.get_value(iter_, 1):
combo.set_active_iter(iter_)
return True
return False
combo.props.model.foreach(select_specific_row, None)
def get_combo_value(combo):
active = combo.get_active()
return combo.props.model[active][1]
active_iter = combo.get_active_iter()
if not active_iter:
return None
return combo.props.model.get_value(active_iter, 1)
def get_value_from_model(model, key):
......
......@@ -37,7 +37,7 @@ class TestRender(TestCase):
"""Checks we associate file extensions to the muxers of the presets."""
with mock.patch("pitivi.preset.xdg_data_home") as xdg_data_home:
xdg_data_home.return_value = "/pitivi-dir-which-does-not-exist"
preset_manager = RenderPresetManager(system=None)
preset_manager = RenderPresetManager(system=None, encoders=Encoders())
preset_manager.loadAll()
self.assertTrue(preset_manager.presets)
for unused_name, preset in preset_manager.presets.items():
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment